返回 reveal.js
notes.js
根目录 / dist / plugin / notes.js
1 (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.RevealNotes=t())})(this,function(){var e=`<!--
2 NOTE: You need to build the notes plugin after making changes to this file.
3 -->
4 <html lang="en">
5 <head>
6 <meta charset="utf-8">
7
8 <title>reveal.js - Speaker View</title>
9
10 <style>
11 body {
12 font-family: Helvetica;
13 font-size: 18px;
14 }
15
16 #current-slide,
17 #upcoming-slide,
18 #speaker-controls {
19 padding: 6px;
20 box-sizing: border-box;
21 -moz-box-sizing: border-box;
22 }
23
24 #current-slide iframe,
25 #upcoming-slide iframe {
26 width: 100%;
27 height: 100%;
28 border: 1px solid #ddd;
29 }
30
31 #current-slide .label,
32 #upcoming-slide .label {
33 position: absolute;
34 top: 10px;
35 left: 10px;
36 z-index: 2;
37 }
38
39 #connection-status {
40 position: absolute;
41 top: 0;
42 left: 0;
43 width: 100%;
44 height: 100%;
45 z-index: 20;
46 padding: 30% 20% 20% 20%;
47 font-size: 18px;
48 color: #222;
49 background: #fff;
50 text-align: center;
51 box-sizing: border-box;
52 line-height: 1.4;
53 }
54
55 .overlay-element {
56 height: 34px;
57 line-height: 34px;
58 padding: 0 10px;
59 text-shadow: none;
60 background: rgba( 220, 220, 220, 0.8 );
61 color: #222;
62 font-size: 14px;
63 }
64
65 .overlay-element.interactive:hover {
66 background: rgba( 220, 220, 220, 1 );
67 }
68
69 #current-slide {
70 position: absolute;
71 width: 60%;
72 height: 100%;
73 top: 0;
74 left: 0;
75 padding-right: 0;
76 }
77
78 #upcoming-slide {
79 position: absolute;
80 width: 40%;
81 height: 40%;
82 right: 0;
83 top: 0;
84 }
85
86 /* Speaker controls */
87 #speaker-controls {
88 position: absolute;
89 top: 40%;
90 right: 0;
91 width: 40%;
92 height: 60%;
93 overflow: auto;
94 font-size: 18px;
95 }
96
97 .speaker-controls-time.hidden,
98 .speaker-controls-notes.hidden {
99 display: none;
100 }
101
102 .speaker-controls-time .label,
103 .speaker-controls-pace .label,
104 .speaker-controls-notes .label {
105 text-transform: uppercase;
106 font-weight: normal;
107 font-size: 0.66em;
108 color: #666;
109 margin: 0;
110 }
111
112 .speaker-controls-time, .speaker-controls-pace {
113 border-bottom: 1px solid rgba( 200, 200, 200, 0.5 );
114 margin-bottom: 10px;
115 padding: 10px 16px;
116 padding-bottom: 20px;
117 cursor: pointer;
118 }
119
120 .speaker-controls-time .reset-button {
121 opacity: 0;
122 float: right;
123 color: #666;
124 text-decoration: none;
125 }
126 .speaker-controls-time:hover .reset-button {
127 opacity: 1;
128 }
129
130 .speaker-controls-time .timer,
131 .speaker-controls-time .clock {
132 width: 50%;
133 }
134
135 .speaker-controls-time .timer,
136 .speaker-controls-time .clock,
137 .speaker-controls-time .pacing .hours-value,
138 .speaker-controls-time .pacing .minutes-value,
139 .speaker-controls-time .pacing .seconds-value {
140 font-size: 1.9em;
141 }
142
143 .speaker-controls-time .timer {
144 float: left;
145 }
146
147 .speaker-controls-time .clock {
148 float: right;
149 text-align: right;
150 }
151
152 .speaker-controls-time span.mute {
153 opacity: 0.3;
154 }
155
156 .speaker-controls-time .pacing-title {
157 margin-top: 5px;
158 }
159
160 .speaker-controls-time .pacing.ahead {
161 color: blue;
162 }
163
164 .speaker-controls-time .pacing.on-track {
165 color: green;
166 }
167
168 .speaker-controls-time .pacing.behind {
169 color: red;
170 }
171
172 .speaker-controls-notes {
173 padding: 10px 16px;
174 }
175
176 .speaker-controls-notes .value {
177 margin-top: 5px;
178 line-height: 1.4;
179 font-size: 1.2em;
180 }
181
182 /* Layout selector\xA0*/
183 #speaker-layout {
184 position: absolute;
185 top: 10px;
186 right: 10px;
187 color: #222;
188 z-index: 10;
189 }
190 #speaker-layout select {
191 position: absolute;
192 width: 100%;
193 height: 100%;
194 top: 0;
195 left: 0;
196 border: 0;
197 box-shadow: 0;
198 cursor: pointer;
199 opacity: 0;
200
201 font-size: 1em;
202 background-color: transparent;
203
204 -moz-appearance: none;
205 -webkit-appearance: none;
206 -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
207 }
208
209 #speaker-layout select:focus {
210 outline: none;
211 box-shadow: none;
212 }
213
214 .clear {
215 clear: both;
216 }
217
218 /* Speaker layout: Wide */
219 body[data-speaker-layout="wide"] #current-slide,
220 body[data-speaker-layout="wide"] #upcoming-slide {
221 width: 50%;
222 height: 45%;
223 padding: 6px;
224 }
225
226 body[data-speaker-layout="wide"] #current-slide {
227 top: 0;
228 left: 0;
229 }
230
231 body[data-speaker-layout="wide"] #upcoming-slide {
232 top: 0;
233 left: 50%;
234 }
235
236 body[data-speaker-layout="wide"] #speaker-controls {
237 top: 45%;
238 left: 0;
239 width: 100%;
240 height: 50%;
241 font-size: 1.25em;
242 }
243
244 /* Speaker layout: Tall */
245 body[data-speaker-layout="tall"] #current-slide,
246 body[data-speaker-layout="tall"] #upcoming-slide {
247 width: 45%;
248 height: 50%;
249 padding: 6px;
250 }
251
252 body[data-speaker-layout="tall"] #current-slide {
253 top: 0;
254 left: 0;
255 }
256
257 body[data-speaker-layout="tall"] #upcoming-slide {
258 top: 50%;
259 left: 0;
260 }
261
262 body[data-speaker-layout="tall"] #speaker-controls {
263 padding-top: 40px;
264 top: 0;
265 left: 45%;
266 width: 55%;
267 height: 100%;
268 font-size: 1.25em;
269 }
270
271 /* Speaker layout: Notes only */
272 body[data-speaker-layout="notes-only"] #current-slide,
273 body[data-speaker-layout="notes-only"] #upcoming-slide {
274 display: none;
275 }
276
277 body[data-speaker-layout="notes-only"] #speaker-controls {
278 padding-top: 40px;
279 top: 0;
280 left: 0;
281 width: 100%;
282 height: 100%;
283 font-size: 1.25em;
284 }
285
286 @media screen and (max-width: 1080px) {
287 body[data-speaker-layout="default"] #speaker-controls {
288 font-size: 16px;
289 }
290 }
291
292 @media screen and (max-width: 900px) {
293 body[data-speaker-layout="default"] #speaker-controls {
294 font-size: 14px;
295 }
296 }
297
298 @media screen and (max-width: 800px) {
299 body[data-speaker-layout="default"] #speaker-controls {
300 font-size: 12px;
301 }
302 }
303
304 </style>
305 </head>
306
307 <body>
308
309 <div id="connection-status">Loading speaker view...</div>
310
311 <div id="current-slide"></div>
312 <div id="upcoming-slide"><span class="overlay-element label">Upcoming</span></div>
313 <div id="speaker-controls">
314 <div class="speaker-controls-time">
315 <h4 class="label">Time <span class="reset-button">Click to Reset</span></h4>
316 <div class="clock">
317 <span class="clock-value">0:00 AM</span>
318 </div>
319 <div class="timer">
320 <span class="hours-value">00</span><span class="minutes-value">:00</span><span class="seconds-value">:00</span>
321 </div>
322 <div class="clear"></div>
323
324 <h4 class="label pacing-title" style="display: none">Pacing – Time to finish current slide</h4>
325 <div class="pacing" style="display: none">
326 <span class="hours-value">00</span><span class="minutes-value">:00</span><span class="seconds-value">:00</span>
327 </div>
328 </div>
329
330 <div class="speaker-controls-notes hidden">
331 <h4 class="label">Notes</h4>
332 <div class="value"></div>
333 </div>
334 </div>
335 <div id="speaker-layout" class="overlay-element interactive">
336 <span class="speaker-layout-label"></span>
337 <select class="speaker-layout-dropdown"></select>
338 </div>
339
340 <script>
341
342 (function() {
343
344 var notes,
345 notesValue,
346 currentState,
347 currentSlide,
348 upcomingSlide,
349 layoutLabel,
350 layoutDropdown,
351 pendingCalls = {},
352 lastRevealApiCallId = 0,
353 connected = false
354
355 var connectionStatus = document.querySelector( '#connection-status' );
356
357 var SPEAKER_LAYOUTS = {
358 'default': 'Default',
359 'wide': 'Wide',
360 'tall': 'Tall',
361 'notes-only': 'Notes only'
362 };
363
364 setupLayout();
365
366 let openerOrigin;
367
368 try {
369 openerOrigin = window.opener.location.origin;
370 }
371 catch ( error ) { console.warn( error ) }
372
373 // In order to prevent XSS, the speaker view will only run if its
374 // opener has the same origin as itself
375 if( window.location.origin !== openerOrigin ) {
376 connectionStatus.innerHTML = 'Cross origin error.<br>The speaker window can only be opened from the same origin.';
377 return;
378 }
379
380 var connectionTimeout = setTimeout( function() {
381 connectionStatus.innerHTML = 'Error connecting to main window.<br>Please try closing and reopening the speaker view.';
382 }, 5000 );
383
384 window.addEventListener( 'message', function( event ) {
385
386 // Validate the origin of all messages to avoid parsing messages
387 // that aren't meant for us. Ignore when running off file:// so
388 // that the speaker view continues to work without a web server.
389 if( window.location.origin !== event.origin && window.location.origin !== 'file://' ) {
390 return
391 }
392
393 clearTimeout( connectionTimeout );
394 connectionStatus.style.display = 'none';
395
396 var data = JSON.parse( event.data );
397
398 // The overview mode is only useful to the reveal.js instance
399 // where navigation occurs so we don't sync it
400 if( data.state ) delete data.state.overview;
401
402 // Messages sent by the notes plugin inside of the main window
403 if( data && data.namespace === 'reveal-notes' ) {
404 if( data.type === 'connect' ) {
405 handleConnectMessage( data );
406 }
407 else if( data.type === 'state' ) {
408 handleStateMessage( data );
409 }
410 else if( data.type === 'return' ) {
411 pendingCalls[data.callId](data.result);
412 delete pendingCalls[data.callId];
413 }
414 }
415 // Messages sent by the reveal.js inside of the current slide preview
416 else if( data && data.namespace === 'reveal' ) {
417 const supportedEvents = [
418 'slidechanged',
419 'fragmentshown',
420 'fragmenthidden',
421 'paused',
422 'resumed',
423 'previewiframe',
424 'previewimage',
425 'previewvideo',
426 'closeoverlay'
427 ];
428
429 if( /ready/.test( data.eventName ) ) {
430 // Send a message back to notify that the handshake is complete
431 window.opener.postMessage( JSON.stringify({ namespace: 'reveal-notes', type: 'connected'} ), '*' );
432 }
433 else if( supportedEvents.includes( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
434 dispatchStateToMainWindow( data.state );
435 }
436 }
437
438 } );
439
440 /**
441 * Updates the presentation in the main window to match the state
442 * of the presentation in the notes window.
443 */
444 const dispatchStateToMainWindow = debounce(( state ) => {
445 window.opener.postMessage( JSON.stringify({ method: 'setState', args: [ state ]} ), '*' );
446 }, 500);
447
448 /**
449 * Asynchronously calls the Reveal.js API of the main frame.
450 */
451 function callRevealApi( methodName, methodArguments, callback ) {
452
453 var callId = ++lastRevealApiCallId;
454 pendingCalls[callId] = callback;
455 window.opener.postMessage( JSON.stringify( {
456 namespace: 'reveal-notes',
457 type: 'call',
458 callId: callId,
459 methodName: methodName,
460 arguments: methodArguments
461 } ), '*' );
462
463 }
464
465 /**
466 * Called when the main window is trying to establish a
467 * connection.
468 */
469 function handleConnectMessage( data ) {
470
471 if( connected === false ) {
472 connected = true;
473
474 setupIframes( data );
475 setupKeyboard();
476 setupNotes();
477 setupTimer();
478 setupHeartbeat();
479 }
480
481 }
482
483 /**
484 * Called when the main window sends an updated state.
485 */
486 function handleStateMessage( data ) {
487
488 // Store the most recently set state to avoid circular loops
489 // applying the same state
490 currentState = JSON.stringify( data.state );
491
492 // No need for updating the notes in case of fragment changes
493 if ( data.notes ) {
494 notes.classList.remove( 'hidden' );
495 notesValue.style.whiteSpace = data.whitespace;
496 if( data.markdown ) {
497 notesValue.innerHTML = marked.parse( data.notes );
498 }
499 else {
500 notesValue.innerHTML = data.notes;
501 }
502 }
503 else {
504 notes.classList.add( 'hidden' );
505 }
506
507 // Don't show lightboxes in the upcoming slide
508 const { previewVideo, previewImage, previewIframe, ...upcomingState } = data.state;
509
510 // Update the note slides
511 currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
512 upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ upcomingState ] }), '*' );
513 upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'next' }), '*' );
514
515 }
516
517 // Limit to max one state update per X ms
518 handleStateMessage = debounce( handleStateMessage, 200 );
519
520 /**
521 * Forward keyboard events to the current slide window.
522 * This enables keyboard events to work even if focus
523 * isn't set on the current slide iframe.
524 *
525 * Block F5 default handling, it reloads and disconnects
526 * the speaker notes window.
527 */
528 function setupKeyboard() {
529
530 document.addEventListener( 'keydown', function( event ) {
531 if( event.keyCode === 116 || ( event.metaKey && event.keyCode === 82 ) ) {
532 event.preventDefault();
533 return false;
534 }
535 currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' );
536 } );
537
538 }
539
540 /**
541 * Creates the preview iframes.
542 */
543 function setupIframes( data ) {
544
545 var params = [
546 'receiver',
547 'progress=false',
548 'history=false',
549 'transition=none',
550 'autoSlide=0',
551 'backgroundTransition=none'
552 ].join( '&' );
553
554 var urlSeparator = /\\?/.test(data.url) ? '&' : '?';
555 var hash = '#/' + data.state.indexh + '/' + data.state.indexv;
556 var currentURL = data.url + urlSeparator + params + '&scrollActivationWidth=false&postMessageEvents=true' + hash;
557 var upcomingURL = data.url + urlSeparator + params + '&scrollActivationWidth=false&controls=false' + hash;
558
559 currentSlide = document.createElement( 'iframe' );
560 currentSlide.setAttribute( 'width', 1280 );
561 currentSlide.setAttribute( 'height', 1024 );
562 currentSlide.setAttribute( 'src', currentURL );
563 document.querySelector( '#current-slide' ).appendChild( currentSlide );
564
565 upcomingSlide = document.createElement( 'iframe' );
566 upcomingSlide.setAttribute( 'width', 640 );
567 upcomingSlide.setAttribute( 'height', 512 );
568 upcomingSlide.setAttribute( 'src', upcomingURL );
569 document.querySelector( '#upcoming-slide' ).appendChild( upcomingSlide );
570
571 }
572
573 /**
574 * Setup the notes UI.
575 */
576 function setupNotes() {
577
578 notes = document.querySelector( '.speaker-controls-notes' );
579 notesValue = document.querySelector( '.speaker-controls-notes .value' );
580
581 }
582
583 /**
584 * We send out a heartbeat at all times to ensure we can
585 * reconnect with the main presentation window after reloads.
586 */
587 function setupHeartbeat() {
588
589 setInterval( () => {
590 window.opener.postMessage( JSON.stringify({ namespace: 'reveal-notes', type: 'heartbeat'} ), '*' );
591 }, 1000 );
592
593 }
594
595 function getTimings( callback ) {
596
597 callRevealApi( 'getSlidesAttributes', [], function ( slideAttributes ) {
598 callRevealApi( 'getConfig', [], function ( config ) {
599 var totalTime = config.totalTime;
600 var minTimePerSlide = config.minimumTimePerSlide || 0;
601 var defaultTiming = config.defaultTiming;
602 if ((defaultTiming == null) && (totalTime == null)) {
603 callback(null);
604 return;
605 }
606 // Setting totalTime overrides defaultTiming
607 if (totalTime) {
608 defaultTiming = 0;
609 }
610 var timings = [];
611 for ( var i in slideAttributes ) {
612 var slide = slideAttributes[ i ];
613 var timing = defaultTiming;
614 if( slide.hasOwnProperty( 'data-timing' )) {
615 var t = slide[ 'data-timing' ];
616 timing = parseInt(t);
617 if( isNaN(timing) ) {
618 console.warn("Could not parse timing '" + t + "' of slide " + i + "; using default of " + defaultTiming);
619 timing = defaultTiming;
620 }
621 }
622 timings.push(timing);
623 }
624 if ( totalTime ) {
625 // After we've allocated time to individual slides, we summarize it and
626 // subtract it from the total time
627 var remainingTime = totalTime - timings.reduce( function(a, b) { return a + b; }, 0 );
628 // The remaining time is divided by the number of slides that have 0 seconds
629 // allocated at the moment, giving the average time-per-slide on the remaining slides
630 var remainingSlides = (timings.filter( function(x) { return x == 0 }) ).length
631 var timePerSlide = Math.round( remainingTime / remainingSlides, 0 )
632 // And now we replace every zero-value timing with that average
633 timings = timings.map( function(x) { return (x==0 ? timePerSlide : x) } );
634 }
635 var slidesUnderMinimum = timings.filter( function(x) { return (x < minTimePerSlide) } ).length
636 if ( slidesUnderMinimum ) {
637 message = "The pacing time for " + slidesUnderMinimum + " slide(s) is under the configured minimum of " + minTimePerSlide + " seconds. Check the data-timing attribute on individual slides, or consider increasing the totalTime or minimumTimePerSlide configuration options (or removing some slides).";
638 alert(message);
639 }
640 callback( timings );
641 } );
642 } );
643
644 }
645
646 /**
647 * Return the number of seconds allocated for presenting
648 * all slides up to and including this one.
649 */
650 function getTimeAllocated( timings, callback ) {
651
652 callRevealApi( 'getSlidePastCount', [], function ( currentSlide ) {
653 var allocated = 0;
654 for (var i in timings.slice(0, currentSlide + 1)) {
655 allocated += timings[i];
656 }
657 callback( allocated );
658 } );
659
660 }
661
662 /**
663 * Create the timer and clock and start updating them
664 * at an interval.
665 */
666 function setupTimer() {
667
668 var start = new Date(),
669 timeEl = document.querySelector( '.speaker-controls-time' ),
670 clockEl = timeEl.querySelector( '.clock-value' ),
671 hoursEl = timeEl.querySelector( '.hours-value' ),
672 minutesEl = timeEl.querySelector( '.minutes-value' ),
673 secondsEl = timeEl.querySelector( '.seconds-value' ),
674 pacingTitleEl = timeEl.querySelector( '.pacing-title' ),
675 pacingEl = timeEl.querySelector( '.pacing' ),
676 pacingHoursEl = pacingEl.querySelector( '.hours-value' ),
677 pacingMinutesEl = pacingEl.querySelector( '.minutes-value' ),
678 pacingSecondsEl = pacingEl.querySelector( '.seconds-value' );
679
680 var timings = null;
681 getTimings( function ( _timings ) {
682
683 timings = _timings;
684 if (_timings !== null) {
685 pacingTitleEl.style.removeProperty('display');
686 pacingEl.style.removeProperty('display');
687 }
688
689 // Update once directly
690 _updateTimer();
691
692 // Then update every second
693 setInterval( _updateTimer, 1000 );
694
695 } );
696
697
698 function _resetTimer() {
699
700 if (timings == null) {
701 start = new Date();
702 _updateTimer();
703 }
704 else {
705 // Reset timer to beginning of current slide
706 getTimeAllocated( timings, function ( slideEndTimingSeconds ) {
707 var slideEndTiming = slideEndTimingSeconds * 1000;
708 callRevealApi( 'getSlidePastCount', [], function ( currentSlide ) {
709 var currentSlideTiming = timings[currentSlide] * 1000;
710 var previousSlidesTiming = slideEndTiming - currentSlideTiming;
711 var now = new Date();
712 start = new Date(now.getTime() - previousSlidesTiming);
713 _updateTimer();
714 } );
715 } );
716 }
717
718 }
719
720 timeEl.addEventListener( 'click', function() {
721 _resetTimer();
722 return false;
723 } );
724
725 function _displayTime( hrEl, minEl, secEl, time) {
726
727 var sign = Math.sign(time) == -1 ? "-" : "";
728 time = Math.abs(Math.round(time / 1000));
729 var seconds = time % 60;
730 var minutes = Math.floor( time / 60 ) % 60 ;
731 var hours = Math.floor( time / ( 60 * 60 )) ;
732 hrEl.innerHTML = sign + zeroPadInteger( hours );
733 if (hours == 0) {
734 hrEl.classList.add( 'mute' );
735 }
736 else {
737 hrEl.classList.remove( 'mute' );
738 }
739 minEl.innerHTML = ':' + zeroPadInteger( minutes );
740 if (hours == 0 && minutes == 0) {
741 minEl.classList.add( 'mute' );
742 }
743 else {
744 minEl.classList.remove( 'mute' );
745 }
746 secEl.innerHTML = ':' + zeroPadInteger( seconds );
747 }
748
749 function _updateTimer() {
750
751 var diff, hours, minutes, seconds,
752 now = new Date();
753
754 diff = now.getTime() - start.getTime();
755
756 clockEl.innerHTML = now.toLocaleTimeString( 'en-US', { hour12: true, hour: '2-digit', minute:'2-digit' } );
757 _displayTime( hoursEl, minutesEl, secondsEl, diff );
758 if (timings !== null) {
759 _updatePacing(diff);
760 }
761
762 }
763
764 function _updatePacing(diff) {
765
766 getTimeAllocated( timings, function ( slideEndTimingSeconds ) {
767 var slideEndTiming = slideEndTimingSeconds * 1000;
768
769 callRevealApi( 'getSlidePastCount', [], function ( currentSlide ) {
770 var currentSlideTiming = timings[currentSlide] * 1000;
771 var timeLeftCurrentSlide = slideEndTiming - diff;
772 if (timeLeftCurrentSlide < 0) {
773 pacingEl.className = 'pacing behind';
774 }
775 else if (timeLeftCurrentSlide < currentSlideTiming) {
776 pacingEl.className = 'pacing on-track';
777 }
778 else {
779 pacingEl.className = 'pacing ahead';
780 }
781 _displayTime( pacingHoursEl, pacingMinutesEl, pacingSecondsEl, timeLeftCurrentSlide );
782 } );
783 } );
784 }
785
786 }
787
788 /**
789 * Sets up the speaker view layout and layout selector.
790 */
791 function setupLayout() {
792
793 layoutDropdown = document.querySelector( '.speaker-layout-dropdown' );
794 layoutLabel = document.querySelector( '.speaker-layout-label' );
795
796 // Render the list of available layouts
797 for( var id in SPEAKER_LAYOUTS ) {
798 var option = document.createElement( 'option' );
799 option.setAttribute( 'value', id );
800 option.textContent = SPEAKER_LAYOUTS[ id ];
801 layoutDropdown.appendChild( option );
802 }
803
804 // Monitor the dropdown for changes
805 layoutDropdown.addEventListener( 'change', function( event ) {
806
807 setLayout( layoutDropdown.value );
808
809 }, false );
810
811 // Restore any currently persisted layout
812 setLayout( getLayout() );
813
814 }
815
816 /**
817 * Sets a new speaker view layout. The layout is persisted
818 * in local storage.
819 */
820 function setLayout( value ) {
821
822 var title = SPEAKER_LAYOUTS[ value ];
823
824 layoutLabel.innerHTML = 'Layout' + ( title ? ( ': ' + title ) : '' );
825 layoutDropdown.value = value;
826
827 document.body.setAttribute( 'data-speaker-layout', value );
828
829 // Persist locally
830 if( supportsLocalStorage() ) {
831 window.localStorage.setItem( 'reveal-speaker-layout', value );
832 }
833
834 }
835
836 /**
837 * Returns the ID of the most recently set speaker layout
838 * or our default layout if none has been set.
839 */
840 function getLayout() {
841
842 if( supportsLocalStorage() ) {
843 var layout = window.localStorage.getItem( 'reveal-speaker-layout' );
844 if( layout ) {
845 return layout;
846 }
847 }
848
849 // Default to the first record in the layouts hash
850 for( var id in SPEAKER_LAYOUTS ) {
851 return id;
852 }
853
854 }
855
856 function supportsLocalStorage() {
857
858 try {
859 localStorage.setItem('test', 'test');
860 localStorage.removeItem('test');
861 return true;
862 }
863 catch( e ) {
864 return false;
865 }
866
867 }
868
869 function zeroPadInteger( num ) {
870
871 var str = '00' + parseInt( num );
872 return str.substring( str.length - 2 );
873
874 }
875
876 /**
877 * Limits the frequency at which a function can be called.
878 */
879 function debounce( fn, ms ) {
880
881 var lastTime = 0,
882 timeout;
883
884 return function() {
885
886 var args = arguments;
887 var context = this;
888
889 clearTimeout( timeout );
890
891 var timeSinceLastCall = Date.now() - lastTime;
892 if( timeSinceLastCall > ms ) {
893 fn.apply( context, args );
894 lastTime = Date.now();
895 }
896 else {
897 timeout = setTimeout( function() {
898 fn.apply( context, args );
899 lastTime = Date.now();
900 }, ms - timeSinceLastCall );
901 }
902
903 }
904
905 }
906
907 })();
908
909 <\/script>
910 </body>
911 </html>`;function t(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var n=t();function r(e){n=e}var i={exec:()=>null};function a(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(s.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var o=(()=>{try{return!0}catch{return!1}})(),s={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},c=/^(?:[ \t]*(?:\n|$))+/,l=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,u=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,d=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,f=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,p=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,m=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,h=a(m).replace(/bull/g,p).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ee=a(m).replace(/bull/g,p).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),g=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,te=/^[^\n]+/,_=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ne=a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,_).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),re=a(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,p).getRegex(),v=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,y=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ie=a(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,y).replace(`tag`,v).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),b=a(g).replace(`hr`,d).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,v).getRegex(),x={blockquote:a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,b).getRegex(),code:l,def:ne,fences:u,heading:f,hr:d,html:ie,lheading:h,list:re,newline:c,paragraph:b,table:i,text:te},S=a(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,d).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,v).getRegex(),ae={...x,lheading:ee,table:S,paragraph:a(g).replace(`hr`,d).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,S).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,v).getRegex()},oe={...x,html:a(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,y).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:i,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:a(g).replace(`hr`,d).replace(`heading`,` *#{1,6} *[^
912 ]`).replace(`lheading`,h).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},se=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ce=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,C=/^( {2,}|\\)\n(?!\s*$)/,le=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,w=/[\p{P}\p{S}]/u,T=/[\s\p{P}\p{S}]/u,E=/[^\s\p{P}\p{S}]/u,ue=a(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,T).getRegex(),D=/(?!~)[\p{P}\p{S}]/u,de=/(?!~)[\s\p{P}\p{S}]/u,fe=/(?:[^\s\p{P}\p{S}]|~)/u,pe=a(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,o?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),O=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,me=a(O,`u`).replace(/punct/g,w).getRegex(),he=a(O,`u`).replace(/punct/g,D).getRegex(),k=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,ge=a(k,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),A=a(k,`gu`).replace(/notPunctSpace/g,fe).replace(/punctSpace/g,de).replace(/punct/g,D).getRegex(),_e=a(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),ve=a(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,w).getRegex(),ye=a(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,E).replace(/punctSpace/g,T).replace(/punct/g,w).getRegex(),be=a(/\\(punct)/,`gu`).replace(/punct/g,w).getRegex(),xe=a(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),j=a(y).replace(`(?:-->|$)`,`-->`).getRegex(),Se=a(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,j).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),M=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ce=a(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,M).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),N=a(/^!?\[(label)\]\[(ref)\]/).replace(`label`,M).replace(`ref`,_).getRegex(),P=a(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,_).getRegex(),we=a(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,N).replace(`nolink`,P).getRegex(),F=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,I={_backpedal:i,anyPunctuation:be,autolink:xe,blockSkip:pe,br:C,code:ce,del:i,delLDelim:i,delRDelim:i,emStrongLDelim:me,emStrongRDelimAst:ge,emStrongRDelimUnd:_e,escape:se,link:Ce,nolink:P,punctuation:ue,reflink:N,reflinkSearch:we,tag:Se,text:le,url:i},Te={...I,link:a(/^!?\[(label)\]\((.*?)\)/).replace(`label`,M).getRegex(),reflink:a(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,M).getRegex()},L={...I,emStrongRDelimAst:A,emStrongLDelim:he,delLDelim:ve,delRDelim:ye,url:a(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,F).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:a(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,F).getRegex()},Ee={...L,br:a(C).replace(`{2,}`,`*`).getRegex(),text:a(L.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},R={normal:x,gfm:ae,pedantic:oe},z={normal:I,gfm:L,breaks:Ee,pedantic:Te},De={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},B=e=>De[e];function V(e,t){if(t){if(s.escapeTest.test(e))return e.replace(s.escapeReplace,B)}else if(s.escapeTestNoEncode.test(e))return e.replace(s.escapeReplaceNoEncode,B);return e}function H(e){try{e=encodeURI(e).replace(s.percentDecode,`%`)}catch{return null}return e}function U(e,t){let n=e.replace(s.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(s.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(s.slashPipe,`|`);return n}function W(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Oe(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function ke(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function G(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Ae(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
913 `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
914 `)}var K=class{options;rules;lexer;constructor(e){this.options=e||n}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:W(e,`
915 `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Ae(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=W(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:W(t[0],`
916 `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=W(t[0],`
917 `).split(`
918 `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
919 `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
920 $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
921 ${s}`:s,r=r?`${r}
922 ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
923 `+e.join(`
924 `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
925 `+e.join(`
926 `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
927 `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=ke(t[2].split(`
928 `,1)[0],t[1].length),l=e.split(`
929 `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
930 `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
931 `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
932 `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
933 `+l}u=!l.trim(),r+=p+`
934 `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=U(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
935 `):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(U(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
936 `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=W(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Oe(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),G(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return G(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},q=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||n,this.options.tokenizer=this.options.tokenizer||new K,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:s,block:R.normal,inline:z.normal};this.options.pedantic?(t.block=R.pedantic,t.inline=z.pedantic):this.options.gfm&&(t.block=R.gfm,this.options.breaks?t.inline=z.breaks:t.inline=z.gfm),this.tokenizer.rules=t}static get rules(){return{block:R,inline:z}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(s.carriageReturn,`
937 `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(s.tabCharGlobal,` `).replace(s.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
938 `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
939 `)?``:`
940 `)+r.raw,n.text+=`
941 `+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
942 `)?``:`
943 `)+r.raw,n.text+=`
944 `+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
945 `)?``:`
946 `)+r.raw,a.text+=`
947 `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
948 `)?``:`
949 `)+r.raw,n.text+=`
950 `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},J=class{options;parser;constructor(e){this.options=e||n}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(s.notSpaceStart)?.[0],i=e.replace(s.endingNewline,``)+`
951 `;return r?`<pre><code class="language-`+V(r)+`">`+(n?i:V(i,!0))+`</code></pre>
952 `:`<pre><code>`+(n?i:V(i,!0))+`</code></pre>
953 `}blockquote({tokens:e}){return`<blockquote>
954 ${this.parser.parse(e)}</blockquote>
955 `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
956 `}hr(e){return`<hr>
957 `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
958 `+r+`</`+i+`>
959 `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
960 `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
961 `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
962 <thead>
963 `+t+`</thead>
964 `+r+`</table>
965 `}tablerow({text:e}){return`<tr>
966 ${e}</tr>
967 `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
968 `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${V(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=H(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+V(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=H(e);if(i===null)return V(n);e=i;let a=`<img src="${e}" alt="${V(n)}"`;return t&&(a+=` title="${V(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:V(e.text)}},Y=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},X=class e{options;renderer;textRenderer;constructor(e){this.options=e||n,this.options.renderer=this.options.renderer||new J,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Y}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Z=class{options;block;constructor(e){this.options=e||n}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?q.lex:q.lexInline}provideParser(){return this.block?X.parse:X.parseInline}},Q=new class{defaults=t();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=X;Renderer=J;TextRenderer=Y;Lexer=q;Tokenizer=K;Hooks=Z;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new J(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new K(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Z;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Z.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return q.lex(e,t??this.defaults)}parser(e,t){return X.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?q.lex:q.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?X.parse:X.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?q.lex:q.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?X.parse:X.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
969 Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+V(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return Q.parse(e,t)}return $.options=$.setOptions=function(e){return Q.setOptions(e),$.defaults=Q.defaults,r($.defaults),$},$.getDefaults=t,$.defaults=n,$.use=function(...e){return Q.use(...e),$.defaults=Q.defaults,r($.defaults),$},$.walkTokens=function(e,t){return Q.walkTokens(e,t)},$.parseInline=Q.parseInline,$.Parser=X,$.parser=X.parse,$.Renderer=J,$.TextRenderer=Y,$.Lexer=q,$.lexer=q.lex,$.Tokenizer=K,$.Hooks=Z,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,X.parse,q.lex,()=>{let t,n=null,r;function i(){if(n&&!n.closed)n.focus();else{if(n=window.open(`about:blank`,`reveal.js - Notes`,`width=1100,height=700`),n.marked=$,n.document.write(e),!n){alert(`Speaker view popup failed to open. Please make sure popups are allowed and reopen the speaker view.`);return}o()}}function a(e){n&&!n.closed?n.focus():(n=e,window.addEventListener(`message`,u),d())}function o(){let e=r.getConfig().url,i=typeof e==`string`?e:window.location.protocol+`//`+window.location.host+window.location.pathname+window.location.search;t=setInterval(function(){n.postMessage(JSON.stringify({namespace:`reveal-notes`,type:`connect`,state:r.getState(),url:i}),`*`)},500),window.addEventListener(`message`,u)}function s(e,t,i){let a=r[e].apply(r,t);n.postMessage(JSON.stringify({namespace:`reveal-notes`,type:`return`,result:a,callId:i}),`*`)}function c(e){let t=r.getCurrentSlide(),i=t.querySelectorAll(`aside.notes`),a=t.querySelector(`.current-fragment`),o={namespace:`reveal-notes`,type:`state`,notes:``,markdown:!1,whitespace:`normal`,state:r.getState()};if(t.hasAttribute(`data-notes`)&&(o.notes=t.getAttribute(`data-notes`),o.whitespace=`pre-wrap`),a){let e=a.querySelector(`aside.notes`);e?(o.notes=e.innerHTML,o.markdown=typeof e.getAttribute(`data-markdown`)==`string`,i=null):a.hasAttribute(`data-notes`)&&(o.notes=a.getAttribute(`data-notes`),o.whitespace=`pre-wrap`,i=null)}i&&i.length&&(i=Array.from(i).filter(e=>e.closest(`.fragment`)===null),o.notes=i.map(e=>e.innerHTML).join(`
970 `),o.markdown=i[0]&&typeof i[0].getAttribute(`data-markdown`)==`string`),n.postMessage(JSON.stringify(o),`*`)}function l(e){try{return window.location.origin===e.source.location.origin}catch{return!1}}function u(e){if(l(e))try{let n=JSON.parse(e.data);n&&n.namespace===`reveal-notes`&&n.type===`connected`?(clearInterval(t),d()):n&&n.namespace===`reveal-notes`&&n.type===`call`&&s(n.methodName,n.arguments,n.callId)}catch{}}function d(){r.on(`slidechanged`,c),r.on(`fragmentshown`,c),r.on(`fragmenthidden`,c),r.on(`overviewhidden`,c),r.on(`overviewshown`,c),r.on(`paused`,c),r.on(`resumed`,c),r.on(`previewiframe`,c),r.on(`previewimage`,c),r.on(`previewvideo`,c),r.on(`closeoverlay`,c),c()}return{id:`notes`,init:function(e){r=e,/receiver/i.test(window.location.search)||(window.location.search.match(/(\?|\&)notes/gi)===null?window.addEventListener(`message`,e=>{if(!n&&typeof e.data==`string`){let t;try{t=JSON.parse(e.data)}catch{}t&&t.namespace===`reveal-notes`&&t.type===`heartbeat`&&a(e.source)}}):i(),r.addKeyBinding({keyCode:83,key:`S`,description:`Speaker notes view`},function(){i()}))},open:i}}});
970 lines JAVASCRIPT