text: var radDemo=function(){"use strict";class e{constructor(t){this.sourceStr=t,this.subCombos=e.parseComboStr(t),this.keyNames=this.subCombos.reduce((e,t)=>e.concat(t),[])}check(e){let t=0;for(let s=0;s<this.subCombos.length;s+=1)if(t=this._checkSubCombo(this.subCombos[s],t,e),-1===t)return!1;return!0}isEqual(t){if(!t||"string"!=typeof t&&"object"!=typeof t)return!1;if("string"==typeof t&&(t=new e(t)),this.subCombos.length!==t.subCombos.length)return!1;for(let e=0;e<this.subCombos.length;e+=1)if(this.subCombos[e].length!==t.subCombos[e].length)return!1;for(let e=0;e<this.subCombos.length;e+=1){const s=this.subCombos[e],i=t.subCombos[e].slice(0);for(let e=0;e<s.length;e+=1){const t=s[e],n=i.indexOf(t);n>-1&&i.splice(n,1)}if(0!==i.length)return!1}return!0}_checkSubCombo(t,s,i){t=t.slice(0),i=i.slice(s);let n=s;for(let s=0;s<t.length;s+=1){let a=t[s];if("\\"===a[0]){const t=a.slice(1);t!==e.comboDeliminator&&t!==e.keyDeliminator||(a=t)}const o=i.indexOf(a);if(o>-1&&(t.splice(s,1),s-=1,o>n&&(n=o),0===t.length))return n}return-1}}e.comboDeliminator=">",e.keyDeliminator="+",e.parseComboStr=function(t){const s=e._splitStr(t,e.comboDeliminator),i=[];for(let t=0;t<s.length;t+=1)i.push(e._splitStr(s[t],e.keyDeliminator));return i},e._splitStr=function(e,t){const s=e,i=t;let n="";const a=[];for(let e=0;e<s.length;e+=1)e>0&&s[e]===i&&"\\"!==s[e-1]&&(a.push(n.trim()),n="",e+=1),n+=s[e];return n&&a.push(n.trim()),a};class t{constructor(e){this.localeName=e,this.activeTargetKeys=[],this.pressedKeys=[],this._appliedMacros=[],this._keyMap={},this._killKeyCodes=[],this._macros=[]}bindKeyCode(e,t){"string"==typeof t&&(t=[t]),this._keyMap[e]=t}bindMacro(t,s){"string"==typeof s&&(s=[s]);let i=null;"function"==typeof s&&(i=s,s=null);const n={keyCombo:new e(t),keyNames:s,handler:i};this._macros.push(n)}getKeyCodes(e){const t=[];for(const s in this._keyMap){this._keyMap[s].indexOf(e)>-1&&t.push(0|s)}return t}getKeyNames(e){return this._keyMap[e]||[]}setKillKey(e){if("string"!=typeof e)this._killKeyCodes.push(e);else{const t=this.getKeyCodes(e);for(let e=0;e<t.length;e+=1)this.setKillKey(t[e])}}pressKey(e){if("string"==typeof e){const t=this.getKeyCodes(e);for(let e=0;e<t.length;e+=1)this.pressKey(t[e]);return}this.activeTargetKeys.length=0;const t=this.getKeyNames(e);for(let e=0;e<t.length;e+=1)this.activeTargetKeys.push(t[e]),-1===this.pressedKeys.indexOf(t[e])&&this.pressedKeys.push(t[e]);this._applyMacros()}releaseKey(e){if("string"==typeof e){const t=this.getKeyCodes(e);for(let e=0;e<t.length;e+=1)this.releaseKey(t[e])}else{const t=this.getKeyNames(e);if(-1!==this._killKeyCodes.indexOf(e))this.pressedKeys.length=0;else for(let e=0;e<t.length;e+=1){const s=this.pressedKeys.indexOf(t[e]);s>-1&&this.pressedKeys.splice(s,1)}this.activeTargetKeys.length=0,this._clearMacros()}}_applyMacros(){const e=this._macros.slice(0);for(let t=0;t<e.length;t+=1){const s=e[t];if(s.keyCombo.check(this.pressedKeys)){s.handler&&(s.keyNames=s.handler(this.pressedKeys));for(let e=0;e<s.keyNames.length;e+=1)-1===this.pressedKeys.indexOf(s.keyNames[e])&&this.pressedKeys.push(s.keyNames[e]);this._appliedMacros.push(s)}}}_clearMacros(){for(let e=0;e<this._appliedMacros.length;e+=1){const t=this._appliedMacros[e];if(!t.keyCombo.check(this.pressedKeys)){for(let e=0;e<t.keyNames.length;e+=1){const s=this.pressedKeys.indexOf(t.keyNames[e]);s>-1&&this.pressedKeys.splice(s,1)}t.handler&&(t.keyNames=null),this._appliedMacros.splice(e,1),e-=1}}}}class s{constructor(e,t,s,i){this._locale=null,this._currentContext="",this._contexts={},this._listeners=[],this._appliedListeners=[],this._locales={},this._targetElement=null,this._targetWindow=null,this._targetPlatform="",this._targetUserAgent="",this._isModernBrowser=!1,this._targetKeyDownBinding=null,this._targetKeyUpBinding=null,this._targetResetBinding=null,this._paused=!1,this._contexts.global={listeners:this._listeners,targetWindow:e,targetElement:t,targetPlatform:s,targetUserAgent:i},this.setContext("global")}setLocale(e,s){let i=null;return"string"==typeof e?s?(i=new t(e),s(i,this._targetPlatform,this._targetUserAgent)):i=this._locales[e]||null:(i=e,e=i._localeName),this._locale=i,this._locales[e]=i,i&&(this._locale.pressedKeys=i.pressedKeys),this}getLocale(e){return e||(e=this._locale.localeName),this._locales[e]||null}bind(t,s,i,n){if(null!==t&&"function"!=typeof t||(n=i,i=s,s=t,t=null),t&&"object"==typeof t&&"number"==typeof t.length){for(let e=0;e<t.length;e+=1)this.bind(t[e],s,i);return this}return this._listeners.push({keyCombo:t?new e(t):null,pressHandler:s||null,releaseHandler:i||null,preventRepeat:n||!1,preventRepeatByDefault:n||!1,executingHandler:!1}),this}addListener(e,t,s,i){return this.bind(e,t,s,i)}on(e,t,s,i){return this.bind(e,t,s,i)}bindPress(e,t,s){return this.bind(e,t,null,s)}bindRelease(e,t){return this.bind(e,null,t,preventRepeatByDefault)}unbind(e,t,s){if(null!==e&&"function"!=typeof e||(s=t,t=e,e=null),e&&"object"==typeof e&&"number"==typeof e.length){for(let i=0;i<e.length;i+=1)this.unbind(e[i],t,s);return this}for(let i=0;i<this._listeners.length;i+=1){const n=this._listeners[i],a=!e&&!n.keyCombo||n.keyCombo&&n.keyCombo.isEqual(e),o=!t&&!s||!t&&!n.pressHandler||t===n.pressHandler,r=!t&&!s||!s&&!n.releaseHandler||s===n.releaseHandler;a&&o&&r&&(this._listeners.splice(i,1),i-=1)}return this}removeListener(e,t,s){return this.unbind(e,t,s)}off(e,t,s){return this.unbind(e,t,s)}setContext(e){if(this._locale&&this.releaseAllKeys(),!this._contexts[e]){const t=this._contexts.global;this._contexts[e]={listeners:[],targetWindow:t.targetWindow,targetElement:t.targetElement,targetPlatform:t.targetPlatform,targetUserAgent:t.targetUserAgent}}const t=this._contexts[e];return this._currentContext=e,this._listeners=t.listeners,this.stop(),this.watch(t.targetWindow,t.targetElement,t.targetPlatform,t.targetUserAgent),this}getContext(){return this._currentContext}withContext(e,t){const s=this.getContext();return this.setContext(e),t(),this.setContext(s),this}watch(e,t,s,i){this.stop();const n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:{};if(!e){if(!n.addEventListener&&!n.attachEvent)throw new Error("Cannot find window functions addEventListener or attachEvent.");e=n}if("number"==typeof e.nodeType&&(i=s,s=t,t=e,e=n),!e.addEventListener&&!e.attachEvent)throw new Error("Cannot find addEventListener or attachEvent methods on targetWindow.");this._isModernBrowser=!!e.addEventListener;const a=e.navigator&&e.navigator.userAgent||"",o=e.navigator&&e.navigator.platform||"";t&&null!==t||(t=e.document),s&&null!==s||(s=o),i&&null!==i||(i=a),this._targetKeyDownBinding=e=>{this.pressKey(e.keyCode,e),this._handleCommandBug(e,o)},this._targetKeyUpBinding=e=>{this.releaseKey(e.keyCode,e)},this._targetResetBinding=e=>{this.releaseAllKeys(e)},this._bindEvent(t,"keydown",this._targetKeyDownBinding),this._bindEvent(t,"keyup",this._targetKeyUpBinding),this._bindEvent(e,"focus",this._targetResetBinding),this._bindEvent(e,"blur",this._targetResetBinding),this._targetElement=t,this._targetWindow=e,this._targetPlatform=s,this._targetUserAgent=i;const r=this._contexts[this._currentContext];return r.targetWindow=this._targetWindow,r.targetElement=this._targetElement,r.targetPlatform=this._targetPlatform,r.targetUserAgent=this._targetUserAgent,this}stop(){if(this._targetElement&&this._targetWindow)return this._unbindEvent(this._targetElement,"keydown",this._targetKeyDownBinding),this._unbindEvent(this._targetElement,"keyup",this._targetKeyUpBinding),this._unbindEvent(this._targetWindow,"focus",this._targetResetBinding),this._unbindEvent(this._targetWindow,"blur",this._targetResetBinding),this._targetWindow=null,this._targetElement=null,this}pressKey(e,t){if(this._paused)return this;if(!this._locale)throw new Error("Locale not set");return this._locale.pressKey(e),this._applyBindings(t),this}releaseKey(e,t){if(this._paused)return this;if(!this._locale)throw new Error("Locale not set");return this._locale.releaseKey(e),this._clearBindings(t),this}releaseAllKeys(e){if(this._paused)return this;if(!this._locale)throw new Error("Locale not set");return this._locale.pressedKeys.length=0,this._clearBindings(e),this}pause(){return this._paused||(this._locale&&this.releaseAllKeys(),this._paused=!0),this}resume(){return this._paused=!1,this}reset(){return this.releaseAllKeys(),this._listeners.length=0,this}_bindEvent(e,t,s){return this._isModernBrowser?e.addEventListener(t,s,!1):e.attachEvent("on"+t,s)}_unbindEvent(e,t,s){return this._isModernBrowser?e.removeEventListener(t,s,!1):e.detachEvent("on"+t,s)}_getGroupedListeners(){const e=[],t=[];let s=this._listeners;return"global"!==this._currentContext&&(s=[...s,...this._contexts.global.listeners]),s.sort((e,t)=>(t.keyCombo?t.keyCombo.keyNames.length:0)-(e.keyCombo?e.keyCombo.keyNames.length:0)).forEach(s=>{let i=-1;for(let e=0;e<t.length;e+=1)(null===t[e]&&null===s.keyCombo||null!==t[e]&&t[e].isEqual(s.keyCombo))&&(i=e);-1===i&&(i=t.length,t.push(s.keyCombo)),e[i]||(e[i]=[]),e[i].push(s)}),e}_applyBindings(e){let t=!1;e||(e={}),e.preventRepeat=()=>{t=!0},e.pressedKeys=this._locale.pressedKeys.slice(0);const s=this._locale.activeTargetKeys,i=this._locale.pressedKeys.slice(0),n=this._getGroupedListeners();for(let a=0;a<n.length;a+=1){const o=n[a],r=o[0].keyCombo;if(null===r||r.check(i)&&s.some(e=>r.keyNames.includes(e))){for(let s=0;s<o.length;s+=1){let i=o[s];i.executingHandler||!i.pressHandler||i.preventRepeat||(i.executingHandler=!0,i.pressHandler.call(this,e),i.executingHandler=!1,(t||i.preventRepeatByDefault)&&(i.preventRepeat=!0,t=!1)),-1===this._appliedListeners.indexOf(i)&&this._appliedListeners.push(i)}if(r)for(let e=0;e<r.keyNames.length;e+=1){const t=i.indexOf(r.keyNames[e]);-1!==t&&(i.splice(t,1),e-=1)}}}}_clearBindings(e){e||(e={}),e.pressedKeys=this._locale.pressedKeys.slice(0);for(let t=0;t<this._appliedListeners.length;t+=1){const s=this._appliedListeners[t],i=s.keyCombo;null!==i&&i.check(this._locale.pressedKeys)||(s.preventRepeat=!1,null===i&&0!==e.pressedKeys.length||(this._appliedListeners.splice(t,1),t-=1),!s.executingHandler&&s.releaseHandler&&(s.executingHandler=!0,s.releaseHandler.call(this,e),s.executingHandler=!1))}}_handleCommandBug(e,t){t.match("Mac")&&this._locale.pressedKeys.includes("command")&&!["shift","ctrl","alt","capslock","tab","command"].includes(this._locale.getKeyNames(e.keyCode)[0])&&this._targetKeyUpBinding(e)}}const i=new s;i.setLocale("us",(function(e,t,s){e.bindKeyCode(3,["cancel"]),e.bindKeyCode(8,["backspace"]),e.bindKeyCode(9,["tab"]),e.bindKeyCode(12,["clear"]),e.bindKeyCode(13,["enter"]),e.bindKeyCode(16,["shift"]),e.bindKeyCode(17,["ctrl"]),e.bindKeyCode(18,["alt","menu"]),e.bindKeyCode(19,["pause","break"]),e.bindKeyCode(20,["capslock"]),e.bindKeyCode(27,["escape","esc"]),e.bindKeyCode(32,["space","spacebar"]),e.bindKeyCode(33,["pageup"]),e.bindKeyCode(34,["pagedown"]),e.bindKeyCode(35,["end"]),e.bindKeyCode(36,["home"]),e.bindKeyCode(37,["left"]),e.bindKeyCode(38,["up"]),e.bindKeyCode(39,["right"]),e.bindKeyCode(40,["down"]),e.bindKeyCode(41,["select"]),e.bindKeyCode(42,["printscreen"]),e.bindKeyCode(43,["execute"]),e.bindKeyCode(44,["snapshot"]),e.bindKeyCode(45,["insert","ins"]),e.bindKeyCode(46,["delete","del"]),e.bindKeyCode(47,["help"]),e.bindKeyCode(145,["scrolllock","scroll"]),e.bindKeyCode(188,["comma",","]),e.bindKeyCode(190,["period","."]),e.bindKeyCode(191,["slash","forwardslash","/"]),e.bindKeyCode(192,["graveaccent","`"]),e.bindKeyCode(219,["openbracket","["]),e.bindKeyCode(220,["backslash","\\"]),e.bindKeyCode(221,["closebracket","]"]),e.bindKeyCode(222,["apostrophe","'"]),e.bindKeyCode(48,["zero","0"]),e.bindKeyCode(49,["one","1"]),e.bindKeyCode(50,["two","2"]),e.bindKeyCode(51,["three","3"]),e.bindKeyCode(52,["four","4"]),e.bindKeyCode(53,["five","5"]),e.bindKeyCode(54,["six","6"]),e.bindKeyCode(55,["seven","7"]),e.bindKeyCode(56,["eight","8"]),e.bindKeyCode(57,["nine","9"]),e.bindKeyCode(96,["numzero","num0"]),e.bindKeyCode(97,["numone","num1"]),e.bindKeyCode(98,["numtwo","num2"]),e.bindKeyCode(99,["numthree","num3"]),e.bindKeyCode(100,["numfour","num4"]),e.bindKeyCode(101,["numfive","num5"]),e.bindKeyCode(102,["numsix","num6"]),e.bindKeyCode(103,["numseven","num7"]),e.bindKeyCode(104,["numeight","num8"]),e.bindKeyCode(105,["numnine","num9"]),e.bindKeyCode(106,["nummultiply","num*"]),e.bindKeyCode(107,["numadd","num+"]),e.bindKeyCode(108,["numenter"]),e.bindKeyCode(109,["numsubtract","num-"]),e.bindKeyCode(110,["numdecimal","num."]),e.bindKeyCode(111,["numdivide","num/"]),e.bindKeyCode(144,["numlock","num"]),e.bindKeyCode(112,["f1"]),e.bindKeyCode(113,["f2"]),e.bindKeyCode(114,["f3"]),e.bindKeyCode(115,["f4"]),e.bindKeyCode(116,["f5"]),e.bindKeyCode(117,["f6"]),e.bindKeyCode(118,["f7"]),e.bindKeyCode(119,["f8"]),e.bindKeyCode(120,["f9"]),e.bindKeyCode(121,["f10"]),e.bindKeyCode(122,["f11"]),e.bindKeyCode(123,["f12"]),e.bindKeyCode(124,["f13"]),e.bindKeyCode(125,["f14"]),e.bindKeyCode(126,["f15"]),e.bindKeyCode(127,["f16"]),e.bindKeyCode(128,["f17"]),e.bindKeyCode(129,["f18"]),e.bindKeyCode(130,["f19"]),e.bindKeyCode(131,["f20"]),e.bindKeyCode(132,["f21"]),e.bindKeyCode(133,["f22"]),e.bindKeyCode(134,["f23"]),e.bindKeyCode(135,["f24"]),e.bindMacro("shift + `",["tilde","~"]),e.bindMacro("shift + 1",["exclamation","exclamationpoint","!"]),e.bindMacro("shift + 2",["at","@"]),e.bindMacro("shift + 3",["number","#"]),e.bindMacro("shift + 4",["dollar","dollars","dollarsign","$"]),e.bindMacro("shift + 5",["percent","%"]),e.bindMacro("shift + 6",["caret","^"]),e.bindMacro("shift + 7",["ampersand","and","&"]),e.bindMacro("shift + 8",["asterisk","*"]),e.bindMacro("shift + 9",["openparen","("]),e.bindMacro("shift + 0",["closeparen",")"]),e.bindMacro("shift + -",["underscore","_"]),e.bindMacro("shift + =",["plus","+"]),e.bindMacro("shift + [",["opencurlybrace","opencurlybracket","{"]),e.bindMacro("shift + ]",["closecurlybrace","closecurlybracket","}"]),e.bindMacro("shift + \\",["verticalbar","|"]),e.bindMacro("shift + ;",["colon",":"]),e.bindMacro("shift + '",["quotationmark","'"]),e.bindMacro("shift + !,",["openanglebracket","<"]),e.bindMacro("shift + .",["closeanglebracket",">"]),e.bindMacro("shift + /",["questionmark","?"]),t.match("Mac")?e.bindMacro("command",["mod","modifier"]):e.bindMacro("ctrl",["mod","modifier"]);for(let t=65;t<=90;t+=1){var i=String.fromCharCode(t+32),n=String.fromCharCode(t);e.bindKeyCode(t,i),e.bindMacro("shift + "+i,n),e.bindMacro("capslock + "+i,n)}const a=s.match("Firefox")?59:186,o=s.match("Firefox")?173:189,r=s.match("Firefox")?61:187;let l,d;t.match("Mac")&&(s.match("Safari")||s.match("Chrome"))?(l=91,d=93):t.match("Mac")&&s.match("Opera")?(l=17,d=17):t.match("Mac")&&s.match("Firefox")&&(l=224,d=224),e.bindKeyCode(a,["semicolon",";"]),e.bindKeyCode(o,["dash","-"]),e.bindKeyCode(r,["equal","equalsign","="]),e.bindKeyCode(l,["command","windows","win","super","leftcommand","leftwindows","leftwin","leftsuper"]),e.bindKeyCode(d,["command","windows","win","super","rightcommand","rightwindows","rightwin","rightsuper"]),e.setKillKey("command")})),i.Keyboard=s,i.Locale=t,i.KeyCombo=e;class n{constructor(e){this.state={currentPlaylistItem:0,interval:e.interval?e.interval:100,subinterval:e.interval?e.interval/2:50,timecodeCurrent:0,timecodePrev:0,pausePointPrev:0,pausePointCurrent:0,autoplayNextPausePoint:sessionStorage.autoPlayNextPausePoint?"true"===sessionStorage.autoPlayNextPausePoint:"boolean"!=typeof e.autoplayNextPausePoint||e.autoplayNextPausePoint,autoplayPrevPausePoint:e.autoplayPrevPausePoint,autoplayNextChapter:sessionStorage.autoPlayNextChapter?"true"===sessionStorage.autoPlayNextChapter:"boolean"!=typeof e.autoplayNextChapter||e.autoplayNextChapter,playCount:0},this.container=document.querySelector(e.container),this.container.innerHTML='\n    <div class="raddemo video-container">\n        <video width="1280" height="720" muted></video>\n    </div>\n',this.container.insertAdjacentHTML("beforeend",'\n    <div class="video-controls">\n        <div class="timeline-container">\n            <div class="timeline-fill"></div>\n            <div class="timeline-pause-points-container"></div>\n        </div>\n        <div class="buttons">\n            <button type="button" class="playlist-prev">\n                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M11.5 280.6l192 160c20.6 17.2 52.5 2.8 52.5-24.6V96c0-27.4-31.9-41.8-52.5-24.6l-192 160c-15.3 12.8-15.3 36.4 0 49.2zm256 0l192 160c20.6 17.2 52.5 2.8 52.5-24.6V96c0-27.4-31.9-41.8-52.5-24.6l-192 160c-15.3 12.8-15.3 36.4 0 49.2z"/></svg>\n                <span class="sr-only">Prev Chapter</span>\n            </button>\n            <button type="button" class="prev">\n                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M64 468V44c0-6.6 5.4-12 12-12h48c6.6 0 12 5.4 12 12v176.4l195.5-181C352.1 22.3 384 36.6 384 64v384c0 27.4-31.9 41.7-52.5 24.6L136 292.7V468c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12z"/></svg>\n                <span class="sr-only">Previous</span>\n            </button>\n            <button type="button" class="play-pause pause">\n                <span class="play">\n                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"/></svg>\n                </span>\n                <span class="pause">\n                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"/></svg>\n                </span>\n                <span class="sr-only">Play / Pause</span>\n            </button>\n            <button type="button" class="next">\n                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M384 44v424c0 6.6-5.4 12-12 12h-48c-6.6 0-12-5.4-12-12V291.6l-195.5 181C95.9 489.7 64 475.4 64 448V64c0-27.4 31.9-41.7 52.5-24.6L312 219.3V44c0-6.6 5.4-12 12-12h48c6.6 0 12 5.4 12 12z"/></svg>\n                <span class="sr-only">Next</span>\n            </button>\n            <button type="button" class="playlist-next">\n                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M500.5 231.4l-192-160C287.9 54.3 256 68.6 256 96v320c0 27.4 31.9 41.8 52.5 24.6l192-160c15.3-12.8 15.3-36.4 0-49.2zm-256 0l-192-160C31.9 54.3 0 68.6 0 96v320c0 27.4 31.9 41.8 52.5 24.6l192-160c15.3-12.8 15.3-36.4 0-49.2z"/></svg>\n                <span class="sr-only">Next Chapter</span>\n            </button>\n            <button type="button" class="settings" title="Settings">\n                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"/></svg>\n                <span class="sr-only">Settings</span>\n            </button>\n        </div>\n        <div class="timecode"></div>\n    </div> \n'),this.timecode=this.container.querySelector(".timecode"),this.settings=document.createElement("div"),this.settings.setAttribute("class","settings hidden"),this.container.appendChild(this.settings),this.settings.innerHTML='\n    <div class="settings-overlay"></div>\n    \n    <div class="settings-panel">\n        <h2><i class="fas fa-cog"></i> Settings</h2>\n        \n        <div>\n            <h3>\n                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M384 44v424c0 6.6-5.4 12-12 12h-48c-6.6 0-12-5.4-12-12V291.6l-195.5 181C95.9 489.7 64 475.4 64 448V64c0-27.4 31.9-41.7 52.5-24.6L312 219.3V44c0-6.6 5.4-12 12-12h48c6.6 0 12 5.4 12 12z"/></svg>\n                Next Button Behavior\n            </h3>\n            <label>Autoplay the next pause point?</label>\n            <input type="checkbox" name="autoplay-next-pause-point" class="autoplay-next-pause-point" checked />\n        </div>\n        \n        <div>\n            <h3>\n                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M500.5 231.4l-192-160C287.9 54.3 256 68.6 256 96v320c0 27.4 31.9 41.8 52.5 24.6l192-160c15.3-12.8 15.3-36.4 0-49.2zm-256 0l-192-160C31.9 54.3 0 68.6 0 96v320c0 27.4 31.9 41.8 52.5 24.6l192-160c15.3-12.8 15.3-36.4 0-49.2z"/></svg>\n                Next Chapter Button Behavior\n            </h3>\n            <label>Autoplay the next chapter?</label>\n            <input type="checkbox" name="autoplay-next-chapter" class="autoplay-next-chapter" checked />\n        </div>\n        \n        <div>\n            <button type="button" class="settings-confirm">\n                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"/></svg>\n                OK\n            </button>\n        </div>\n    </div>\n',this.media=document.querySelector("video"),this.btnPlayPause=document.querySelector(".video-controls .play-pause"),this.btnPrev=document.querySelector(".video-controls .prev"),this.btnNext=document.querySelector(".video-controls .next"),this.btnPlayPauselistNext=this.container.querySelector(".playlist-next"),this.btnPlayPauselistPrev=this.container.querySelector(".playlist-prev"),this.btnSettings=this.container.querySelector("button.settings"),this.btnAutoPlayNextPP=this.settings.querySelector(".autoplay-next-pause-point"),this.state.autoplayNextPausePoint||this.btnAutoPlayNextPP.removeAttribute("checked"),this.btnAutoPlayNextChap=this.settings.querySelector(".autoplay-next-chapter"),this.state.autoplayNextChapter||this.btnAutoPlayNextChap.removeAttribute("checked"),this.btnSettingsConfirm=this.container.querySelector(".settings-confirm"),this.btnPausePoints=null,this.timelineContainer=document.querySelector(".timeline-container"),this.timelineFill=document.querySelector(".timeline-fill"),this.timelinePausePointsContainer=document.querySelector(".timeline-pause-points-container"),this.media.addEventListener("timeupdate",e=>{this.timecodeUpdate()}),this.media.addEventListener("ended",e=>{this.nextPlaylistItem()}),this.btnPlayPause.addEventListener("click",e=>{this.toggle(),e.target.closest("button").blur()}),this.btnNext.addEventListener("click",e=>{this.next(),e.target.closest("button").blur()}),this.btnPrev.addEventListener("click",e=>{this.prev(),e.target.closest("button").blur()}),this.btnPlayPauselistNext.addEventListener("click",e=>{this.nextPlaylistItem(),e.target.closest("button").blur()}),this.btnPlayPauselistPrev.addEventListener("click",e=>{this.prevPlaylistItem(),e.target.closest("button").blur()}),this.btnSettings.addEventListener("click",e=>{this.showSettings(),e.target.closest("button").blur()}),this.btnSettingsConfirm.addEventListener("click",e=>{this.hideSettings()}),this.btnAutoPlayNextPP.addEventListener("change",e=>{sessionStorage.setItem("autoPlayNextPausePoint",e.target.checked),this.state.autoplayNextPausePoint=e.target.checked}),this.btnAutoPlayNextChap.addEventListener("change",e=>{sessionStorage.setItem("autoPlayNextChapter",e.target.checked),this.state.autoplayNextChapter=e.target.checked}),this.media.addEventListener("durationchange",e=>{this.btnPausePoints&&this.btnPausePoints.forEach(e=>{e.removeEventListener("click",this.handlePausePointClick.bind(this))});let t=this.playlist[this.state.currentPlaylistItem];this.timelinePausePointsContainer.innerHTML="";for(let e=0;e<t.pausePoints.length;e++)this.timelinePausePointsContainer.innerHTML+=`\n                    <div class="timeline-pause-point"\n                         data-pause-point="${t.pausePoints[e]}"\n                         style="left: ${t.pausePoints[e]/this.media.duration*100+"%"}"></div>\n                `;this.btnPausePoints=document.querySelectorAll(".timeline-pause-point"),this.btnPausePoints.forEach(e=>{e.addEventListener("click",this.handlePausePointClick.bind(this))})}),this.playlist=e.playlist;for(let t=0;t<e.playlist.length;t++){let s=e.playlist[t];"SMTP"===s.pauseFormat?this.playlist[t].pausePoints=this.convertTimecodeListToSecondsList(s.pausePoints,s.framerate):this.playlist[t].pausePoints=s}this.loadPlaylistItem(this.state.currentPlaylistItem),this.keyboard=i,this.keyboard.bind("space",()=>{this.toggle()}),this.keyboard.bind("left",()=>{this.prev()}),this.keyboard.bind("right",()=>{this.next()}),this.keyboard.bind("shift > left",()=>{this.prevPlaylistItem()}),this.keyboard.bind("shift > right",()=>{this.nextPlaylistItem()}),this.keyboard.bind("s",()=>{this.showSettings()})}timecodeUpdate(){this.state.timecodePrev=this.roundTime(this.state.timecodeCurrent),this.state.timecodeCurrent=this.roundTime(this.media.currentTime);const e=this.state.timecodePrev,t=this.roundTime(this.media.currentTime),s=this.playlist[this.state.currentPlaylistItem].pausePoints;if(this.timecode.innerHTML=t,this.timelineFill.style.width=t/this.media.duration*100+"%",t>=e)for(let e=0;e<s.length;e++)t>this.state.pausePointCurrent+.3&&t>s[e]-.15&&t<s[e]+.15&&(this.highlightPausePoint(s[e]),this.state.pausePointPrev=this.state.pausePointCurrent,this.state.pausePointCurrent=s[e],"true"===this.media.dataset.autoplay?(this.play(),this.media.dataset.autoplay="false"):this.pause());else if(this.pause(),t>0)for(let e=0;e<s.length;e++)t>s[e]-.15&&t<s[e]+.15&&(this.highlightPausePoint(s[e]),this.state.pausePointPrev=this.state.pausePointCurrent,this.state.pausePointCurrent=s[e]);else this.state.pausePointPrev=this.state.pausePointCurrent,this.state.pausePointCurrent=0}highlightPausePoint(e){this.btnPausePoints.forEach(t=>{t.classList.remove("current","previous"),t.dataset.pausePoint==e&&t.classList.add("current","viewed")})}roundTime(e){return Math.round(100*e)/100}convertTimecodeToSeconds(e,t){var s=e.split(":");return 60*parseInt(s[0])*60+60*parseInt(s[1])+parseInt(s[2])+parseInt(s[3])*(1/t)}convertTimecodeListToSecondsList(e,t){let s=e;for(var i=0;i<e.length;i++)s[i]=this.convertTimecodeToSeconds(s[i],t);return s}loadPlaylistItem(e){this.state.currentPlaylistItem=e,this.state.pausePointPrev=0,this.state.pausePointCurrent=0,this.timelineFill.style.width="0%",this.btnPlayPause.classList.add("pause"),this.btnPlayPause.classList.remove("play"),this.state.timecodePrev=0,this.state.timecodeCurrent=0,this.media.setAttribute("src",this.playlist[this.state.currentPlaylistItem].videoSource)}handlePausePointClick(e){const t=e.target.dataset.pausePoint?e.target.dataset.pausePoint:this.media.currentTime;this.goToTimeCode(t)}goToTimeCode(e){this.media.currentTime=e}nextPlaylistItem(){let e=this.state.currentPlaylistItem+1;e+1>this.playlist.length&&(e=0),this.loadPlaylistItem(e),this.state.autoplayNextChapter?this.play():this.pause()}prevPlaylistItem(){let e=this.state.currentPlaylistItem-1;e<0&&(e=this.playlist.length-1),this.loadPlaylistItem(e),this.state.autoplayNextChapter?this.play():this.pause()}play(){this.media.play(),this.btnPlayPause.classList.add("play"),this.btnPlayPause.classList.remove("pause"),this.btnPausePoints.forEach(e=>{(e.classList.contains("current")||e.classList.contains("previous"))&&(e.classList.remove("current","previous"),this.state.pausePointCurrent==e.dataset.pausePoint&&e.classList.add("previous"))}),this.state.playCount++}pause(){this.media.pause(),this.btnPlayPause.classList.add("pause"),this.btnPlayPause.classList.remove("play")}toggle(){this.media.paused?this.play():this.pause()}next(){this.media.paused&&this.media.play();const e=this.media.currentTime,t=this.playlist[this.state.currentPlaylistItem].pausePoints;let s=0;for(let i=0;i<t.length;i++)if(e<t[i]-.15&&this.state.pausePointCurrent!==t[i]){s=t[i],this.state.autoplayNextPausePoint&&(this.media.dataset.autoplay="true"),this.media.currentTime=s-.15;break}0===s&&this.nextPlaylistItem()}prev(){const e=this.media.currentTime;let t=this.playlist[this.state.currentPlaylistItem].pausePoints.slice().reverse(),s=0;for(let i=0;i<t.length;i++)if(e>t[i]+.15){s=t[i];break}this.media.currentTime=s}showSettings(){this.settings.classList.remove("hidden")}hideSettings(){this.settings.classList.add("hidden")}}return e=>new n(e)}();