slidetake 0.4.6 → 0.5.1
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 +1 -1
- package/dist/index.html +145 -25
- package/dist/slidetake.js +117 -34
- package/package.json +1 -1
package/dist/slidetake.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* Slidetake 0.
|
|
2
|
-
"use strict";(()=>{var
|
|
1
|
+
/* Slidetake 0.5.1 · https://slidetake.com · Apache-2.0 */
|
|
2
|
+
"use strict";(()=>{var q=(e,t)=>()=>(e&&(t=e(e=0)),t);var wo,_r=q(()=>{wo=`---
|
|
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
|
|
@@ -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 qr,Ur=q(()=>{qr=`---
|
|
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
|
|
@@ -396,7 +396,7 @@ Open a deck straight from a link: a GitHub file, a gist or any markdown URL. Or
|
|
|
396
396
|
| \`/gh/owner/repo@branch/deck.md\` | another branch or tag |
|
|
397
397
|
| \`/gist/<id>\` | a gist's first markdown file |
|
|
398
398
|
| \`/?src=https://\u2026/deck.md\` | anything else |
|
|
399
|
-
| \`/new\` | a template: blank, talk or
|
|
399
|
+
| \`/new\` | a template: blank, talk, recording or short (9:16) |
|
|
400
400
|
|
|
401
401
|
### On your computer
|
|
402
402
|
|
|
@@ -510,6 +510,7 @@ title: My talk \u2190 page and video title
|
|
|
510
510
|
duration: 10m \u2190 for the timer
|
|
511
511
|
accent: "#3b82f6" \u2190 the deck's colour
|
|
512
512
|
mode: light \u2190 open in light mode
|
|
513
|
+
format: portrait \u2190 a 9:16 deck, for Shorts and Reels
|
|
513
514
|
brand: example.com \u2190 top-right corner text
|
|
514
515
|
brand_style: chip \u2190 the brand as a pill
|
|
515
516
|
logo: https://\u2026/l.png \u2190 image beside it
|
|
@@ -722,6 +723,16 @@ Words you can combine: \`on\`, \`off\`, \`full\`, \`behind\` (next), a size like
|
|
|
722
723
|
|
|
723
724
|
It stays on its slide; \`pip: behind\` makes it the whole deck's. With the camera off, the slide still shows this way, over an empty frame.
|
|
724
725
|
|
|
726
|
+
### Shorts and Reels
|
|
727
|
+
|
|
728
|
+
\`format: portrait\` in the top block makes the deck a 9:16 column, and its video 1080\xD71920 (or 720\xD71280):
|
|
729
|
+
|
|
730
|
+
- \`top\` and \`bottom\` are halves, above or below you; \`left\` and \`right\` go below you
|
|
731
|
+
- a slide's words are larger, to read on a phone
|
|
732
|
+
- easy mode records the column from the middle of the screen: a Retina laptop makes 720p, a 16" one or a screen on its side 1080p
|
|
733
|
+
|
|
734
|
+
Start from the [Short template](https://slidetake.com/new?template=short): **New** \u2192 **Short**.
|
|
735
|
+
|
|
725
736
|
### Take by take
|
|
726
737
|
|
|
727
738
|
**\u25CF Record** (R) counts down and starts. From then on \u2192 drives everything: slides, reveals and camera moves (a Bluetooth clicker works).
|
|
@@ -796,7 +807,7 @@ Every deck you open is **read-only**: Slidetake's own decks, templates, files on
|
|
|
796
807
|
No accounts, and no decks kept. Recording stays on your device.
|
|
797
808
|
|
|
798
809
|
Next, everything that leaves your browser, and where it goes: **[Privacy \u2192](/privacy)**
|
|
799
|
-
`});var
|
|
810
|
+
`});var Gr,Vr=q(()=>{Gr=`---
|
|
800
811
|
title: Slidetake Features
|
|
801
812
|
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."
|
|
802
813
|
brand: slidetake
|
|
@@ -880,6 +891,7 @@ For Safari, Firefox or any browser, a screen too small for easy mode, or whateve
|
|
|
880
891
|
|---|---|
|
|
881
892
|
| **[OBS](https://obsproject.com), driven by the deck** | it starts and stops for you; you only talk |
|
|
882
893
|
| **16:9 check** | Setup warns before a video with bars; use a 16:9 screen, physical or virtual |
|
|
894
|
+
| **Shorts and Reels** (\`format: portrait\`) | a 9:16 deck and video, the words above or below you; New \u2192 Short starts one |
|
|
883
895
|
|
|
884
896
|
## \u2702\uFE0F Edit by picking the best take
|
|
885
897
|
|
|
@@ -909,7 +921,7 @@ For Safari, Firefox or any browser, a screen too small for easy mode, or whateve
|
|
|
909
921
|
| **Open source, Apache 2.0** | read it, host it, change it: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake) |
|
|
910
922
|
|
|
911
923
|
Next, see them working: **[Showcase \u2192](/showcase)**
|
|
912
|
-
`});var
|
|
924
|
+
`});var Kr,Yr=q(()=>{Kr=`---
|
|
913
925
|
title: Slidetake Privacy
|
|
914
926
|
brand: slidetake
|
|
915
927
|
pip: none
|
|
@@ -980,7 +992,7 @@ A shared link carries the whole deck after \`#\`. Browsers never send that part
|
|
|
980
992
|
## \u2709\uFE0F Questions
|
|
981
993
|
|
|
982
994
|
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.
|
|
983
|
-
`});var
|
|
995
|
+
`});var $r,Jr=q(()=>{$r=`---
|
|
984
996
|
title: My deck
|
|
985
997
|
---
|
|
986
998
|
|
|
@@ -995,7 +1007,7 @@ Every heading is a card. \`##\` sections branch from the first card.
|
|
|
995
1007
|
### A detail
|
|
996
1008
|
|
|
997
1009
|
\`###\` branches from the section above it.
|
|
998
|
-
`});var
|
|
1010
|
+
`});var Qr,Xr=q(()=>{Qr=`---
|
|
999
1011
|
title: Talk title
|
|
1000
1012
|
duration: 15m
|
|
1001
1013
|
---
|
|
@@ -1036,7 +1048,7 @@ Something concrete the audience will recognise.
|
|
|
1036
1048
|
## \u{1F64F} Thank you
|
|
1037
1049
|
|
|
1038
1050
|
Where to find you, and the link to these slides.
|
|
1039
|
-
`});var
|
|
1051
|
+
`});var en,Zr=q(()=>{en=`---
|
|
1040
1052
|
title: Video title
|
|
1041
1053
|
duration: 10m
|
|
1042
1054
|
pip: bottom-right
|
|
@@ -1085,7 +1097,53 @@ Slides you talk over in the corner.
|
|
|
1085
1097
|
<!-- camera: on, full, on, off -->
|
|
1086
1098
|
|
|
1087
1099
|
Ends on you full screen, then back to the slide, then without the camera.
|
|
1088
|
-
`});var
|
|
1100
|
+
`});var an,tn=q(()=>{an=`---
|
|
1101
|
+
title: My Short
|
|
1102
|
+
description: "A portrait (9:16) deck for Shorts and Reels: one markdown file, the camera behind the words."
|
|
1103
|
+
format: portrait
|
|
1104
|
+
pip: behind bottom
|
|
1105
|
+
---
|
|
1106
|
+
|
|
1107
|
+
# A hook in one line
|
|
1108
|
+
|
|
1109
|
+
What the viewer gets, in under a minute.
|
|
1110
|
+
|
|
1111
|
+
## The first point
|
|
1112
|
+
|
|
1113
|
+
<!-- camera: behind top -->
|
|
1114
|
+
|
|
1115
|
+
The words above, you below. Keep each slide to a line or two.
|
|
1116
|
+
|
|
1117
|
+
## Split screen
|
|
1118
|
+
|
|
1119
|
+
<!-- camera: behind top solid, behind bottom solid -->
|
|
1120
|
+
|
|
1121
|
+
\`solid\` hides the camera behind the card. Press \u2192 and you swap places.
|
|
1122
|
+
|
|
1123
|
+
## A number that matters
|
|
1124
|
+
|
|
1125
|
+
<!-- camera: behind top -->
|
|
1126
|
+
|
|
1127
|
+
\`\`\`echarts
|
|
1128
|
+
{
|
|
1129
|
+
"xAxis": {"type": "category", "data": ["Mon", "Tue", "Wed", "Thu", "Fri"]},
|
|
1130
|
+
"yAxis": {"type": "value"},
|
|
1131
|
+
"series": [{"type": "bar", "data": [3, 5, 4, 8, 11]}]
|
|
1132
|
+
}
|
|
1133
|
+
\`\`\`
|
|
1134
|
+
|
|
1135
|
+
## Just you
|
|
1136
|
+
|
|
1137
|
+
<!-- camera: full -->
|
|
1138
|
+
|
|
1139
|
+
Say the key line straight to the camera.
|
|
1140
|
+
|
|
1141
|
+
## Follow for more
|
|
1142
|
+
|
|
1143
|
+
<!-- camera: on -->
|
|
1144
|
+
|
|
1145
|
+
The camera back in its corner, the slide full size.
|
|
1146
|
+
`});var rn,on=q(()=>{rn=`---
|
|
1089
1147
|
title: Slidetake Showcase
|
|
1090
1148
|
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."
|
|
1091
1149
|
brand: slidetake
|
|
@@ -1284,6 +1342,10 @@ Add \`solid\` and the card hides the camera behind it: a split screen, with the
|
|
|
1284
1342
|
|
|
1285
1343
|
\`clear\` takes the card away: the words sit straight on the camera. Best over a plain wall or a green screen.
|
|
1286
1344
|
|
|
1345
|
+
### Shorts and Reels
|
|
1346
|
+
|
|
1347
|
+
\`format: portrait\` in the top block turns the whole deck into a 9:16 column, for a video at 1080\xD71920. The words go above or below you. Start from the [Short template](https://slidetake.com/new?template=short).
|
|
1348
|
+
|
|
1287
1349
|
### A picture beside you
|
|
1288
1350
|
|
|
1289
1351
|
<!-- camera: behind right, behind left, behind bottom -->
|
|
@@ -1371,29 +1433,29 @@ Try it: this deck is a file on GitHub, and opens from there too: **[slidetake.co
|
|
|
1371
1433
|
|
|
1372
1434
|
## \u{1F680} Start your own
|
|
1373
1435
|
|
|
1374
|
-
Open **\u270E Editor** and press **New** for a template (blank, talk or
|
|
1436
|
+
Open **\u270E Editor** and press **New** for a template (blank, talk, recording or a 9:16 short), or type in this deck to make it your copy.
|
|
1375
1437
|
|
|
1376
1438
|
The templates and this deck live in [examples/](https://github.com/slidetake/slidetake/tree/main/examples) on GitHub.
|
|
1377
1439
|
|
|
1378
1440
|
Next, how it all works, step by step: **[Docs \u2192](/docs)**
|
|
1379
|
-
`});function
|
|
1441
|
+
`});function pt(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"card"}function _t(e){return e.replace(/<[^>]*>/g,"").replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`~]/g,"").trim()}function A(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}function nn(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)):Us[a.toLowerCase()]??t)}function Ut(e){let t={};for(let a of e.matchAll(/([\w-]+)="([^"]*)"/g))t[a[1]]=a[2];return t}function qt(e,t){let a=[[]],o=null;return e.split(`
|
|
1380
1442
|
`).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(`
|
|
1381
|
-
`))}function
|
|
1443
|
+
`))}function sn(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 wa(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 ut(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 Us,xa=q(()=>{"use strict";Us={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",rsquo:"\u2019",lsquo:"\u2018",rdquo:"\u201D",ldquo:"\u201C"}});function cn(e){let t=null;return e.split(`
|
|
1382
1444
|
`).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(`
|
|
1383
|
-
`).replace(/`[^`\n]*`/g,"")}function
|
|
1384
|
-
`).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
|
|
1445
|
+
`).replace(/`[^`\n]*`/g,"")}function xo(e){return/<!--\s*view\s*:\s*(overview|map)\s*-->/i.test(cn(e))}function ko(e){let t=cn(e).match(/<!--\s*camera\s*:\s*([\s\S]*?)\s*-->/i);return t?t[1].trim():null}function qs(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(`
|
|
1446
|
+
`).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 dn(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?`---
|
|
1385
1447
|
`+o.join(`
|
|
1386
1448
|
`)+`
|
|
1387
1449
|
---
|
|
1388
|
-
`:""}function
|
|
1450
|
+
`:""}function Vs(e){let t=e.split(`
|
|
1389
1451
|
`),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(`
|
|
1390
|
-
`).replace(/^\n+/,""))}return{meta:a,body:o}}function
|
|
1391
|
-
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));r=n?n.slice(0,60):null}return r?
|
|
1392
|
-
`);let n=/^\+\+\+[ \t]*$/m.test(e),i={};n||({deck:i,body:e}=
|
|
1393
|
-
`).forEach(x=>{let y=x.match(/^\s{0,3}(`{3,}|~{3,})/);y&&(p?y[1][0]===p[0]&&y[1].length>=p.length&&(p=null):p=y[1]);let E=!p&&!y?x.match(/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/):null;if(E){let L=E[2],$=null,ae=L.match(/\s*\{#([\w\-:.]+)\}\s*$/);ae&&($=ae[1],L=L.slice(0,ae.index)),b={level:E[1].length,title:
|
|
1394
|
-
`);C.trim()&&(
|
|
1395
|
-
`).trim(),L=x.title||
|
|
1396
|
-
`).find(X=>X.trim())||"Intro").slice(0,48));x.id=o(x.explicitId||
|
|
1452
|
+
`).replace(/^\n+/,""))}return{meta:a,body:o}}function Gs(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(`
|
|
1453
|
+
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));r=n?n.slice(0,60):null}return r?nn(_t(r)).replace(/\s+/g," ").trim():null}function ln(e){let t=e.match(/<!--\s*\.slide:([\s\S]*?)-->/i);return t?Ut(t[1]):{}}function hn(e,{render:t=a=>({html:a,err:null})}={}){let a=new Map,o=f=>{let b=f,p=2;for(;a.has(b);)b=f+"-"+p++;return b},r=f=>(a.set(f.id,{x:null,y:null,children:[],...f}),f.id);e=e.replace(/\r\n?/g,`
|
|
1454
|
+
`);let n=/^\+\+\+[ \t]*$/m.test(e),i={};n||({deck:i,body:e}=qs(e));let s=/^slides?$/i.test(String(i.layout||""))||/^slides?$/i.test(String(i.type||"")),l=!n&&(qt(e,/^--\s*$/).length>1||s&&qt(e,/^---\s*$/).length>1),c=n?k():l?m():d();return a.forEach(f=>{(!f.parent||f.parent===f.id||!a.has(f.parent))&&(f.parent=null)}),a.forEach(f=>{let b=new Set([f.id]),p=f.parent;for(;p;){if(b.has(p)){f.parent=null;break}b.add(p),p=a.get(p).parent}}),a.forEach(f=>{f.parent&&a.get(f.parent).children.push(f.id)}),{deck:i,nodes:a,format:n?"+++":l?"reveal":"headings",errCount:c};function d(){let f=[],b=null,p=null,T={level:0,title:null,explicitId:null,lines:[]};e.split(`
|
|
1455
|
+
`).forEach(x=>{let y=x.match(/^\s{0,3}(`{3,}|~{3,})/);y&&(p?y[1][0]===p[0]&&y[1].length>=p.length&&(p=null):p=y[1]);let E=!p&&!y?x.match(/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/):null;if(E){let L=E[2],$=null,ae=L.match(/\s*\{#([\w\-:.]+)\}\s*$/);ae&&($=ae[1],L=L.slice(0,ae.index)),b={level:E[1].length,title:_t(L),explicitId:$,lines:[E[1]+" "+L]},f.push(b)}else(b||T).lines.push(x)});let C=T.lines.join(`
|
|
1456
|
+
`);C.trim()&&(f.length&&!C.replace(/<!--[\s\S]*?-->/g,"").trim()?f[0].lines.splice(1,0,...T.lines):f.unshift(T));let w=[];return f.forEach(x=>{for(;w.length&&w[w.length-1].level>=x.level;)w.pop();let y=w.length?w[w.length-1].id:null,E=x.lines.join(`
|
|
1457
|
+
`).trim(),L=x.title||_t((E.split(`
|
|
1458
|
+
`).find(X=>X.trim())||"Intro").slice(0,48));x.id=o(x.explicitId||pt(L));let{html:$,err:ae}=t(E);r({id:x.id,parent:y,title:L,html:$,err:ae,camera:ko(E),mapFirst:xo(E)}),w.push(x)}),0}function k(){let f=e.split(/\n\+\+\+[ \t]*\n/).map(T=>T.trim()).filter(T=>T.length),b=null,p=0;return f.forEach((T,C)=>{let{meta:w,body:x}=Vs(T),y=o(w.id||"slide-"+(C+1)),E="parent"in w?w.parent||null:b,L=x.match(/^#{1,6}\s+(.+)$/m),$=w.title||(L?_t(L[1]):y),{html:ae,err:X}=t(x);X&&p++,r({id:y,parent:E,title:$,html:ae,err:X,camera:w.camera||ko(x),mapFirst:xo(x),x:w.x!==void 0?parseFloat(w.x):null,y:w.y!==void 0?parseFloat(w.y):null}),b=y}),p}function m(){let f=0,b=0,p=null;function T(w,x){let y=w.body.trim();b++;let E=Gs(y)||"Slide "+b,L=x?a.get(x).title:null;L&&E.startsWith(L+" / ")&&(E=E.slice(L.length+3));let $=o(pt(E)),{html:ae,err:X}=t(y);return X&&f++,r({id:$,parent:x,title:E,html:ae,err:X,camera:ko(y),mapFirst:xo(y),autoslide:parseInt(w.attrs["data-autoslide"],10)||0})}let C=[];return qt(e,/^---\s*$/).forEach(w=>{if(/<section\b/i.test(w)){for(let E of w.matchAll(/<section\b([^>]*)>([\s\S]*?)<\/section>/gi))C.push([{body:E[2],attrs:Ut(E[1])}]);let y=w.replace(/<section\b[^>]*>[\s\S]*?<\/section>/gi,"");y.trim()&&C.push([{body:y,attrs:ln(y)}]);return}let x=qt(w,/^--\s*$/).filter(y=>y.trim()).map(y=>({body:y,attrs:ln(y)}));x.length&&C.push(x)}),C.forEach(w=>{let x=null;w.forEach((y,E)=>{if(!p){p=x=T(y,null);return}E===0?x=T(y,p):T(y,x)})}),f}}var pn=q(()=>{"use strict";xa()});function Ke(e,t){return String(t||"").toLowerCase().split(/\s+/).forEach(a=>{a&&(a==="solid"?(e.card=100,e.used=!0):a==="clear"?(e.card=0,e.used=!0):a==="off"||a==="hide"?e.off=!0:a==="on"||a==="pip"||a==="show"?(e.off=!1,e.full=!1,e.behind=!1,e.place="",e.used=!0):a==="full"||a==="fullscreen"?(e.full=!0,e.behind=!1,e.place="",e.off=!1,e.used=!0):a==="behind"||a==="under"?(e.full=!0,e.behind=!0,e.place="left",e.off=!1,e.used=!0):Ys.includes(a)?(e.place=a,e.used=!0):/^\d+(\.\d+)?%?$/.test(a)?(e.size=So(parseFloat(a)),e.used=!0):Vt.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 un(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function mn(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=>!Ke({},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 Vt,Ys,So,fn=q(()=>{"use strict";Vt=["top-left","top-right","bottom-left","bottom-right"],Ys=["left","right","top","bottom"],So=e=>Math.max(8,Math.min(60,e))});function gn(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:Eo+[r,n,s].join("/")+"/"+c}}if(r&&n&&!i)return{kind:"url",url:Eo+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=Co(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 Co(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:Eo+[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 yn(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 Eo,Mo=q(()=>{"use strict";Eo="https://raw.githubusercontent.com/"});function Ks(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 Js(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4));return Uint8Array.from(t,a=>a.charCodeAt(0))}async function bn(e,t){let a=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await a.arrayBuffer())}async function vn(e){return Ks(await bn(new TextEncoder().encode(e),new CompressionStream("deflate-raw")))}async function wn(e){return new TextDecoder().decode(await bn(Js(e),new DecompressionStream("deflate-raw")))}function ka(e){let t=e.replace(/^#/,"");if(!t.startsWith(To)){let n=t;try{n=decodeURIComponent(t)}catch{}return{data:null,slide:n}}let a=t.slice(To.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 Lo(e,t){return"#"+To+e+(t?"~"+encodeURIComponent(t):"")}var To,Ao=q(()=>{"use strict";To="deflate:"});function xn(e,t,a){let o=e.replace(/\/+$/,"")||"/",r=new URLSearchParams(t),{data:n,slide:i}=ka(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&&$s.includes(c)?{page:"source",source:{kind:"builtin",id:"template:"+c},slide:i}:{page:"pick"}}let s=Co(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 Ee(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 Sa(e,t,{exported:a=!1}={}){return{text:e,origin:t,originText:e,exported:a?e:null}}function Ea(e){return e.text!==(e.exported??e.originText)}function Ca(e){return e.text===e.originText}function kn(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 $s,Sn=q(()=>{"use strict";Mo();Ao();$s=["blank","talk","recording","short"]});function Bo(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:Xs(t.searchParams.get("t")||t.searchParams.get("start")||""),portrait:r}}function Xs(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 En(e){return"https://www.youtube-nocookie.com/embed/"+encodeURIComponent(e.id)+"?enablejsapi=1&rel=0&playsinline=1"+(e.start?"&start="+e.start:"")}var Cn=q(()=>{"use strict"});function be(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:Mn(o)+(o.skip||0),end:i?Mn(i)-(i.lead||0):a})}),t}function Gt(e){let t=[],a=Ta(e);return be(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=Tn(n.start,a),s=Tn(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 Qs(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 Oo(e,t){let a=0,o=[];return Gt(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 An(e,t){let{list:a,length:o}=Oo(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=>wa(n.t)+" "+n.title),dropped:a.length-r.length,length:o}}function Bn(e,t,{input:a,outputName:o,sectionOf:r,loudness:n}){let i=Qs(Gt(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=Zs(a)+o,{list:l,length:c}=Oo(e,r),d=y=>String(y).replace(/[=;#\\\n]/g,E=>"\\"+E),m=`cat > /tmp/slidetake-chapters.txt <<'EOF'
|
|
1397
1459
|
`+(`;FFMETADATA1
|
|
1398
1460
|
title=`+d(e.deckTitle)+`
|
|
1399
1461
|
`+l.map((y,E)=>`[CHAPTER]
|
|
@@ -1403,23 +1465,23 @@ END=`+Math.round(l[E+1]?l[E+1].t:c)+`
|
|
|
1403
1465
|
title=`+d(y.title)).join(`
|
|
1404
1466
|
`))+`
|
|
1405
1467
|
EOF
|
|
1406
|
-
`,
|
|
1407
|
-
inpoint `+
|
|
1408
|
-
outpoint `+
|
|
1468
|
+
`,f=" -map 0:v:0 -map 0:a:0 -map_metadata 1 -map_chapters 1";if(t==="copy"){let y=i.map(L=>"file "+Ma(a)+`
|
|
1469
|
+
inpoint `+Ln(L.start)+`
|
|
1470
|
+
outpoint `+Ln(L.end)).join(`
|
|
1409
1471
|
`);return(i.length>1?`# Careful: without re-encoding, cuts can only land on keyframes (OBS puts one about every 2 s),
|
|
1410
1472
|
# 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.
|
|
1411
1473
|
`:"")+`cat > /tmp/slidetake-cuts.txt <<'EOF'
|
|
1412
1474
|
`+y+`
|
|
1413
1475
|
EOF
|
|
1414
|
-
`+
|
|
1415
|
-
`)};[cl(),U&&U.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 Le(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let a=getComputedStyle(t).color;return t.remove(),Ke=Ke||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),Ke.clearRect(0,0,1,1),Ke.fillStyle="#000",Ke.fillStyle=a,Ke.fillRect(0,0,1,1),"#"+[...Ke.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function hl(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 ro(){if(U&&U.themeKey&&!_n){let t=j(U.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(_n||j("slidetake:mode")||R.mode||"dark").toLowerCase()==="light"?"light":"dark"}function li(){let e=ro()==="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 ci(){let e=ro()==="light"?"dark":"light";U&&U.themeKey?(W(U.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):W("slidetake:mode",e),li(),se.querySelector(".echarts-container, .diagram.d2, .diagram.dot")&&Mt(!0)}function pl(){let t=(R.camera||"").replace(/^\[|\]$/g,"").split(",").map(a=>a.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function Vo(e){if(!e)return[];let t=ln(e.camera);return!te||t.some(ul)?t:[]}function ul(e){return!!Ye({},e).behind}function It(e){return cn(Vo(e),e&&e.frags?e.frags.length:0)}function di(){let e=It(u.get(m));return e[Math.min(xe,e.length-1)]||{cam:0,frag:0}}function ml(){if(!m)return null;let e=u.get(m),t=Vo(e);if(t.length)return t[Math.min(di().cam,t.length-1)];if(e&&e.el&&e.el.classList.contains("card-full"))return"off";for(let a=v.indexOf(m)-1;a>=0;a--){let o=Vo(u.get(v[a]));if(o.length)return Ye({},o[o.length-1]).behind?null:o[o.length-1]}return null}function fl(){let e={corner:(R.pip||"none").toLowerCase(),size:wo(parseFloat(R.pip_size)||24),circle:(R.pip_shape||"").toLowerCase()==="circle",mirror:zi(),full:!1,off:!1,flip:!1,used:!1,card:50};if(/^(behind|under)\b/.test(e.corner)){let t=e.corner;e.corner="bottom-right",Ye(e,t)}return Ye(e,ml()),be&&!/\b(off|hide)\b/i.test(be)&&(e.off=!1),Ye(e,be),!_t.includes(e.corner)&&(re||e.used)&&(e.corner="bottom-right"),e.flip&&_t.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function Ie(){let e=!B.hidden&&B.offsetWidth?B.getBoundingClientRect():null,t=Fe=fl();t.behind&&(!m||ue)&&(t.full=!1,t.behind=!1);let a=_t.includes(t.corner),o=te&&!!t.behind&&!t.off;B.className=a?[t.corner,t.circle&&"circle",re&&"live",t.mirror&&"mirror",t.full&&"full",t.behind&&"behind",o&&"empty",B.classList.contains("msg")&&"msg"].filter(Boolean).join(" "):"",B.style.width=t.full?"":t.size+"%",B.hidden=!a||t.off||te&&!o,de.dataset.pip=B.hidden||t.full?"none":t.corner,de.classList.toggle("cam-behind",!B.hidden&&!!t.behind),de.style.setProperty("--cam-card",String((t.card||0)/100)),de.classList.toggle("cam-card",(t.card||0)>0),de.classList.toggle("cam-solid",(t.card||0)>=100),de.classList.toggle("cam-live",!B.hidden&&!!t.behind&&!o);let r=!!Ae;if(Yo(!B.hidden&&t.behind&&t.place||""),Ae&&!r&&e&&!_e&&Me.animate&&Me.animate([{opacity:0},{opacity:1}],{duration:300,delay:550,easing:"ease-out",fill:"backwards"}),B.hidden||_e||!B.animate)return;let n="cubic-bezier(.65,0,.35,1)";if(!e){B.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let i=B.getBoundingClientRect();if(Math.abs(e.left-i.left)+Math.abs(e.top-i.top)+Math.abs(e.width-i.width)+Math.abs(e.height-i.height)<2)return;let s=(B.offsetParent||de).getBoundingClientRect(),l=c=>({left:c.left-s.left+"px",top:c.top-s.top+"px",width:c.width+"px",height:c.height+"px",right:"auto",bottom:"auto",aspectRatio:"auto"});B.animate([l(e),l(i)],{duration:600,easing:n})}function Yo(e){let t=Ae,a=Me.querySelector(".cam-box"),o=a&&a.getBoundingClientRect();Ae=e,de.dataset.place=e,Me.innerHTML="";let r=e&&u.get(m);if(!r||!r.el)return;let n=r.el.querySelector(".body"),i=[...n.children].map(S=>S.cloneNode(!0)),s=S=>S.matches("figure.media, .diagram, .echarts-container, .gallery"),l=[[e,i]],c=n.clientWidth;l.forEach(([S,f])=>{if(!f.length)return;let g=document.createElement("div");g.className="cam-box "+S;let b=(p,T)=>{if(!T.length)return;let C=document.createElement("div");C.className=p;let w=document.createElement("section");w.className="node";let x=document.createElement("div");x.className="body",T.forEach(y=>x.appendChild(y)),w.appendChild(x),p==="cam-media"&&(w.style.width=c+"px"),C.appendChild(w),g.appendChild(C)};b("cam-text",f.filter(p=>!s(p))),b("cam-media",f.filter(s)),Me.appendChild(g)}),Me.querySelectorAll("img").forEach(S=>{S.complete||S.addEventListener("load",Ko,{once:!0})}),Ko();let d=Me.querySelector(".cam-box");if(o&&t&&t!==e&&d&&!_e&&d.animate){let S=d.getBoundingClientRect();Math.abs(o.width-S.width)<2&&Math.abs(o.height-S.height)<2&&d.animate([{transform:"translate("+(o.left-S.left)+"px,"+(o.top-S.top)+"px)"},{transform:"none"}],{duration:600,easing:"cubic-bezier(.65,0,.35,1)"})}}function Ko(){let e=N.clientHeight/240;Me.querySelectorAll(".cam-media").forEach(t=>{let a=t.firstElementChild,o=Math.min(t.clientWidth/a.offsetWidth,t.clientHeight/a.offsetHeight,e*1.5);a.style.transform="translate(-50%, -50%) scale("+o+")"}),Me.querySelectorAll(".cam-text").forEach(t=>{let a=t.firstElementChild,o=t.clientWidth,r=t.clientHeight,n=.3,i=e;for(let s=0;s<12;s++){let l=(n+i)/2;a.style.width=o/l+"px",a.offsetHeight*l<=r?n=l:i=l}a.style.width=o/n+"px",a.style.transform="scale("+n+")"})}function gl(){let e=Fe;if(!e||B.hidden||e.full)return null;let t=N.clientWidth,a=N.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 yl(){if(!Ge)return;if(te){Dt(!0);return}let e=pl();De=(De+1)%e.length,be=e[De],Ie(),K||xt("Camera: "+be),!re&&!B.hidden?lt():ke()}function hi(e){let t=nn(e,{render:il});R=t.deck,u=t.nodes,qa();let a={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];Xs.textContent=u.size+(u.size===1?" card":" cards")+" \xB7 "+a,ea.textContent=t.errCount?t.errCount+" card(s) had errors":""}function pi(){et=[...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}}et.forEach(o=>t(o,0)),v=[];function a(o){v.push(o),u.get(o).children.forEach(a)}return et.forEach(a),Math.max(1,e)}function bl(){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 ui(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 vl(){let{maxH:e,maxDepth:t}=bl(),a=[0];for(let l=1;l<=t;l++)a[l]=a[l-1]+e[l-1]+tl;let o=el-St,r=[],n=(l,c)=>{let d=u.get(l);d.cx+=c,d.children.forEach(S=>n(S,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)}et.forEach(s),u.forEach(l=>{l.cy=a[l.depth]+l._h/2,ui(l)})}function wl(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?et.length>1?ol*.5:0:i+al;for(let d=0;d<400&&(l.forEach(f=>{let g=(f._slot+.5)*t-Math.PI/2;f.cx=c*Math.cos(g),f.cy=c*Math.sin(g),ui(f)}),!!l.some((f,g)=>l.some((b,p)=>p>g&&r(f,b))||o.some(b=>r(f,b))));d++)c=c*1.02+10;i=c,o.push(...l)}}function xl(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(jt(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 El(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||!kl.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"+ ++Sl+"-";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 Re(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 Do(e){let t=document.createElement("figure");t.className="media",Re(e,t),t.appendChild(e);let a=e.getAttribute("alt");return a&&t.insertAdjacentHTML("beforeend","<figcaption>"+A(a)+"</figcaption>"),t}function Cl(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="'+vn(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 Un(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 Tl(e,t){t.querySelectorAll("pre > code.language-svg").forEach(n=>{let i=El(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",Re(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&&To(s);l&&Re(n,Cl(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(n=>{let i=[...n.children];!i.length||!i.every(s=>Fo(s)||Al(s))||(n.classList.add("gallery"),i.some(s=>!Fo(s))&&n.classList.add("diagrams"),i.forEach(s=>{if(!Fo(s))return;let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),Do(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)})):Un(n,i.length))}),t.querySelectorAll(":scope > p").forEach(n=>{if(!Ml(n))return;let i=[...n.querySelectorAll("img")];if(i.length===1){Re(n,i[0]),Do(i[0]);return}let s=document.createElement("div");s.className="gallery grid",Re(n,s),i.forEach(l=>{s.appendChild(l),Do(l)}),Un(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 mi(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 Bl(e){let t=r=>r.classList.contains("fragment")&&(r.tagName==="P"&&r.children.length===1&&r.children[0].tagName==="IMG"&&!r.textContent.trim()&&!To(r.children[0].getAttribute("src")||"")||r.tagName==="PRE"&&!!r.querySelector(fi)),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 Ol(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 hr(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&&mi(n,r<t?"playVideo":"pauseVideo")})),a&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function Il(){try{return R.base?new URL(R.base,Ne||location.href):Ne?new URL(Ne):null}catch{return null}}function Pl(e){let t=Il(),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 no(e){let t=e.el,a=t.querySelector(".body");t.classList.add("measuring"),a.style.zoom="";let o=St;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-Pa*l>=260;if(r&&c)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(Pa*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(Pa*l),le-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",d+"px"),o=Math.min(le,Math.max(Ro,d*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(St,Math.min(le,(Pa-Zs)*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=Ro);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(Ro,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||Go,t.classList.remove("measuring")}function zl(){clearTimeout(qn),qn=setTimeout(()=>{u.forEach(no),ca(),ke(!0)},200)}function Nl(){let e=ro()==="light"?"light":"dark",t=Le(e==="light"?"--accent-ring":"--accent"),a="slidetake-"+e+"-"+t.slice(1);return Gn.has(a)||(Hl(a,Fl[e],t),Gn.add(a)),a}function Hl(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 _l(){let e=ro()==="light"?"light":"dark",t=Le("--node-bg"),a=Le(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],r={...Wl[e],N7:t,B1:Le("--accent")};return o.forEach((n,i)=>{r["B"+(i+2)]=hl(a,t,n)}),r}function Ul(){let e=Le("--text"),t=Le("--text-muted"),a=Le("--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 Jo(e){return No[e]||(No[e]=new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete No[e],a(new Error("could not load "+e))},document.head.appendChild(o)}))}async function Vl(){let e=Je,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,Re(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 Jo(Rl),Ho=Ho||await Viz.instance(),e!==Je)return;let n=Ul();t.forEach(i=>{let s=document.createElement("div");s.className="diagram dot";try{s.appendChild(Ho.renderSVGElement(ql(i.textContent,n)))}catch(l){s.className="diagram err",s.textContent="Diagram error: "+l.message}Re(i.parentElement,s)})}catch{r.push("diagrams")}if(o.length)try{if(!za){let i=await import(jl);za=new i.D2}if(e!==Je)return;let n=_l();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await za.compile(Gl(i.textContent));s.innerHTML=await za.render(l.diagram,{...l.renderOptions||{},themeOverrides:n,darkThemeOverrides:n})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==Je)return;Re(i.parentElement,s)}}catch{r.push("D2 diagrams")}if(a.length)try{if(await Jo(Dl),e!==Je)return;let n=Nl();a.forEach(i=>{let s;try{s=JSON.parse(i.dataset.chart)}catch{i.textContent="Chart data is not valid JSON.";return}let l=echarts.init(i,n,{renderer:"svg"});l.on("finished",()=>{Ae&&i.closest(".node")===(u.get(m)||{}).el&&Yo(Ae)}),l.setOption(Object.assign({backgroundColor:"transparent",animation:!_e},s))})}catch{r.push("charts")}e===Je&&(Ae&&Yo(Ae),r.length&&(ea.textContent="Could not load the "+r.join(" and ")+" renderer (offline?)"),u.forEach(no),ca(),ke(!0))}function Yl(){let e=[];return v.forEach(t=>{let a=Ot(t),o=e[e.length-1];o&&o.sec===a?o.ids.push(t):e.push({sec:a,ids:[t]})}),e}function Kl(){let a=0,o=0,r=0;Yl().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,S)=>{let f=u.get(d);S&&(l+=90+f._w/2),f.cx=l,f.cy=a,c=l,l+=f._w/2}),o=c,r=s})}function Jl(){u.forEach(e=>{e.cx=0,e.cy=0})}function gi(){Je++,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=pi(),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?io(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");xl(n),Ll(n),Bl(n),Tl(o,n),/^slidetake$/i.test(R.brand||"")&&ll(n),n.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=Pl(n),a.frags=Ol(n),n.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",zl,{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||_(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{h.active||_(a.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&_(a.id)}),se.appendChild(o),a.el=o,hr(a,a.frags.length)}),t&&!ea.textContent&&(ea.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),u.forEach(no),ca(e),Vl()}function ca(e){e===void 0&&(e=pi()),J==="radial"?wl(e):J==="path"?Kl():J==="focus"?Jl():vl(),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(),Pt(),mr()}function $l(){let e="";if(J==="focus"){zo.innerHTML="";return}if(J==="path"){for(let t=1;t<v.length;t++){let a=u.get(v[t-1]),o=u.get(v[t]);e+='<path data-from="'+a.id+'" data-to="'+o.id+'" d="M '+a.cx+" "+a.cy+" L "+o.cx+" "+o.cy+'"/>'}zo.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+'"/>'}}),zo.innerHTML=e}function io(e){let t=[],a=e;for(;a;)t.unshift(a),a=u.get(a).parent;return t}function Et(){let e=N.clientWidth,t=N.clientHeight;se.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+z.zoom+") translate("+-z.x+"px,"+-z.y+"px)",Ci()}function pr(){Qt&&(Qt.kill(),Qt=null)}function yi(e,t){if(pr(),t||_e||!window.gsap){Object.assign(z,e),Et();return}let a=N.clientWidth,o=Math.hypot(e.x-z.x,e.y-z.y),r=e.zoom,n=gsap.timeline({onUpdate:Et,onComplete:()=>{Qt=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+St)));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);Qt=n}function Xl(){let e=N.getBoundingClientRect(),t=14,a=[];if(!Pe.hidden&&Pe.offsetWidth){let r=Pe.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=gl();return o&&a.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),a}function Ql(){let e=N.clientWidth,t=N.clientHeight,a=[{x0:16,y0:K?20:56,x1:e-16,y1:t-(K?20:74)}];return Xl().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 $o(e,t,a){let o=N.clientWidth,r=N.clientHeight,n=null;return Ql().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 bi(e,t,a,o){return{x:e-a.sx/o,y:t-a.sy/o}}function rt(e,t){let a=u.get(e);if(!a)return;let o=$o(a._w,a._h,ta),r=Ot(e),n=v.filter(l=>Ot(l)===r&&!u.get(l).visual).map(l=>{let c=u.get(l);return $o(c._w,c._h,ta).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));yi(Object.assign(bi(a.cx,a.cy,o,s),{zoom:s}),t)}function da(e){let t=[...u.values()];if(!t.length)return;let a=N.clientWidth,o=N.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=$o(n-r,s-i,.94),c=Math.max(.05,Math.min(1,l.zoom));yi(Object.assign(bi((r+n)/2,(i+s)/2,l,c),{zoom:c}),e)}function ke(e){m&&u.has(m)?rt(m,e):da(e)}function Pt(){let e=m?io(m):[];u.forEach(t=>{let a=t.el;a.classList.toggle("current",t.id===m),a.classList.toggle("active-path",e.includes(t.id))}),se.querySelectorAll("#connectors path").forEach(t=>{let a=J==="path"?!!m&&v.indexOf(t.dataset.to)<=v.indexOf(m):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",a)}),ac(e),wi()}function vi(){return tn(new URLSearchParams(location.search).get("duration")??R.duration)}function Zl(){return K&&vi()>0&&(!h.active||/^always$/i.test(R.timer||""))}function Ga(){let e=Zl()&&He.start>0;if(Xe.classList.toggle("timed",e),!e){Xe.classList.remove("over");return}let a=(h.active&&h.t0?Tt():performance.now()-He.start)/vi();Xe.firstChild.style.width=Math.min(100,a*100)+"%",Xe.classList.toggle("over",a>=1)}function ec(){He.start=performance.now(),clearInterval(He.timer),He.timer=setInterval(Ga,1e3),Ga()}function tc(){clearInterval(He.timer),He.timer=null,He.start=0,Ga()}function wi(){let e=K&&v.length>1&&!/^(off|no|false)$/i.test(R.progress||"");if(Xe.classList.toggle("show",e),!e)return;Ga();let t=v.indexOf(m),a=0,o=0;v.forEach((r,n)=>{let i=It(u.get(r)).length;a+=i,n<t?o+=i:n===t&&(o+=Math.min(xe,i-1)+1)}),Xe.lastChild.style.width=(a?o/a*100:0)+"%"}function ac(e){jn.innerHTML=e.map((t,a)=>(a>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===m?" here":"")+'" data-id="'+A(t)+'">'+A(u.get(t).title)+"</button>").join(""),jn.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{h.active||_(t.dataset.id)}))}function ha(e){let t=u.get(m);t&&(hr(t,di().frag,e),Ie(),(B.hidden||!Fe||!Fe.full||Fe.behind)&&nc(t),ur(t))}function rc(e){return!v.length||e.id!==v[0]&&e.id!==v[v.length-1]||e.el.querySelector("[data-gsap], .title-scramble")?null:[...e.el.querySelector(".body").children].filter(t=>!t.classList.contains("fragment"))}function nc(e){if(e._played||!window.gsap||_e)return;e._played=!0;let t=rc(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"),Vn(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(Vn)}function aa(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=>oc.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 Vn(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 ur(e){clearTimeout(Ct),!(!K||!e||!e.autoslide||h.active&&(!h.t0||h.paused))&&(Ct=setTimeout(()=>{m===e.id&&je(1)},e.autoslide))}function xi(e){let t=e&&e!==v[0]?e:"";try{M&&M.kind==="share"?history.replaceState(null,"",location.pathname+location.search+Co(M.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function _(e,t,a){if(!u.has(e))return;if(e!==m){be=null,De=-1,xe=a?It(u.get(e)).length-1:0;let n=u.get(m);n&&J==="focus"&&!t&&(n.el.classList.add("leaving"),setTimeout(()=>n.el.classList.remove("leaving"),600)),Si()}let o=e!==m;if(o&&(ki=m),m=e,clearTimeout(ue),ue=null,o&&J==="focus"&&!t&&!_e){let n=u.get(e).el;n.classList.add("entering"),n.offsetWidth,n.classList.remove("entering")}ha(o),o&&!Be&&ia("slide",e);let r=u.get(e);o&&r.mapFirst&&!a&&!t&&J!=="focus"?(da(),ue=setTimeout(()=>{ue=null,m===e&&(Ie(),rt(e))},1900),Ie()):rt(e,t),Pt(),mr(),xi(e)}function Si(){let e=u.get(m);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>mi(t,"pauseVideo")),hr(e,e.frags.length,!0),aa(e))}function ic(){if(!m&&Qe&&u.has(Qe)){Ei();return}m&&(Qe=m),J==="focus"&&fr("path"),Si(),clearTimeout(Ct),m=null,Ie(),Pt(),mr(),da(),xi(null)}function Ei(){if(ue)return clearTimeout(ue),ue=null,Ie(),rt(m),!0;if(!m&&Qe&&u.has(Qe)){let e=Qe;return Qe=null,_(e),!0}return!1}function je(e){if(!m){v.length&&_(v[e>0?0:v.length-1]);return}if(ue&&e>0){clearTimeout(ue),ue=null,Ie(),rt(m);return}let t=It(u.get(m)),a=Math.min(xe,t.length-1)+e;if(a>=0&&a<t.length){xe=a,be=null,De=-1,ha(),!re&&!B.hidden&&Fe.used?lt():ke(),Pt();return}let o=v.indexOf(m)+e;o>=0&&o<v.length&&_(v[o],!1,e<0)}function sc(){let e=u.get(m);e&&e.parent&&_(e.parent)}function lc(){let e=u.get(m);e&&e.children.length?_(e.children[0]):!m&&v.length&&_(v[0])}function mr(){let e=[...u.values()];if(!e.length){qo.innerHTML="",Ce=null;return}Qs.textContent="map";let t=p=>p.cx,a=p=>p.cy,o=Math.min(...e.map(t))-St/2,r=Math.max(...e.map(t))+St/2,n=Math.min(...e.map(a))-Go/2,i=Math.max(...e.map(a))+Go/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)),S=l/2-(o+r)/2*d,f=c/2+5-(n+i)/2*d,g=m?io(m):[],b="";e.forEach(p=>{if(!p.parent)return;let T=u.get(p.parent);b+='<line x1="'+(t(T)*d+S)+'" y1="'+(a(T)*d+f)+'" x2="'+(t(p)*d+S)+'" y2="'+(a(p)*d+f)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(p=>{let T=p.id===m?"var(--accent)":g.includes(p.id)?"var(--accent-teal)":"var(--node-border)";b+='<circle data-id="'+A(p.id)+'" cx="'+(t(p)*d+S)+'" cy="'+(a(p)*d+f)+'" r="'+(p.id===m?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"/>',qo.innerHTML=b,Ce={s:d,ox:S,oy:f},Ci()}function Ci(){let e=document.getElementById("mm-viewport");if(!e||!Ce)return;let t=N.clientWidth/z.zoom,a=N.clientHeight/z.zoom;e.setAttribute("x",(z.x-t/2)*Ce.s+Ce.ox),e.setAttribute("y",(z.y-a/2)*Ce.s+Ce.oy),e.setAttribute("width",Math.max(2,t*Ce.s)),e.setAttribute("height",Math.max(2,a*Ce.s))}function Mt(e){hi(ie.value),m&&!u.has(m)&&(m=null),gi(),m?_(m,e):v.length?_(v[0],e):(m=null,da(!0))}function fr(e,t){J=e,W("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(a=>a.classList.toggle("active",a.dataset.mode===e)),u.size&&(!t&&!_e&&(se.classList.add("morph"),setTimeout(()=>se.classList.remove("morph"),700)),ca(),Et(),m?rt(m,t):da(t))}function Mi(e){return Math.max(.04,Math.min(5,e))}function cc(e){ta=Math.round(Math.max(rl,Math.min(nl,e))*100)/100,W("slidetake:slideSize",ta),m&&rt(m)}function Yn(e){m?cc(ta+e*.1):Ti(e>0?1.2:1/1.2)}function Ti(e,t,a){pr();let o=Mi(z.zoom*e);if(t!==void 0){let r=N.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,Et()}function so(){U||(Ue.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!Ue.classList.contains("collapsed")))}function ve(e){K=e,document.body.classList.toggle("presenting",e),gs(document.getElementById("btn-present"),e),ys();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!m&&v.length&&_(v[0]);let a=R.camera||[...u.values()].some(o=>o.camera);e&&a&&!re&&!te&<(),e?ur(u.get(m)):clearTimeout(Ct),e?ec():tc(),wi()}function Tt(){return(h.paused?h.pauseAt:performance.now())-h.t0-h.pausedMs}function pa(e){e.classList.add("open")}function uc(e){if(W("slidetake:analytics",e?"on":"off"),!e){window["ga-disable-"+hc]=!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}))}Ai()}function Ai(){br.querySelectorAll("[data-analytics]").forEach(e=>e.setAttribute("aria-checked",String(e.dataset.analytics==="on"===pc())))}function ua(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function mc(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,a,...o]=e.split(":");return Va.value=t||"localhost",Ya.value=a||"4455",Ka.value=o.join(":"),!0}try{let t=JSON.parse(j("slidetake:obs")||"null");t&&(Va.value=t.host||"localhost",Ya.value=t.port||"4455",Ka.value=t.password||"",gr.checked=!0)}catch{}return!1}function Oi(){if(gr.checked)W("slidetake:obs",JSON.stringify({host:Va.value.trim(),port:Ya.value.trim(),password:Ka.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function Vt(e,t,a){Zt.textContent=e,Zt.className=t||"",Zt.title=a||e;let o=document.getElementById("obs-detail");o.textContent=a||"",o.hidden=!a}function gc(e){return location.protocol==="https:"&&!fc(e)}async function vr(){let e=Va.value.trim()||"localhost",t="ws://"+e+":"+(Ya.value.trim()||"4455");if(gc(e)){Oe=!1,Vt("Blocked here","err",yc);return}Vt("Connecting\u2026"),Zt.title="Connecting to "+t;try{await Jo(dc);let a=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(ne)try{await ne.disconnect()}catch{}ne=new a,ne.on("ConnectionClosed",()=>{Oe=!1,Vt("Disconnected","err")}),ne.on("RecordStateChanged",r=>{r.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&Ze&&(Ze(),Ze=null),r.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&h.active&&h.withObs&&!h.finishing&&Bt("Stopped in OBS")});let o=await ne.connect(t,Ka.value||void 0);Oe=!0;try{let r=await ne.call("GetVideoSettings");r&&r.fpsNumerator&&r.fpsDenominator&&(yr=r.fpsNumerator/r.fpsDenominator),Li=r&&r.outputWidth&&r.outputHeight?Bn(r.outputWidth,r.outputHeight):""}catch{}Vt("Connected","ok",""),Zt.title="Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),Oi(),Y.classList.contains("open")&&it()&&(O("Connected to OBS. Press \u25CF Record."),Ve())}catch(a){Oe=!1;let o=a&&a.message&&a.message!=="Error"?a.message+".":"Nothing answered at "+t+".";Vt("Could not connect","err",o+" Is OBS running with its WebSocket server on, and are the port and password right?")}}function bc(){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 Se(){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?Tn(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}=Mn(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 lo(){Zo++,he&&(cancelAnimationFrame(he.raf),he.stream.getTracks().forEach(e=>e.stop()),he.ctx.close().catch(()=>{}),he=null,Qo.value=0,vt.getContext("2d").clearRect(0,0,vt.width,vt.height),Ii())}function Ii(){er++,Na&&(Na.getTracks().forEach(e=>e.stop()),Na=null),wr.srcObject=null}async function Pi(){Ii(),xr();let e=er,t=bt.value;if(Da.hidden=t!=="none"&&!!t,Da.textContent="No camera",!(!t||t==="none"))try{let a=await navigator.mediaDevices.getUserMedia({video:t==="default"?!0:{deviceId:{exact:t}}});if(e!==er){a.getTracks().forEach(o=>o.stop());return}Na=a,wr.srcObject=a}catch{Da.hidden=!1,Da.textContent="The camera isn\u2019t available"}}async function Ja(){await lo();let e=Zo;try{let t=Lt.value,a=await navigator.mediaDevices.getUserMedia({audio:Ki(t)});if(e!==Zo){a.getTracks().forEach(f=>f.stop());return}let o=new AudioContext,r=o.createAnalyser();r.fftSize=512,o.createMediaStreamSource(a).connect(r);let n=new Float32Array(r.fftSize),i=he={stream:a,ctx:o,raf:0},s=vt.getContext("2d"),l=vt.width,c=vt.height,d=Le("--accent"),S=()=>{if(he!==i)return;r.getFloatTimeDomainData(n);let f=0;for(let g of n)f=Math.max(f,Math.abs(g));Qo.value=Math.max(f,Qo.value*.85),s.clearRect(0,0,l,c),s.lineWidth=3,s.strokeStyle=d,s.lineJoin="round",s.beginPath();for(let g=0;g<n.length;g++){let b=g/(n.length-1)*l,p=c/2-Math.max(-1,Math.min(1,n[g]*3))*(c/2-4);g?s.lineTo(b,p):s.moveTo(b,p)}s.stroke(),i.raf=requestAnimationFrame(S)};S()}catch(t){yt.innerHTML='<span class="warn">The microphone isn\u2019t available: '+A(t.message||t.name)+". Allow it in the site settings.</span>"}}async function $a(e=!0){try{e&&!he&&await Ja();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"),S=b=>!!l&&(b.label===c||!!l.groupId&&b.groupId===l.groupId&&!d.some(p=>p!==b&&p.label===c)),f=d.map((b,p)=>An(b.label)||(n==="audioinput"?"Microphone ":"Camera ")+(p+1));f.forEach((b,p)=>{let T=f.slice(0,p).filter(C=>C===b).length;T&&(f[p]=b+" "+(T+1))});let g=d.some(b=>b.deviceId===i)||i==="none"?i:(d.find(S)||d[0]||{}).deviceId;return d.map((b,p)=>'<option value="'+A(b.deviceId)+'"'+(b.deviceId===g?" selected":"")+">"+A(f[p]+(S(b)?" (system default)":""))+"</option>").join("")},o=kr();bt.innerHTML='<option value="none"'+(o==="none"?" selected":"")+">No camera</option>"+a("videoinput",o);let r=j("slidetake:mic")||"";Lt.innerHTML=a("audioinput",r),r&&Lt.value===r&&he&&he.stream.getAudioTracks()[0].getSettings().deviceId!==r&&Ja()}catch{}}function zi(){let e=j("slidetake:mirror");return e?e==="on":/^(yes|true|on)$/i.test(R.pip_mirror||"")}function xr(){Xa.checked=zi(),wr.parentElement.classList.toggle("mirror",Xa.checked)}function kr(){let e=j(Ri());return e||(wc()?j("slidetake:cam")||"default":"none")}function xc(e){W(Ri(),e),e!=="none"&&e!=="default"&&W("slidetake:cam",e)}function kc(){h.camWas=!te;let e=kr()!=="none";e!==!te&&Dt(e,!0)}function Di(){h.camWas!=null&&(h.camWas!==!te&&Dt(h.camWas,!0),h.camWas=null)}async function Fi(){let e=Se();if(!e.ok)return yt.innerHTML='<span class="warn">'+A(e.why)+"</span>",e;Fa&&(yt.innerHTML='<span class="warn">'+A(Fa)+"</span>",Fa="");let t=mt.indexOf(e.quality),a=j("slidetake:quality");At.innerHTML=mt.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=mt.find(s=>s.name===At.value)||e.quality;o=" Room for about "+Math.floor((r-n)/Ln(i))+" minutes of takes."}catch{}return yt.querySelector(".warn")||(yt.innerHTML='<span class="ok">Ready: this screen records up to '+e.quality.name+" in fullscreen."+A(o)+"</span>"),e}function Sc(e){me=e,W("slidetake:rec-mode",e),na({setup:Rt()})}function na(e={}){Ge&&(Se().ok&&(me||"browser")==="browser"?Ar(e):Ec(e))}function Ec(e={}){let t=co().find(a=>a.key===qe()&&a.withObs&&!a.inBrowser);Qi(t||{key:qe(),deckTitle:R.title||(v[0]?u.get(v[0]).title:"Deck"),date:new Date().toISOString(),withObs:!0,outputPath:null,reason:"",total:0,totalObs:null,fps:yr,events:[],picks:{},empty:!0},e)}async function Sr(){if(!(!Ge||h.active||!v.length)){if(!Cc()){or({note:"Set up once: after this, \u25CF Record (R) starts recording straight away."});return}if(Se().ok&&(me||"browser")==="browser"){let t=Oa(st(),uo()).filter(r=>!r.pick).map(r=>r.id),a=v.indexOf(m),o=t.length?t:a>0?v.slice(a):v;Qa("browser",o.length===v.length?null:o);return}if(!Oe&&j("slidetake:obs")&&await vr(),Oe){Qa("obs");return}or({note:"Connect to OBS first: OBS \u2192 Connect."})}}async function Er(e,t){return(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes",{create:!0})).getDirectoryHandle(e,{create:!!t})}async function Cr(e){try{await(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes")).removeEntry(e,{recursive:!0})}catch{}}async function Hi(e){window.RestrictionTarget&&e.restrictTo?await e.restrictTo(await RestrictionTarget.fromElement(de)):await e.cropTo(await CropTarget.fromElement(de))}async function Mc(e){try{window.RestrictionTarget&&e.track.restrictTo?await e.track.restrictTo(null):await e.track.cropTo(null),await Hi(e.track)}catch{}await e.track.applyConstraints(Ni(e.quality)).catch(()=>{}),await ra()}async function Tc(){let e=Se();if(!e.ok)throw new Error(e.why);let t=mt.find(s=>s.name===At.value)||e.quality;document.body.classList.add("rec-frame");let a=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:qt},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 Hi(o)}catch(s){throw r(),new Error("Chrome could not record just the slides ("+(s.message||s.name)+").")}await o.applyConstraints(Ni(t)).catch(()=>{});let n;try{let s=j("slidetake:mic");n=await navigator.mediaDevices.getUserMedia({audio:Ki(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 Er(i,!0),clips:[],cur:null,chain:Promise.resolve(),error:null},o.addEventListener("ended",()=>{h.active&&!h.finishing&&Bt("Sharing stopped")})}function ji(){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 Lc(e){let t=h.browser,a="take-"+t.clips.length+"."+Ao(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:Ta}),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(Tt()),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 Qa(e,t){if(h.active||!v.length)return;let a=e==="obs";if(lo(),me||(me=a?"obs":"browser",W("slidetake:rec-mode",me)),e==="browser"){K||ve(!0);try{await Tc()}catch(l){document.body.classList.remove("rec-frame"),K&&ve(!1),Fa=l.name==="NotAllowedError"?"Recording needs this tab shared: press \u25CF Record again and choose Share.":l.message,Ar({setup:!0});return}}ua();let o=t&&t.length?t.filter(l=>v.includes(l)):null,r=o?o[0]:v[0],n=v[v.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"),Or(),K||ve(!0),kc(),n?(document.body.classList.add("no-anim"),u.get(n)._played=!0,Be=!0,_(n,!0,!0),Be=!1,B.getAnimations().forEach(l=>l.finish()),await ra(),document.body.classList.remove("no-anim")):(m===r&&(xe=0,be=null,De=-1),_(r,!0)),!document.fullscreenElement&&document.documentElement.requestFullscreen&&await document.documentElement.requestFullscreen().catch(()=>{});let i=Kt.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",Kt.querySelector(".num").textContent=l,Kt.classList.add("show"),await oa(1e3),!h.active)return;if(Kt.classList.remove("show"),await ra(),a){let l=new Promise(c=>{Ze=c,setTimeout(()=>{Ze&&(Ze(),Ze=null)},2500)});try{await ne.call("StartRecord")}catch(c){Mr("OBS could not start recording: "+(c&&c.message||c));return}if(await l,!h.active)return}h.browser&&await Mc(h.browser),h.counting=!1,h.t0=performance.now();let s=u.get(r);if(n){ia("slide",r),h.browser&&await h.browser.chain,aa(s),Be=!0,_(r),Be=!1;return}aa(s),ha(!0),ia("slide",m)}function Mr(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(()=>Cr(t.id)),ji(),h.browser=null}Kt.classList.remove("show"),document.body.classList.remove("recording"),K&&ve(!1),Di(),xt(e)}function ia(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(Tt()),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&&Lc(r),h.withObs&&Oe&&(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 Ac(e){let t=e.key;if((Jn.includes(t)||$n.includes(t)||Xn.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){h.counting?Mr("Take cancelled"):Bt("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||tt)){if(Xn.includes(t)){Pc();return}h.paused||(Jn.includes(t)?Bc():$n.includes(t)&&Oc())}}function Bc(){let e=It(u.get(m)),t=Math.min(xe,e.length-1)>=e.length-1,a=v.indexOf(m);if(!t){je(1);return}if(!h.only){a===v.length-1?Bt():je(1);return}let o=v.slice(a+1).find(r=>h.only.has(r));o?v[a+1]===o?je(1):Wi(v[v.indexOf(o)-1],o,"slide"):Bt()}async function Oc(){let e=u.get(m);if(!e||tt)return;let t=m,a=ki;if(!a||a===t||!u.has(a)){Ic(e);return}Wi(a,t,"retake")}async function Wi(e,t,a){let o=u.get(t);if(!o||tt)return;tt=!0;let r=Tt();document.body.classList.add("no-anim");let n=u.get(e);Be=!0,n._played=!0,_(e,!0,!0),B.getAnimations().forEach(i=>i.finish()),Be=!1,await ra(),document.body.classList.remove("no-anim"),ia(a,t,r),h.browser&&await h.browser.chain,h.withObs&&await _i(),aa(o),Be=!0,_(t),Be=!1,!re&&!B.hidden&&Fe.used&<(),tt=!1}async function _i(){let e=h.events[h.events.length-1];e&&(e.skip=Qn/2),await oa(Qn)}async function Ic(e){tt=!0,xe=0,be=null,De=-1,aa(e),ha(!0),!re&&!B.hidden&&Fe.used?lt():ke(),Pt(),ia("retake",m),h.withObs&&await _i(),tt=!1}async function Pc(){if(h.t0)if(h.paused){if(Xo.classList.remove("show"),await ra(),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,ur(u.get(m))}else{if(h.paused=!0,h.pauseAt=performance.now(),clearTimeout(Ct),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()})}Xo.classList.add("show")}}async function Bt(e){if(!h.active||h.finishing)return;if(h.counting){Mr("Take cancelled");return}h.finishing=!0,clearTimeout(Ct),h.paused&&(h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,Xo.classList.remove("show"));let t=Math.round(Tt()),a=null;if(h.withObs){try{let n=await ne.call("GetRecordStatus");n&&typeof n.outputDuration=="number"&&(a=n.outputDuration)}catch{}await oa(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 oa(600),await o.chain,t=Math.round(Tt()),o.cur&&o.cur.rec&&o.cur.rec.state!=="inactive"&&o.cur.rec.stop(),await Promise.all(o.clips.map(n=>n.done)),ji(),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),Di();let r={key:qe(),deckTitle:R.title||u.get(v[0]).title,date:new Date().toISOString(),withObs:h.withObs,outputPath:h.outputPath,reason:e||"",total:t,totalObs:a,fps:o?qt:yr,...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){Wc(r);return}Tr(r),Qi(r,{note:(e?e+". ":"")+ye(r).size+" slides recorded with OBS."})}function qe(){return ht(R.title||(v[0]?u.get(v[0]).title:"deck"))}function co(){try{return JSON.parse(j("slidetake:sessions")||"[]")}catch{return[]}}function Tr(e){let t=co().filter(a=>a.date!==e.date);t.unshift(e),t.slice(12).forEach(a=>{a.takesId&&Cr(a.takesId)}),W("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function Ot(e){let t=u.has(e)?io(e):[e];return t[Math.min(1,t.length-1)]}function Ui(e,t){let a=Ot(e);return{sec:a,title:u.has(a)?u.get(a).title:t}}function O(e,{warn:t=!1,html:a="",title:o=""}={}){Yt.classList.toggle("warn",t),a?Yt.innerHTML=a:Yt.textContent=e,Yt.title=o||Yt.textContent;let r=document.getElementById("rv-save-again");r&&(r.onclick=()=>ss(!0))}function Qi(e,t={}){ua(),H=e,Z=null;let a=e.events.filter(i=>i.retake).length,o=e.empty?"":ye(e).size+" slides, "+(a?a+" retake"+(a>1?"s":""):"no retakes")+", recorded "+pt(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?" ("+ut(e.outputPath)+")":"";let n=Ca(e);Za.value=[...Za.options].reduce((i,s)=>Math.abs(s.value-n)<Math.abs(i.value-n)?s:i).value,k.src&&(e.inBrowser||We!==ut(e.outputPath)&&e.outputPath)&&(k.removeAttribute("src"),k.load(),We=""),document.getElementById("rv-novideo").hidden=!!k.src||!!e.empty,Z=null,F=null,zt(),ho(),pa(Y),t.setup?mo(t):(fo(),$a(!1).then(Ve)),O(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||Vc(e)}function ho(){if(H&&H.board){nt();return}let e=H,t=document.getElementById("rv-list"),a=null;t.innerHTML=[...ye(e).values()].map(o=>{let r=e.picks[o.id]??o.takes.length,n=Ot(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 "+pt(l.end-l.start)+"</button>").join("");return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+A(o.title)+"<small>"+ba(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,Tr(e),ho();let r=ye(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&&po([{clip:s.clip,keep:(n.end-n.start)/1e3,title:i}])}else to([{start:n.start,end:n.end,title:i}])}),document.getElementById("rv-ffmpeg-copy").disabled=document.getElementById("rv-play-final").disabled=!e.events.length,es(e),as(e)}function es(e){let t=zc(e),a=document.getElementById("rv-chapters");Zi=t.lines.join(`
|
|
1416
|
-
`),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 ts(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 as(e){let t=document.getElementById("rv-final"),a=++Wo,o=Ut(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 ")+pt(o);if(!e.inBrowser||e.cleaned){t.textContent=r(null);return}try{let n=0;for(let i of Gt(e))ja.has(i.clip)||ja.set(i.clip,(await ma(i.clip)).size),n+=ja.get(i.clip);a===Wo&&(t.textContent=r(n))}catch{a===Wo&&(t.textContent=r(null))}}function to(e){if(!k.src){eo=e,O(nr?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.");return}eo=null,Z={ranges:e,i:0},O("\u25B6 "+e[0].title);let t=()=>{k.currentTime=e[0].start/1e3,k.play().catch(a=>{a&&a.name!=="AbortError"&&O("Could not play: "+a.message,{warn:!0})})};k.readyState>=1?t():k.addEventListener("loadedmetadata",t,{once:!0})}function zt(){wt=null}function Lr(){let e=F&&!F.single&&!k.paused;os.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 Dc(e){let t=H?Gt(H):[],a=t.findIndex(r=>r.id===e.id),o=a>=0?t[a+1]:null;wt=o?o.id:null,O(o?"Preview continues from "+o.title+".":"That was the last slide: Preview plays from the start.")}function rs(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 ma(e){let[t,a]=e.split("/");return(await(await Er(t)).getFileHandle(a)).getFile()}async function po(e,t=0,a=!1){if(!(!H||H.cleaned||!e.length)){Z=null,F={parts:e,i:t,single:a};try{let o=await ma(e[t].clip);if(!Y.classList.contains("open"))return;k.src&&URL.revokeObjectURL(k.src),k.src=URL.createObjectURL(o),O("\u25B6 "+e[t].title),await k.play()}catch(o){if(o&&o.name==="AbortError")return;F=null,O(o&&o.name==="NotFoundError"?"This take is no longer in the browser.":"Could not play this take: "+(o&&o.message||o),{warn:!0})}}}function ns(){let e=F;if(e.i+1<e.parts.length){po(e.parts,e.i+1,e.single);return}F=null,k.pause(),e.single?Dc(e.parts[0]):O(""),Lr()}async function Fc(e){if(!e.where)return!0;try{let t=await Br("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 ss(e){let t=H;if(!t||!t.inBrowser||t.cleaned)return;let a=Gt(t);if(!a.length){O("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)]),at(),sa(),t.type]),r=t.board&&I.lastDownload;if(!e&&r&&r.sig===o&&await Fc(r)){O("",{html:'<button class="btn small" id="rv-save-again">Save another copy</button> Already saved in '+A(_o(r))+".",title:"Already saved in "+_o(r)+". A new video is made only when a take or the sound settings change."});return}let n=Ao(t.type||"")==="mp4",i=qe()+" "+Hc(new Date)+"."+(n?"mp4":"webm"),s=null,l="";try{let d=await ls(!1);d&&(s=await(await d.getFileHandle(i,{create:!0})).createWritable(),l=d.name)}catch(d){if(d&&d.name==="AbortError")return}let c=ao;c.disabled=!0,$e("Preparing\u2026");try{let d=await import(vc),S=s?new d.StreamTarget(s):new d.BufferTarget,f=new d.Output({format:n?new d.Mp4OutputFormat({fastStart:s?!1:"in-memory"}):new d.WebMOutputFormat,target:S}),g=1,b="",p=at()&&sa();if(at()){let D=await Zn(d,a,1,!1,"Measuring");if(D&&isFinite(D.integrated)){let q=Oo(D,{limit:p});if(p&&Math.abs(q)>=.05){let Q=await Zn(d,a,Ba(q),!0,"Checking");Q&&isFinite(Q.integrated)&&(q=Math.min(q+(-14-Q.integrated),Bo))}g=Ba(q);let ce=p?-14:D.integrated+q,oe=!p&&Oo(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")+(oe?"; a loud peak held it back, turn on Peak limiter to reach "+-14:"")}}let T=g!==1||p;await Nc(d,a);let C=null,w=null,x=0,y=-1,E=-1,L=null,$=[],ae=async()=>{for(;$.length&&L.ready()>=$[0].n;){let D=$.shift(),q=L.take(D.n),ce=new Float32Array(D.n*D.ch);q.forEach((oe,Q)=>ce.set(oe,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()){$e("Joining "+(D+1)+"/"+a.length);let ce=new d.Input({source:new d.BlobSource(await ma(q.clip)),formats:d.ALL_FORMATS}),oe=await ce.getPrimaryVideoTrack(),Q=await ce.getPrimaryAudioTrack();if(!oe)throw new Error(q.title+" has no video");C||(C=new d.EncodedVideoPacketSource(await oe.getCodec()),f.addVideoTrack(C,{frameRate:qt}),Q&&(w=T?new d.AudioSampleSource({codec:n?"aac":"opus",bitrate:Ta}):new d.EncodedAudioPacketSource(await Q.getCodec()),f.addAudioTrack(w)),await f.start());let Nt={decoderConfig:await oe.getDecoderConfig()},ct=0,Rr=!0;for await(let G of new d.EncodedPacketSink(oe).packets())G.timestamp>=q.keep||(y=La(y,x+G.timestamp),await C.add(G.clone({timestamp:y}),Rr&&D===0?Nt:void 0),Rr=!1,ct=Math.max(ct,G.timestamp+G.duration));if(Q&&w&&T)for await(let G of new d.AudioSampleSink(Q).samples(0,ct)){if(G.timestamp+G.duration>ct+1e-4){G.close();continue}E=La(E,x+G.timestamp);let fe=rs(G);if(fe.forEach(ge=>{for(let dt=0;dt<ge.length;dt++)ge[dt]*=g}),p)L=L||Io(G.sampleRate,fe.length),L.push(fe),$.push({t:E,n:G.numberOfFrames,rate:G.sampleRate,ch:fe.length}),G.close(),await ae();else{let ge=G.numberOfFrames,dt=new Float32Array(ge*fe.length);fe.forEach((Ss,Es)=>dt.set(Ss,Es*ge)),await w.add(new d.AudioSample({data:dt,format:"f32-planar",numberOfChannels:fe.length,sampleRate:G.sampleRate,timestamp:E})),G.close()}}else if(Q&&w){let G={decoderConfig:await Q.getDecoderConfig()},fe=!0;for await(let ge of new d.EncodedPacketSink(Q).packets())ge.timestamp+ge.duration>ct+1e-4||(E=La(E,x+ge.timestamp),await w.add(ge.clone({timestamp:E}),fe&&D===0?G:void 0),fe=!1)}x+=ct}if(L&&(L.end(),await ae(),L.events&&(b+=", "+L.events+" peak"+(L.events===1?"":"s")+" limited")),$e("Finishing\u2026"),await f.finalize(),!s){let D=document.createElement("a");D.href=URL.createObjectURL(new Blob([S.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&&(I.lastDownload=X,fa()),O("Saved in "+_o(X)+" ("+pt(x*1e3)+b+")."),$e("\u2713 Saved"),is=setTimeout(()=>$e(),2500)}catch(d){$e(),O("Could not save the video: "+(d&&d.message||d),{warn:!0}),s&&s.abort().catch(()=>{})}finally{c.disabled=!!t.cleaned}}async function Zn(e,t,a,o,r){let n=null,i=null;for(let[s,l]of t.entries()){$e(r+" "+(s+1)+"/"+t.length);let c=await new e.Input({source:new e.BlobSource(await ma(l.clip)),formats:e.ALL_FORMATS}).getPrimaryAudioTrack();if(c)for await(let d of new e.AudioSampleSink(c).samples(0,l.keep)){let S=rs(d);n=n||In(d.sampleRate,S.length),a!==1&&o?(S.forEach(f=>{for(let g=0;g<f.length;g++)f[g]*=a}),i=i||Io(d.sampleRate,S.length),i.push(S),i.ready()&&n.add(i.take(i.ready()))):n.add(S),d.close()}}return i&&(i.end(),i.ready()&&n.add(i.take(i.ready()))),n?n.result():null}async function Nc(e,t){let a=[];for(let i of t){let s=await new e.Input({source:new e.BlobSource(await ma(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 ls(e){if(!window.showDirectoryPicker)return null;let t=e?null:await Br("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"}),ps("video-folder",t),t}function st(){let e=cs();if(I&&ar===e)return I;ar=e;try{I=JSON.parse(j(e)||"null")}catch{I=null}return(!I||!Array.isArray(I.takes))&&(I={takes:[],picks:{},type:"",quality:""}),I}function Wc(e){st();let t=Dn(e,e.takesId,uo());t.forEach(a=>{delete I.picks[a.id]}),I.takes.push(...t),Object.assign(I,{type:e.type,quality:e.quality}),fa(),ze.clear(),Ar({note:(e.reason?e.reason+". ":"")+t.length+" new take"+(t.length===1?"":"s")+" on the board."})}function ds(){let e=Oa(st(),uo()),t=Object.assign(Fn(e),{board:!0,inBrowser:!0,withObs:!1,type:I.type||"video/mp4",quality:I.quality||"",deckTitle:R.title||(v[0]?u.get(v[0]).title:"Deck"),date:new Date().toISOString()});return{rows:e,sess:t}}function mo(e={}){Y.classList.add("setup-view"),ti.textContent=e.note||"",ti.hidden=!e.note,ot.textContent="\u2190 Back",ot.title="Back to Studio",ot.setAttribute("aria-expanded","true"),_c()}function fo(){let e=Rt();e&&Y.classList.remove("setup-view"),ot.textContent="\u2699 Setup",ot.title="Settings: camera, microphone, video, OBS and files",ot.setAttribute("aria-expanded","false"),e&&(lo(),Ve())}function or(e={}){Y.classList.contains("open")?mo(e):na({...e,setup:!0})}function _c(){let e=()=>{Ve(),Rt()&&Pi()};if(it()){bc(),$a(!1).then(e);return}yt.innerHTML="",Fi().then(t=>{t.ok?$a().then(e):e()})}function Ve(){let e=i=>{let s=i.selectedOptions[0];return s?s.textContent.replace(/ \(system default\)$/,""):""},t=e(bt)||(kr()==="none"?"No camera":"Camera"),a=it(),o=a?Li:Se().ok?At.value:"",r=a?[t]:[t,e(Lt)||"Microphone"],n=document.getElementById("rv-using");n.textContent=r.join(" \xB7 "),n.title="Recording with "+r.join(" \xB7 "),document.getElementById("rv-size").textContent=o||"",gt.classList.toggle("on",a),gt.setAttribute("aria-pressed",String(a)),gt.disabled=!Se().ok,gt.title=gt.disabled?Wa+" records only with OBS: pro mode":a?"Pro mode: recording with OBS. Click for easy mode, in "+Wa:"Easy mode: recording in "+Wa+". Click for pro mode, with OBS"}function Ar(e={}){Ge&&(ua(),st(),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,zt(),Ha=-1,nt(),pa(Y),e.setup||!Se().ok?mo(e):(fo(),Fi().then(()=>$a(!1)).then(Ve)),O(e.note||Xi()||(I.takes.length?Uc()+". Click a take to preview it.":v.length+" slides, nothing recorded yet. Press \u25CF Record.")))}function Uc(){let e=Oa(st(),uo()),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 nt(){let{rows:e,sess:t}=ds();H=t;let a=document.getElementById("rv-list"),o=null;a.innerHTML=e.map(i=>{let s=Ot(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"},S=i.takes.length?i.takes.map(f=>'<button class="rv-chip'+(i.pick===f.uid?" on":"")+(f.outdated?' outdated" title="'+d[f.outdated]:"")+'" data-id="'+c+'" data-uid="'+A(f.uid)+'">Take '+f.no+" \xB7 "+pt(f.ms)+"</button>").join("")+(i.pick?"":'<span class="rv-none">'+(i.takes.some(f=>f.outdated==="before")&&!i.takes.some(f=>f.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":"")+(ze.has(i.id)?" selected":"")+'" data-id="'+c+'"><input type="checkbox" class="rv-sel" data-id="'+c+'"'+(ze.has(i.id)?" checked":"")+' aria-label="Select '+A(i.title)+' to record"><div><div class="t">'+A(i.title)+'</div><div class="rv-chips">'+S+"</div></div></div>"}).join(""),a.querySelectorAll(".rv-chip").forEach(i=>i.onclick=()=>{I.picks[i.dataset.id]=i.dataset.uid,fa(),nt();let s=e.find(c=>c.id===i.dataset.id),l=s&&s.takes.find(c=>c.uid===i.dataset.uid);l&&po([{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?Nn(v,ei,i.dataset.id):[i.dataset.id]).forEach(c=>{i.checked?ze.add(c):ze.delete(c)}),zt(),ei=i.dataset.id,nt()}));let r=Ia(v,ze),n=Se().ok;document.getElementById("rv-rec").disabled=!n,Ha>=0&&r.length!==Ha&&O(Xi()||"Record takes the whole deck."),Ha=r.length,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-play-final").disabled=!t.events.length,es(t),as(t)}async function qc(e){for(let a of e)try{let[o,r]=a.clip.split("/");await(await Er(o)).removeEntry(r)}catch{}let t=new Set(e.map(a=>a.uid));I.takes=I.takes.filter(a=>!t.has(a.uid)),Object.keys(I.picks).forEach(a=>{t.has(I.picks[a])&&delete I.picks[a]}),fa(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,zt(),nt()}function hs(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 Br(e){let t=async a=>{let o=await hs(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 ps(e,t){try{(await hs()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function go(e){nr=!0;try{return await Gc(e)}finally{nr=!1}}async function Gc(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 ga(e,t,a){k.src&&URL.revokeObjectURL(k.src),Jt=t||null,a||(rr=0),k.src=URL.createObjectURL(e),We=e.name,document.getElementById("rv-novideo").hidden=!0,O("Loaded "+e.name+". Click a take to preview it."),eo?to(eo):a&&Z&&to(Z.ranges.slice(Z.i))}async function Vc(e){let t=ut(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(We===t&&k.src))try{let a=await Br("obs-folder");if(!a||await a.queryPermission({mode:"read"})!=="granted")return;let o=await a.getFileHandle(t);O("Opening "+t+"\u2026"),ga(await go(o),o)}catch{}}function xt(e,t){if(!h.active){if(clearTimeout(_a),!B.hidden&&!B.classList.contains("live")){Xt.classList.remove("show"),ms.textContent=e,B.classList.add("msg"),t||(_a=setTimeout(fs,9e3));return}Xt.textContent=e,Xt.classList.add("show"),t||(_a=setTimeout(()=>Xt.classList.remove("show"),9e3))}}function fs(){ms.textContent="PIP camera",B.classList.remove("msg")}function Or(){clearTimeout(_a),Xt.classList.remove("show"),fs()}function Uo(){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 Ir(){re&&re.getTracks().forEach(t=>t.stop()),re=null;let e=B.querySelector("video");e&&e.remove()}async function lt(){if(!(re||te)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){xt("Camera not available on this page."+Uo(),!0);return}if(Te.disabled)return;Te.disabled=!0,xt("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{let t=j("slidetake:cam");re=await navigator.mediaDevices.getUserMedia({video:{...t?{deviceId:{ideal:t}}:{},width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),Or()}catch(t){let a=t&&t.name;xt(a==="NotAllowedError"||a==="SecurityError"?"Camera access was blocked."+Uo():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+")":"")+"."+Uo(),!0);return}finally{Te.disabled=!1,Pr()}re.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{Ir(),qa(),ke()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=re,B.appendChild(e)}qa(),ke()}}function gs(e,t){e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))}function Pr(){Te.querySelector("svg")||(Te.innerHTML=Yc+'<span class="lbl"> <u class="key">C</u>amera</span>'),Te.classList.toggle("on",!te),Te.setAttribute("aria-pressed",String(!te)),Te.title=te?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function Dt(e,t){e&&!Ge||(te=!e,t||W("slidetake:camera",e?"on":"off"),te&&(Ir(),Or()),be=null,De=-1,xe=Math.min(xe,Math.max(0,It(u.get(m)).length-1)),Pr(),qa(),ha(),Pt(),ke(),!K&&!t&&xt(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&<())}function ys(){document.body.classList.remove("idle"),clearTimeout(ai),K&&(ai=setTimeout(()=>document.body.classList.add("idle"),2e3))}function la(e,t){kt.textContent=e,kt.classList.add("show"),clearTimeout(ri),ri=setTimeout(()=>kt.classList.remove("show"),t||2500)}function ir(e,{keepObs:t=!0,keepEdit:a=!0,slide:o=""}={}){let r=new URL(pn(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(M.kind==="source")return{link:ir(M.source,t),inside:!1};if(M.kind==="copy"&&Sa(P)&&["url","gist","builtin"].includes(P.origin.kind))return{link:ir(P.origin,t),inside:!1};let o=M.kind==="share"?M.data:await mn(ie.value),r=new URLSearchParams(location.search);return["src","obs","edit"].forEach(n=>r.delete(n)),{link:location.origin+"/share"+(r.toString()?"?"+r:"")+Co(o,e),inside:!0}}function $c(){let e=j("slidetake:draft");if(!e||e===yo)return null;let t=xa(e,{kind:"file",name:"your earlier draft"},{exported:!0});W("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function ya(){W("slidetake:copy",JSON.stringify(P))}function Ft(){if(U)return;let e;if(zr())e='<span class="mine">'+A(pe.file)+'</span> <span class="ro">\xB7 on this computer, saved as you type</span>';else if(M.kind==="copy")e='<span class="mine">Your copy of '+A(Ee(P.origin))+"</span>"+(ka(P)?' <span class="edited">\xB7 edited</span>':"");else{let a=M.kind==="share"?"a shared deck":Ee(M.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,Ue.classList.toggle("unsaved",M.kind==="copy"&&ka(P)),document.getElementById("btn-reset").hidden=!(M.kind==="copy"&&!Sa(P));let t=document.getElementById("continue");t.hidden=M.kind==="copy"||!P,P&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+Ee(P.origin))}function bs(e){return!P||!ka(P)?!0:confirm("Your copy of "+Ee(P.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function vs(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function Xc(){let e=M.kind==="share"?{kind:"shared"}:M.source;return bs("a copy of "+Ee(e))?(P=xa(M.text,e),M={kind:"copy"},history.pushState(null,"",vs()+(m&&m!==v[0]?"#"+encodeURIComponent(m):"")),la("Editing your own copy of "+Ee(e)+". The original is unchanged.",4e3),!0):(ie.value=M.text,!1)}function Qc(){M={kind:"copy"},history.pushState(null,"",vs()),Ue.classList.contains("collapsed")&&so(),ie.value=P.text,Mt(!0),Ft()}function zr(){return!!(pe&&M&&M.kind==="source"&&M.source.kind==="url"&&new URL(M.source.url,location.href).pathname===pe.deck)}function Zc(e){fetch(pe.save,{method:"PUT",body:e}).catch(()=>la("Could not save "+pe.file+": is npx slidetake still running?",6e3))}async function ed(e){if(e.kind==="builtin")return Ua[e.id==="help"?"docs":e.id]??Ua.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 Ne=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 Ne=new URL(e.url,location.href).href,await t.text()}function si(){return M={kind:"source",source:{kind:"builtin",id:"home"},text:Ua.home},M.text}async function td(){if(pe&&ee.page==="source"&&ee.source.kind==="builtin"&&ee.source.id==="home"&&location.pathname==="/"&&(ee.source={kind:"url",url:pe.deck}),U)return Ne=U.base||location.href,M={kind:"source",source:{kind:"url",url:Ne},text:rn(U.settings||{})+String(U.markdown||"")},M.text;if(ee.page==="edit"){if(P)return M={kind:"copy"},P.text;history.replaceState(null,"","/new"+location.search),ee.page="pick"}if(ee.page==="pick")return pa(document.getElementById("new-dialog")),M={kind:"source",source:{kind:"builtin",id:"template:blank"},text:Ua["template:blank"]},M.text;if(ee.page==="share")try{let e=await fn(ee.data);return M={kind:"share",data:ee.data,text:e},e}catch{return la("This link's deck is damaged or cut short, so it could not be opened.",6e3),si()}try{let e=await ed(ee.source);return M={kind:"source",source:ee.source,text:e},e}catch(e){return ea.textContent="Could not load the deck ("+e.message+")",la("Could not load "+Ee(ee.source)+": "+e.message,6e3),si()}}var U,pe,cr,Ge,_e,Ua,ie,N,se,zo,jn,Xs,ea,qo,Qs,Ue,Pa,Zs,St,Ro,le,Go,el,tl,al,ol,rl,nl,ta,u,v,et,m,dr,J,K,R,te,re,Pe,B,de,z,Qt,sl,Wn,Ke,_n,xe,be,De,Fe,Me,Ae,kl,Sl,Ml,fi,Fo,Al,Ne,qn,Rl,Dl,Fl,Gn,jl,za,Wl,ql,Gl,No,Je,Ho,Xe,He,oc,Ct,ue,ki,Be,Qe,Ce,Ra,jo,ft,Kn,dc,Jn,$n,Xn,Y,Kt,Xo,Va,Ya,Ka,gr,Zt,ne,Oe,Ze,yr,Li,h,oa,ra,hc,br,pc,Bi,fc,yc,vc,bt,Lt,At,Qo,yt,vt,me,Fa,he,Zo,wr,Da,Na,er,Xa,wc,Ri,it,Cc,Ni,tt,Qn,We,zc,Rc,qi,at,Gi,tr,sa,Vi,Yi,Ki,Ji,$i,H,Z,k,Yt,Ha,Xi,Zi,ja,Wo,Za,eo,os,wt,F,ao,is,$e,_o,Hc,I,ar,ei,ze,cs,fa,jc,uo,ot,ti,Rt,Wa,gt,Jt,rr,nr,$t,us,Te,Xt,_a,ms,Yc,ai,we,oi,kt,ri,Kc,sr,lr,ni,oo,ee,ii,M,P,ws=V(()=>{"use strict";Hr();jr();_r();qr();Vr();Kr();$r();Qr();va();sn();dn();So();Mo();bn();wn();On();Pn();Hn();Ma();U=window.SLIDETAKE||null;document.getElementById("deck-text")?.remove();pe=window.SLIDETAKE_LOCAL||null,cr=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!U);Ge=!U||U.recording===!0;document.documentElement.classList.toggle("no-record",!Ge);_e=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ua={home:yo,docs:Wr,features:Ur,privacy:Gr,showcase:Zr,"template:blank":Yr,"template:talk":Jr,"template:recording":Xr},ie=document.getElementById("editor"),N=document.getElementById("stage"),se=document.getElementById("world"),zo=document.getElementById("connectors"),jn=document.getElementById("breadcrumbs"),Xs=document.getElementById("status-count"),ea=document.getElementById("status-err"),qo=document.getElementById("mm-svg"),Qs=document.getElementById("mm-label"),Ue=document.getElementById("editor-pane"),Pa=540,Zs=96,St=440,Ro=720,le=960,Go=180,el=540,tl=100,al=110,ol=420,rl=.35,nl=1,ta=parseFloat(j("slidetake:slideSize"))||.92,u=new Map,v=[],et=[],m=null,dr=["focus","path","radial","tree"],J="path",K=!1,R={},te=!0,re=null,Pe=document.getElementById("brand"),B=document.getElementById("pip"),de=document.getElementById("stage-wrap"),z={x:0,y:0,zoom:.6},Qt=null;sl='<span class="st-name">'+cr+'Slide<span class="st-take">take</span></span>';Wn={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};Ke=null;_n=new URLSearchParams(location.search).get("mode");xe=0;be=null,De=-1,Fe=null;Me=document.getElementById("cam-overlay"),Ae="";new ResizeObserver(()=>{Ae&&Ko()}).observe(de);kl=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(" ")),Sl=0;Ml=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));fi=["dot","d2","echarts","svg"].map(e=>":scope > code.language-"+e).join(", "),Fo=e=>!!e.querySelector("img")&&!e.textContent.trim(),Al=e=>e.children.length===1&&(e.children[0].tagName==="PRE"&&!!e.children[0].querySelector(fi)||e.children[0].matches("div.diagram"));Ne=null;qn=null;Rl="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",Dl="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Fl={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"}};Gn=new Set;jl="https://esm.sh/@terrastruct/d2@0.1.33",za=null,Wl={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"}};ql=(e,t)=>e.replace("{","{"+t),Gl=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
1476
|
+
`+m+"ffmpeg -f concat -safe 0 -i /tmp/slidetake-cuts.txt -i /tmp/slidetake-chapters.txt"+f+" -c copy -movflags +faststart "+Ma(s)}let b=Ta(e),p=y=>(y/b).toFixed(6),T=y=>((y-.5)/b).toFixed(6),C=i.map(y=>"gte(t,"+T(y.f0)+")*lt(t,"+T(y.f1)+")").join("+"),w=i.map(y=>"gte(t,"+p(y.f0)+")*lt(t,"+p(y.f1)+")").join("+"),x=t==="mac"?"-c:v h264_videotoolbox -b:v 12M":"-c:v libx264 -crf 18 -preset medium";return m+"ffmpeg -i "+Ma(a)+" -i /tmp/slidetake-chapters.txt"+f+` -vf "select='`+C+`',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 "+Ma(s)}var Mn,Ta,Tn,mt,Zs,Ma,Ln,La=q(()=>{"use strict";xa();Mn=e=>e.obsT??e.t,Ta=e=>e.fps||60,Tn=(e,t)=>Math.round(e*t/1e3);mt=e=>String(e||"").split(/[\\/]/).pop()||"",Zs=e=>{let t=Math.max(String(e).lastIndexOf("/"),String(e).lastIndexOf("\\"));return t>=0?String(e).slice(0,t+1):""},Ma=e=>"'"+String(e).replace(/'/g,"'\\''")+"'",Ln=e=>(e/1e3).toFixed(3)});function el(e,t,a){let o=a?.5625:1.7777777777777777,r=Math.min(e,t*o),n=r/o;return{w:r,h:n,x:(e-r)/2,y:(t-n)/2}}function On(e,t,a,o){let r=el(e,t,o),n=[Math.floor(r.w*a),Math.floor(r.h*a)];return{quality:ft.find(i=>{let s=Ba(i,o);return n[0]>=s.w&&n[1]>=s.h})||null,device:n}}function Yt(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 be(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 ft,Aa,gt,Ba,tl,In,Io,Pn,Oa,zn,Rn,Dn=q(()=>{"use strict";La();ft=[{name:"1080p",w:1920,h:1080,bitrate:8e6},{name:"720p",w:1280,h:720,bitrate:5e6}],Aa=192e3,gt=30,Ba=(e,t)=>t?{...e,w:e.h,h:e.w}:e;tl=["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"],In=e=>tl.find(t=>e(t))||"",Io=e=>e.startsWith("video/mp4")?"mp4":"webm",Pn=e=>Math.round((e.bitrate+Aa)/8*60);Oa=(e,t)=>t>e?t:e+.001,zn=e=>e.replace(/\s*\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i,""),Rn=(e,t)=>Math.min(e,t)+"p"+(t>e?" portrait":"")});function al(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 Fn(e,t){let{shelf:a,highPass:o}=al(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 k=d[0].length;for(let m=0;m<t;m++){let f=d[m]||d[0],b=i[m],p=s(m),[T,C,w,x,y,E,L,$]=b,ae=l,X=Math.floor(ae/r),D=(X+1)*r,V=0;for(let de=0;de<k;de++){let oe=f[de];oe>c?c=oe:-oe>c&&(c=-oe);let Q=a.b0*oe+a.b1*T+a.b2*C-a.a1*w-a.a2*x;C=T,T=oe,x=w,w=Q;let Wt=o.b0*Q+o.b1*y+o.b2*E-o.a1*L-o.a2*$;E=y,y=Q,$=L,L=Wt,V+=Wt*Wt,++ae===D&&(n[X]=(n[X]||0)+p*V,V=0,X++,D+=r)}V&&(n[X]=(n[X]||0)+p*V),b.set([T,C,w,x,y,E,L,$])}l+=k},result(){let d=Math.floor(l/r),k=[];for(let p=3;p<d;p++)k.push(((n[p-3]||0)+(n[p-2]||0)+(n[p-1]||0)+(n[p]||0))/(4*r));let m=p=>p.reduce((T,C)=>T+C,0)/p.length,f=k.filter(p=>Ia(p)>-70),b=f.length?f.filter(p=>Ia(p)>Ia(m(f))-10):[];return{integrated:b.length?Ia(m(b)):-1/0,peak:c,peakDb:c>0?ol(c):-1/0}}}}function zo(e,{limit:t=!1,target:a=-14,ceiling:o=-1.5}={}){if(!isFinite(e.integrated))return 0;let r=Math.min(a-e.integrated,Po);return r<=0||t||e.peakDb==null||!isFinite(e.peakDb)?r:Math.max(0,Math.min(r,o-e.peakDb))}function Ro(e,t,a={}){let o=Pa(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,k=r,m=1,f=!1,b=0,p=0;c.fill(1);let T=C=>{for(;l.length&&l[l.length-1][1]>=C;)l.pop();for(l.push([d,C]);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),k+=m-c[d%r],c[d%r]=m,d>=r-1){let x=k/r,y=x>.999?1:x;s.push(y),y<.999&&!f&&b++,f=y<.999}d++};return{push(C){let w=C[0].length;for(let x=0;x<w;x++){let y=0;for(let E=0;E<t;E++){let L=(C[E]||C[0])[x];i[E].push(L),L>y?y=L:-L>y&&(y=-L)}T(y>o?o/y:1)}},ready:()=>s.length-p,take(C){let w=Array.from({length:t},()=>new Float32Array(C));for(let x=0;x<C;x++){let y=s[p+x];for(let E=0;E<t;E++)w[E][x]=i[E][p+x]*y}return p+=C,p>65536&&(s.splice(0,p),i.forEach(x=>x.splice(0,p)),p=0),w},end(){for(let C=0;C<r-1;C++){for(let w=0;w<t;w++)i[w].push(0);T(1)}},get events(){return b}}}var ol,Ia,Po,Pa,Nn=q(()=>{"use strict";ol=e=>20*Math.log10(e),Ia=e=>-.691+10*Math.log10(e);Po=20;Pa=e=>Math.pow(10,e/20)});function Hn(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 jn(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 Wn(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 be(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 za(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 _n(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 Ra(e,t){let a=new Set(t);return e.filter(o=>a.has(o))}function Un(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 qn=q(()=>{"use strict";La()});var dd={};function j(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 W(e,t){try{localStorage.setItem(e,t)}catch{}}function ul(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 fl(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,ml),o.replaceWith(...r.childNodes)})}function Ya(){let e=R.brand||"",t=R.logo||"",a=/^chip$/i.test(R.brand_style||""),o=/^slidetake$/i.test(e)?'<span class="st-mark">'+hr+'<span class="word">Slide<span>take</span></span></span>':(t?'<img alt="" src="'+A(t)+'">':"")+(e?"<span"+(a?' class="chip"':"")+">"+A(e)+"</span>":"");if(ze.dataset.html!==o){ze.dataset.html=o,ze.innerHTML=o;let n=ze.querySelector("img");n&&(n.onload=n.onerror=()=>fe(!0))}ze.hidden=!o;let r=document.body.classList.contains("portrait");document.body.classList.toggle("portrait",Ie()),r!==Ie()&&fe(!0),Pe(),document.title=R.title||"Slidetake",yl(),ui()}function gl(){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 yl(){let e="",t=(o,r)=>{let n=Object.entries(r||{}).filter(([i,s])=>Gn[i]&&s&&typeof s!="object").map(([i,s])=>Gn[i]+":"+String(s).replace(/[;{}<>]/g,"")).join(";");n&&(e+=o+"{"+n+`}
|
|
1477
|
+
`)};[gl(),U&&U.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 Le(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let a=getComputedStyle(t).color;return t.remove(),Je=Je||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),Je.clearRect(0,0,1,1),Je.fillStyle="#000",Je.fillStyle=a,Je.fillRect(0,0,1,1),"#"+[...Je.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function bl(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 so(){if(U&&U.themeKey&&!Yn){let t=j(U.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(Yn||j("slidetake:mode")||R.mode||"dark").toLowerCase()==="light"?"light":"dark"}function ui(){let e=so()==="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 mi(){let e=so()==="light"?"dark":"light";U&&U.themeKey?(W(U.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):W("slidetake:mode",e),ui(),se.querySelector(".echarts-container, .diagram.d2, .diagram.dot")&&At(!0)}function vl(){let t=(R.camera||"").replace(/^\[|\]$/g,"").split(",").map(a=>a.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function Ko(e){if(!e)return[];let t=un(e.camera);return!te||t.some(wl)?t:[]}function wl(e){return!!Ke({},e).behind}function Rt(e){return mn(Ko(e),e&&e.frags?e.frags.length:0)}function fi(){let e=Rt(u.get(g));return e[Math.min(ke,e.length-1)]||{cam:0,frag:0}}function xl(){if(!g)return null;let e=u.get(g),t=Ko(e);if(t.length)return t[Math.min(fi().cam,t.length-1)];if(e&&e.el&&e.el.classList.contains("card-full"))return"off";for(let a=v.indexOf(g)-1;a>=0;a--){let o=Ko(u.get(v[a]));if(o.length)return Ke({},o[o.length-1]).behind?null:o[o.length-1]}return null}function kl(){let e={corner:(R.pip||"none").toLowerCase(),size:So(parseFloat(R.pip_size)||(Ie()?40:24)),circle:(R.pip_shape||"").toLowerCase()==="circle",mirror:Hi(),full:!1,off:!1,flip:!1,used:!1,card:50};if(/^(behind|under)\b/.test(e.corner)){let t=e.corner;e.corner="bottom-right",Ke(e,t)}return Ke(e,xl()),ve&&!/\b(off|hide)\b/i.test(ve)&&(e.off=!1),Ke(e,ve),!Vt.includes(e.corner)&&(re||e.used)&&(e.corner="bottom-right"),e.flip&&Vt.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function Pe(){let e=!B.hidden&&B.offsetWidth?B.getBoundingClientRect():null,t=Ne=kl();t.behind&&(!g||ue)&&(t.full=!1,t.behind=!1);let a=Vt.includes(t.corner),o=te&&!!t.behind&&!t.off;B.className=a?[t.corner,t.circle&&"circle",re&&"live",t.mirror&&"mirror",t.full&&"full",t.behind&&"behind",o&&"empty",B.classList.contains("msg")&&"msg"].filter(Boolean).join(" "):"",B.style.width=t.full?"":t.size+"%",B.hidden=!a||t.off||te&&!o,ce.dataset.pip=B.hidden||t.full?"none":t.corner,ce.classList.toggle("cam-behind",!B.hidden&&!!t.behind),ce.style.setProperty("--cam-card",String((t.card||0)/100)),ce.classList.toggle("cam-card",(t.card||0)>0),ce.classList.toggle("cam-solid",(t.card||0)>=100),ce.classList.toggle("cam-live",!B.hidden&&!!t.behind&&!o);let r=!!Ae;if(Ie()&&/^(left|right)$/.test(t.place||"")&&(t.place="bottom"),Jo(!B.hidden&&t.behind&&t.place||""),Ae&&!r&&e&&!Ue&&Me.animate&&Me.animate([{opacity:0},{opacity:1}],{duration:300,delay:550,easing:"ease-out",fill:"backwards"}),B.hidden||Ue||!B.animate)return;let n="cubic-bezier(.65,0,.35,1)";if(!e){B.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let i=B.getBoundingClientRect();if(Math.abs(e.left-i.left)+Math.abs(e.top-i.top)+Math.abs(e.width-i.width)+Math.abs(e.height-i.height)<2)return;let s=Math.max(e.width/i.width,e.height/i.height),l=e.left+e.width/2-(i.left+i.width/2),c=e.top+e.height/2-(i.top+i.height/2),d=Math.max(0,(i.width-e.width/s)/2),k=Math.max(0,(i.height-e.height/s)/2),m=parseFloat(getComputedStyle(B).borderTopLeftRadius)||0;B.animate([{transformOrigin:"50% 50%",transform:"translate("+l+"px,"+c+"px) scale("+s+")",clipPath:"inset("+k+"px "+d+"px round "+10/s+"px)"},{transformOrigin:"50% 50%",transform:"none",clipPath:"inset(0px 0px round "+m+"px)"}],{duration:600,easing:n})}function Jo(e){let t=Ae,a=Me.querySelector(".cam-box"),o=a&&a.getBoundingClientRect();Ae=e,ce.dataset.place=e,Me.innerHTML="";let r=e&&u.get(g);if(!r||!r.el)return;let n=r.el.querySelector(".body"),i=[...n.children].map(k=>{let m=k.cloneNode(!0);return[m,...m.querySelectorAll("[style]")].forEach(f=>{f.style.removeProperty("opacity"),f.style.removeProperty("transform"),f.style.removeProperty("visibility")}),[m,...m.querySelectorAll("[data-text]")].forEach(f=>{f.dataset.text&&(f.textContent=f.dataset.text)}),m}),s=k=>k.matches("figure.media, .diagram, .echarts-container, .gallery"),l=[[e,i]],c=n.clientWidth;l.forEach(([k,m])=>{if(!m.length)return;let f=document.createElement("div");f.className="cam-box "+k;let b=(p,T)=>{if(!T.length)return;let C=document.createElement("div");C.className=p;let w=document.createElement("section");w.className="node";let x=document.createElement("div");x.className="body",T.forEach(y=>x.appendChild(y)),w.appendChild(x),p==="cam-media"&&(w.style.width=c+"px"),C.appendChild(w),f.appendChild(C)};b("cam-text",m.filter(p=>!s(p))),b("cam-media",m.filter(s)),Me.appendChild(f)}),Me.querySelectorAll("img").forEach(k=>{k.complete||k.addEventListener("load",$o,{once:!0})}),$o();let d=Me.querySelector(".cam-box");if(o&&t&&t!==e&&d&&!Ue&&d.animate){let k=d.getBoundingClientRect();Math.abs(o.width-k.width)<2&&Math.abs(o.height-k.height)<2&&d.animate([{transform:"translate("+(o.left-k.left)+"px,"+(o.top-k.top)+"px)"},{transform:"none"}],{duration:600,easing:"cubic-bezier(.65,0,.35,1)"})}}function $o(){let e=N.clientHeight/240;Me.querySelectorAll(".cam-media").forEach(t=>{let a=t.firstElementChild,o=Math.min(t.clientWidth/a.offsetWidth,t.clientHeight/a.offsetHeight,e*1.5);a.style.transform="translate(-50%, -50%) scale("+o+")"}),Me.querySelectorAll(".cam-text").forEach(t=>{let a=t.firstElementChild,o=t.clientWidth,r=t.clientHeight,n=.3,i=e;for(let s=0;s<12;s++){let l=(n+i)/2;a.style.width=o/l+"px",a.offsetHeight*l<=r?n=l:i=l}a.style.width=o/n+"px",a.style.transform="scale("+n+")"})}function Sl(){let e=Ne;if(!e||B.hidden||e.full)return null;let t=N.clientWidth,a=N.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 El(){if(!Ge)return;if(te){Ht(!0);return}let e=vl();Fe=(Fe+1)%e.length,ve=e[Fe],Pe(),K||Et("Camera: "+ve),!re&&!B.hidden?ct():fe()}function gi(e){let t=hn(e,{render:ul});R=t.deck,u=t.nodes,Ya();let a={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];rl.textContent=u.size+(u.size===1?" card":" cards")+" \xB7 "+a,aa.textContent=t.errCount?t.errCount+" card(s) had errors":""}function yi(){tt=[...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}}tt.forEach(o=>t(o,0)),v=[];function a(o){v.push(o),u.get(o).children.forEach(a)}return tt.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 bi(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 Ml(){let{maxH:e,maxDepth:t}=Cl(),a=[0];for(let l=1;l<=t;l++)a[l]=a[l-1]+e[l-1]+ll;let o=sl-Mt,r=[],n=(l,c)=>{let d=u.get(l);d.cx+=c,d.children.forEach(k=>n(k,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)}tt.forEach(s),u.forEach(l=>{l.cy=a[l.depth]+l._h/2,bi(l)})}function Tl(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?tt.length>1?dl*.5:0:i+cl;for(let d=0;d<400&&(l.forEach(m=>{let f=(m._slot+.5)*t-Math.PI/2;m.cx=c*Math.cos(f),m.cy=c*Math.sin(f),bi(m)}),!!l.some((m,f)=>l.some((b,p)=>p>f&&r(m,b))||o.some(b=>r(m,b))));d++)c=c*1.02+10;i=c,o.push(...l)}}function Ll(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(Ut(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 Ol(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"+ ++Bl+"-";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 De(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 Ho(e){let t=document.createElement("figure");t.className="media",De(e,t),t.appendChild(e);let a=e.getAttribute("alt");return a&&t.insertAdjacentHTML("beforeend","<figcaption>"+A(a)+"</figcaption>"),t}function Il(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="'+A(t||"YouTube video")+'" allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe></div>'+(t?"<figcaption>"+A(t)+"</figcaption>":""),a}function Kn(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 zl(e,t){t.querySelectorAll("pre > code.language-svg").forEach(n=>{let i=Ol(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",De(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&&Bo(s);l&&De(n,Il(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(n=>{let i=[...n.children];!i.length||!i.every(s=>jo(s)||Dl(s))||(n.classList.add("gallery"),i.some(s=>!jo(s))&&n.classList.add("diagrams"),i.forEach(s=>{if(!jo(s))return;let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),Ho(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)})):Kn(n,i.length))}),t.querySelectorAll(":scope > p").forEach(n=>{if(!Pl(n))return;let i=[...n.querySelectorAll("img")];if(i.length===1){De(n,i[0]),Ho(i[0]);return}let s=document.createElement("div");s.className="gallery grid",De(n,s),i.forEach(l=>{s.appendChild(l),Ho(l)}),Kn(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 vi(e,t){let a=e.querySelector("iframe");a&&a.contentWindow&&a.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function Rl(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 Fl(e){let t=r=>r.classList.contains("fragment")&&(r.tagName==="P"&&r.children.length===1&&r.children[0].tagName==="IMG"&&!r.textContent.trim()&&!Bo(r.children[0].getAttribute("src")||"")||r.tagName==="PRE"&&!!r.querySelector(wi)),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 Nl(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 ur(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&&vi(n,r<t?"playVideo":"pauseVideo")})),a&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function Hl(){try{return R.base?new URL(R.base,He||location.href):He?new URL(He):null}catch{return null}}function jl(e){let t=Hl(),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 lo(e){let t=e.el,a=t.querySelector(".body");t.classList.add("measuring"),a.style.zoom="";let o=Mt;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-Da*l>=260;if(r&&c)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(Da*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(Da*l),le-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",d+"px"),o=Math.min(le,Math.max(No,d*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(Mt,Math.min(le,(Da-il)*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=No);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(No,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||Yo,t.classList.remove("measuring")}function Wl(){clearTimeout(Jn),Jn=setTimeout(()=>{u.forEach(lo),ha(),fe(!0)},200)}function Vl(){let e=so()==="light"?"light":"dark",t=Le(e==="light"?"--accent-ring":"--accent"),a="slidetake-"+e+"-"+t.slice(1);return $n.has(a)||(Gl(a,ql[e],t),$n.add(a)),a}function Gl(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 Jl(){let e=so()==="light"?"light":"dark",t=Le("--node-bg"),a=Le(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],r={...Kl[e],N7:t,B1:Le("--accent")};return o.forEach((n,i)=>{r["B"+(i+2)]=bl(a,t,n)}),r}function $l(){let e=Le("--text"),t=Le("--text-muted"),a=Le("--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 Xo(e){return Wo[e]||(Wo[e]=new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete Wo[e],a(new Error("could not load "+e))},document.head.appendChild(o)}))}async function Zl(){let e=$e,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,De(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 Xo(_l),_o=_o||await Viz.instance(),e!==$e)return;let n=$l();t.forEach(i=>{let s=document.createElement("div");s.className="diagram dot";try{s.appendChild(_o.renderSVGElement(Xl(i.textContent,n)))}catch(l){s.className="diagram err",s.textContent="Diagram error: "+l.message}De(i.parentElement,s)})}catch{r.push("diagrams")}if(o.length)try{if(!Fa){let i=await import(Yl);Fa=new i.D2}if(e!==$e)return;let n=Jl();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await Fa.compile(Ql(i.textContent));s.innerHTML=await Fa.render(l.diagram,{...l.renderOptions||{},themeOverrides:n,darkThemeOverrides:n})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==$e)return;De(i.parentElement,s)}}catch{r.push("D2 diagrams")}if(a.length)try{if(await Xo(Ul),e!==$e)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}let l=echarts.init(i,n,{renderer:"svg"});l.on("finished",()=>{Ae&&i.closest(".node")===(u.get(g)||{}).el&&Jo(Ae)}),l.setOption(Object.assign({backgroundColor:"transparent",animation:!Ue},s))})}catch{r.push("charts")}e===$e&&(Ae&&Jo(Ae),r.length&&(aa.textContent="Could not load the "+r.join(" and ")+" renderer (offline?)"),u.forEach(lo),ha(),fe(!0))}function ec(){let e=[];return v.forEach(t=>{let a=zt(t),o=e[e.length-1];o&&o.sec===a?o.ids.push(t):e.push({sec:a,ids:[t]})}),e}function tc(){let a=0,o=0,r=0;ec().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,k)=>{let m=u.get(d);k&&(l+=90+m._w/2),m.cx=l,m.cy=a,c=l,l+=m._w/2}),o=c,r=s})}function ac(){u.forEach(e=>{e.cx=0,e.cy=0})}function xi(){$e++,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=yi(),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?co(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");Ll(n),Rl(n),Fl(n),zl(o,n),/^slidetake$/i.test(R.brand||"")&&fl(n),n.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=jl(n),a.frags=Nl(n),n.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",Wl,{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||_(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{h.active||_(a.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&_(a.id)}),se.appendChild(o),a.el=o,ur(a,a.frags.length)}),t&&!aa.textContent&&(aa.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),u.forEach(lo),ha(e),Zl()}function ha(e){e===void 0&&(e=yi()),J==="radial"?Tl(e):J==="path"?tc():J==="focus"?ac():Ml(),se.classList.toggle("focus",J==="focus"),u.forEach(t=>{let a=t.el.style;a.setProperty("--cx",t.cx),a.setProperty("--cy",t.cy)}),oc(),Dt(),gr()}function oc(){let e="";if(J==="focus"){Fo.innerHTML="";return}if(J==="path"){for(let t=1;t<v.length;t++){let a=u.get(v[t-1]),o=u.get(v[t]);e+='<path data-from="'+a.id+'" data-to="'+o.id+'" d="M '+a.cx+" "+a.cy+" L "+o.cx+" "+o.cy+'"/>'}Fo.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+'"/>'}}),Fo.innerHTML=e}function co(e){let t=[],a=e;for(;a;)t.unshift(a),a=u.get(a).parent;return t}function Tt(){let e=N.clientWidth,t=N.clientHeight;se.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+z.zoom+") translate("+-z.x+"px,"+-z.y+"px)",Bi()}function mr(){ea&&(ea.kill(),ea=null)}function ki(e,t){if(mr(),t||Ue||!window.gsap){Object.assign(z,e),Tt();return}let a=N.clientWidth,o=Math.hypot(e.x-z.x,e.y-z.y),r=e.zoom,n=gsap.timeline({onUpdate:Tt,onComplete:()=>{ea=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+Mt)));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);ea=n}function rc(){let e=N.getBoundingClientRect(),t=14,a=[];if(!ze.hidden&&ze.offsetWidth){let r=ze.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 nc(){let e=N.clientWidth,t=N.clientHeight,a=[{x0:16,y0:K?20:56,x1:e-16,y1:t-(K?20:74)}];return rc().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=N.clientWidth,r=N.clientHeight,n=null;return nc().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 Si(e,t,a,o){return{x:e-a.sx/o,y:t-a.sy/o}}function nt(e,t){let a=u.get(e);if(!a)return;let o=Qo(a._w,a._h,oa),r=zt(e),n=v.filter(l=>zt(l)===r&&!u.get(l).visual).map(l=>{let c=u.get(l);return Qo(c._w,c._h,oa).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));ki(Object.assign(Si(a.cx,a.cy,o,s),{zoom:s}),t)}function pa(e){let t=[...u.values()];if(!t.length)return;let a=N.clientWidth,o=N.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));ki(Object.assign(Si((r+n)/2,(i+s)/2,l,c),{zoom:c}),e)}function fe(e){g&&u.has(g)?nt(g,e):pa(e)}function Dt(){let e=g?co(g):[];u.forEach(t=>{let a=t.el;a.classList.toggle("current",t.id===g),a.classList.toggle("active-path",e.includes(t.id))}),se.querySelectorAll("#connectors path").forEach(t=>{let a=J==="path"?!!g&&v.indexOf(t.dataset.to)<=v.indexOf(g):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",a)}),cc(e),Ci()}function Ei(){return sn(new URLSearchParams(location.search).get("duration")??R.duration)}function ic(){return K&&Ei()>0&&(!h.active||/^always$/i.test(R.timer||""))}function Ka(){let e=ic()&&je.start>0;if(Qe.classList.toggle("timed",e),!e){Qe.classList.remove("over");return}let a=(h.active&&h.t0?Bt():performance.now()-je.start)/Ei();Qe.firstChild.style.width=Math.min(100,a*100)+"%",Qe.classList.toggle("over",a>=1)}function sc(){je.start=performance.now(),clearInterval(je.timer),je.timer=setInterval(Ka,1e3),Ka()}function lc(){clearInterval(je.timer),je.timer=null,je.start=0,Ka()}function Ci(){let e=K&&v.length>1&&!/^(off|no|false)$/i.test(R.progress||"");if(Qe.classList.toggle("show",e),!e)return;Ka();let t=v.indexOf(g),a=0,o=0;v.forEach((r,n)=>{let i=Rt(u.get(r)).length;a+=i,n<t?o+=i:n===t&&(o+=Math.min(ke,i-1)+1)}),Qe.lastChild.style.width=(a?o/a*100:0)+"%"}function cc(e){Vn.innerHTML=e.map((t,a)=>(a>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===g?" here":"")+'" data-id="'+A(t)+'">'+A(u.get(t).title)+"</button>").join(""),Vn.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{h.active||_(t.dataset.id)}))}function ua(e){let t=u.get(g);t&&(ur(t,fi().frag,e),Pe(),(B.hidden||!Ne||!Ne.full||Ne.behind)&&pc(t),fr(t))}function hc(e){return!v.length||e.id!==v[0]&&e.id!==v[v.length-1]||e.el.querySelector("[data-gsap], .title-scramble")?null:[...e.el.querySelector(".body").children].filter(t=>!t.classList.contains("fragment"))}function pc(e){if(e._played||!window.gsap||Ue)return;e._played=!0;let t=hc(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"),Xn(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(Xn)}function ra(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=>dc.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 Xn(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 fr(e){clearTimeout(Lt),!(!K||!e||!e.autoslide||h.active&&(!h.t0||h.paused))&&(Lt=setTimeout(()=>{g===e.id&&We(1)},e.autoslide))}function Mi(e){let t=e&&e!==v[0]?e:"";try{M&&M.kind==="share"?history.replaceState(null,"",location.pathname+location.search+Lo(M.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function _(e,t,a){if(!u.has(e))return;if(e!==g){ve=null,Fe=-1,ke=a?Rt(u.get(e)).length-1:0;let n=u.get(g);n&&J==="focus"&&!t&&(n.el.classList.add("leaving"),setTimeout(()=>n.el.classList.remove("leaving"),600)),Li()}let o=e!==g;if(o&&(Ti=g),g=e,clearTimeout(ue),ue=null,o&&J==="focus"&&!t&&!Ue){let n=u.get(e).el;n.classList.add("entering"),n.offsetWidth,n.classList.remove("entering")}ua(o),o&&!Be&&la("slide",e);let r=u.get(e);o&&r.mapFirst&&!a&&!t&&J!=="focus"?(pa(),ue=setTimeout(()=>{ue=null,g===e&&(Pe(),nt(e))},1900),Pe()):nt(e,t),Dt(),gr(),Mi(e)}function Li(){let e=u.get(g);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>vi(t,"pauseVideo")),ur(e,e.frags.length,!0),ra(e))}function uc(){if(!g&&Ze&&u.has(Ze)){Ai();return}g&&(Ze=g),J==="focus"&&yr("path"),Li(),clearTimeout(Lt),g=null,Pe(),Dt(),gr(),pa(),Mi(null)}function Ai(){if(ue)return clearTimeout(ue),ue=null,Pe(),nt(g),!0;if(!g&&Ze&&u.has(Ze)){let e=Ze;return Ze=null,_(e),!0}return!1}function We(e){if(!g){v.length&&_(v[e>0?0:v.length-1]);return}if(ue&&e>0){clearTimeout(ue),ue=null,Pe(),nt(g);return}let t=Rt(u.get(g)),a=Math.min(ke,t.length-1)+e;if(a>=0&&a<t.length){ke=a,ve=null,Fe=-1,ua(),!re&&!B.hidden&&Ne.used?ct():fe(),Dt();return}let o=v.indexOf(g)+e;o>=0&&o<v.length&&_(v[o],!1,e<0)}function mc(){let e=u.get(g);e&&e.parent&&_(e.parent)}function fc(){let e=u.get(g);e&&e.children.length?_(e.children[0]):!g&&v.length&&_(v[0])}function gr(){let e=[...u.values()];if(!e.length){Go.innerHTML="",Ce=null;return}nl.textContent="map";let t=p=>p.cx,a=p=>p.cy,o=Math.min(...e.map(t))-Mt/2,r=Math.max(...e.map(t))+Mt/2,n=Math.min(...e.map(a))-Yo/2,i=Math.max(...e.map(a))+Yo/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)),k=l/2-(o+r)/2*d,m=c/2+5-(n+i)/2*d,f=g?co(g):[],b="";e.forEach(p=>{if(!p.parent)return;let T=u.get(p.parent);b+='<line x1="'+(t(T)*d+k)+'" y1="'+(a(T)*d+m)+'" x2="'+(t(p)*d+k)+'" y2="'+(a(p)*d+m)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(p=>{let T=p.id===g?"var(--accent)":f.includes(p.id)?"var(--accent-teal)":"var(--node-border)";b+='<circle data-id="'+A(p.id)+'" cx="'+(t(p)*d+k)+'" cy="'+(a(p)*d+m)+'" r="'+(p.id===g?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"/>',Go.innerHTML=b,Ce={s:d,ox:k,oy:m},Bi()}function Bi(){let e=document.getElementById("mm-viewport");if(!e||!Ce)return;let t=N.clientWidth/z.zoom,a=N.clientHeight/z.zoom;e.setAttribute("x",(z.x-t/2)*Ce.s+Ce.ox),e.setAttribute("y",(z.y-a/2)*Ce.s+Ce.oy),e.setAttribute("width",Math.max(2,t*Ce.s)),e.setAttribute("height",Math.max(2,a*Ce.s))}function At(e){gi(ie.value),g&&!u.has(g)&&(g=null),xi(),g?_(g,e):v.length?_(v[0],e):(g=null,pa(!0))}function yr(e,t){J=e,W("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(a=>a.classList.toggle("active",a.dataset.mode===e)),u.size&&(!t&&!Ue&&(se.classList.add("morph"),setTimeout(()=>se.classList.remove("morph"),700)),ha(),Tt(),g?nt(g,t):pa(t))}function Oi(e){return Math.max(.04,Math.min(5,e))}function gc(e){oa=Math.round(Math.max(hl,Math.min(pl,e))*100)/100,W("slidetake:slideSize",oa),g&&nt(g)}function Qn(e){g?gc(oa+e*.1):Ii(e>0?1.2:1/1.2)}function Ii(e,t,a){mr();let o=Oi(z.zoom*e);if(t!==void 0){let r=N.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,Tt()}function ho(){U||(qe.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!qe.classList.contains("collapsed")))}function we(e){K=e,document.body.classList.toggle("presenting",e),ks(document.getElementById("btn-present"),e),Ss();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!g&&v.length&&_(v[0]);let a=R.camera||[...u.values()].some(o=>o.camera);e&&a&&!re&&!te&&ct(),e?fr(u.get(g)):clearTimeout(Lt),e?sc():lc(),Ci()}function Bt(){return(h.paused?h.pauseAt:performance.now())-h.t0-h.pausedMs}function ma(e){e.classList.add("open")}function wc(e){if(W("slidetake:analytics",e?"on":"off"),!e){window["ga-disable-"+bc]=!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}))}zi()}function zi(){wr.querySelectorAll("[data-analytics]").forEach(e=>e.setAttribute("aria-checked",String(e.dataset.analytics==="on"===vc())))}function fa(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function xc(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,a,...o]=e.split(":");return Ja.value=t||"localhost",$a.value=a||"4455",Xa.value=o.join(":"),!0}try{let t=JSON.parse(j("slidetake:obs")||"null");t&&(Ja.value=t.host||"localhost",$a.value=t.port||"4455",Xa.value=t.password||"",br.checked=!0)}catch{}return!1}function Di(){if(br.checked)W("slidetake:obs",JSON.stringify({host:Ja.value.trim(),port:$a.value.trim(),password:Xa.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function Kt(e,t,a){ta.textContent=e,ta.className=t||"",ta.title=a||e;let o=document.getElementById("obs-detail");o.textContent=a||"",o.hidden=!a}function Sc(e){return location.protocol==="https:"&&!kc(e)}async function xr(){let e=Ja.value.trim()||"localhost",t="ws://"+e+":"+($a.value.trim()||"4455");if(Sc(e)){Oe=!1,Kt("Blocked here","err",Ec);return}Kt("Connecting\u2026"),ta.title="Connecting to "+t;try{await Xo(yc);let a=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(ne)try{await ne.disconnect()}catch{}ne=new a,ne.on("ConnectionClosed",()=>{Oe=!1,Kt("Disconnected","err")}),ne.on("RecordStateChanged",r=>{r.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&et&&(et(),et=null),r.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&h.active&&h.withObs&&!h.finishing&&Pt("Stopped in OBS")});let o=await ne.connect(t,Xa.value||void 0);Oe=!0;try{let r=await ne.call("GetVideoSettings");r&&r.fpsNumerator&&r.fpsDenominator&&(vr=r.fpsNumerator/r.fpsDenominator),Pi=r&&r.outputWidth&&r.outputHeight?Rn(r.outputWidth,r.outputHeight):""}catch{}Kt("Connected","ok",""),ta.title="Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),Di(),Y.classList.contains("open")&&st()&&(O("Connected to OBS. Press \u25CF Record."),Ye())}catch(a){Oe=!1;let o=a&&a.message&&a.message!=="Error"?a.message+".":"Nothing answered at "+t+".";Kt("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(Ie()){e.innerHTML='<span class="warn">This deck is portrait (9:16). In OBS, set the canvas to 1080\xD71920 (Settings \u2192 Video) and fit the 9:16 column in the middle of the screen to it.</span>';return}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 Se(){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?In(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}=On(screen.width,screen.height,devicePixelRatio||1,Ie());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 po(){tr++,he&&(cancelAnimationFrame(he.raf),he.stream.getTracks().forEach(e=>e.stop()),he.ctx.close().catch(()=>{}),he=null,er.value=0,kt.getContext("2d").clearRect(0,0,kt.width,kt.height),Fi())}function Fi(){ar++,Wa&&(Wa.getTracks().forEach(e=>e.stop()),Wa=null),kr.srcObject=null}async function Ni(){Fi(),Sr();let e=ar,t=xt.value;if(Ha.hidden=t!=="none"&&!!t,Ha.textContent="No camera",!(!t||t==="none"))try{let a=await navigator.mediaDevices.getUserMedia({video:t==="default"?!0:{deviceId:{exact:t}}});if(e!==ar){a.getTracks().forEach(o=>o.stop());return}Wa=a,kr.srcObject=a}catch{Ha.hidden=!1,Ha.textContent="The camera isn\u2019t available"}}async function Qa(){await po();let e=tr;try{let t=Ot.value,a=await navigator.mediaDevices.getUserMedia({audio:es(t)});if(e!==tr){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=he={stream:a,ctx:o,raf:0},s=kt.getContext("2d"),l=kt.width,c=kt.height,d=Le("--accent"),k=()=>{if(he!==i)return;r.getFloatTimeDomainData(n);let m=0;for(let f of n)m=Math.max(m,Math.abs(f));er.value=Math.max(m,er.value*.85),s.clearRect(0,0,l,c),s.lineWidth=3,s.strokeStyle=d,s.lineJoin="round",s.beginPath();for(let f=0;f<n.length;f++){let b=f/(n.length-1)*l,p=c/2-Math.max(-1,Math.min(1,n[f]*3))*(c/2-4);f?s.lineTo(b,p):s.moveTo(b,p)}s.stroke(),i.raf=requestAnimationFrame(k)};k()}catch(t){vt.innerHTML='<span class="warn">The microphone isn\u2019t available: '+A(t.message||t.name)+". Allow it in the site settings.</span>"}}async function Za(e=!0){try{e&&!he&&await Qa();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"),k=b=>!!l&&(b.label===c||!!l.groupId&&b.groupId===l.groupId&&!d.some(p=>p!==b&&p.label===c)),m=d.map((b,p)=>zn(b.label)||(n==="audioinput"?"Microphone ":"Camera ")+(p+1));m.forEach((b,p)=>{let T=m.slice(0,p).filter(C=>C===b).length;T&&(m[p]=b+" "+(T+1))});let f=d.some(b=>b.deviceId===i)||i==="none"?i:(d.find(k)||d[0]||{}).deviceId;return d.map((b,p)=>'<option value="'+A(b.deviceId)+'"'+(b.deviceId===f?" selected":"")+">"+A(m[p]+(k(b)?" (system default)":""))+"</option>").join("")},o=Er();xt.innerHTML='<option value="none"'+(o==="none"?" selected":"")+">No camera</option>"+a("videoinput",o);let r=j("slidetake:mic")||"";Ot.innerHTML=a("audioinput",r),r&&Ot.value===r&&he&&he.stream.getAudioTracks()[0].getSettings().deviceId!==r&&Qa()}catch{}}function Hi(){let e=j("slidetake:mirror");return e?e==="on":/^(yes|true|on)$/i.test(R.pip_mirror||"")}function Sr(){eo.checked=Hi(),kr.parentElement.classList.toggle("mirror",eo.checked)}function Er(){let e=j(ji());return e||(Tc()?j("slidetake:cam")||"default":"none")}function Lc(e){W(ji(),e),e!=="none"&&e!=="default"&&W("slidetake:cam",e)}function Ac(){h.camWas=!te;let e=Er()!=="none";e!==!te&&Ht(e,!0)}function Wi(){h.camWas!=null&&(h.camWas!==!te&&Ht(h.camWas,!0),h.camWas=null)}async function _i(){let e=Se();if(!e.ok)return vt.innerHTML='<span class="warn">'+A(e.why)+"</span>",e;ja&&(vt.innerHTML='<span class="warn">'+A(ja)+"</span>",ja="");let t=ft.indexOf(e.quality),a=j("slidetake:quality");It.innerHTML=ft.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=ft.find(s=>s.name===It.value)||e.quality;o=" Room for about "+Math.floor((r-n)/Pn(i))+" minutes of takes."}catch{}return vt.querySelector(".warn")||(vt.innerHTML='<span class="ok">Ready: this screen records up to '+e.quality.name+" in fullscreen."+A(o)+"</span>"),e}function Bc(e){me=e,W("slidetake:rec-mode",e),sa({setup:Nt()})}function sa(e={}){Ge&&(Se().ok&&(me||"browser")==="browser"?Ir(e):Oc(e))}function Oc(e={}){let t=uo().find(a=>a.key===Ve()&&a.withObs&&!a.inBrowser);rs(t||{key:Ve(),deckTitle:R.title||(v[0]?u.get(v[0]).title:"Deck"),date:new Date().toISOString(),withObs:!0,outputPath:null,reason:"",total:0,totalObs:null,fps:vr,events:[],picks:{},empty:!0},e)}async function Cr(){if(!(!Ge||h.active||!v.length)){if(!Ic()){nr({note:"Set up once: after this, \u25CF Record (R) starts recording straight away."});return}if(Se().ok&&(me||"browser")==="browser"){let t=za(lt(),go()).filter(r=>!r.pick).map(r=>r.id),a=v.indexOf(g),o=t.length?t:a>0?v.slice(a):v;to("browser",o.length===v.length?null:o);return}if(!Oe&&j("slidetake:obs")&&await xr(),Oe){to("obs");return}nr({note:"Connect to OBS first: OBS \u2192 Connect."})}}async function Mr(e,t){return(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes",{create:!0})).getDirectoryHandle(e,{create:!!t})}async function Tr(e){try{await(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes")).removeEntry(e,{recursive:!0})}catch{}}function qi(){if(!document.body.classList.contains("rec-frame"))return;let e=devicePixelRatio||1,t=Ie()?9/16:16/9,a=wt.clientWidth,o=wt.clientHeight,r=s=>Math.floor(s*e/2)*2/e,n=r(Math.min(o,a/t)),i=r(n*t);i>a&&(i=r(a),n=r(i/t)),Object.assign(ce.style,{width:i+"px",height:n+"px",aspectRatio:"auto",margin:Math.floor((o-n)/2)+"px 0 0 "+Math.floor((a-i)/2)+"px"})}function Lr(e){document.body.classList.toggle("rec-frame",e),e?qi():["width","height","aspectRatio","margin"].forEach(t=>ce.style.removeProperty(t.replace(/[A-Z]/g,a=>"-"+a.toLowerCase())))}async function Vi(e){window.RestrictionTarget&&e.restrictTo?await e.restrictTo(await RestrictionTarget.fromElement(ce)):await e.cropTo(await CropTarget.fromElement(ce))}function Pc(e,{w:t,h:a}){let o=document.createElement("video");o.muted=!0,o.playsInline=!0,o.srcObject=new MediaStream([e]);let r=document.createElement("canvas");r.width=t,r.height=a;let n=r.getContext("2d",{alpha:!1}),i=!0,s=()=>{if(!i)return;let c=o.videoWidth,d=o.videoHeight;if(c&&d){let k=Math.max(t/c,a/d),m=c*k,f=d*k;n.drawImage(o,(t-m)/2,(a-f)/2,m,f)}o.requestVideoFrameCallback(s)};o.requestVideoFrameCallback(s),o.play().catch(()=>{});let l=r.captureStream(gt).getVideoTracks()[0];return{track:l,stop(){i=!1,l.stop(),o.srcObject=null}}}async function zc(e){try{window.RestrictionTarget&&e.track.restrictTo?await e.track.restrictTo(null):await e.track.cropTo(null),await Vi(e.track)}catch{}e.scaled||await e.track.applyConstraints(Ui(e.quality)).catch(t=>console.warn("Slidetake: the recording size was refused",t)),await ia()}async function Rc(){let e=Se();if(!e.ok)throw new Error(e.why);let t=ft.find(l=>l.name===It.value)||e.quality;Lr(!0);let a=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:gt},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),o=a.getVideoTracks()[0],r=()=>a.getTracks().forEach(l=>l.stop());if(!o.restrictTo&&!o.cropTo)throw r(),new Error("Share \u201Cthis tab\u201D to record the slides.");try{await Vi(o)}catch(l){throw r(),new Error("Chrome could not record just the slides ("+(l.message||l.name)+").")}let n=Ie()?Pc(o,Ba(t,!0)):null;n||await o.applyConstraints(Ui(t)).catch(l=>console.warn("Slidetake: the recording size was refused",l));let i;try{let l=j("slidetake:mic");i=await navigator.mediaDevices.getUserMedia({audio:es(l)})}catch(l){throw r(),new Error("The microphone isn\u2019t available ("+(l.message||l.name)+").")}let s=new Date().toISOString().replace(/[:.]/g,"-");h.browser={id:s,display:a,mic:i,track:o,quality:t,type:e.type,scaled:n,stream:new MediaStream([n?n.track:o,...i.getAudioTracks()]),dir:await Mr(s,!0),clips:[],cur:null,chain:Promise.resolve(),error:null},o.addEventListener("ended",()=>{h.active&&!h.finishing&&Pt("Sharing stopped")})}function Gi(){let e=h.browser;e&&(e.display.getTracks().forEach(t=>t.stop()),e.mic.getTracks().forEach(t=>t.stop()),e.scaled&&e.scaled.stop(),Lr(!1))}function Dc(e){let t=h.browser,a="take-"+t.clips.length+"."+Io(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:Aa}),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(Bt()),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 to(e,t){if(h.active||!v.length)return;let a=e==="obs";if(po(),me||(me=a?"obs":"browser",W("slidetake:rec-mode",me)),e==="browser"){K||we(!0);try{await Rc()}catch(l){Lr(!1),K&&we(!1),ja=l.name==="NotAllowedError"?"Recording needs this tab shared: press \u25CF Record again and choose Share.":l.message,Ir({setup:!0});return}}fa();let o=t&&t.length?t.filter(l=>v.includes(l)):null,r=o?o[0]:v[0],n=v[v.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"),zr(),K||we(!0),Ac(),n?(document.body.classList.add("no-anim"),u.get(n)._played=!0,Be=!0,_(n,!0,!0),Be=!1,B.getAnimations().forEach(l=>l.finish()),await ia(),document.body.classList.remove("no-anim")):(g===r&&(ke=0,ve=null,Fe=-1),_(r,!0)),!document.fullscreenElement&&document.documentElement.requestFullscreen&&await document.documentElement.requestFullscreen().catch(()=>{});let i=$t.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",$t.querySelector(".num").textContent=l,$t.classList.add("show"),await na(1e3),!h.active)return;if($t.classList.remove("show"),await ia(),a){let l=new Promise(c=>{et=c,setTimeout(()=>{et&&(et(),et=null)},2500)});try{await ne.call("StartRecord")}catch(c){Ar("OBS could not start recording: "+(c&&c.message||c));return}if(await l,!h.active)return}h.browser&&await zc(h.browser),h.counting=!1,h.t0=performance.now();let s=u.get(r);if(n){la("slide",r),h.browser&&await h.browser.chain,ra(s),Be=!0,_(r),Be=!1;return}ra(s),ua(!0),la("slide",g)}function Ar(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(()=>Tr(t.id)),Gi(),h.browser=null}$t.classList.remove("show"),document.body.classList.remove("recording"),K&&we(!1),Wi(),Et(e)}function la(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(Bt()),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&&Dc(r),h.withObs&&Oe&&(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 Fc(e){let t=e.key;if((ei.includes(t)||ti.includes(t)||ai.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){h.counting?Ar("Take cancelled"):Pt("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||at)){if(ai.includes(t)){Wc();return}h.paused||(ei.includes(t)?Nc():ti.includes(t)&&Hc())}}function Nc(){let e=Rt(u.get(g)),t=Math.min(ke,e.length-1)>=e.length-1,a=v.indexOf(g);if(!t){We(1);return}if(!h.only){a===v.length-1?Pt():We(1);return}let o=v.slice(a+1).find(r=>h.only.has(r));o?v[a+1]===o?We(1):Yi(v[v.indexOf(o)-1],o,"slide"):Pt()}async function Hc(){let e=u.get(g);if(!e||at)return;let t=g,a=Ti;if(!a||a===t||!u.has(a)){jc(e);return}Yi(a,t,"retake")}async function Yi(e,t,a){let o=u.get(t);if(!o||at)return;at=!0;let r=Bt();document.body.classList.add("no-anim");let n=u.get(e);Be=!0,n._played=!0,_(e,!0,!0),B.getAnimations().forEach(i=>i.finish()),Be=!1,await ia(),document.body.classList.remove("no-anim"),la(a,t,r),h.browser&&await h.browser.chain,h.withObs&&await Ki(),ra(o),Be=!0,_(t),Be=!1,!re&&!B.hidden&&Ne.used&&ct(),at=!1}async function Ki(){let e=h.events[h.events.length-1];e&&(e.skip=oi/2),await na(oi)}async function jc(e){at=!0,ke=0,ve=null,Fe=-1,ra(e),ua(!0),!re&&!B.hidden&&Ne.used?ct():fe(),Dt(),la("retake",g),h.withObs&&await Ki(),at=!1}async function Wc(){if(h.t0)if(h.paused){if(Zo.classList.remove("show"),await ia(),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,fr(u.get(g))}else{if(h.paused=!0,h.pauseAt=performance.now(),clearTimeout(Lt),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()})}Zo.classList.add("show")}}async function Pt(e){if(!h.active||h.finishing)return;if(h.counting){Ar("Take cancelled");return}h.finishing=!0,clearTimeout(Lt),h.paused&&(h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,Zo.classList.remove("show"));let t=Math.round(Bt()),a=null;if(h.withObs){try{let n=await ne.call("GetRecordStatus");n&&typeof n.outputDuration=="number"&&(a=n.outputDuration)}catch{}await na(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 na(600),await o.chain,t=Math.round(Bt()),o.cur&&o.cur.rec&&o.cur.rec.state!=="inactive"&&o.cur.rec.stop(),await Promise.all(o.clips.map(n=>n.done)),Gi(),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&&we(!1),Wi();let r={key:Ve(),deckTitle:R.title||u.get(v[0]).title,date:new Date().toISOString(),withObs:h.withObs,outputPath:h.outputPath,reason:e||"",total:t,totalObs:a,fps:o?gt:vr,...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){Jc(r);return}Br(r),rs(r,{note:(e?e+". ":"")+be(r).size+" slides recorded with OBS."})}function Ve(){return pt(R.title||(v[0]?u.get(v[0]).title:"deck"))}function uo(){try{return JSON.parse(j("slidetake:sessions")||"[]")}catch{return[]}}function Br(e){let t=uo().filter(a=>a.date!==e.date);t.unshift(e),t.slice(12).forEach(a=>{a.takesId&&Tr(a.takesId)}),W("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function zt(e){let t=u.has(e)?co(e):[e];return t[Math.min(1,t.length-1)]}function Ji(e,t){let a=zt(e);return{sec:a,title:u.has(a)?u.get(a).title:t}}function O(e,{warn:t=!1,html:a="",title:o=""}={}){Jt.classList.toggle("warn",t),a?Jt.innerHTML=a:Jt.textContent=e,Jt.title=o||Jt.textContent;let r=document.getElementById("rv-save-again");r&&(r.onclick=()=>us(!0))}function rs(e,t={}){fa(),H=e,Z=null;let a=e.events.filter(i=>i.retake).length,o=e.empty?"":be(e).size+" slides, "+(a?a+" retake"+(a>1?"s":""):"no retakes")+", recorded "+ut(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?" ("+mt(e.outputPath)+")":"";let n=Ta(e);ao.value=[...ao.options].reduce((i,s)=>Math.abs(s.value-n)<Math.abs(i.value-n)?s:i).value,S.src&&(e.inBrowser||_e!==mt(e.outputPath)&&e.outputPath)&&(S.removeAttribute("src"),S.load(),_e=""),document.getElementById("rv-novideo").hidden=!!S.src||!!e.empty,Z=null,F=null,Ft(),mo(),ma(Y),t.setup?yo(t):(bo(),Za(!1).then(Ye)),O(t.note||(e.empty?Oe?"Press \u25CF Record: OBS records the deck.":"Connect to OBS in Setup, then press \u25CF Record.":o+(S.src?"Click a take to preview it.":"Open the recording to preview it."))),e.empty||ed(e)}function mo(){if(H&&H.board){it();return}let e=H,t=document.getElementById("rv-list"),a=null;t.innerHTML=[...be(e).values()].map(o=>{let r=e.picks[o.id]??o.takes.length,n=zt(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 "+ut(l.end-l.start)+"</button>").join("");return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+A(o.title)+"<small>"+wa(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,Br(e),mo();let r=be(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&&fo([{clip:s.clip,keep:(n.end-n.start)/1e3,title:i}])}else ro([{start:n.start,end:n.end,title:i}])}),document.getElementById("rv-ffmpeg-copy").disabled=document.getElementById("rv-play-final").disabled=!e.events.length,is(e),ls(e)}function is(e){let t=_c(e),a=document.getElementById("rv-chapters");ns=t.lines.join(`
|
|
1478
|
+
`),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 ss(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 ls(e){let t=document.getElementById("rv-final"),a=++Uo,o=Gt(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 ")+ut(o);if(!e.inBrowser||e.cleaned){t.textContent=r(null);return}try{let n=0;for(let i of Yt(e))Ua.has(i.clip)||Ua.set(i.clip,(await ga(i.clip)).size),n+=Ua.get(i.clip);a===Uo&&(t.textContent=r(n))}catch{a===Uo&&(t.textContent=r(null))}}function ro(e){if(!S.src){oo=e,O(sr?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.");return}oo=null,Z={ranges:e,i:0},O("\u25B6 "+e[0].title);let t=()=>{S.currentTime=e[0].start/1e3,S.play().catch(a=>{a&&a.name!=="AbortError"&&O("Could not play: "+a.message,{warn:!0})})};S.readyState>=1?t():S.addEventListener("loadedmetadata",t,{once:!0})}function Ft(){St=null}function Or(){let e=F&&!F.single&&!S.paused;cs.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 qc(e){let t=H?Yt(H):[],a=t.findIndex(r=>r.id===e.id),o=a>=0?t[a+1]:null;St=o?o.id:null,O(o?"Preview continues from "+o.title+".":"That was the last slide: Preview plays from the start.")}function ds(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 ga(e){let[t,a]=e.split("/");return(await(await Mr(t)).getFileHandle(a)).getFile()}async function fo(e,t=0,a=!1){if(!(!H||H.cleaned||!e.length)){Z=null,F={parts:e,i:t,single:a};try{let o=await ga(e[t].clip);if(!Y.classList.contains("open"))return;S.src&&URL.revokeObjectURL(S.src),S.src=URL.createObjectURL(o),O("\u25B6 "+e[t].title),await S.play()}catch(o){if(o&&o.name==="AbortError")return;F=null,O(o&&o.name==="NotFoundError"?"This take is no longer in the browser.":"Could not play this take: "+(o&&o.message||o),{warn:!0})}}}function hs(){let e=F;if(e.i+1<e.parts.length){fo(e.parts,e.i+1,e.single);return}F=null,S.pause(),e.single?qc(e.parts[0]):O(""),Or()}async function Vc(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 us(e){let t=H;if(!t||!t.inBrowser||t.cleaned)return;let a=Yt(t);if(!a.length){O("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)]),ot(),ca(),t.type]),r=t.board&&I.lastDownload;if(!e&&r&&r.sig===o&&await Vc(r)){O("",{html:'<button class="btn small" id="rv-save-again">Save another copy</button> Already saved in '+A(qo(r))+".",title:"Already saved in "+qo(r)+". A new video is made only when a take or the sound settings change."});return}let n=Io(t.type||"")==="mp4",i=Ve()+" "+Yc(new Date)+"."+(n?"mp4":"webm"),s=null,l="";try{let d=await ms(!1);d&&(s=await(await d.getFileHandle(i,{create:!0})).createWritable(),l=d.name)}catch(d){if(d&&d.name==="AbortError")return}let c=no;c.disabled=!0,Xe("Preparing\u2026");try{let d=await import(Mc),k=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:k}),f=1,b="",p=ot()&&ca();if(ot()){let D=await ri(d,a,1,!1,"Measuring");if(D&&isFinite(D.integrated)){let V=zo(D,{limit:p});if(p&&Math.abs(V)>=.05){let Q=await ri(d,a,Pa(V),!0,"Checking");Q&&isFinite(Q.integrated)&&(V=Math.min(V+(-14-Q.integrated),Po))}f=Pa(V);let de=p?-14:D.integrated+V,oe=!p&&zo(D,{limit:!0})-V>.5;b=" \xB7 loudness "+D.integrated.toFixed(1)+(Math.abs(V)<.05?" LUFS, left as is":" \u2192 "+de.toFixed(1)+" LUFS")+(oe?"; a loud peak held it back, turn on Peak limiter to reach "+-14:"")}}let T=f!==1||p;await Gc(d,a);let C=null,w=null,x=0,y=-1,E=-1,L=null,$=[],ae=async()=>{for(;$.length&&L.ready()>=$[0].n;){let D=$.shift(),V=L.take(D.n),de=new Float32Array(D.n*D.ch);V.forEach((oe,Q)=>de.set(oe,Q*D.n)),await w.add(new d.AudioSample({data:de,format:"f32-planar",numberOfChannels:D.ch,sampleRate:D.rate,timestamp:D.t}))}};for(let[D,V]of a.entries()){Xe("Joining "+(D+1)+"/"+a.length);let de=new d.Input({source:new d.BlobSource(await ga(V.clip)),formats:d.ALL_FORMATS}),oe=await de.getPrimaryVideoTrack(),Q=await de.getPrimaryAudioTrack();if(!oe)throw new Error(V.title+" has no video");C||(C=new d.EncodedVideoPacketSource(await oe.getCodec()),m.addVideoTrack(C,{frameRate:gt}),Q&&(w=T?new d.AudioSampleSource({codec:n?"aac":"opus",bitrate:Aa}):new d.EncodedAudioPacketSource(await Q.getCodec()),m.addAudioTrack(w)),await m.start());let Wt={decoderConfig:await oe.getDecoderConfig()},dt=0,Nr=!0;for await(let G of new d.EncodedPacketSink(oe).packets())G.timestamp>=V.keep||(y=Oa(y,x+G.timestamp),await C.add(G.clone({timestamp:y}),Nr&&D===0?Wt:void 0),Nr=!1,dt=Math.max(dt,G.timestamp+G.duration));if(Q&&w&&T)for await(let G of new d.AudioSampleSink(Q).samples(0,dt)){if(G.timestamp+G.duration>dt+1e-4){G.close();continue}E=Oa(E,x+G.timestamp);let ge=ds(G);if(ge.forEach(ye=>{for(let ht=0;ht<ye.length;ht++)ye[ht]*=f}),p)L=L||Ro(G.sampleRate,ge.length),L.push(ge),$.push({t:E,n:G.numberOfFrames,rate:G.sampleRate,ch:ge.length}),G.close(),await ae();else{let ye=G.numberOfFrames,ht=new Float32Array(ye*ge.length);ge.forEach((As,Bs)=>ht.set(As,Bs*ye)),await w.add(new d.AudioSample({data:ht,format:"f32-planar",numberOfChannels:ge.length,sampleRate:G.sampleRate,timestamp:E})),G.close()}}else if(Q&&w){let G={decoderConfig:await Q.getDecoderConfig()},ge=!0;for await(let ye of new d.EncodedPacketSink(Q).packets())ye.timestamp+ye.duration>dt+1e-4||(E=Oa(E,x+ye.timestamp),await w.add(ye.clone({timestamp:E}),ge&&D===0?G:void 0),ge=!1)}x+=dt}if(L&&(L.end(),await ae(),L.events&&(b+=", "+L.events+" peak"+(L.events===1?"":"s")+" limited")),Xe("Finishing\u2026"),await m.finalize(),!s){let D=document.createElement("a");D.href=URL.createObjectURL(new Blob([k.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&&(I.lastDownload=X,ya()),O("Saved in "+qo(X)+" ("+ut(x*1e3)+b+")."),Xe("\u2713 Saved"),ps=setTimeout(()=>Xe(),2500)}catch(d){Xe(),O("Could not save the video: "+(d&&d.message||d),{warn:!0}),s&&s.abort().catch(()=>{})}finally{c.disabled=!!t.cleaned}}async function ri(e,t,a,o,r){let n=null,i=null;for(let[s,l]of t.entries()){Xe(r+" "+(s+1)+"/"+t.length);let c=await new e.Input({source:new e.BlobSource(await ga(l.clip)),formats:e.ALL_FORMATS}).getPrimaryAudioTrack();if(c)for await(let d of new e.AudioSampleSink(c).samples(0,l.keep)){let k=ds(d);n=n||Fn(d.sampleRate,k.length),a!==1&&o?(k.forEach(m=>{for(let f=0;f<m.length;f++)m[f]*=a}),i=i||Ro(d.sampleRate,k.length),i.push(k),i.ready()&&n.add(i.take(i.ready()))):n.add(k),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 ga(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 ms(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"}),bs("video-folder",t),t}function lt(){let e=fs();if(I&&rr===e)return I;rr=e;try{I=JSON.parse(j(e)||"null")}catch{I=null}return(!I||!Array.isArray(I.takes))&&(I={takes:[],picks:{},type:"",quality:""}),I}function Jc(e){lt();let t=Wn(e,e.takesId,go());t.forEach(a=>{delete I.picks[a.id]}),I.takes.push(...t),Object.assign(I,{type:e.type,quality:e.quality}),ya(),Re.clear(),Ir({note:(e.reason?e.reason+". ":"")+t.length+" new take"+(t.length===1?"":"s")+" on the board."})}function gs(){let e=za(lt(),go()),t=Object.assign(_n(e),{board:!0,inBrowser:!0,withObs:!1,type:I.type||"video/mp4",quality:I.quality||"",deckTitle:R.title||(v[0]?u.get(v[0]).title:"Deck"),date:new Date().toISOString()});return{rows:e,sess:t}}function yo(e={}){Y.classList.add("setup-view"),ii.textContent=e.note||"",ii.hidden=!e.note,rt.textContent="\u2190 Back",rt.title="Back to Studio",rt.setAttribute("aria-expanded","true"),$c()}function bo(){let e=Nt();e&&Y.classList.remove("setup-view"),rt.textContent="\u2699 Setup",rt.title="Settings: camera, microphone, video, OBS and files",rt.setAttribute("aria-expanded","false"),e&&(po(),Ye())}function nr(e={}){Y.classList.contains("open")?yo(e):sa({...e,setup:!0})}function $c(){let e=()=>{Ye(),Nt()&&Ni()};if(st()){Cc(),Za(!1).then(e);return}vt.innerHTML="",_i().then(t=>{t.ok?Za().then(e):e()})}function Ye(){let e=i=>{let s=i.selectedOptions[0];return s?s.textContent.replace(/ \(system default\)$/,""):""},t=e(xt)||(Er()==="none"?"No camera":"Camera"),a=st(),o=a?Pi:Se().ok?It.value:"",r=a?[t]:[t,e(Ot)||"Microphone"],n=document.getElementById("rv-using");n.textContent=r.join(" \xB7 "),n.title="Recording with "+r.join(" \xB7 "),document.getElementById("rv-size").textContent=o||"",bt.classList.toggle("on",a),bt.setAttribute("aria-pressed",String(a)),bt.disabled=!Se().ok,bt.title=bt.disabled?qa+" records only with OBS: pro mode":a?"Pro mode: recording with OBS. Click for easy mode, in "+qa:"Easy mode: recording in "+qa+". Click for pro mode, with OBS"}function Ir(e={}){Ge&&(fa(),lt(),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,S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),Z=null,F=null,Ft(),_a=-1,it(),ma(Y),e.setup||!Se().ok?yo(e):(bo(),_i().then(()=>Za(!1)).then(Ye)),O(e.note||os()||(I.takes.length?Xc()+". Click a take to preview it.":v.length+" slides, nothing recorded yet. Press \u25CF Record.")))}function Xc(){let e=za(lt(),go()),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 it(){let{rows:e,sess:t}=gs();H=t;let a=document.getElementById("rv-list"),o=null;a.innerHTML=e.map(i=>{let s=zt(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"},k=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 "+ut(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":"")+(Re.has(i.id)?" selected":"")+'" data-id="'+c+'"><input type="checkbox" class="rv-sel" data-id="'+c+'"'+(Re.has(i.id)?" checked":"")+' aria-label="Select '+A(i.title)+' to record"><div><div class="t">'+A(i.title)+'</div><div class="rv-chips">'+k+"</div></div></div>"}).join(""),a.querySelectorAll(".rv-chip").forEach(i=>i.onclick=()=>{I.picks[i.dataset.id]=i.dataset.uid,ya(),it();let s=e.find(c=>c.id===i.dataset.id),l=s&&s.takes.find(c=>c.uid===i.dataset.uid);l&&fo([{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?Un(v,ni,i.dataset.id):[i.dataset.id]).forEach(c=>{i.checked?Re.add(c):Re.delete(c)}),Ft(),ni=i.dataset.id,it()}));let r=Ra(v,Re),n=Se().ok;document.getElementById("rv-rec").disabled=!n,_a>=0&&r.length!==_a&&O(os()||"Record takes the whole deck."),_a=r.length,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-play-final").disabled=!t.events.length,is(t),ls(t)}async function Qc(e){for(let a of e)try{let[o,r]=a.clip.split("/");await(await Mr(o)).removeEntry(r)}catch{}let t=new Set(e.map(a=>a.uid));I.takes=I.takes.filter(a=>!t.has(a.uid)),Object.keys(I.picks).forEach(a=>{t.has(I.picks[a])&&delete I.picks[a]}),ya(),S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),F=null,Ft(),it()}function ys(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 ys(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 bs(e,t){try{(await ys()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function vo(e){sr=!0;try{return await Zc(e)}finally{sr=!1}}async function Zc(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 ba(e,t,a){S.src&&URL.revokeObjectURL(S.src),Xt=t||null,a||(ir=0),S.src=URL.createObjectURL(e),_e=e.name,document.getElementById("rv-novideo").hidden=!0,O("Loaded "+e.name+". Click a take to preview it."),oo?ro(oo):a&&Z&&ro(Z.ranges.slice(Z.i))}async function ed(e){let t=mt(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(_e===t&&S.src))try{let a=await Pr("obs-folder");if(!a||await a.queryPermission({mode:"read"})!=="granted")return;let o=await a.getFileHandle(t);O("Opening "+t+"\u2026"),ba(await vo(o),o)}catch{}}function Et(e,t){if(!h.active){if(clearTimeout(Va),!B.hidden&&!B.classList.contains("live")){Zt.classList.remove("show"),ws.textContent=e,B.classList.add("msg"),t||(Va=setTimeout(xs,9e3));return}Zt.textContent=e,Zt.classList.add("show"),t||(Va=setTimeout(()=>Zt.classList.remove("show"),9e3))}}function xs(){ws.textContent="PIP camera",B.classList.remove("msg")}function zr(){clearTimeout(Va),Zt.classList.remove("show"),xs()}function Vo(){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 Rr(){re&&re.getTracks().forEach(t=>t.stop()),re=null;let e=B.querySelector("video");e&&e.remove()}async function ct(){if(!(re||te)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){Et("Camera not available on this page."+Vo(),!0);return}if(Te.disabled)return;Te.disabled=!0,Et("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{let t=j("slidetake:cam");re=await navigator.mediaDevices.getUserMedia({video:{...t?{deviceId:{ideal:t}}:{},width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),zr()}catch(t){let a=t&&t.name;Et(a==="NotAllowedError"||a==="SecurityError"?"Camera access was blocked."+Vo():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+")":"")+"."+Vo(),!0);return}finally{Te.disabled=!1,Dr()}re.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{Rr(),Ya(),fe()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=re,B.appendChild(e)}Ya(),fe()}}function ks(e,t){e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))}function Dr(){Te.querySelector("svg")||(Te.innerHTML=td+'<span class="lbl"> <u class="key">C</u>amera</span>'),Te.classList.toggle("on",!te),Te.setAttribute("aria-pressed",String(!te)),Te.title=te?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function Ht(e,t){e&&!Ge||(te=!e,t||W("slidetake:camera",e?"on":"off"),te&&(Rr(),zr()),ve=null,Fe=-1,ke=Math.min(ke,Math.max(0,Rt(u.get(g)).length-1)),Dr(),Ya(),ua(),Dt(),fe(),!K&&!t&&Et(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&ct())}function Ss(){document.body.classList.remove("idle"),clearTimeout(si),K&&(si=setTimeout(()=>document.body.classList.add("idle"),2e3))}function da(e,t){Ct.textContent=e,Ct.classList.add("show"),clearTimeout(ci),ci=setTimeout(()=>Ct.classList.remove("show"),t||2500)}function lr(e,{keepObs:t=!0,keepEdit:a=!0,slide:o=""}={}){let r=new URL(yn(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 od(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(M.kind==="source")return{link:lr(M.source,t),inside:!1};if(M.kind==="copy"&&Ca(P)&&["url","gist","builtin"].includes(P.origin.kind))return{link:lr(P.origin,t),inside:!1};let o=M.kind==="share"?M.data:await vn(ie.value),r=new URLSearchParams(location.search);return["src","obs","edit"].forEach(n=>r.delete(n)),{link:location.origin+"/share"+(r.toString()?"?"+r:"")+Lo(o,e),inside:!0}}function rd(){let e=j("slidetake:draft");if(!e||e===wo)return null;let t=Sa(e,{kind:"file",name:"your earlier draft"},{exported:!0});W("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function va(){W("slidetake:copy",JSON.stringify(P))}function jt(){if(U)return;let e;if(Fr())e='<span class="mine">'+A(pe.file)+'</span> <span class="ro">\xB7 on this computer, saved as you type</span>';else if(M.kind==="copy")e='<span class="mine">Your copy of '+A(Ee(P.origin))+"</span>"+(Ea(P)?' <span class="edited">\xB7 edited</span>':"");else{let a=M.kind==="share"?"a shared deck":Ee(M.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,qe.classList.toggle("unsaved",M.kind==="copy"&&Ea(P)),document.getElementById("btn-reset").hidden=!(M.kind==="copy"&&!Ca(P));let t=document.getElementById("continue");t.hidden=M.kind==="copy"||!P,P&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+Ee(P.origin))}function Es(e){return!P||!Ea(P)?!0:confirm("Your copy of "+Ee(P.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function Cs(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function nd(){let e=M.kind==="share"?{kind:"shared"}:M.source;return Es("a copy of "+Ee(e))?(P=Sa(M.text,e),M={kind:"copy"},history.pushState(null,"",Cs()+(g&&g!==v[0]?"#"+encodeURIComponent(g):"")),da("Editing your own copy of "+Ee(e)+". The original is unchanged.",4e3),!0):(ie.value=M.text,!1)}function id(){M={kind:"copy"},history.pushState(null,"",Cs()),qe.classList.contains("collapsed")&&ho(),ie.value=P.text,At(!0),jt()}function Fr(){return!!(pe&&M&&M.kind==="source"&&M.source.kind==="url"&&new URL(M.source.url,location.href).pathname===pe.deck)}function sd(e){fetch(pe.save,{method:"PUT",body:e}).catch(()=>da("Could not save "+pe.file+": is npx slidetake still running?",6e3))}async function ld(e){if(e.kind==="builtin")return Ga[e.id==="help"?"docs":e.id]??Ga.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 He=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 He=new URL(e.url,location.href).href,await t.text()}function pi(){return M={kind:"source",source:{kind:"builtin",id:"home"},text:Ga.home},M.text}async function cd(){if(pe&&ee.page==="source"&&ee.source.kind==="builtin"&&ee.source.id==="home"&&location.pathname==="/"&&(ee.source={kind:"url",url:pe.deck}),U)return He=U.base||location.href,M={kind:"source",source:{kind:"url",url:He},text:dn(U.settings||{})+String(U.markdown||"")},M.text;if(ee.page==="edit"){if(P)return M={kind:"copy"},P.text;history.replaceState(null,"","/new"+location.search),ee.page="pick"}if(ee.page==="pick")return ma(document.getElementById("new-dialog")),M={kind:"source",source:{kind:"builtin",id:"template:blank"},text:Ga["template:blank"]},M.text;if(ee.page==="share")try{let e=await wn(ee.data);return M={kind:"share",data:ee.data,text:e},e}catch{return da("This link's deck is damaged or cut short, so it could not be opened.",6e3),pi()}try{let e=await ld(ee.source);return M={kind:"source",source:ee.source,text:e},e}catch(e){return aa.textContent="Could not load the deck ("+e.message+")",da("Could not load "+Ee(ee.source)+": "+e.message,6e3),pi()}}var U,pe,hr,Ge,Ue,Ga,ie,N,se,Fo,Vn,rl,aa,Go,nl,qe,Da,il,Mt,No,le,Yo,sl,ll,cl,dl,hl,pl,oa,u,v,tt,g,pr,J,K,R,te,re,ze,B,ce,z,ea,ml,Ie,Gn,Je,Yn,ke,ve,Fe,Ne,Me,Ae,Al,Bl,Pl,wi,jo,Dl,He,Jn,_l,Ul,ql,$n,Yl,Fa,Kl,Xl,Ql,Wo,$e,_o,Qe,je,dc,Lt,ue,Ti,Be,Ze,Ce,Na,wt,yt,Zn,yc,ei,ti,ai,Y,$t,Zo,Ja,$a,Xa,br,ta,ne,Oe,et,vr,Pi,h,na,ia,bc,wr,vc,Ri,kc,Ec,Mc,xt,Ot,It,er,vt,kt,me,ja,he,tr,kr,Ha,Wa,ar,eo,Tc,ji,st,Ic,Ui,at,oi,_e,_c,Uc,$i,ot,Xi,or,ca,Qi,Zi,es,ts,as,H,Z,S,Jt,_a,os,ns,Ua,Uo,ao,oo,cs,St,F,no,ps,Xe,qo,Yc,I,rr,ni,Re,fs,ya,Kc,go,rt,ii,Nt,qa,bt,Xt,ir,sr,Qt,vs,Te,Zt,Va,ws,td,si,xe,li,Ct,ci,ad,cr,dr,di,io,ee,hi,M,P,Ms=q(()=>{"use strict";_r();Ur();Vr();Yr();Jr();Xr();Zr();tn();on();xa();pn();fn();Mo();Ao();Sn();Cn();Dn();Nn();qn();La();U=window.SLIDETAKE||null;document.getElementById("deck-text")?.remove();pe=window.SLIDETAKE_LOCAL||null,hr=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!U);Ge=!U||U.recording===!0;document.documentElement.classList.toggle("no-record",!Ge);Ue=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ga={home:wo,docs:qr,features:Gr,privacy:Kr,showcase:rn,"template:blank":$r,"template:talk":Qr,"template:recording":en,"template:short":an},ie=document.getElementById("editor"),N=document.getElementById("stage"),se=document.getElementById("world"),Fo=document.getElementById("connectors"),Vn=document.getElementById("breadcrumbs"),rl=document.getElementById("status-count"),aa=document.getElementById("status-err"),Go=document.getElementById("mm-svg"),nl=document.getElementById("mm-label"),qe=document.getElementById("editor-pane"),Da=540,il=96,Mt=440,No=720,le=960,Yo=180,sl=540,ll=100,cl=110,dl=420,hl=.35,pl=1,oa=parseFloat(j("slidetake:slideSize"))||.92,u=new Map,v=[],tt=[],g=null,pr=["focus","path","radial","tree"],J="path",K=!1,R={},te=!0,re=null,ze=document.getElementById("brand"),B=document.getElementById("pip"),ce=document.getElementById("stage-wrap"),z={x:0,y:0,zoom:.6},ea=null;ml='<span class="st-name">'+hr+'Slide<span class="st-take">take</span></span>';Ie=()=>/^(portrait|vertical|9:16)$/i.test(String(R.format||"").trim());Gn={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};Je=null;Yn=new URLSearchParams(location.search).get("mode");ke=0;ve=null,Fe=-1,Ne=null;Me=document.getElementById("cam-overlay"),Ae="";new ResizeObserver(()=>{Ae&&$o()}).observe(ce);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(" ")),Bl=0;Pl=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));wi=["dot","d2","echarts","svg"].map(e=>":scope > code.language-"+e).join(", "),jo=e=>!!e.querySelector("img")&&!e.textContent.trim(),Dl=e=>e.children.length===1&&(e.children[0].tagName==="PRE"&&!!e.children[0].querySelector(wi)||e.children[0].matches("div.diagram"));He=null;Jn=null;_l="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",Ul="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",ql={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"}};$n=new Set;Yl="https://esm.sh/@terrastruct/d2@0.1.33",Fa=null,Kl={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"}};Xl=(e,t)=>e.replace("{","{"+t),Ql=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
1417
1479
|
d2-config: {
|
|
1418
1480
|
layout-engine: elk
|
|
1419
1481
|
}
|
|
1420
1482
|
}
|
|
1421
|
-
`+e,
|
|
1422
|
-
`+t.html):""},uo=()=>Rn(v,e=>({title:u.get(e).title,fp:jc(e)}));ot=document.getElementById("rv-setup-btn"),ti=document.getElementById("setup-note"),Rt=()=>Y.classList.contains("setup-view");new MutationObserver(()=>{Y.classList.contains("open")||fo()}).observe(Y,{attributes:!0,attributeFilter:["class"]});ot.onclick=()=>{Rt()?fo():mo()};document.getElementById("setup-record").onclick=()=>{ua(),me||(me=it()?"obs":"browser",W("slidetake:rec-mode",me)),Sr()};Y.addEventListener("click",e=>{(e.target===Y||e.target.closest("[data-close]"))&&lo()});Wa=(()=>{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=Wa});document.getElementById("rv-rec").onclick=()=>{if(!it()){Qa("browser",Ia(v,ze));return}if(Oe){Qa("obs");return}or({note:"Connect to OBS first: OBS \u2192 Connect."})};gt=document.getElementById("rv-pro");gt.onclick=()=>{Se().ok&&Sc(it()?"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}=ds(),t=new Set(e.map(o=>o.pick).filter(Boolean)),a=I.takes.filter(o=>!t.has(o.uid));if(!a.length){O("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 qc(a),O("Purged "+a.length+" unused take"+(a.length===1?"":"s")+"."))};document.getElementById("rv-clean").onclick=async()=>{if(!I.takes.length||!confirm("Purge all "+I.takes.length+" takes of this deck from this browser? Download the video first if you need it."))return;let e=new Set(I.takes.map(t=>t.clip.split("/")[0]));I.takes=[],I.picks={},fa();for(let t of e)await Cr(t);k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,zt(),O("All takes purged."),nt()};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){O("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{}}),W("slidetake:sessions",JSON.stringify(co().map(s=>s.inBrowser?{...s,cleaned:!0}:s))),I=null,ar="",st(),ja.clear(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,zt(),nt(),O("Purged "+i+" of takes from every deck.")}};Jt=null,rr=0,nr=!1;k.addEventListener("error",async()=>{if(k.getAttribute("src")){if(Jt&&rr<5){rr++,O("Reloading "+We+" (OBS was still finishing it)\u2026"),await new Promise(e=>setTimeout(e,1500));try{ga(await go(Jt),Jt,!0);return}catch{}}O(Jt?"Chrome cannot play "+We+". 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 "+(We||"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})}});$t=document.getElementById("rv-file-input");$t.addEventListener("change",()=>{$t.files[0]&&ga($t.files[0]),$t.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return $t.click();try{let[e]=await window.showOpenFilePicker({id:"obs-recordings",types:[{description:"Recordings",accept:{"video/*":[".mov",".mp4",".m4v",".mkv",".webm"]}}]});O("Opening "+e.name+"\u2026"),ga(await go(e),e)}catch(e){(!e||e.name!=="AbortError")&&O("Could not open that file.",{warn:!0})}};us=document.getElementById("rv-folder");window.showDirectoryPicker||(us.style.display="none");us.onclick=async()=>{let e=H&&ut(H.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(ps("obs-folder",t),!e){O("Folder remembered. This session has no file name from OBS; open the file instead.");return}let a=await t.getFileHandle(e);ga(await go(a),a)}catch{}};mc()&&new URLSearchParams(location.search).get("obs")&&vr();Te=document.getElementById("btn-camera"),Xt=document.getElementById("pip-msg"),_a=null,ms=B.querySelector("span");Yc='<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>';Te.onclick=()=>Dt(te);Pr();ai=null;window.addEventListener("pointermove",ys);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(h.active?Bt("Stopped: the browser left fullscreen"):K&&ve(!1))});we=document.getElementById("help");new MutationObserver(()=>gs(document.getElementById("btn-keys"),we.classList.contains("open"))).observe(we,{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=()=>we.classList.add("open");document.getElementById("help-close").onclick=()=>we.classList.remove("open");we.addEventListener("click",e=>{e.target===we&&we.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),h.active||na();return}if(h.active){Ac(e);return}if(document.querySelector(".modal.open")){let o=Y.classList.contains("open")&&Rt();if(e.key==="Escape")ua();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"?it()?"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(we.classList.contains("open")){/^(Escape|k|K|\?|\/)$/.test(e.key)&&we.classList.remove("open");return}let a=e.key;a==="ArrowRight"||a===" "||a==="PageDown"?(e.preventDefault(),je(1)):a==="ArrowLeft"||a==="PageUp"?(e.preventDefault(),je(-1)):a==="ArrowDown"?(e.preventDefault(),lc()):a==="ArrowUp"?(e.preventDefault(),sc()):a==="Home"?v.length&&_(v[0]):a==="End"?v.length&&_(v[v.length-1]):a==="o"||a==="O"?ic():a==="e"||a==="E"?so():a==="f"||a==="F"||a==="p"||a==="P"?ve(!K):a==="r"||a==="R"?Sr():a==="s"||a==="S"?na():/^[1-4]$/.test(a)?fr(dr[+a-1]):a==="c"||a==="C"?Dt(te):a==="v"||a==="V"?yl():a==="l"||a==="L"?ci():a==="+"||a==="="?Yn(1):a==="-"||a==="_"?Yn(-1):a==="?"||a==="/"||a==="k"||a==="K"?we.classList.add("open"):a==="Escape"&&!Ei()&&K&&ve(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=wa(location.hash);if(e&&!(M&&M.kind==="share"&&e===M.data)){location.reload();return}t&&t!==m&&u.has(t)&&_(t)});oi="";new ResizeObserver(()=>{let e=N.clientWidth+"x"+N.clientHeight;e!==oi&&(oi=e,Et(),ke(!0))}).observe(N);kt=document.createElement("div");kt.id="toast";kt.setAttribute("role","status");document.body.appendChild(kt);ri=null;Kc=document.getElementById("open-dialog"),sr=document.getElementById("open-url"),lr=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{lr.hidden=!0,pa(Kc),sr.focus(),sr.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=hn(sr.value);if(!t){lr.textContent="That doesn't look like a link.",lr.hidden=!1;return}location.href=ir(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await Jc(m&&m!==v[0]?m:""),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),la(a,5e3)}catch{prompt("Copy this link:",e)}M.kind==="copy"&&(P.exported=P.text,ya(),Ft())};ni=j("slidetake:layout");J=dr.includes(ni)?ni:"path";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J));oo=new URLSearchParams(location.search);dr.includes(oo.get("layout"))&&(J=oo.get("layout"),document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J)));if(U){let e=(Array.isArray(U.trail)?U.trail:U.back?[U.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=cr+'<span class="word">Slide<span>take</span></span>';let o=document.querySelector("header .hdr-actions");o.insertBefore(a,o.firstChild),Ge||(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=gn(location.pathname,location.search,location.hash),ii=ee.page==="pick"?"":ee.slide,M=null,P=yn(j("slidetake:copy"))||$c();window.addEventListener("popstate",()=>location.reload());pe&&window.EventSource&&(new EventSource(pe.events).onmessage=async e=>{if(!zr())return;let t=(JSON.parse(e.data).file||"").replace(/\\/g,"/");if(t===pe.file){let a=await(await fetch(pe.deck,{cache:"no-store"})).text();if(a===ie.value)return;ie.value=M.text=a,Mt(!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)})});(oo.get("edit")==="1"||ee.page==="edit"&&P&&oo.get("edit")!=="0")&&so();td().then(e=>(ie.value=e,Ft(),hi(ie.value),gi(),document.fonts?document.fonts.ready:null)).then(()=>{u.forEach(no),ca(),_(u.has(ii)?ii:v[0],!0),Ge&&j("slidetake:camera")==="on"&&Dt(!0,!0)})});var Dr=` /* Every colour comes from these tokens. Slidetake's own is seafoam green: bright on zinc in dark mode,
|
|
1483
|
+
`+e,Wo={};$e=0,_o=null;Qe=document.getElementById("progress");Qe.innerHTML="<b></b><i></i>";je={start:0,timer:null};dc=["x","y","xPercent","yPercent","scale","scaleX","scaleY","rotation","rotate","skewX","skewY"];Lt=null;ue=null,Ti=null,Be=!1;Ze=null;Ce=null;Go.addEventListener("click",e=>{let t=e.target.closest("circle");t&&!h.active&&_(t.dataset.id)});Na=null;ie.addEventListener("input",()=>{if(Fr()){M.text=ie.value,clearTimeout(Na),Na=setTimeout(()=>{sd(ie.value),At(!0)},300);return}M.kind!=="copy"&&!nd()||(P.text=ie.value,jt(),clearTimeout(Na),Na=setTimeout(()=>{va(),At(!0)},300))});document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>{e.addEventListener("click",()=>{e.dataset.mode!==J&&yr(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};N.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,mr(),N.classList.add("dragging")),a&&(e.size===2&&o?z.zoom=Oi(o.zoom*r()/o.d):(z.x-=l/z.zoom,z.y-=c/z.zoom),Tt())});let n=i=>{e.delete(i.pointerId),e.size<2&&(o=null),e.size||N.classList.remove("dragging")};window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),N.addEventListener("click",i=>{a&&(i.stopPropagation(),i.preventDefault(),a=!1)},!0)})();N.addEventListener("wheel",e=>{e.preventDefault(),!h.active&&Ii(Math.exp(-e.deltaY*(e.ctrlKey?.01:.0015)),e.clientX,e.clientY)},{passive:!1});document.getElementById("nav-prev").onclick=()=>We(-1);document.getElementById("nav-next").onclick=()=>We(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=()=>{Es("a copy of "+t.name)&&(P=Sa(String(a.result),{kind:"file",name:t.name},{exported:!0}),va(),He=null,g=null,id())},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=(tt[0]?pt(u.get(tt[0]).title):"deck")+".md",t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3),M.kind==="copy"&&(P.exported=P.text,va(),jt())};document.getElementById("btn-reset").onclick=()=>{M.kind!=="copy"||Ca(P)||confirm("Discard your edits and go back to "+Ee(P.origin)+" as it was?")&&(P.text=P.originText,va(),ie.value=P.text,g=null,At(!0),jt())};document.getElementById("btn-edit-toggle").onclick=ho;wt=document.querySelector("main"),yt=document.getElementById("editor-resizer"),Zn=parseFloat(j("slidetake:editorWidth"));Zn&&qe.style.setProperty("--editor-w",Zn+"px");yt.addEventListener("pointerdown",e=>{e.preventDefault(),yt.setPointerCapture(e.pointerId),wt.classList.add("resizing");let t=wt.getBoundingClientRect().right,a=r=>{let n=Math.round(Math.max(280,Math.min(window.innerWidth*.75,t-r.clientX)));qe.style.setProperty("--editor-w",n+"px")},o=()=>{wt.classList.remove("resizing"),yt.removeEventListener("pointermove",a),W("slidetake:editorWidth",String(qe.getBoundingClientRect().width))};yt.addEventListener("pointermove",a),yt.addEventListener("pointerup",o,{once:!0})});yt.addEventListener("dblclick",()=>{qe.style.removeProperty("--editor-w");try{localStorage.removeItem("slidetake:editorWidth")}catch{}});document.getElementById("btn-mode").onclick=mi;document.getElementById("btn-present").onclick=()=>we(!K);yc="https://cdn.jsdelivr.net/npm/obs-websocket-js@5.0.5/dist/obs-ws.min.js",ei=["ArrowRight","PageDown"," ","ArrowDown","Enter"],ti=["ArrowLeft","PageUp","ArrowUp","r","R"],ai=["b","B","."],Y=document.getElementById("review"),$t=document.getElementById("rec-countdown"),Zo=document.getElementById("rec-paused"),Ja=document.getElementById("obs-host"),$a=document.getElementById("obs-port"),Xa=document.getElementById("obs-pass"),br=document.getElementById("obs-remember"),ta=document.getElementById("obs-status"),ne=null,Oe=!1,et=null,vr=null,Pi="",h={active:!1,withObs:!1,counting:!1,paused:!1,finishing:!1,t0:0,pauseAt:0,pausedMs:0,events:[],outputPath:null,browser:null},na=e=>new Promise(t=>setTimeout(t,e)),ia=()=>Promise.race([new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),na(100)]);bc="G-3S9FY4MQLS",wr=document.getElementById("analytics-dialog"),vc=()=>j("slidetake:analytics")!=="off";wr.querySelectorAll("[data-analytics]").forEach(e=>e.onclick=()=>wc(e.dataset.analytics==="on"));Ri=document.getElementById("btn-analytics");Ri.hidden=!/^(www\.)?slidetake\.com$/.test(location.hostname);Ri.onclick=()=>{zi(),ma(wr)};document.querySelectorAll(".modal").forEach(e=>{e.addEventListener("click",t=>{(t.target===e||t.target.closest("[data-close]"))&&e.classList.remove("open")})});kc=e=>/^(localhost|127(\.\d+){3}|\[?::1\]?)$/i.test(e);Ec="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=xr;br.addEventListener("change",Di);Mc="https://cdn.jsdelivr.net/npm/mediabunny@1.64.0/+esm",xt=document.getElementById("rec-cam"),Ot=document.getElementById("rec-mic"),It=document.getElementById("rec-quality"),er=document.getElementById("rec-meter"),vt=document.getElementById("rec-browser-check"),kt=document.getElementById("rec-wave"),me=j("slidetake:rec-mode")||"",ja="",he=null;tr=0;kr=document.getElementById("rec-cam-preview"),Ha=document.getElementById("rec-cam-none"),Wa=null,ar=0;Ot.onchange=()=>{W("slidetake:mic",Ot.value),Qa(),Ye()};eo=document.getElementById("rec-mirror");eo.onchange=()=>{W("slidetake:mirror",eo.checked?"on":"off"),Sr(),Pe()};Sr();xt.onchange=()=>{Lc(xt.value),xt.value!=="none"&&re&&(Rr(),ct()),Nt()&&Ni(),Ye()};Tc=()=>(R.pip||"none").toLowerCase()!=="none"||!!R.camera||[...u.values()].some(e=>e.camera),ji=()=>"slidetake:rec-cam:"+Ve();It.onchange=()=>{W("slidetake:quality",It.value),Ye()};st=()=>!(Se().ok&&(me||"browser")==="browser");document.getElementById("btn-studio").onclick=()=>sa();Ic=()=>!!me||lt().takes.length>0||uo().some(e=>e.key===Ve());document.getElementById("btn-record").onclick=()=>Cr();Ui=e=>{let t=Ba(e,Ie());return{width:t.w,height:t.h,aspectRatio:t.w/t.h,frameRate:gt,resizeMode:"crop-and-scale"}};new ResizeObserver(qi).observe(wt);at=!1;oi=600;_e="";_c=e=>An(e,Ji),Uc=(e,t)=>Bn(e,t,{input:e.outputPath||_e||"recording.mov",outputName:Ve()+"-final.mp4",sectionOf:Ji,loudness:ot()}),$i=document.querySelectorAll(".rv-loud"),ot=()=>j("slidetake:loudness")!=="off",Xi=()=>$i.forEach(e=>{e.setAttribute("aria-pressed",String(ot())),e.classList.toggle("on",ot())}),or=document.getElementById("rv-limiter"),ca=()=>j("slidetake:limiter")==="on",Qi=()=>{or.setAttribute("aria-pressed",String(ca())),or.classList.toggle("on",ca())};Qi();or.onclick=()=>{W("slidetake:limiter",ca()?"off":"on"),Qi()};Zi=()=>j("slidetake:mic-sound")==="raw"?"raw":"voice",es=e=>({...e?{deviceId:{ideal:e}}:{},echoCancellation:!1,autoGainControl:!1,noiseSuppression:Zi()==="voice"}),ts=document.querySelectorAll("[data-sound]"),as=()=>ts.forEach(e=>{let t=e.dataset.sound===Zi();e.classList.toggle("active",t),e.setAttribute("aria-checked",String(t))});as();ts.forEach(e=>e.onclick=()=>{W("slidetake:mic-sound",e.dataset.sound),as(),he&&Qa()});Xi();$i.forEach(e=>e.onclick=()=>{W("slidetake:loudness",ot()?"off":"on"),Xi(),H&&mo()});H=null,Z=null,S=document.getElementById("rv-video"),Jt=document.getElementById("rv-now");_a=-1,os=()=>{let e=Ra(v,Re).length;return e?e+"/"+v.length+" slide"+(e===1?"":"s")+" up for a take":""};ns="";document.getElementById("rv-chapters").onclick=e=>ss(e.currentTarget,ns);document.getElementById("rv-ffmpeg-copy").onclick=e=>{!H||!H.events.length||(ss(e.currentTarget,Uc(H,document.getElementById("rv-mode").value)),O("Copied the ffmpeg command: run it in a terminal, in the folder with "+(mt(H.outputPath)||"the recording")+"."))};Ua=new Map,Uo=0;ao=document.getElementById("rv-fps");ao.onchange=()=>{H&&(H.fps=parseFloat(ao.value),Br(H),mo())};oo=null;S.addEventListener("timeupdate",()=>{if(!Z)return;let e=Z.ranges[Z.i];if(S.currentTime*1e3<e.end)return;if(Z.i++,Z.i>=Z.ranges.length){S.pause(),Z=null,O("");return}let t=Z.ranges[Z.i];S.currentTime=t.start/1e3,O("\u25B6 "+t.title)});cs=document.getElementById("rv-play-final"),St=null;cs.onclick=()=>{if(!H)return;if(!H.inBrowser){ro(Gt(H).map(a=>({start:a.start,end:a.end,title:a.title})));return}if(F&&!F.single){S.paused?S.play().catch(()=>{}):S.pause();return}let e=Yt(H),t=Math.max(0,St?e.findIndex(a=>a.id===St):0);St=null,fo(e.slice(t))};S.addEventListener("play",Or);S.addEventListener("pause",()=>{F&&F.single&&S.currentTime<F.parts[0].keep-.05&&(St=F.parts[0].id,O("Preview starts from "+F.parts[0].title.replace(/ · take \d+$/,"")+".")),Or()});F=null;S.addEventListener("timeupdate",()=>{F&&S.currentTime>=F.parts[F.i].keep&&hs()});S.addEventListener("ended",()=>{F&&hs()});no=document.getElementById("rv-render-btn");no.onclick=()=>us(!1);ps=0,Xe=e=>{clearTimeout(ps),e?no.textContent=e:no.innerHTML='\u2193 <span><u class="key">D</u>ownload</span>'},qo=e=>e.where?"\u201C"+e.where+"\u201D as "+e.name:"your downloads as "+e.name;Yc=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 ms(!0);e&&O("Videos now go to "+e.name+".")}catch{}};I=null,rr="",ni=null,Re=new Set,fs=()=>"slidetake:board:"+Ve();ya=()=>W(fs(),JSON.stringify(I)),Kc=e=>{let t=u.get(e);return t?Hn(t.title+`
|
|
1484
|
+
`+t.html):""},go=()=>jn(v,e=>({title:u.get(e).title,fp:Kc(e)}));rt=document.getElementById("rv-setup-btn"),ii=document.getElementById("setup-note"),Nt=()=>Y.classList.contains("setup-view");new MutationObserver(()=>{Y.classList.contains("open")||bo()}).observe(Y,{attributes:!0,attributeFilter:["class"]});rt.onclick=()=>{Nt()?bo():yo()};document.getElementById("setup-record").onclick=()=>{fa(),me||(me=st()?"obs":"browser",W("slidetake:rec-mode",me)),Cr()};Y.addEventListener("click",e=>{(e.target===Y||e.target.closest("[data-close]"))&&po()});qa=(()=>{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=qa});document.getElementById("rv-rec").onclick=()=>{if(!st()){to("browser",Ra(v,Re));return}if(Oe){to("obs");return}nr({note:"Connect to OBS first: OBS \u2192 Connect."})};bt=document.getElementById("rv-pro");bt.onclick=()=>{Se().ok&&Bc(st()?"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}=gs(),t=new Set(e.map(o=>o.pick).filter(Boolean)),a=I.takes.filter(o=>!t.has(o.uid));if(!a.length){O("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 Qc(a),O("Purged "+a.length+" unused take"+(a.length===1?"":"s")+"."))};document.getElementById("rv-clean").onclick=async()=>{if(!I.takes.length||!confirm("Purge all "+I.takes.length+" takes of this deck from this browser? Download the video first if you need it."))return;let e=new Set(I.takes.map(t=>t.clip.split("/")[0]));I.takes=[],I.picks={},ya();for(let t of e)await Tr(t);S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),F=null,Ft(),O("All takes purged."),it()};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){O("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{}}),W("slidetake:sessions",JSON.stringify(uo().map(s=>s.inBrowser?{...s,cleaned:!0}:s))),I=null,rr="",lt(),Ua.clear(),S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),F=null,Ft(),it(),O("Purged "+i+" of takes from every deck.")}};Xt=null,ir=0,sr=!1;S.addEventListener("error",async()=>{if(S.getAttribute("src")){if(Xt&&ir<5){ir++,O("Reloading "+_e+" (OBS was still finishing it)\u2026"),await new Promise(e=>setTimeout(e,1500));try{ba(await vo(Xt),Xt,!0);return}catch{}}O(Xt?"Chrome cannot play "+_e+". 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 "+(_e||"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})}});Qt=document.getElementById("rv-file-input");Qt.addEventListener("change",()=>{Qt.files[0]&&ba(Qt.files[0]),Qt.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return Qt.click();try{let[e]=await window.showOpenFilePicker({id:"obs-recordings",types:[{description:"Recordings",accept:{"video/*":[".mov",".mp4",".m4v",".mkv",".webm"]}}]});O("Opening "+e.name+"\u2026"),ba(await vo(e),e)}catch(e){(!e||e.name!=="AbortError")&&O("Could not open that file.",{warn:!0})}};vs=document.getElementById("rv-folder");window.showDirectoryPicker||(vs.style.display="none");vs.onclick=async()=>{let e=H&&mt(H.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(bs("obs-folder",t),!e){O("Folder remembered. This session has no file name from OBS; open the file instead.");return}let a=await t.getFileHandle(e);ba(await vo(a),a)}catch{}};xc()&&new URLSearchParams(location.search).get("obs")&&xr();Te=document.getElementById("btn-camera"),Zt=document.getElementById("pip-msg"),Va=null,ws=B.querySelector("span");td='<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>';Te.onclick=()=>Ht(te);Dr();si=null;window.addEventListener("pointermove",Ss);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(h.active?Pt("Stopped: the browser left fullscreen"):K&&we(!1))});xe=document.getElementById("help");new MutationObserver(()=>ks(document.getElementById("btn-keys"),xe.classList.contains("open"))).observe(xe,{attributes:!0,attributeFilter:["class"]});new MutationObserver(()=>{let e=Y.classList.contains("open");document.getElementById("btn-studio").classList.toggle("active",e),!e&&!S.paused&&S.pause()}).observe(Y,{attributes:!0,attributeFilter:["class"]});document.getElementById("btn-keys").onclick=()=>xe.classList.add("open");document.getElementById("help-close").onclick=()=>xe.classList.remove("open");xe.addEventListener("click",e=>{e.target===xe&&xe.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),h.active||sa();return}if(h.active){Fc(e);return}if(document.querySelector(".modal.open")){let o=Y.classList.contains("open")&&Nt();if(e.key==="Escape")fa();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"?st()?"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(xe.classList.contains("open")){/^(Escape|k|K|\?|\/)$/.test(e.key)&&xe.classList.remove("open");return}let a=e.key;a==="ArrowRight"||a===" "||a==="PageDown"?(e.preventDefault(),We(1)):a==="ArrowLeft"||a==="PageUp"?(e.preventDefault(),We(-1)):a==="ArrowDown"?(e.preventDefault(),fc()):a==="ArrowUp"?(e.preventDefault(),mc()):a==="Home"?v.length&&_(v[0]):a==="End"?v.length&&_(v[v.length-1]):a==="o"||a==="O"?uc():a==="e"||a==="E"?ho():a==="f"||a==="F"||a==="p"||a==="P"?we(!K):a==="r"||a==="R"?Cr():a==="s"||a==="S"?sa():/^[1-4]$/.test(a)?yr(pr[+a-1]):a==="c"||a==="C"?Ht(te):a==="v"||a==="V"?El():a==="l"||a==="L"?mi():a==="+"||a==="="?Qn(1):a==="-"||a==="_"?Qn(-1):a==="?"||a==="/"||a==="k"||a==="K"?xe.classList.add("open"):a==="Escape"&&!Ai()&&K&&we(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=ka(location.hash);if(e&&!(M&&M.kind==="share"&&e===M.data)){location.reload();return}t&&t!==g&&u.has(t)&&_(t)});li="";new ResizeObserver(()=>{let e=N.clientWidth+"x"+N.clientHeight;e!==li&&(li=e,Tt(),fe(!0))}).observe(N);Ct=document.createElement("div");Ct.id="toast";Ct.setAttribute("role","status");document.body.appendChild(Ct);ci=null;ad=document.getElementById("open-dialog"),cr=document.getElementById("open-url"),dr=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{dr.hidden=!0,ma(ad),cr.focus(),cr.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=gn(cr.value);if(!t){dr.textContent="That doesn't look like a link.",dr.hidden=!1;return}location.href=lr(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await od(g&&g!==v[0]?g:""),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),da(a,5e3)}catch{prompt("Copy this link:",e)}M.kind==="copy"&&(P.exported=P.text,va(),jt())};di=j("slidetake:layout");J=pr.includes(di)?di:"path";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J));io=new URLSearchParams(location.search);pr.includes(io.get("layout"))&&(J=io.get("layout"),document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J)));if(U){let e=(Array.isArray(U.trail)?U.trail:U.back?[U.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=hr+'<span class="word">Slide<span>take</span></span>';let o=document.querySelector("header .hdr-actions");o.insertBefore(a,o.firstChild),Ge||(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=()=>we(!K))}ee=xn(location.pathname,location.search,location.hash),hi=ee.page==="pick"?"":ee.slide,M=null,P=kn(j("slidetake:copy"))||rd();window.addEventListener("popstate",()=>location.reload());pe&&window.EventSource&&(new EventSource(pe.events).onmessage=async e=>{if(!Fr())return;let t=(JSON.parse(e.data).file||"").replace(/\\/g,"/");if(t===pe.file){let a=await(await fetch(pe.deck,{cache:"no-store"})).text();if(a===ie.value)return;ie.value=M.text=a,At(!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)})});(io.get("edit")==="1"||ee.page==="edit"&&P&&io.get("edit")!=="0")&&ho();cd().then(e=>(ie.value=e,jt(),gi(ie.value),xi(),document.fonts?document.fonts.ready:null)).then(()=>{u.forEach(lo),ha(),_(u.has(hi)?hi:v[0],!0),Ge&&j("slidetake:camera")==="on"&&Ht(!0,!0)})});var Hr=` /* Every colour comes from these tokens. Slidetake's own is seafoam green: bright on zinc in dark mode,
|
|
1423
1485
|
deep on white in light mode. A host page passes its own (window.SLIDETAKE.colors) and a deck can carry
|
|
1424
1486
|
its own (accent: in its top block); see applyColors in app.js. */
|
|
1425
1487
|
:root{
|
|
@@ -1795,6 +1857,20 @@ EOF
|
|
|
1795
1857
|
only while it is its own stacking context, hence the isolation (without it the capture is silently empty). */
|
|
1796
1858
|
body.rec-frame main{background:#000;}
|
|
1797
1859
|
body.rec-frame #stage-wrap{flex:none;margin:auto;width:min(100%, calc(100vh * 16 / 9));aspect-ratio:16/9;isolation:isolate;}
|
|
1860
|
+
/* format: portrait \u2014 the deck is a 9:16 column, always: what you see is what a Short records */
|
|
1861
|
+
body.portrait main{background:color-mix(in srgb, var(--text) 5%, var(--bg));}
|
|
1862
|
+
body.portrait #stage-wrap, body.portrait.rec-frame #stage-wrap{flex:none;margin:0 auto;width:auto;height:100%;max-width:100%;aspect-ratio:9/16;isolation:isolate;}
|
|
1863
|
+
body.portrait.rec-frame main{background:#000;}
|
|
1864
|
+
body.portrait .rv-video{aspect-ratio:9/16;max-height:62vh;margin:0 auto;}
|
|
1865
|
+
/* the bottom bar and the map go beside the column, where the window is empty (they're never recorded); a window
|
|
1866
|
+
too narrow for that keeps the bar in the column and drops the map */
|
|
1867
|
+
@media (min-aspect-ratio: 1/1){
|
|
1868
|
+
body.portrait #navbar{position:fixed;left:16px;bottom:16px;transform:none;}
|
|
1869
|
+
body.portrait #stage-wrap[data-pip] #minimap{position:fixed;right:16px;bottom:16px;left:auto;}
|
|
1870
|
+
}
|
|
1871
|
+
@media (max-aspect-ratio: 1/1){ body.portrait #minimap{display:none;} }
|
|
1872
|
+
/* a card's words are larger for its width, so a slide filling the narrow column reads on a phone */
|
|
1873
|
+
body.portrait #world .node > .body{zoom:1.8;}
|
|
1798
1874
|
#review.in-browser #rv-novideo{display:none !important;}
|
|
1799
1875
|
/* the takes screen records in this browser, or with OBS: each mode's own controls */
|
|
1800
1876
|
#review.obs .for-browser, #review:not(.obs) .for-obs{display:none !important;}
|
|
@@ -2142,6 +2218,8 @@ EOF
|
|
|
2142
2218
|
#stage-wrap.cam-solid[data-place="right"] #pip.full.behind{right:50%;width:50%;}
|
|
2143
2219
|
#stage-wrap.cam-solid[data-place="top"] #pip.full.behind{top:25%;height:75%;}
|
|
2144
2220
|
#stage-wrap.cam-solid[data-place="bottom"] #pip.full.behind{bottom:25%;height:75%;}
|
|
2221
|
+
body.portrait #stage-wrap.cam-solid[data-place="top"] #pip.full.behind{top:50%;height:50%;}
|
|
2222
|
+
body.portrait #stage-wrap.cam-solid[data-place="bottom"] #pip.full.behind{bottom:50%;height:50%;}
|
|
2145
2223
|
/* the camera behind the slide while it is off: an empty frame with a faint person where you'd be */
|
|
2146
2224
|
#stage-wrap #pip.empty{border:none;background:color-mix(in srgb, var(--text) 6%, var(--bg)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='%23fff' fill-opacity='.07'%3E%3Ccircle cx='50' cy='40' r='15'/%3E%3Cpath d='M18 100c0-22 14-36 32-36s32 14 32 36z'/%3E%3C/g%3E%3C/svg%3E") 50% 100%/auto 70% no-repeat;}
|
|
2147
2225
|
body[data-mode="light"] #stage-wrap #pip.empty{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='%23000' fill-opacity='.06'%3E%3Ccircle cx='50' cy='40' r='15'/%3E%3Cpath d='M18 100c0-22 14-36 32-36s32 14 32 36z'/%3E%3C/g%3E%3C/svg%3E");}
|
|
@@ -2174,6 +2252,10 @@ EOF
|
|
|
2174
2252
|
#stage-wrap.cam-card #cam-overlay .cam-box.right{right:0;top:0;width:50%;height:100%;}
|
|
2175
2253
|
#stage-wrap.cam-card #cam-overlay .cam-box.top{left:0;top:0;width:100%;height:25%;}
|
|
2176
2254
|
#stage-wrap.cam-card #cam-overlay .cam-box.bottom{left:0;bottom:0;width:100%;height:25%;}
|
|
2255
|
+
/* portrait: the words take half the column, above or below you, stacked like a card */
|
|
2256
|
+
body.portrait #cam-overlay .cam-box:is(.top, .bottom){height:44%;flex-direction:column;}
|
|
2257
|
+
body.portrait #stage-wrap.cam-card #cam-overlay .cam-box:is(.top, .bottom){height:50%;}
|
|
2258
|
+
body.portrait #cam-overlay .cam-box:is(.top, .bottom) .cam-text + .cam-media{flex-basis:55%;}
|
|
2177
2259
|
/* the words take what the picture leaves: below it beside you, to its left in a band */
|
|
2178
2260
|
#cam-overlay .cam-text{flex:1 1 0;min-width:0;min-height:0;display:flex;align-items:center;}
|
|
2179
2261
|
#cam-overlay .cam-box.top .cam-text{align-items:flex-start;}
|
|
@@ -2233,7 +2315,7 @@ EOF
|
|
|
2233
2315
|
#minimap{display:none;}
|
|
2234
2316
|
#navbar .lbl{display:none;}
|
|
2235
2317
|
}
|
|
2236
|
-
`;var
|
|
2318
|
+
`;var jr=`
|
|
2237
2319
|
<noscript>
|
|
2238
2320
|
<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>
|
|
2239
2321
|
<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>
|
|
@@ -2358,6 +2440,7 @@ EOF
|
|
|
2358
2440
|
<li><a href="/new?template=blank"><strong>Blank</strong><span>A first card, a section and a detail.</span></a></li>
|
|
2359
2441
|
<li><a href="/new?template=talk"><strong>Talk</strong><span>Why it matters, the idea, trade-offs, summary.</span></a></li>
|
|
2360
2442
|
<li><a href="/new?template=recording"><strong>Recording</strong><span>Camera steps, an overview moment and a closing on camera.</span></a></li>
|
|
2443
|
+
<li><a href="/new?template=short"><strong>Short</strong><span>A 9:16 deck for Shorts and Reels: words above or below you.</span></a></li>
|
|
2361
2444
|
<li><a href="/showcase"><strong>Showcase</strong><span>Every feature in one deck: diagrams, charts, images, YouTube, camera.</span></a></li>
|
|
2362
2445
|
</ul>
|
|
2363
2446
|
<p>Or <strong>\u21E3 Load</strong> a deck from a link, or <strong>Open</strong> a file from this computer.</p>
|
|
@@ -2513,5 +2596,5 @@ EOF
|
|
|
2513
2596
|
<div id="rec-paused">Paused \xB7 press B to resume</div>
|
|
2514
2597
|
|
|
2515
2598
|
<!-- The sample deck. Plain markdown, nothing else. -->
|
|
2516
|
-
`;var
|
|
2517
|
-
<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
|
|
2599
|
+
`;var Wr=`<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
2600
|
+
<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 Ts=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 Ls(){document.head.insertAdjacentHTML("beforeend",Wr);let e=document.createElement("style");e.textContent=Hr,document.head.appendChild(e),document.body.insertAdjacentHTML("afterbegin",jr),await Promise.all([window.gsap?null:Ts("https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"),window.marked?null:Ts("https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.2/marked.min.js")]),await Promise.resolve().then(()=>(Ms(),dd))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ls,{once:!0}):Ls();})();
|