notes.js 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944
  1. (function(z,T){typeof exports=="object"&&typeof module<"u"?module.exports=T():typeof define=="function"&&define.amd?define(T):(z=typeof globalThis<"u"?globalThis:z||self,z.RevealNotes=T())})(this,function(){"use strict";var kt=Object.defineProperty;var wt=(z,T,_)=>T in z?kt(z,T,{enumerable:!0,configurable:!0,writable:!0,value:_}):z[T]=_;var G=(z,T,_)=>wt(z,typeof T!="symbol"?T+"":T,_);const z=`<!--
  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. <title>reveal.js - Speaker View</title>
  8. <style>
  9. body {
  10. font-family: Helvetica;
  11. font-size: 18px;
  12. }
  13. #current-slide,
  14. #upcoming-slide,
  15. #speaker-controls {
  16. padding: 6px;
  17. box-sizing: border-box;
  18. -moz-box-sizing: border-box;
  19. }
  20. #current-slide iframe,
  21. #upcoming-slide iframe {
  22. width: 100%;
  23. height: 100%;
  24. border: 1px solid #ddd;
  25. }
  26. #current-slide .label,
  27. #upcoming-slide .label {
  28. position: absolute;
  29. top: 10px;
  30. left: 10px;
  31. z-index: 2;
  32. }
  33. #connection-status {
  34. position: absolute;
  35. top: 0;
  36. left: 0;
  37. width: 100%;
  38. height: 100%;
  39. z-index: 20;
  40. padding: 30% 20% 20% 20%;
  41. font-size: 18px;
  42. color: #222;
  43. background: #fff;
  44. text-align: center;
  45. box-sizing: border-box;
  46. line-height: 1.4;
  47. }
  48. .overlay-element {
  49. height: 34px;
  50. line-height: 34px;
  51. padding: 0 10px;
  52. text-shadow: none;
  53. background: rgba( 220, 220, 220, 0.8 );
  54. color: #222;
  55. font-size: 14px;
  56. }
  57. .overlay-element.interactive:hover {
  58. background: rgba( 220, 220, 220, 1 );
  59. }
  60. #current-slide {
  61. position: absolute;
  62. width: 60%;
  63. height: 100%;
  64. top: 0;
  65. left: 0;
  66. padding-right: 0;
  67. }
  68. #upcoming-slide {
  69. position: absolute;
  70. width: 40%;
  71. height: 40%;
  72. right: 0;
  73. top: 0;
  74. }
  75. /* Speaker controls */
  76. #speaker-controls {
  77. position: absolute;
  78. top: 40%;
  79. right: 0;
  80. width: 40%;
  81. height: 60%;
  82. overflow: auto;
  83. font-size: 18px;
  84. }
  85. .speaker-controls-time.hidden,
  86. .speaker-controls-notes.hidden {
  87. display: none;
  88. }
  89. .speaker-controls-time .label,
  90. .speaker-controls-pace .label,
  91. .speaker-controls-notes .label {
  92. text-transform: uppercase;
  93. font-weight: normal;
  94. font-size: 0.66em;
  95. color: #666;
  96. margin: 0;
  97. }
  98. .speaker-controls-time, .speaker-controls-pace {
  99. border-bottom: 1px solid rgba( 200, 200, 200, 0.5 );
  100. margin-bottom: 10px;
  101. padding: 10px 16px;
  102. padding-bottom: 20px;
  103. cursor: pointer;
  104. }
  105. .speaker-controls-time .reset-button {
  106. opacity: 0;
  107. float: right;
  108. color: #666;
  109. text-decoration: none;
  110. }
  111. .speaker-controls-time:hover .reset-button {
  112. opacity: 1;
  113. }
  114. .speaker-controls-time .timer,
  115. .speaker-controls-time .clock {
  116. width: 50%;
  117. }
  118. .speaker-controls-time .timer,
  119. .speaker-controls-time .clock,
  120. .speaker-controls-time .pacing .hours-value,
  121. .speaker-controls-time .pacing .minutes-value,
  122. .speaker-controls-time .pacing .seconds-value {
  123. font-size: 1.9em;
  124. }
  125. .speaker-controls-time .timer {
  126. float: left;
  127. }
  128. .speaker-controls-time .clock {
  129. float: right;
  130. text-align: right;
  131. }
  132. .speaker-controls-time span.mute {
  133. opacity: 0.3;
  134. }
  135. .speaker-controls-time .pacing-title {
  136. margin-top: 5px;
  137. }
  138. .speaker-controls-time .pacing.ahead {
  139. color: blue;
  140. }
  141. .speaker-controls-time .pacing.on-track {
  142. color: green;
  143. }
  144. .speaker-controls-time .pacing.behind {
  145. color: red;
  146. }
  147. .speaker-controls-notes {
  148. padding: 10px 16px;
  149. }
  150. .speaker-controls-notes .value {
  151. margin-top: 5px;
  152. line-height: 1.4;
  153. font-size: 1.2em;
  154. }
  155. /* Layout selector */
  156. #speaker-layout {
  157. position: absolute;
  158. top: 10px;
  159. right: 10px;
  160. color: #222;
  161. z-index: 10;
  162. }
  163. #speaker-layout select {
  164. position: absolute;
  165. width: 100%;
  166. height: 100%;
  167. top: 0;
  168. left: 0;
  169. border: 0;
  170. box-shadow: 0;
  171. cursor: pointer;
  172. opacity: 0;
  173. font-size: 1em;
  174. background-color: transparent;
  175. -moz-appearance: none;
  176. -webkit-appearance: none;
  177. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  178. }
  179. #speaker-layout select:focus {
  180. outline: none;
  181. box-shadow: none;
  182. }
  183. .clear {
  184. clear: both;
  185. }
  186. /* Speaker layout: Wide */
  187. body[data-speaker-layout="wide"] #current-slide,
  188. body[data-speaker-layout="wide"] #upcoming-slide {
  189. width: 50%;
  190. height: 45%;
  191. padding: 6px;
  192. }
  193. body[data-speaker-layout="wide"] #current-slide {
  194. top: 0;
  195. left: 0;
  196. }
  197. body[data-speaker-layout="wide"] #upcoming-slide {
  198. top: 0;
  199. left: 50%;
  200. }
  201. body[data-speaker-layout="wide"] #speaker-controls {
  202. top: 45%;
  203. left: 0;
  204. width: 100%;
  205. height: 50%;
  206. font-size: 1.25em;
  207. }
  208. /* Speaker layout: Tall */
  209. body[data-speaker-layout="tall"] #current-slide,
  210. body[data-speaker-layout="tall"] #upcoming-slide {
  211. width: 45%;
  212. height: 50%;
  213. padding: 6px;
  214. }
  215. body[data-speaker-layout="tall"] #current-slide {
  216. top: 0;
  217. left: 0;
  218. }
  219. body[data-speaker-layout="tall"] #upcoming-slide {
  220. top: 50%;
  221. left: 0;
  222. }
  223. body[data-speaker-layout="tall"] #speaker-controls {
  224. padding-top: 40px;
  225. top: 0;
  226. left: 45%;
  227. width: 55%;
  228. height: 100%;
  229. font-size: 1.25em;
  230. }
  231. /* Speaker layout: Notes only */
  232. body[data-speaker-layout="notes-only"] #current-slide,
  233. body[data-speaker-layout="notes-only"] #upcoming-slide {
  234. display: none;
  235. }
  236. body[data-speaker-layout="notes-only"] #speaker-controls {
  237. padding-top: 40px;
  238. top: 0;
  239. left: 0;
  240. width: 100%;
  241. height: 100%;
  242. font-size: 1.25em;
  243. }
  244. @media screen and (max-width: 1080px) {
  245. body[data-speaker-layout="default"] #speaker-controls {
  246. font-size: 16px;
  247. }
  248. }
  249. @media screen and (max-width: 900px) {
  250. body[data-speaker-layout="default"] #speaker-controls {
  251. font-size: 14px;
  252. }
  253. }
  254. @media screen and (max-width: 800px) {
  255. body[data-speaker-layout="default"] #speaker-controls {
  256. font-size: 12px;
  257. }
  258. }
  259. </style>
  260. </head>
  261. <body>
  262. <div id="connection-status">Loading speaker view...</div>
  263. <div id="current-slide"></div>
  264. <div id="upcoming-slide"><span class="overlay-element label">Upcoming</span></div>
  265. <div id="speaker-controls">
  266. <div class="speaker-controls-time">
  267. <h4 class="label">Time <span class="reset-button">Click to Reset</span></h4>
  268. <div class="clock">
  269. <span class="clock-value">0:00 AM</span>
  270. </div>
  271. <div class="timer">
  272. <span class="hours-value">00</span><span class="minutes-value">:00</span><span class="seconds-value">:00</span>
  273. </div>
  274. <div class="clear"></div>
  275. <h4 class="label pacing-title" style="display: none">Pacing – Time to finish current slide</h4>
  276. <div class="pacing" style="display: none">
  277. <span class="hours-value">00</span><span class="minutes-value">:00</span><span class="seconds-value">:00</span>
  278. </div>
  279. </div>
  280. <div class="speaker-controls-notes hidden">
  281. <h4 class="label">Notes</h4>
  282. <div class="value"></div>
  283. </div>
  284. </div>
  285. <div id="speaker-layout" class="overlay-element interactive">
  286. <span class="speaker-layout-label"></span>
  287. <select class="speaker-layout-dropdown"></select>
  288. </div>
  289. <script>
  290. (function() {
  291. var notes,
  292. notesValue,
  293. currentState,
  294. currentSlide,
  295. upcomingSlide,
  296. layoutLabel,
  297. layoutDropdown,
  298. pendingCalls = {},
  299. lastRevealApiCallId = 0,
  300. connected = false
  301. var connectionStatus = document.querySelector( '#connection-status' );
  302. var SPEAKER_LAYOUTS = {
  303. 'default': 'Default',
  304. 'wide': 'Wide',
  305. 'tall': 'Tall',
  306. 'notes-only': 'Notes only'
  307. };
  308. setupLayout();
  309. let openerOrigin;
  310. try {
  311. openerOrigin = window.opener.location.origin;
  312. }
  313. catch ( error ) { console.warn( error ) }
  314. // In order to prevent XSS, the speaker view will only run if its
  315. // opener has the same origin as itself
  316. if( window.location.origin !== openerOrigin ) {
  317. connectionStatus.innerHTML = 'Cross origin error.<br>The speaker window can only be opened from the same origin.';
  318. return;
  319. }
  320. var connectionTimeout = setTimeout( function() {
  321. connectionStatus.innerHTML = 'Error connecting to main window.<br>Please try closing and reopening the speaker view.';
  322. }, 5000 );
  323. window.addEventListener( 'message', function( event ) {
  324. // Validate the origin of all messages to avoid parsing messages
  325. // that aren't meant for us. Ignore when running off file:// so
  326. // that the speaker view continues to work without a web server.
  327. if( window.location.origin !== event.origin && window.location.origin !== 'file://' ) {
  328. return
  329. }
  330. clearTimeout( connectionTimeout );
  331. connectionStatus.style.display = 'none';
  332. var data = JSON.parse( event.data );
  333. // The overview mode is only useful to the reveal.js instance
  334. // where navigation occurs so we don't sync it
  335. if( data.state ) delete data.state.overview;
  336. // Messages sent by the notes plugin inside of the main window
  337. if( data && data.namespace === 'reveal-notes' ) {
  338. if( data.type === 'connect' ) {
  339. handleConnectMessage( data );
  340. }
  341. else if( data.type === 'state' ) {
  342. handleStateMessage( data );
  343. }
  344. else if( data.type === 'return' ) {
  345. pendingCalls[data.callId](data.result);
  346. delete pendingCalls[data.callId];
  347. }
  348. }
  349. // Messages sent by the reveal.js inside of the current slide preview
  350. else if( data && data.namespace === 'reveal' ) {
  351. if( /ready/.test( data.eventName ) ) {
  352. // Send a message back to notify that the handshake is complete
  353. window.opener.postMessage( JSON.stringify({ namespace: 'reveal-notes', type: 'connected'} ), '*' );
  354. }
  355. else if( /slidechanged|fragmentshown|fragmenthidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
  356. dispatchStateToMainWindow( data.state );
  357. }
  358. }
  359. } );
  360. /**
  361. * Updates the presentation in the main window to match the state
  362. * of the presentation in the notes window.
  363. */
  364. const dispatchStateToMainWindow = debounce(( state ) => {
  365. window.opener.postMessage( JSON.stringify({ method: 'setState', args: [ state ]} ), '*' );
  366. }, 500);
  367. /**
  368. * Asynchronously calls the Reveal.js API of the main frame.
  369. */
  370. function callRevealApi( methodName, methodArguments, callback ) {
  371. var callId = ++lastRevealApiCallId;
  372. pendingCalls[callId] = callback;
  373. window.opener.postMessage( JSON.stringify( {
  374. namespace: 'reveal-notes',
  375. type: 'call',
  376. callId: callId,
  377. methodName: methodName,
  378. arguments: methodArguments
  379. } ), '*' );
  380. }
  381. /**
  382. * Called when the main window is trying to establish a
  383. * connection.
  384. */
  385. function handleConnectMessage( data ) {
  386. if( connected === false ) {
  387. connected = true;
  388. setupIframes( data );
  389. setupKeyboard();
  390. setupNotes();
  391. setupTimer();
  392. setupHeartbeat();
  393. }
  394. }
  395. /**
  396. * Called when the main window sends an updated state.
  397. */
  398. function handleStateMessage( data ) {
  399. // Store the most recently set state to avoid circular loops
  400. // applying the same state
  401. currentState = JSON.stringify( data.state );
  402. // No need for updating the notes in case of fragment changes
  403. if ( data.notes ) {
  404. notes.classList.remove( 'hidden' );
  405. notesValue.style.whiteSpace = data.whitespace;
  406. if( data.markdown ) {
  407. notesValue.innerHTML = marked( data.notes );
  408. }
  409. else {
  410. notesValue.innerHTML = data.notes;
  411. }
  412. }
  413. else {
  414. notes.classList.add( 'hidden' );
  415. }
  416. // Update the note slides
  417. currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
  418. upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ] }), '*' );
  419. upcomingSlide.contentWindow.postMessage( JSON.stringify({ method: 'next' }), '*' );
  420. }
  421. // Limit to max one state update per X ms
  422. handleStateMessage = debounce( handleStateMessage, 200 );
  423. /**
  424. * Forward keyboard events to the current slide window.
  425. * This enables keyboard events to work even if focus
  426. * isn't set on the current slide iframe.
  427. *
  428. * Block F5 default handling, it reloads and disconnects
  429. * the speaker notes window.
  430. */
  431. function setupKeyboard() {
  432. document.addEventListener( 'keydown', function( event ) {
  433. if( event.keyCode === 116 || ( event.metaKey && event.keyCode === 82 ) ) {
  434. event.preventDefault();
  435. return false;
  436. }
  437. currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' );
  438. } );
  439. }
  440. /**
  441. * Creates the preview iframes.
  442. */
  443. function setupIframes( data ) {
  444. var params = [
  445. 'receiver',
  446. 'progress=false',
  447. 'history=false',
  448. 'transition=none',
  449. 'autoSlide=0',
  450. 'backgroundTransition=none'
  451. ].join( '&' );
  452. var urlSeparator = /\\?/.test(data.url) ? '&' : '?';
  453. var hash = '#/' + data.state.indexh + '/' + data.state.indexv;
  454. var currentURL = data.url + urlSeparator + params + '&scrollActivationWidth=false&postMessageEvents=true' + hash;
  455. var upcomingURL = data.url + urlSeparator + params + '&scrollActivationWidth=false&controls=false' + hash;
  456. currentSlide = document.createElement( 'iframe' );
  457. currentSlide.setAttribute( 'width', 1280 );
  458. currentSlide.setAttribute( 'height', 1024 );
  459. currentSlide.setAttribute( 'src', currentURL );
  460. document.querySelector( '#current-slide' ).appendChild( currentSlide );
  461. upcomingSlide = document.createElement( 'iframe' );
  462. upcomingSlide.setAttribute( 'width', 640 );
  463. upcomingSlide.setAttribute( 'height', 512 );
  464. upcomingSlide.setAttribute( 'src', upcomingURL );
  465. document.querySelector( '#upcoming-slide' ).appendChild( upcomingSlide );
  466. }
  467. /**
  468. * Setup the notes UI.
  469. */
  470. function setupNotes() {
  471. notes = document.querySelector( '.speaker-controls-notes' );
  472. notesValue = document.querySelector( '.speaker-controls-notes .value' );
  473. }
  474. /**
  475. * We send out a heartbeat at all times to ensure we can
  476. * reconnect with the main presentation window after reloads.
  477. */
  478. function setupHeartbeat() {
  479. setInterval( () => {
  480. window.opener.postMessage( JSON.stringify({ namespace: 'reveal-notes', type: 'heartbeat'} ), '*' );
  481. }, 1000 );
  482. }
  483. function getTimings( callback ) {
  484. callRevealApi( 'getSlidesAttributes', [], function ( slideAttributes ) {
  485. callRevealApi( 'getConfig', [], function ( config ) {
  486. var totalTime = config.totalTime;
  487. var minTimePerSlide = config.minimumTimePerSlide || 0;
  488. var defaultTiming = config.defaultTiming;
  489. if ((defaultTiming == null) && (totalTime == null)) {
  490. callback(null);
  491. return;
  492. }
  493. // Setting totalTime overrides defaultTiming
  494. if (totalTime) {
  495. defaultTiming = 0;
  496. }
  497. var timings = [];
  498. for ( var i in slideAttributes ) {
  499. var slide = slideAttributes[ i ];
  500. var timing = defaultTiming;
  501. if( slide.hasOwnProperty( 'data-timing' )) {
  502. var t = slide[ 'data-timing' ];
  503. timing = parseInt(t);
  504. if( isNaN(timing) ) {
  505. console.warn("Could not parse timing '" + t + "' of slide " + i + "; using default of " + defaultTiming);
  506. timing = defaultTiming;
  507. }
  508. }
  509. timings.push(timing);
  510. }
  511. if ( totalTime ) {
  512. // After we've allocated time to individual slides, we summarize it and
  513. // subtract it from the total time
  514. var remainingTime = totalTime - timings.reduce( function(a, b) { return a + b; }, 0 );
  515. // The remaining time is divided by the number of slides that have 0 seconds
  516. // allocated at the moment, giving the average time-per-slide on the remaining slides
  517. var remainingSlides = (timings.filter( function(x) { return x == 0 }) ).length
  518. var timePerSlide = Math.round( remainingTime / remainingSlides, 0 )
  519. // And now we replace every zero-value timing with that average
  520. timings = timings.map( function(x) { return (x==0 ? timePerSlide : x) } );
  521. }
  522. var slidesUnderMinimum = timings.filter( function(x) { return (x < minTimePerSlide) } ).length
  523. if ( slidesUnderMinimum ) {
  524. 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).";
  525. alert(message);
  526. }
  527. callback( timings );
  528. } );
  529. } );
  530. }
  531. /**
  532. * Return the number of seconds allocated for presenting
  533. * all slides up to and including this one.
  534. */
  535. function getTimeAllocated( timings, callback ) {
  536. callRevealApi( 'getSlidePastCount', [], function ( currentSlide ) {
  537. var allocated = 0;
  538. for (var i in timings.slice(0, currentSlide + 1)) {
  539. allocated += timings[i];
  540. }
  541. callback( allocated );
  542. } );
  543. }
  544. /**
  545. * Create the timer and clock and start updating them
  546. * at an interval.
  547. */
  548. function setupTimer() {
  549. var start = new Date(),
  550. timeEl = document.querySelector( '.speaker-controls-time' ),
  551. clockEl = timeEl.querySelector( '.clock-value' ),
  552. hoursEl = timeEl.querySelector( '.hours-value' ),
  553. minutesEl = timeEl.querySelector( '.minutes-value' ),
  554. secondsEl = timeEl.querySelector( '.seconds-value' ),
  555. pacingTitleEl = timeEl.querySelector( '.pacing-title' ),
  556. pacingEl = timeEl.querySelector( '.pacing' ),
  557. pacingHoursEl = pacingEl.querySelector( '.hours-value' ),
  558. pacingMinutesEl = pacingEl.querySelector( '.minutes-value' ),
  559. pacingSecondsEl = pacingEl.querySelector( '.seconds-value' );
  560. var timings = null;
  561. getTimings( function ( _timings ) {
  562. timings = _timings;
  563. if (_timings !== null) {
  564. pacingTitleEl.style.removeProperty('display');
  565. pacingEl.style.removeProperty('display');
  566. }
  567. // Update once directly
  568. _updateTimer();
  569. // Then update every second
  570. setInterval( _updateTimer, 1000 );
  571. } );
  572. function _resetTimer() {
  573. if (timings == null) {
  574. start = new Date();
  575. _updateTimer();
  576. }
  577. else {
  578. // Reset timer to beginning of current slide
  579. getTimeAllocated( timings, function ( slideEndTimingSeconds ) {
  580. var slideEndTiming = slideEndTimingSeconds * 1000;
  581. callRevealApi( 'getSlidePastCount', [], function ( currentSlide ) {
  582. var currentSlideTiming = timings[currentSlide] * 1000;
  583. var previousSlidesTiming = slideEndTiming - currentSlideTiming;
  584. var now = new Date();
  585. start = new Date(now.getTime() - previousSlidesTiming);
  586. _updateTimer();
  587. } );
  588. } );
  589. }
  590. }
  591. timeEl.addEventListener( 'click', function() {
  592. _resetTimer();
  593. return false;
  594. } );
  595. function _displayTime( hrEl, minEl, secEl, time) {
  596. var sign = Math.sign(time) == -1 ? "-" : "";
  597. time = Math.abs(Math.round(time / 1000));
  598. var seconds = time % 60;
  599. var minutes = Math.floor( time / 60 ) % 60 ;
  600. var hours = Math.floor( time / ( 60 * 60 )) ;
  601. hrEl.innerHTML = sign + zeroPadInteger( hours );
  602. if (hours == 0) {
  603. hrEl.classList.add( 'mute' );
  604. }
  605. else {
  606. hrEl.classList.remove( 'mute' );
  607. }
  608. minEl.innerHTML = ':' + zeroPadInteger( minutes );
  609. if (hours == 0 && minutes == 0) {
  610. minEl.classList.add( 'mute' );
  611. }
  612. else {
  613. minEl.classList.remove( 'mute' );
  614. }
  615. secEl.innerHTML = ':' + zeroPadInteger( seconds );
  616. }
  617. function _updateTimer() {
  618. var diff, hours, minutes, seconds,
  619. now = new Date();
  620. diff = now.getTime() - start.getTime();
  621. clockEl.innerHTML = now.toLocaleTimeString( 'en-US', { hour12: true, hour: '2-digit', minute:'2-digit' } );
  622. _displayTime( hoursEl, minutesEl, secondsEl, diff );
  623. if (timings !== null) {
  624. _updatePacing(diff);
  625. }
  626. }
  627. function _updatePacing(diff) {
  628. getTimeAllocated( timings, function ( slideEndTimingSeconds ) {
  629. var slideEndTiming = slideEndTimingSeconds * 1000;
  630. callRevealApi( 'getSlidePastCount', [], function ( currentSlide ) {
  631. var currentSlideTiming = timings[currentSlide] * 1000;
  632. var timeLeftCurrentSlide = slideEndTiming - diff;
  633. if (timeLeftCurrentSlide < 0) {
  634. pacingEl.className = 'pacing behind';
  635. }
  636. else if (timeLeftCurrentSlide < currentSlideTiming) {
  637. pacingEl.className = 'pacing on-track';
  638. }
  639. else {
  640. pacingEl.className = 'pacing ahead';
  641. }
  642. _displayTime( pacingHoursEl, pacingMinutesEl, pacingSecondsEl, timeLeftCurrentSlide );
  643. } );
  644. } );
  645. }
  646. }
  647. /**
  648. * Sets up the speaker view layout and layout selector.
  649. */
  650. function setupLayout() {
  651. layoutDropdown = document.querySelector( '.speaker-layout-dropdown' );
  652. layoutLabel = document.querySelector( '.speaker-layout-label' );
  653. // Render the list of available layouts
  654. for( var id in SPEAKER_LAYOUTS ) {
  655. var option = document.createElement( 'option' );
  656. option.setAttribute( 'value', id );
  657. option.textContent = SPEAKER_LAYOUTS[ id ];
  658. layoutDropdown.appendChild( option );
  659. }
  660. // Monitor the dropdown for changes
  661. layoutDropdown.addEventListener( 'change', function( event ) {
  662. setLayout( layoutDropdown.value );
  663. }, false );
  664. // Restore any currently persisted layout
  665. setLayout( getLayout() );
  666. }
  667. /**
  668. * Sets a new speaker view layout. The layout is persisted
  669. * in local storage.
  670. */
  671. function setLayout( value ) {
  672. var title = SPEAKER_LAYOUTS[ value ];
  673. layoutLabel.innerHTML = 'Layout' + ( title ? ( ': ' + title ) : '' );
  674. layoutDropdown.value = value;
  675. document.body.setAttribute( 'data-speaker-layout', value );
  676. // Persist locally
  677. if( supportsLocalStorage() ) {
  678. window.localStorage.setItem( 'reveal-speaker-layout', value );
  679. }
  680. }
  681. /**
  682. * Returns the ID of the most recently set speaker layout
  683. * or our default layout if none has been set.
  684. */
  685. function getLayout() {
  686. if( supportsLocalStorage() ) {
  687. var layout = window.localStorage.getItem( 'reveal-speaker-layout' );
  688. if( layout ) {
  689. return layout;
  690. }
  691. }
  692. // Default to the first record in the layouts hash
  693. for( var id in SPEAKER_LAYOUTS ) {
  694. return id;
  695. }
  696. }
  697. function supportsLocalStorage() {
  698. try {
  699. localStorage.setItem('test', 'test');
  700. localStorage.removeItem('test');
  701. return true;
  702. }
  703. catch( e ) {
  704. return false;
  705. }
  706. }
  707. function zeroPadInteger( num ) {
  708. var str = '00' + parseInt( num );
  709. return str.substring( str.length - 2 );
  710. }
  711. /**
  712. * Limits the frequency at which a function can be called.
  713. */
  714. function debounce( fn, ms ) {
  715. var lastTime = 0,
  716. timeout;
  717. return function() {
  718. var args = arguments;
  719. var context = this;
  720. clearTimeout( timeout );
  721. var timeSinceLastCall = Date.now() - lastTime;
  722. if( timeSinceLastCall > ms ) {
  723. fn.apply( context, args );
  724. lastTime = Date.now();
  725. }
  726. else {
  727. timeout = setTimeout( function() {
  728. fn.apply( context, args );
  729. lastTime = Date.now();
  730. }, ms - timeSinceLastCall );
  731. }
  732. }
  733. }
  734. })();
  735. <\/script>
  736. </body>
  737. </html>`;function T(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let _=T();function tt(l){_=l}const U=/[&<>"']/,et=new RegExp(U.source,"g"),B=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,nt=new RegExp(B.source,"g"),it={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Z=l=>it[l];function v(l,n){if(n){if(U.test(l))return l.replace(et,Z)}else if(B.test(l))return l.replace(nt,Z);return l}const st=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(l){return l.replace(st,(n,e)=>(e=e.toLowerCase(),e==="colon"?":":e.charAt(0)==="#"?e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}const rt=/(^|[^\[])\^/g;function k(l,n){l=typeof l=="string"?l:l.source,n=n||"";const e={replace:(t,i)=>(i=i.source||i,i=i.replace(rt,"$1"),l=l.replace(t,i),e),getRegex:()=>new RegExp(l,n)};return e}const at=/[^\w:]/g,lt=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function j(l,n,e){if(l){let t;try{t=decodeURIComponent(H(e)).replace(at,"").toLowerCase()}catch{return null}if(t.indexOf("javascript:")===0||t.indexOf("vbscript:")===0||t.indexOf("data:")===0)return null}n&&!lt.test(e)&&(e=pt(n,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const M={},ot=/^[^:]+:\/*[^/]*$/,ct=/^([^:]+:)[\s\S]*$/,ut=/^([^:]+:\/*[^/]*)[\s\S]*$/;function pt(l,n){M[" "+l]||(ot.test(l)?M[" "+l]=l+"/":M[" "+l]=P(l,"/",!0)),l=M[" "+l];const e=l.indexOf(":")===-1;return n.substring(0,2)==="//"?e?n:l.replace(ct,"$1")+n:n.charAt(0)==="/"?e?n:l.replace(ut,"$1")+n:l+n}const N={exec:function(){}};function J(l,n){const e=l.replace(/\|/g,(s,a,r)=>{let u=!1,m=a;for(;--m>=0&&r[m]==="\\";)u=!u;return u?"|":" |"}),t=e.split(/ \|/);let i=0;if(t[0].trim()||t.shift(),t.length>0&&!t[t.length-1].trim()&&t.pop(),t.length>n)t.splice(n);else for(;t.length<n;)t.push("");for(;i<t.length;i++)t[i]=t[i].trim().replace(/\\\|/g,"|");return t}function P(l,n,e){const t=l.length;if(t===0)return"";let i=0;for(;i<t;){const s=l.charAt(t-i-1);if(s===n&&!e)i++;else if(s!==n&&e)i++;else break}return l.slice(0,t-i)}function dt(l,n){if(l.indexOf(n[1])===-1)return-1;const e=l.length;let t=0,i=0;for(;i<e;i++)if(l[i]==="\\")i++;else if(l[i]===n[0])t++;else if(l[i]===n[1]&&(t--,t<0))return i;return-1}function ht(l){l&&l.sanitize&&!l.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function W(l,n){if(n<1)return"";let e="";for(;n>1;)n&1&&(e+=l),n>>=1,l+=l;return e+l}function Q(l,n,e,t){const i=n.href,s=n.title?v(n.title):null,a=l[1].replace(/\\([\[\]])/g,"$1");if(l[0].charAt(0)!=="!"){t.state.inLink=!0;const r={type:"link",raw:e,href:i,title:s,text:a,tokens:t.inlineTokens(a)};return t.state.inLink=!1,r}return{type:"image",raw:e,href:i,title:s,text:v(a)}}function gt(l,n){const e=l.match(/^(\s+)(?:```)/);if(e===null)return n;const t=e[1];return n.split(`
  738. `).map(i=>{const s=i.match(/^\s+/);if(s===null)return i;const[a]=s;return a.length>=t.length?i.slice(t.length):i}).join(`
  739. `)}class O{constructor(n){this.options=n||_}space(n){const e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){const e=this.rules.block.code.exec(n);if(e){const t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:P(t,`
  740. `)}}}fences(n){const e=this.rules.block.fences.exec(n);if(e){const t=e[0],i=gt(t,e[3]||"");return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline._escapes,"$1"):e[2],text:i}}}heading(n){const e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(/#$/.test(t)){const i=P(t,"#");(this.options.pedantic||!i||/ $/.test(i))&&(t=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){const e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:e[0]}}blockquote(n){const e=this.rules.block.blockquote.exec(n);if(e){const t=e[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(t);return this.lexer.state.top=i,{type:"blockquote",raw:e[0],tokens:s,text:t}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t,i,s,a,r,u,m,f,d,p,o,x,b=e[1].trim();const S=b.length>1,w={type:"list",raw:"",ordered:S,start:S?+b.slice(0,-1):"",loose:!1,items:[]};b=S?`\\d{1,9}\\${b.slice(-1)}`:`\\${b}`,this.options.pedantic&&(b=S?b:"[*+-]");const y=new RegExp(`^( {0,3}${b})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;n&&(x=!1,!(!(e=y.exec(n))||this.rules.block.hr.test(n)));){if(t=e[0],n=n.substring(t.length),f=e[2].split(`
  741. `,1)[0].replace(/^\t+/,A=>" ".repeat(3*A.length)),d=n.split(`
  742. `,1)[0],this.options.pedantic?(a=2,o=f.trimLeft()):(a=e[2].search(/[^ ]/),a=a>4?1:a,o=f.slice(a),a+=e[1].length),u=!1,!f&&/^ *$/.test(d)&&(t+=d+`
  743. `,n=n.substring(d.length+1),x=!0),!x){const A=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),$=new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),E=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),C=new RegExp(`^ {0,${Math.min(3,a-1)}}#`);for(;n&&(p=n.split(`
  744. `,1)[0],d=p,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(E.test(d)||C.test(d)||A.test(d)||$.test(n)));){if(d.search(/[^ ]/)>=a||!d.trim())o+=`
  745. `+d.slice(a);else{if(u||f.search(/[^ ]/)>=4||E.test(f)||C.test(f)||$.test(f))break;o+=`
  746. `+d}!u&&!d.trim()&&(u=!0),t+=p+`
  747. `,n=n.substring(p.length+1),f=d.slice(a)}}w.loose||(m?w.loose=!0:/\n *\n *$/.test(t)&&(m=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(o),i&&(s=i[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),w.items.push({type:"list_item",raw:t,task:!!i,checked:s,loose:!1,text:o}),w.raw+=t}w.items[w.items.length-1].raw=t.trimRight(),w.items[w.items.length-1].text=o.trimRight(),w.raw=w.raw.trimRight();const I=w.items.length;for(r=0;r<I;r++)if(this.lexer.state.top=!1,w.items[r].tokens=this.lexer.blockTokens(w.items[r].text,[]),!w.loose){const A=w.items[r].tokens.filter(E=>E.type==="space"),$=A.length>0&&A.some(E=>/\n.*\n/.test(E.raw));w.loose=$}if(w.loose)for(r=0;r<I;r++)w.items[r].loose=!0;return w}}html(n){const e=this.rules.block.html.exec(n);if(e){const t={type:"html",raw:e[0],pre:!this.options.sanitizer&&(e[1]==="pre"||e[1]==="script"||e[1]==="style"),text:e[0]};if(this.options.sanitize){const i=this.options.sanitizer?this.options.sanitizer(e[0]):v(e[0]);t.type="paragraph",t.text=i,t.tokens=this.lexer.inline(i)}return t}}def(n){const e=this.rules.block.def.exec(n);if(e){const t=e[1].toLowerCase().replace(/\s+/g," "),i=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline._escapes,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:i,title:s}}}table(n){const e=this.rules.block.table.exec(n);if(e){const t={type:"table",header:J(e[1]).map(i=>({text:i})),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
  748. `):[]};if(t.header.length===t.align.length){t.raw=e[0];let i=t.align.length,s,a,r,u;for(s=0;s<i;s++)/^ *-+: *$/.test(t.align[s])?t.align[s]="right":/^ *:-+: *$/.test(t.align[s])?t.align[s]="center":/^ *:-+ *$/.test(t.align[s])?t.align[s]="left":t.align[s]=null;for(i=t.rows.length,s=0;s<i;s++)t.rows[s]=J(t.rows[s],t.header.length).map(m=>({text:m}));for(i=t.header.length,a=0;a<i;a++)t.header[a].tokens=this.lexer.inline(t.header[a].text);for(i=t.rows.length,a=0;a<i;a++)for(u=t.rows[a],r=0;r<u.length;r++)u[r].tokens=this.lexer.inline(u[r].text);return t}}}lheading(n){const e=this.rules.block.lheading.exec(n);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(n){const e=this.rules.block.paragraph.exec(n);if(e){const t=e[1].charAt(e[1].length-1)===`
  749. `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){const e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){const e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:v(e[1])}}tag(n){const e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):v(e[0]):e[0]}}link(n){const e=this.rules.inline.link.exec(n);if(e){const t=e[2].trim();if(!this.options.pedantic&&/^</.test(t)){if(!/>$/.test(t))return;const a=P(t.slice(0,-1),"\\");if((t.length-a.length)%2===0)return}else{const a=dt(e[2],"()");if(a>-1){const u=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,u).trim(),e[3]=""}}let i=e[2],s="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],s=a[3])}else s=e[3]?e[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(t)?i=i.slice(1):i=i.slice(1,-1)),Q(e,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:s&&s.replace(this.rules.inline._escapes,"$1")},e[0],this.lexer)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let i=(t[2]||t[1]).replace(/\s+/g," ");if(i=e[i.toLowerCase()],!i){const s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return Q(t,i,t[0],this.lexer)}}emStrong(n,e,t=""){let i=this.rules.inline.emStrong.lDelim.exec(n);if(!i||i[3]&&t.match(/[\p{L}\p{N}]/u))return;const s=i[1]||i[2]||"";if(!s||s&&(t===""||this.rules.inline.punctuation.exec(t))){const a=i[0].length-1;let r,u,m=a,f=0;const d=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(d.lastIndex=0,e=e.slice(-1*n.length+a);(i=d.exec(e))!=null;){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(u=r.length,i[3]||i[4]){m+=u;continue}else if((i[5]||i[6])&&a%3&&!((a+u)%3)){f+=u;continue}if(m-=u,m>0)continue;u=Math.min(u,u+m+f);const p=n.slice(0,a+i.index+(i[0].length-r.length)+u);if(Math.min(a,u)%2){const x=p.slice(1,-1);return{type:"em",raw:p,text:x,tokens:this.lexer.inlineTokens(x)}}const o=p.slice(2,-2);return{type:"strong",raw:p,text:o,tokens:this.lexer.inlineTokens(o)}}}}codespan(n){const e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(/\n/g," ");const i=/[^ ]/.test(t),s=/^ /.test(t)&&/ $/.test(t);return i&&s&&(t=t.substring(1,t.length-1)),t=v(t,!0),{type:"codespan",raw:e[0],text:t}}}br(n){const e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){const e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n,e){const t=this.rules.inline.autolink.exec(n);if(t){let i,s;return t[2]==="@"?(i=v(this.options.mangle?e(t[1]):t[1]),s="mailto:"+i):(i=v(t[1]),s=i),{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(n,e){let t;if(t=this.rules.inline.url.exec(n)){let i,s;if(t[2]==="@")i=v(this.options.mangle?e(t[0]):t[0]),s="mailto:"+i;else{let a;do a=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])[0];while(a!==t[0]);i=v(t[0]),t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(n,e){const t=this.rules.inline.text.exec(n);if(t){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):v(t[0]):t[0]:i=v(this.options.smartypants?e(t[0]):t[0]),{type:"text",raw:t[0],text:i}}}}const h={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {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|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:N,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};h._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/,h._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,h.def=k(h.def).replace("label",h._label).replace("title",h._title).getRegex(),h.bullet=/(?:[*+-]|\d{1,9}[.)])/,h.listItemStart=k(/^( *)(bull) */).replace("bull",h.bullet).getRegex(),h.list=k(h.list).replace(/bull/g,h.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+h.def.source+")").getRegex(),h._tag="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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",h._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,h.html=k(h.html,"i").replace("comment",h._comment).replace("tag",h._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),h.paragraph=k(h._paragraph).replace("hr",h.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",h._tag).getRegex(),h.blockquote=k(h.blockquote).replace("paragraph",h.paragraph).getRegex(),h.normal={...h},h.gfm={...h.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"},h.gfm.table=k(h.gfm.table).replace("hr",h.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",h._tag).getRegex(),h.gfm.paragraph=k(h._paragraph).replace("hr",h.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",h.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",h._tag).getRegex(),h.pedantic={...h.normal,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",h._comment).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:N,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(h.normal._paragraph).replace("hr",h.hr).replace("heading",` *#{1,6} *[^
  750. ]`).replace("lheading",h.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const c={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:N,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:N,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};c._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",c.punctuation=k(c.punctuation).replace(/punctuation/g,c._punctuation).getRegex(),c.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,c.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,c._comment=k(h._comment).replace("(?:-->|$)","-->").getRegex(),c.emStrong.lDelim=k(c.emStrong.lDelim).replace(/punct/g,c._punctuation).getRegex(),c.emStrong.rDelimAst=k(c.emStrong.rDelimAst,"g").replace(/punct/g,c._punctuation).getRegex(),c.emStrong.rDelimUnd=k(c.emStrong.rDelimUnd,"g").replace(/punct/g,c._punctuation).getRegex(),c._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,c._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,c._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])?)+(?![-_])/,c.autolink=k(c.autolink).replace("scheme",c._scheme).replace("email",c._email).getRegex(),c._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,c.tag=k(c.tag).replace("comment",c._comment).replace("attribute",c._attribute).getRegex(),c._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,c._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,c._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,c.link=k(c.link).replace("label",c._label).replace("href",c._href).replace("title",c._title).getRegex(),c.reflink=k(c.reflink).replace("label",c._label).replace("ref",h._label).getRegex(),c.nolink=k(c.nolink).replace("ref",h._label).getRegex(),c.reflinkSearch=k(c.reflinkSearch,"g").replace("reflink",c.reflink).replace("nolink",c.nolink).getRegex(),c.normal={...c},c.pedantic={...c.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",c._label).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",c._label).getRegex()},c.gfm={...c.normal,escape:k(c.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},c.gfm.url=k(c.gfm.url,"i").replace("email",c.gfm._extended_email).getRegex(),c.breaks={...c.gfm,br:k(c.br).replace("{2,}","*").getRegex(),text:k(c.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};function ft(l){return l.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function K(l){let n="",e,t;const i=l.length;for(e=0;e<i;e++)t=l.charCodeAt(e),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n}class R{constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||_,this.options.tokenizer=this.options.tokenizer||new O,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const e={block:h.normal,inline:c.normal};this.options.pedantic?(e.block=h.pedantic,e.inline=c.pedantic):this.options.gfm&&(e.block=h.gfm,this.options.breaks?e.inline=c.breaks:e.inline=c.gfm),this.tokenizer.rules=e}static get rules(){return{block:h,inline:c}}static lex(n,e){return new R(e).lex(n)}static lexInline(n,e){return new R(e).inlineTokens(n)}lex(n){n=n.replace(/\r\n|\r/g,`
  751. `),this.blockTokens(n,this.tokens);let e;for(;e=this.inlineQueue.shift();)this.inlineTokens(e.src,e.tokens);return this.tokens}blockTokens(n,e=[]){this.options.pedantic?n=n.replace(/\t/g," ").replace(/^ +$/gm,""):n=n.replace(/^( *)(\t+)/gm,(r,u,m)=>u+" ".repeat(m.length));let t,i,s,a;for(;n;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>(t=r.call({lexer:this},n,e))?(n=n.substring(t.raw.length),e.push(t),!0):!1))){if(t=this.tokenizer.space(n)){n=n.substring(t.raw.length),t.raw.length===1&&e.length>0?e[e.length-1].raw+=`
  752. `:e.push(t);continue}if(t=this.tokenizer.code(n)){n=n.substring(t.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
  753. `+t.raw,i.text+=`
  754. `+t.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(t);continue}if(t=this.tokenizer.fences(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.heading(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.hr(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.blockquote(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.list(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.html(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.def(n)){n=n.substring(t.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
  755. `+t.raw,i.text+=`
  756. `+t.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[t.tag]||(this.tokens.links[t.tag]={href:t.href,title:t.title});continue}if(t=this.tokenizer.table(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.lheading(n)){n=n.substring(t.raw.length),e.push(t);continue}if(s=n,this.options.extensions&&this.options.extensions.startBlock){let r=1/0;const u=n.slice(1);let m;this.options.extensions.startBlock.forEach(function(f){m=f.call({lexer:this},u),typeof m=="number"&&m>=0&&(r=Math.min(r,m))}),r<1/0&&r>=0&&(s=n.substring(0,r+1))}if(this.state.top&&(t=this.tokenizer.paragraph(s))){i=e[e.length-1],a&&i.type==="paragraph"?(i.raw+=`
  757. `+t.raw,i.text+=`
  758. `+t.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(t),a=s.length!==n.length,n=n.substring(t.raw.length);continue}if(t=this.tokenizer.text(n)){n=n.substring(t.raw.length),i=e[e.length-1],i&&i.type==="text"?(i.raw+=`
  759. `+t.raw,i.text+=`
  760. `+t.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(t);continue}if(n){const r="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,e}inline(n,e=[]){return this.inlineQueue.push({src:n,tokens:e}),e}inlineTokens(n,e=[]){let t,i,s,a=n,r,u,m;if(this.tokens.links){const f=Object.keys(this.tokens.links);if(f.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)f.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,r.index)+"["+W("a",r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,r.index)+"["+W("a",r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.escapedEmSt.exec(a))!=null;)a=a.slice(0,r.index+r[0].length-2)+"++"+a.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;n;)if(u||(m=""),u=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(f=>(t=f.call({lexer:this},n,e))?(n=n.substring(t.raw.length),e.push(t),!0):!1))){if(t=this.tokenizer.escape(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.tag(n)){n=n.substring(t.raw.length),i=e[e.length-1],i&&t.type==="text"&&i.type==="text"?(i.raw+=t.raw,i.text+=t.text):e.push(t);continue}if(t=this.tokenizer.link(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(t.raw.length),i=e[e.length-1],i&&t.type==="text"&&i.type==="text"?(i.raw+=t.raw,i.text+=t.text):e.push(t);continue}if(t=this.tokenizer.emStrong(n,a,m)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.codespan(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.br(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.del(n)){n=n.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.autolink(n,K)){n=n.substring(t.raw.length),e.push(t);continue}if(!this.state.inLink&&(t=this.tokenizer.url(n,K))){n=n.substring(t.raw.length),e.push(t);continue}if(s=n,this.options.extensions&&this.options.extensions.startInline){let f=1/0;const d=n.slice(1);let p;this.options.extensions.startInline.forEach(function(o){p=o.call({lexer:this},d),typeof p=="number"&&p>=0&&(f=Math.min(f,p))}),f<1/0&&f>=0&&(s=n.substring(0,f+1))}if(t=this.tokenizer.inlineText(s,ft)){n=n.substring(t.raw.length),t.raw.slice(-1)!=="_"&&(m=t.raw.slice(-1)),u=!0,i=e[e.length-1],i&&i.type==="text"?(i.raw+=t.raw,i.text+=t.text):e.push(t);continue}if(n){const f="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return e}}class D{constructor(n){this.options=n||_}code(n,e,t){const i=(e||"").match(/\S*/)[0];if(this.options.highlight){const s=this.options.highlight(n,i);s!=null&&s!==n&&(t=!0,n=s)}return n=n.replace(/\n$/,"")+`
  761. `,i?'<pre><code class="'+this.options.langPrefix+v(i)+'">'+(t?n:v(n,!0))+`</code></pre>
  762. `:"<pre><code>"+(t?n:v(n,!0))+`</code></pre>
  763. `}blockquote(n){return`<blockquote>
  764. ${n}</blockquote>
  765. `}html(n){return n}heading(n,e,t,i){if(this.options.headerIds){const s=this.options.headerPrefix+i.slug(t);return`<h${e} id="${s}">${n}</h${e}>
  766. `}return`<h${e}>${n}</h${e}>
  767. `}hr(){return this.options.xhtml?`<hr/>
  768. `:`<hr>
  769. `}list(n,e,t){const i=e?"ol":"ul",s=e&&t!==1?' start="'+t+'"':"";return"<"+i+s+`>
  770. `+n+"</"+i+`>
  771. `}listitem(n){return`<li>${n}</li>
  772. `}checkbox(n){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(n){return`<p>${n}</p>
  773. `}table(n,e){return e&&(e=`<tbody>${e}</tbody>`),`<table>
  774. <thead>
  775. `+n+`</thead>
  776. `+e+`</table>
  777. `}tablerow(n){return`<tr>
  778. ${n}</tr>
  779. `}tablecell(n,e){const t=e.header?"th":"td";return(e.align?`<${t} align="${e.align}">`:`<${t}>`)+n+`</${t}>
  780. `}strong(n){return`<strong>${n}</strong>`}em(n){return`<em>${n}</em>`}codespan(n){return`<code>${n}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(n){return`<del>${n}</del>`}link(n,e,t){if(n=j(this.options.sanitize,this.options.baseUrl,n),n===null)return t;let i='<a href="'+n+'"';return e&&(i+=' title="'+e+'"'),i+=">"+t+"</a>",i}image(n,e,t){if(n=j(this.options.sanitize,this.options.baseUrl,n),n===null)return t;let i=`<img src="${n}" alt="${t}"`;return e&&(i+=` title="${e}"`),i+=this.options.xhtml?"/>":">",i}text(n){return n}}class V{strong(n){return n}em(n){return n}codespan(n){return n}del(n){return n}html(n){return n}text(n){return n}link(n,e,t){return""+t}image(n,e,t){return""+t}br(){return""}}class F{constructor(){this.seen={}}serialize(n){return n.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(n,e){let t=n,i=0;if(this.seen.hasOwnProperty(t)){i=this.seen[n];do i++,t=n+"-"+i;while(this.seen.hasOwnProperty(t))}return e||(this.seen[n]=i,this.seen[t]=0),t}slug(n,e={}){const t=this.serialize(n);return this.getNextSafeSlug(t,e.dryrun)}}class L{constructor(n){this.options=n||_,this.options.renderer=this.options.renderer||new D,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new V,this.slugger=new F}static parse(n,e){return new L(e).parse(n)}static parseInline(n,e){return new L(e).parseInline(n)}parse(n,e=!0){let t="",i,s,a,r,u,m,f,d,p,o,x,b,S,w,y,I,A,$,E;const C=n.length;for(i=0;i<C;i++){if(o=n[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]&&(E=this.options.extensions.renderers[o.type].call({parser:this},o),E!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type))){t+=E||"";continue}switch(o.type){case"space":continue;case"hr":{t+=this.renderer.hr();continue}case"heading":{t+=this.renderer.heading(this.parseInline(o.tokens),o.depth,H(this.parseInline(o.tokens,this.textRenderer)),this.slugger);continue}case"code":{t+=this.renderer.code(o.text,o.lang,o.escaped);continue}case"table":{for(d="",f="",r=o.header.length,s=0;s<r;s++)f+=this.renderer.tablecell(this.parseInline(o.header[s].tokens),{header:!0,align:o.align[s]});for(d+=this.renderer.tablerow(f),p="",r=o.rows.length,s=0;s<r;s++){for(m=o.rows[s],f="",u=m.length,a=0;a<u;a++)f+=this.renderer.tablecell(this.parseInline(m[a].tokens),{header:!1,align:o.align[a]});p+=this.renderer.tablerow(f)}t+=this.renderer.table(d,p);continue}case"blockquote":{p=this.parse(o.tokens),t+=this.renderer.blockquote(p);continue}case"list":{for(x=o.ordered,b=o.start,S=o.loose,r=o.items.length,p="",s=0;s<r;s++)y=o.items[s],I=y.checked,A=y.task,w="",y.task&&($=this.renderer.checkbox(I),S?y.tokens.length>0&&y.tokens[0].type==="paragraph"?(y.tokens[0].text=$+" "+y.tokens[0].text,y.tokens[0].tokens&&y.tokens[0].tokens.length>0&&y.tokens[0].tokens[0].type==="text"&&(y.tokens[0].tokens[0].text=$+" "+y.tokens[0].tokens[0].text)):y.tokens.unshift({type:"text",text:$}):w+=$),w+=this.parse(y.tokens,S),p+=this.renderer.listitem(w,A,I);t+=this.renderer.list(p,x,b);continue}case"html":{t+=this.renderer.html(o.text);continue}case"paragraph":{t+=this.renderer.paragraph(this.parseInline(o.tokens));continue}case"text":{for(p=o.tokens?this.parseInline(o.tokens):o.text;i+1<C&&n[i+1].type==="text";)o=n[++i],p+=`
  781. `+(o.tokens?this.parseInline(o.tokens):o.text);t+=e?this.renderer.paragraph(p):p;continue}default:{const X='Token with "'+o.type+'" type was not found.';if(this.options.silent){console.error(X);return}else throw new Error(X)}}}return t}parseInline(n,e){e=e||this.renderer;let t="",i,s,a;const r=n.length;for(i=0;i<r;i++){if(s=n[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]&&(a=this.options.extensions.renderers[s.type].call({parser:this},s),a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type))){t+=a||"";continue}switch(s.type){case"escape":{t+=e.text(s.text);break}case"html":{t+=e.html(s.text);break}case"link":{t+=e.link(s.href,s.title,this.parseInline(s.tokens,e));break}case"image":{t+=e.image(s.href,s.title,s.text);break}case"strong":{t+=e.strong(this.parseInline(s.tokens,e));break}case"em":{t+=e.em(this.parseInline(s.tokens,e));break}case"codespan":{t+=e.codespan(s.text);break}case"br":{t+=e.br();break}case"del":{t+=e.del(this.parseInline(s.tokens,e));break}case"text":{t+=e.text(s.text);break}default:{const u='Token with "'+s.type+'" type was not found.';if(this.options.silent){console.error(u);return}else throw new Error(u)}}}return t}}class q{constructor(n){this.options=n||_}preprocess(n){return n}postprocess(n){return n}}G(q,"passThroughHooks",new Set(["preprocess","postprocess"]));function mt(l,n,e){return t=>{if(t.message+=`
  782. Please report this to https://github.com/markedjs/marked.`,l){const i="<p>An error occurred:</p><pre>"+v(t.message+"",!0)+"</pre>";if(n)return Promise.resolve(i);if(e){e(null,i);return}return i}if(n)return Promise.reject(t);if(e){e(t);return}throw t}}function Y(l,n){return(e,t,i)=>{typeof t=="function"&&(i=t,t=null);const s={...t};t={...g.defaults,...s};const a=mt(t.silent,t.async,i);if(typeof e>"u"||e===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(ht(t),t.hooks&&(t.hooks.options=t),i){const r=t.highlight;let u;try{t.hooks&&(e=t.hooks.preprocess(e)),u=l(e,t)}catch(d){return a(d)}const m=function(d){let p;if(!d)try{t.walkTokens&&g.walkTokens(u,t.walkTokens),p=n(u,t),t.hooks&&(p=t.hooks.postprocess(p))}catch(o){d=o}return t.highlight=r,d?a(d):i(null,p)};if(!r||r.length<3||(delete t.highlight,!u.length))return m();let f=0;g.walkTokens(u,function(d){d.type==="code"&&(f++,setTimeout(()=>{r(d.text,d.lang,function(p,o){if(p)return m(p);o!=null&&o!==d.text&&(d.text=o,d.escaped=!0),f--,f===0&&m()})},0))}),f===0&&m();return}if(t.async)return Promise.resolve(t.hooks?t.hooks.preprocess(e):e).then(r=>l(r,t)).then(r=>t.walkTokens?Promise.all(g.walkTokens(r,t.walkTokens)).then(()=>r):r).then(r=>n(r,t)).then(r=>t.hooks?t.hooks.postprocess(r):r).catch(a);try{t.hooks&&(e=t.hooks.preprocess(e));const r=l(e,t);t.walkTokens&&g.walkTokens(r,t.walkTokens);let u=n(r,t);return t.hooks&&(u=t.hooks.postprocess(u)),u}catch(r){return a(r)}}}function g(l,n,e){return Y(R.lex,L.parse)(l,n,e)}return g.options=g.setOptions=function(l){return g.defaults={...g.defaults,...l},tt(g.defaults),g},g.getDefaults=T,g.defaults=_,g.use=function(...l){const n=g.defaults.extensions||{renderers:{},childTokens:{}};l.forEach(e=>{const t={...e};if(t.async=g.defaults.async||t.async||!1,e.extensions&&(e.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if(i.renderer){const s=n.renderers[i.name];s?n.renderers[i.name]=function(...a){let r=i.renderer.apply(this,a);return r===!1&&(r=s.apply(this,a)),r}:n.renderers[i.name]=i.renderer}if(i.tokenizer){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");n[i.level]?n[i.level].unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),t.extensions=n),e.renderer){const i=g.defaults.renderer||new D;for(const s in e.renderer){const a=i[s];i[s]=(...r)=>{let u=e.renderer[s].apply(i,r);return u===!1&&(u=a.apply(i,r)),u}}t.renderer=i}if(e.tokenizer){const i=g.defaults.tokenizer||new O;for(const s in e.tokenizer){const a=i[s];i[s]=(...r)=>{let u=e.tokenizer[s].apply(i,r);return u===!1&&(u=a.apply(i,r)),u}}t.tokenizer=i}if(e.hooks){const i=g.defaults.hooks||new q;for(const s in e.hooks){const a=i[s];q.passThroughHooks.has(s)?i[s]=r=>{if(g.defaults.async)return Promise.resolve(e.hooks[s].call(i,r)).then(m=>a.call(i,m));const u=e.hooks[s].call(i,r);return a.call(i,u)}:i[s]=(...r)=>{let u=e.hooks[s].apply(i,r);return u===!1&&(u=a.apply(i,r)),u}}t.hooks=i}if(e.walkTokens){const i=g.defaults.walkTokens;t.walkTokens=function(s){let a=[];return a.push(e.walkTokens.call(this,s)),i&&(a=a.concat(i.call(this,s))),a}}g.setOptions(t)})},g.walkTokens=function(l,n){let e=[];for(const t of l)switch(e=e.concat(n.call(g,t)),t.type){case"table":{for(const i of t.header)e=e.concat(g.walkTokens(i.tokens,n));for(const i of t.rows)for(const s of i)e=e.concat(g.walkTokens(s.tokens,n));break}case"list":{e=e.concat(g.walkTokens(t.items,n));break}default:g.defaults.extensions&&g.defaults.extensions.childTokens&&g.defaults.extensions.childTokens[t.type]?g.defaults.extensions.childTokens[t.type].forEach(function(i){e=e.concat(g.walkTokens(t[i],n))}):t.tokens&&(e=e.concat(g.walkTokens(t.tokens,n)))}return e},g.parseInline=Y(R.lexInline,L.parseInline),g.Parser=L,g.parser=L.parse,g.Renderer=D,g.TextRenderer=V,g.Lexer=R,g.lexer=R.lex,g.Tokenizer=O,g.Slugger=F,g.Hooks=q,g.parse=g,g.options,g.setOptions,g.use,g.walkTokens,g.parseInline,L.parse,R.lex,()=>{let l,n=null,e;function t(){if(n&&!n.closed)n.focus();else{if(n=window.open("about:blank","reveal.js - Notes","width=1100,height=700"),n.marked=g,n.document.write(z),!n){alert("Speaker view popup failed to open. Please make sure popups are allowed and reopen the speaker view.");return}s()}}function i(d){n&&!n.closed?n.focus():(n=d,window.addEventListener("message",m),f())}function s(){const d=e.getConfig().url,p=typeof d=="string"?d:window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search;l=setInterval(function(){n.postMessage(JSON.stringify({namespace:"reveal-notes",type:"connect",state:e.getState(),url:p}),"*")},500),window.addEventListener("message",m)}function a(d,p,o){let x=e[d].apply(e,p);n.postMessage(JSON.stringify({namespace:"reveal-notes",type:"return",result:x,callId:o}),"*")}function r(d){let p=e.getCurrentSlide(),o=p.querySelectorAll("aside.notes"),x=p.querySelector(".current-fragment"),b={namespace:"reveal-notes",type:"state",notes:"",markdown:!1,whitespace:"normal",state:e.getState()};if(p.hasAttribute("data-notes")&&(b.notes=p.getAttribute("data-notes"),b.whitespace="pre-wrap"),x){let S=x.querySelector("aside.notes");S?(b.notes=S.innerHTML,b.markdown=typeof S.getAttribute("data-markdown")=="string",o=null):x.hasAttribute("data-notes")&&(b.notes=x.getAttribute("data-notes"),b.whitespace="pre-wrap",o=null)}o&&o.length&&(o=Array.from(o).filter(S=>S.closest(".fragment")===null),b.notes=o.map(S=>S.innerHTML).join(`
  783. `),b.markdown=o[0]&&typeof o[0].getAttribute("data-markdown")=="string"),n.postMessage(JSON.stringify(b),"*")}function u(d){try{return window.location.origin===d.source.location.origin}catch{return!1}}function m(d){if(u(d))try{let p=JSON.parse(d.data);p&&p.namespace==="reveal-notes"&&p.type==="connected"?(clearInterval(l),f()):p&&p.namespace==="reveal-notes"&&p.type==="call"&&a(p.methodName,p.arguments,p.callId)}catch{}}function f(){e.on("slidechanged",r),e.on("fragmentshown",r),e.on("fragmenthidden",r),e.on("overviewhidden",r),e.on("overviewshown",r),e.on("paused",r),e.on("resumed",r),r()}return{id:"notes",init:function(d){e=d,/receiver/i.test(window.location.search)||(window.location.search.match(/(\?|\&)notes/gi)!==null?t():window.addEventListener("message",p=>{if(!n&&typeof p.data=="string"){let o;try{o=JSON.parse(p.data)}catch{}o&&o.namespace==="reveal-notes"&&o.type==="heartbeat"&&i(p.source)}}),e.addKeyBinding({keyCode:83,key:"S",description:"Speaker notes view"},function(){t()}))},open:t}}});