|
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[223,5,6,7],{"+NIl":
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./node_modules/codemirror/mode/stex/stex.js ***!
|
|
|
\***************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){!function(e){"use strict";e.defineMode("stex",(function(e,t){function r(e,t){e.cmdState.push(t)}function n(e){return e.cmdState.length>0?e.cmdState[e.cmdState.length-1]:null}function i(e,t,r){return function(){this.name=e,this.bracketNo=0,this.style=t,this.styles=r,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var a={};function s(e,t){e.f=t}function o(e,t){var i;if(e.match(/^\\[a-zA-Z@]+/)){var o=e.current().slice(1);return r(t,i=new(i=a.hasOwnProperty(o)?a[o]:a.DEFAULT)),s(t,u),i.style}if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/\\]/))return"tag";if(e.match("\\["))return s(t,(function(e,t){return l(e,t,"\\]")})),"keyword";if(e.match("\\("))return s(t,(function(e,t){return l(e,t,"\\)")})),"keyword";if(e.match("$$"))return s(t,(function(e,t){return l(e,t,"$$")})),"keyword";if(e.match("$"))return s(t,(function(e,t){return l(e,t,"$")})),"keyword";var c=e.next();return"%"==c?(e.skipToEnd(),"comment"):"}"==c||"]"==c?(i=n(t))?(i.closeBracket(c),s(t,u),"bracket"):"error":"{"==c||"["==c?(r(t,i=new(i=a.DEFAULT)),"bracket"):/\d/.test(c)?(e.eatWhile(/[\w.%]/),"atom"):(e.eatWhile(/[\w\-_]/),"begin"==(i=function(e){for(var t=e.cmdState,r=t.length-1;r>=0;r--){var n=t[r];if("DEFAULT"!=n.name)return n}return{styleIdentifier:function(){return null}}}(t)).name&&(i.argument=e.current()),i.styleIdentifier())}function l(e,t,r){if(e.eatSpace())return null;if(r&&e.match(r))return s(t,o),"keyword";if(e.match(/^\\[a-zA-Z@]+/))return"tag";if(e.match(/^[a-zA-Z]+/))return"variable-2";if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/]/))return"tag";if(e.match(/^[\^_&]/))return"tag";if(e.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(e.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var n=e.next();return"{"==n||"}"==n||"["==n||"]"==n||"("==n||")"==n?"bracket":"%"==n?(e.skipToEnd(),"comment"):"error"}function u(e,t){var r=e.peek();return"{"==r||"["==r?(n(t).openBracket(r),e.eat(r),s(t,o),"bracket"):/[ \t\r]/.test(r)?(e.eat(r),null):(s(t,o),function(e){var t=e.cmdState.pop();t&&t.closeBracket()}(t),o(e,t))}return a.importmodule=i("importmodule","tag",["string","builtin"]),a.documentclass=i("documentclass","tag",["","atom"]),a.usepackage=i("usepackage","tag",["atom"]),a.begin=i("begin","tag",["atom"]),a.end=i("end","tag",["atom"]),a.label=i("label","tag",["atom"]),a.ref=i("ref","tag",["atom"]),a.eqref=i("eqref","tag",["atom"]),a.cite=i("cite","tag",["atom"]),a.bibitem=i("bibitem","tag",["atom"]),a.Bibitem=i("Bibitem","tag",["atom"]),a.RBibitem=i("RBibitem","tag",["atom"]),a.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{startState:function(){return{cmdState:[],f:t.inMathMode?function(e,t){return l(e,t)}:o}},copyState:function(e){return{cmdState:e.cmdState.slice(),f:e.f}},token:function(e,t){return t.f(e,t)},blankLine:function(e){e.f=o,e.cmdState.length=0},lineComment:"%"}})),e.defineMIME("text/x-stex","stex"),e.defineMIME("text/x-latex","stex")}(r(/*! ../../lib/codemirror */"VrN/"))},"19Vz":
|
|
|
/*!**************************************************************!*\
|
|
|
!*** ./node_modules/codemirror/addon/display/placeholder.js ***!
|
|
|
\**************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){!function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function r(e){t(e);var r=e.state.placeholder=document.createElement("pre");r.style.cssText="height: 0; overflow: visible",r.style.direction=e.getOption("direction"),r.className="CodeMirror-placeholder CodeMirror-line-like";var n=e.getOption("placeholder");"string"==typeof n&&(n=document.createTextNode(n)),r.appendChild(n),e.display.lineSpace.insertBefore(r,e.display.lineSpace.firstChild)}function n(e){a(e)&&r(e)}function i(e){var n=e.getWrapperElement(),i=a(e);n.className=n.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?r(e):t(e)}function a(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",(function(a,s,o){var l=o&&o!=e.Init;if(s&&!l)a.on("blur",n),a.on("change",i),a.on("swapDoc",i),e.on(a.getInputField(),"compositionupdate",a.state.placeholderCompose=function(){!function(e){setTimeout((function(){var n=!1,i=e.getInputField();"TEXTAREA"==i.nodeName?n=!i.value:1==e.lineCount()&&(n=!/[^\u200b]/.test(i.querySelector(".CodeMirror-line").textContent)),n?r(e):t(e)}),20)}(a)}),i(a);else if(!s&&l){a.off("blur",n),a.off("change",i),a.off("swapDoc",i),e.off(a.getInputField(),"compositionupdate",a.state.placeholderCompose),t(a);var u=a.getWrapperElement();u.className=u.className.replace(" CodeMirror-empty","")}s&&!a.hasFocus()&&n(a)}))}(r(/*! ../../lib/codemirror */"VrN/"))},"1eCo":
|
|
|
/*!*************************************************!*\
|
|
|
!*** ./node_modules/codemirror/mode/xml/xml.js ***!
|
|
|
\*************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! all exports used */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){!function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};e.defineMode("xml",(function(n,i){var a,s,o=n.indentUnit,l={},u=i.htmlMode?t:r;for(var c in u)l[c]=u[c];for(var c in i)l[c]=i[c];function d(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();return"<"==n?e.eat("!")?e.eat("[")?e.match("CDATA[")?r(h("atom","]]>")):null:e.match("--")?r(h("comment","--\x3e")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(function e(t){return function(r,n){for(var i;null!=(i=r.next());){if("<"==i)return n.tokenize=e(t+1),n.tokenize(r,n);if(">"==i){if(1==t){n.tokenize=d;break}return n.tokenize=e(t-1),n.tokenize(r,n)}}return"meta"}}(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=h("meta","?>"),"meta"):(a=e.eat("/")?"closeTag":"openTag",t.tokenize=f,"tag bracket"):"&"==n?(e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"))?"atom":"error":(e.eatWhile(/[^&<]/),null)}function f(e,t){var r,n,i=e.next();if(">"==i||"/"==i&&e.eat(">"))return t.tokenize=d,a=">"==i?"endTag":"selfcloseTag","tag bracket";if("="==i)return a="equals",null;if("<"==i){t.tokenize=d,t.state=v,t.tagName=t.tagStart=null;var s=t.tokenize(e,t);return s?s+" tag error":"tag error"}return/[\'\"]/.test(i)?(t.tokenize=(r=i,(n=function(e,t){for(;!e.eol();)if(e.next()==r){t.tokenize=f;break}return"string"}).isInAttribute=!0,n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){n.tokenize=d;break}r.next()}return e}}function p(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(l.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function g(e){e.context&&(e.context=e.context.prev)}function m(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!l.contextGrabbers.hasOwnProperty(r)||!l.contextGrabbers[r].hasOwnProperty(t))return;g(e)}}function v(e,t,r){return"openTag"==e?(r.tagStart=t.column(),y):"closeTag"==e?b:v}function y(e,t,r){return"word"==e?(r.tagName=t.current(),s="tag",S):l.allowMissingTagName&&"endTag"==e?(s="tag bracket",S(e,0,r)):(s="error",y)}function b(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&l.implicitlyClosed.hasOwnProperty(r.context.tagName)&&g(r),r.context&&r.context.tagName==n||!1===l.matchClosing?(s="tag",E):(s="tag error",x)}return l.allowMissingTagName&&"endTag"==e?(s="tag bracket",E(e,0,r)):(s="error",x)}function E(e,t,r){return"endTag"!=e?(s="error",E):(g(r),v)}function x(e,t,r){return s="error",E(e,0,r)}function S(e,t,r){if("word"==e)return s="attribute",T;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||l.autoSelfClosers.hasOwnProperty(n)?m(r,n):(m(r,n),r.context=new p(r,n,i==r.indented)),v}return s="error",S}function T(e,t,r){return"equals"==e?k:(l.allowMissing||(s="error"),S(e,0,r))}function k(e,t,r){return"string"==e?w:"word"==e&&l.allowUnquoted?(s="string",S):(s="error",S(e,0,r))}function w(e,t,r){return"string"==e?w:S(e,0,r)}return d.isInText=!0,{startState:function(e){var t={tokenize:d,state:v,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;a=null;var r=t.tokenize(e,t);return(r||a)&&"comment"!=r&&(s=null,t.state=t.state(a||r,e,t),s&&(r="error"==s?r+" error":s)),r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+o;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=f&&t.tokenize!=d)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==l.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+o*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/<!\[CDATA\[/.test(r))return 0;var a=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(a&&a[1])for(;i;){if(i.tagName==a[2]){i=i.prev;break}if(!l.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(a)for(;i;){var s=l.contextGrabbers[i.tagName];if(!s||!s.hasOwnProperty(a[2]))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+o:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(e){e.state==k&&(e.state=S)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],r=e.context;r;r=r.prev)r.tagName&&t.push(r.tagName);return t.reverse()}}})),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}(r(/*! ../../lib/codemirror */"VrN/"))},"7ahc":
|
|
|
/*!*************************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/code-block/index.tsx ***!
|
|
|
\*************************************************************/
|
|
|
/*! exports provided: default, MyCodeMirror */
|
|
|
/*! exports used: MyCodeMirror, default */function(e,t,r){"use strict";r.d(t,"a",(function(){return m}));var n=r(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),i=r(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends */"0Owb"),a=(r(/*! antd/es/button/style */"+L6B"),r(/*! antd/es/button */"2/Rp")),s=(r(/*! antd/es/form/style */"y8nQ"),r(/*! antd/es/form */"Vl3Y")),o=r(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),l=(r(/*! antd/es/select/style */"OaEy"),r(/*! antd/es/select */"2fM7")),u=r(/*! react */"q1tI"),c=r.n(u),d=r(/*! codemirror */"VrN/"),f=r.n(d),h=(r(/*! codemirror/lib/codemirror.css */"p77/"),r(/*! codemirror/theme/blackboard.css */"c5Ni"),l.a.Option),p={labelCol:{span:4},wrapperCol:{span:20}},g={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};function m(e){var t=e.value,r=e.onChange,i=e.mode,a=e.options,s=void 0===a?{}:a,l=Object(u.useRef)(),d=Object(u.useState)(),h=Object(o.a)(d,2),p=h[0],g=h[1];return Object(u.useEffect)((function(){if(p){function e(e){var t=e.getValue();r&&r(t)}return p.on("change",e),function(){p.off("change",e)}}}),[p,r]),Object(u.useEffect)((function(){p&&p.setOption("mode",i)}),[p,i]),Object(u.useEffect)((function(){p&&(t===p.getValue()&&""!==t||setTimeout((function(){p.setValue(t||" ")}),300))}),[p,t]),Object(u.useEffect)((function(){if(l.current&&!p){var e=f.a.fromTextArea(l.current,Object(n.a)({mode:i,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},s));g(e)}}),[l.current,p]),c.a.createElement("div",{className:"my-codemirror-container"},c.a.createElement("textarea",{ref:l}))}t.b=function(e){var t=e.callback,r=e.onCancel,n=Object(u.useState)("python"),d=Object(o.a)(n,2),f=d[0],v=d[1];return c.a.createElement(s.a,Object(i.a)({},p,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){t(e)}}),c.a.createElement(s.a.Item,{label:"代码语言",name:"language"},c.a.createElement(l.a,{onChange:function(e){v(g[e][1])}},Object.keys(g).map((function(e){return c.a.createElement(h,{key:e,value:e},g[e][0])})))),c.a.createElement(s.a.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}]},c.a.createElement(m,{mode:f})),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(a.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),c.a.createElement(a.a,{type:"ghost",onClick:r},"取消")))}},"8EBN":
|
|
|
/*!**********************************************!*\
|
|
|
!*** ./node_modules/codemirror/mode/meta.js ***!
|
|
|
\**********************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! all exports used */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){!function(e){"use strict";e.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var t=0;t<e.modeInfo.length;t++){var r=e.modeInfo[t];r.mimes&&(r.mime=r.mimes[0])}e.findModeByMIME=function(t){t=t.toLowerCase();for(var r=0;r<e.modeInfo.length;r++){var n=e.modeInfo[r];if(n.mime==t)return n;if(n.mimes)for(var i=0;i<n.mimes.length;i++)if(n.mimes[i]==t)return n}return/\+xml$/.test(t)?e.findModeByMIME("application/xml"):/\+json$/.test(t)?e.findModeByMIME("application/json"):void 0},e.findModeByExtension=function(t){t=t.toLowerCase();for(var r=0;r<e.modeInfo.length;r++){var n=e.modeInfo[r];if(n.ext)for(var i=0;i<n.ext.length;i++)if(n.ext[i]==t)return n}},e.findModeByFileName=function(t){for(var r=0;r<e.modeInfo.length;r++){var n=e.modeInfo[r];if(n.file&&n.file.test(t))return n}var i=t.lastIndexOf("."),a=i>-1&&t.substring(i+1,t.length);if(a)return e.findModeByExtension(a)},e.findModeByName=function(t){t=t.toLowerCase();for(var r=0;r<e.modeInfo.length;r++){var n=e.modeInfo[r];if(n.name.toLowerCase()==t)return n;if(n.alias)for(var i=0;i<n.alias.length;i++)if(n.alias[i].toLowerCase()==t)return n}}}(r(/*! ../lib/codemirror */"VrN/"))},"9Bee":
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/RenderHtml/index.tsx + 1 modules ***!
|
|
|
\*********************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/PreviewAll/index.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/hls.js/dist/hls.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/katex/dist/katex.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/marked/lib/marked.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/marked/src/helpers.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,r){"use strict";var n=r("k1fw"),i=r("tJVT"),a=r("q1tI"),s=r.n(a),o=(r("vg9a"),r("DlQD")),l=r.n(o),u=r("rUJ1");var c=[],d=["<ul>"],f=new l.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function p(){c.length=0,d=["<ul>"]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(){return function e(t,r,n,i){if(r>=t.length||t[r].level<=n)return r;var a=t[r];i.push("<li><a href='#"+a.anchor+"'>"+a.text+"</a>");var s=[];return r=e(t,++r,a.level,s),s.length>0&&(i.push("<ul>"),s.forEach((function(e){i.push(e)})),i.push("</ul>")),i.push("</li>"),r=e(t,r,n,i)}(c,0,0,d),d.push("</ul>"),d.join("")}var v={heading:function(e){var t=h.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}},fences:function(e){var t=this.rules.block.fences.exec(e);if(t){var r=t[0],n=function(e,t){var r=e.match(/^(\s+)(?:```)/);if(null===r)return t;var n=r[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:Object(i.a)(t,1)[0].length>=n.length?e.slice(n.length):e})).join("\n")}(r,t[3]||""),a=t[2]?t[2].trim():t[2];if(["latex","katex","math"].indexOf(a)>=0){var s=E(),o=n;n=s,x[s]={type:"block",expression:o}}return{type:"code",raw:r,lang:a,text:n}}}},y=/(?:\${2})([^\n`]+?)(?:\${2})/gi,b=0,E=function(){return"__special_katext_id_".concat(b++,"__")},x={};function S(){b=0,x={}}function T(e){return e=e.replace(y,(function(e,t){var r=E();return x[r]={type:"inline",expression:t},r}))}var k=f.listitem;f.listitem=function(e){return k(T(e))};var w=f.paragraph;f.paragraph=function(e){return w(T(e))};var C=f.tablecell;f.tablecell=function(e,t){return C(T(e),t)},f.code=function(e,t,r){var n=(t||"").match(/\S*/)[0];return n?["latex","katex","math"].indexOf(n)>=0?"<p class='editormd-tex'>".concat(e,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(t,'">').concat(r?e:Object(u.escape)(e,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(r?e:Object(u.escape)(e,!0))+"</code></pre>"},f.heading=function(e,t,r){var n=this.options.headerPrefix+r.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return c.push({anchor:n,level:t,text:e}),"<h"+t+' id="'+n+'">'+e+"</h"+t+">"},l.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),l.a.use({tokenizer:v,renderer:f});var L=l.a,A=(r("SJMd"),r("ulZh")),D=r.n(A),O=r("m3rI"),_=r("Oy/b"),R=r("p5ED"),I=/<pre[^>]*>/g;t.a=function(e){var t=e.value,r=void 0===t?"":t,o=e.className,l=e.showTextOnly,u=e.showLines,c=e.style,d=void 0===c?{}:c,f=e.stylesPrev,h=void 0===f?{}:f,v=String(r),y=Object(a.useState)(""),b=Object(i.a)(y,2),E=b[0],T=b[1],k=Object(a.useMemo)((function(){try{v=(v=v.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+O.a.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+O.a.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+O.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,"\n")).replace(new RegExp("(?<!\\n)\\n(?!\\n)","g")," \n")}catch(e){}var e=L(v),t=x;if(v.match(/\[TOC\]/)&&(e=e.replace("<p>[TOC]</p>",m()),p()),e=(e=e.replace(/(__special_katext_id_\d+__)/g,(function(e,r){var n=t[r],i=n.type,a=n.expression;return Object(_.renderToString)(function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue}(a)||"",{displayMode:"block"===i,throwOnError:!1,output:"html"})}))).replace(/▁/g,"▁▁▁"),S(),l){var r=document.createElement("div");return r.innerHTML=e,r.innerText}return setTimeout((function(){return A()}),500),e}),[v]),w=Object(a.useRef)();function C(e){var t=e.target;if("A"===t.tagName.toUpperCase()){var r=t.getAttribute("href");if(r.indexOf("office")>-1)e.preventDefault(),T(r);else if(r.startsWith("#")){e.preventDefault();var n=document.getElementById(r.replace("#",""));n&&n.scrollIntoView(!0)}}}g.WebkitLineClamp=u,u&&(d=Object(n.a)(Object(n.a)({},d),g));var A=function(){var e,t=null===(e=w.current)||void 0===e?void 0:e.querySelectorAll("video");null==t||t.forEach((function(e){if(e.oncontextmenu=function(){return!1},e.src.indexOf(".m3u8")>-1)if(e.canPlayType("application/vnd.apple.mpegurl"));else if(D.a.isSupported()){var t=new D.a;t.loadSource(e.src),t.attachMedia(e)}}))};return Object(a.useEffect)((function(){if(w.current&&k&&k.match(I)&&window.PR.prettyPrint(),w.current)return w.current.addEventListener("click",C),function(){w.current.removeEventListener("click",C),S(),p()}}),[k,w.current,C]),s.a.createElement(s.a.Fragment,null,s.a.createElement("div",{ref:w,style:Object(n.a)({},d),className:"".concat(o||""," markdown-body "),dangerouslySetInnerHTML:{__html:k}}),s.a.createElement(R.a,{close:!0,data:E,type:null!=E&&E.length?"office":"",style:Object(n.a)({},h),onClose:function(){return T("")}}))}},"9VGf":
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/components/useInterval.tsx ***!
|
|
|
\****************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(/*! react */"q1tI");function i(e,t){var r=Object(n.useRef)();Object(n.useEffect)((function(){r.current=e})),Object(n.useEffect)((function(){if(null!==t){var e=setInterval((function(){r.current()}),t);return function(){return clearInterval(e)}}}),[t])}},BU3w:
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./node_modules/rc-util/es/Dom/dynamicCSS.js ***!
|
|
|
\***************************************************/
|
|
|
/*! exports provided: injectCSS, updateCSS */
|
|
|
/*! exports used: updateCSS */function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(/*! ./canUseDom */"MNnm");function i(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function a(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object(n.a)())return null;var a,s=document.createElement("style");(null===(t=r.csp)||void 0===t?void 0:t.nonce)&&(s.nonce=null===(a=r.csp)||void 0===a?void 0:a.nonce);s.innerHTML=e;var o=i(r),l=o.firstChild;return r.prepend&&o.prepend?o.prepend(s):r.prepend&&l?o.insertBefore(s,l):o.appendChild(s),s}var s=new Map;function o(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(r);if(!s.has(n)){var o=a("",r),l=o.parentNode;s.set(n,l),l.removeChild(o)}var u=Array.from(s.get(n).children).find((function(e){return"STYLE"===e.tagName&&e["rc-util-key"]===t}));if(u){var c,d,f;if((null===(c=r.csp)||void 0===c?void 0:c.nonce)&&u.nonce!==(null===(d=r.csp)||void 0===d?void 0:d.nonce))u.nonce=null===(f=r.csp)||void 0===f?void 0:f.nonce;return u.innerHTML!==e&&(u.innerHTML=e),u}var h=a(e,r);return h["rc-util-key"]=t,h}},Bd2K:
|
|
|
/*!********************************************************!*\
|
|
|
!*** ./node_modules/codemirror/addon/edit/closetag.js ***!
|
|
|
\********************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){!function(e){e.defineOption("autoCloseTags",!1,(function(s,o,l){if(l!=e.Init&&l&&s.removeKeyMap("autoCloseTags"),o){var u={name:"autoCloseTags"};"object"==typeof o&&!1===o.whenClosing||(u["'/'"]=function(t){return function(t){return t.getOption("disableInput")?e.Pass:n(t,!0)}(t)}),"object"==typeof o&&!1===o.whenOpening||(u["'>'"]=function(n){return function(n){if(n.getOption("disableInput"))return e.Pass;for(var s=n.listSelections(),o=[],l=n.getOption("autoCloseTags"),u=0;u<s.length;u++){if(!s[u].empty())return e.Pass;var c=s[u].head,d=n.getTokenAt(c),f=e.innerMode(n.getMode(),d.state),h=f.state,p=f.mode.xmlCurrentTag&&f.mode.xmlCurrentTag(h),g=p&&p.name;if(!g)return e.Pass;var m="html"==f.mode.configuration,v="object"==typeof l&&l.dontCloseTags||m&&t,y="object"==typeof l&&l.indentTags||m&&r;d.end>c.ch&&(g=g.slice(0,g.length-d.end+c.ch));var b=g.toLowerCase();if(!g||"string"==d.type&&(d.end!=c.ch||!/[\"\']/.test(d.string.charAt(d.string.length-1))||1==d.string.length)||"tag"==d.type&&p.close||d.string.indexOf("/")==c.ch-d.start-1||v&&i(v,b)>-1||a(n,f.mode.xmlCurrentContext&&f.mode.xmlCurrentContext(h)||[],g,c,!0))return e.Pass;var E="object"==typeof l&&l.emptyTags;if(E&&i(E,g)>-1)o[u]={text:"/>",newPos:e.Pos(c.line,c.ch+2)};else{var x=y&&i(y,b)>-1;o[u]={indent:x,text:">"+(x?"\n\n":"")+"</"+g+">",newPos:x?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}}var S="object"==typeof l&&l.dontIndentOnAutoClose;for(u=s.length-1;u>=0;u--){var T=o[u];n.replaceRange(T.text,s[u].head,s[u].anchor,"+insert");var k=n.listSelections().slice(0);k[u]={head:T.newPos,anchor:T.newPos},n.setSelections(k),!S&&T.indent&&(n.indentLine(T.newPos.line,null,!0),n.indentLine(T.newPos.line+1,null,!0))}}(n)}),s.addKeyMap(u)}}));var t=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],r=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function n(t,r){for(var n=t.listSelections(),i=[],s=r?"/":"</",o=t.getOption("autoCloseTags"),l="object"==typeof o&&o.dontIndentOnSlash,u=0;u<n.length;u++){if(!n[u].empty())return e.Pass;var c=n[u].head,d=t.getTokenAt(c),f=e.innerMode(t.getMode(),d.state),h=f.state;if(r&&("string"==d.type||"<"!=d.string.charAt(0)||d.start!=c.ch-1))return e.Pass;var p,g="xml"!=f.mode.name&&"htmlmixed"==t.getMode().name;if(g&&"javascript"==f.mode.name)p=s+"script";else if(g&&"css"==f.mode.name)p=s+"style";else{var m=f.mode.xmlCurrentContext&&f.mode.xmlCurrentContext(h);if(!m||m.length&&a(t,m,m[m.length-1],c))return e.Pass;p=s+m[m.length-1]}">"!=t.getLine(c.line).charAt(d.end)&&(p+=">"),i[u]=p}if(t.replaceSelections(i),n=t.listSelections(),!l)for(u=0;u<n.length;u++)(u==n.length-1||n[u].head.line<n[u+1].head.line)&&t.indentLine(n[u].head.line)}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;++r)if(e[r]==t)return r;return-1}function a(t,r,n,i,a){if(!e.scanForClosingTag)return!1;var s=Math.min(t.lastLine()+1,i.line+500),o=e.scanForClosingTag(t,i,null,s);if(!o||o.tag!=n)return!1;for(var l=a?1:0,u=r.length-1;u>=0&&r[u]==n;u--)++l;for(i=o.to,u=1;u<l;u++){var c=e.scanForClosingTag(t,i,null,s);if(!c||c.tag!=n)return!1;i=c.to}return!0}e.commands.closeTag=function(e){return n(e)}}(r(/*! ../../lib/codemirror */"VrN/"),r(/*! ../fold/xml-fold */"osHv"))},BjJ7:
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/pages/tasks/util.js ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: isCompileOk, getTreeData, processTreeData, debounce, isProd, apiPref */
|
|
|
/*! exports used: apiPref, debounce, getTreeData, isCompileOk, processTreeData */function(e,t,r){"use strict";function n(e){var t=!0;if(e.length>0){for(var r=0;r<e.length;r++)if(0==e[r].compile_success||!e[r].compile_success){t=!1;break}}else t=!1;return t}function i(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=[],n=0;n<e.length;n++){var i=e[n],a=t?"".concat(t,"/").concat(i.name):"".concat(i.name);r.push({title:i.name,isLeaf:"tree"!==i.type,key:a})}return r}function a(e,t,r){for(var n=0;n<e.length;n++){var i=e[n];if(i.key===t){i.children=r;break}i.children&&a(i.children,t,r)}return e}function s(e,t,r){var n;return function(){var i=this,a=arguments,s=function(){n=null,r||e.apply(i,a)},o=r&&!n;clearTimeout(n),n=setTimeout(s,t),o&&e.apply(i,a)}}r.d(t,"d",(function(){return n})),r.d(t,"c",(function(){return i})),r.d(t,"e",(function(){return a})),r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return o}));var o=r(/*! @/utils/env */"m3rI").a.API_SERVER},"C+DQ":
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/css/iconfont.css ***!
|
|
|
\*********************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){},DlQD:
|
|
|
/*!*******************************************!*\
|
|
|
!*** ./node_modules/marked/lib/marked.js ***!
|
|
|
\*******************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){e.exports=function(){"use strict";function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var n=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){function t(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}e.exports={defaults:{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1},getDefaults:t,changeDefaults:function(t){e.exports.defaults=t}}})),i=(n.defaults,n.getDefaults,n.changeDefaults,/[&<>"']/),a=/[&<>"']/g,s=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,l={"&":"&","<":"<",">":">",'"':""","'":"'"},u=function(e){return l[e]},c=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function d(e){return e.replace(c,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var f=/(^|[^\[])\^/g,h=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,g={},m=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function b(e,t){g[" "+e]||(m.test(e)?g[" "+e]=e+"/":g[" "+e]=E(e,"/",!0));var r=-1===(e=g[" "+e]).indexOf(":");return"//"===t.substring(0,2)?r?t:e.replace(v,"$1")+t:"/"===t.charAt(0)?r?t:e.replace(y,"$1")+t:e+t}function E(e,t,r){var n=e.length;if(0===n)return"";for(var i=0;i<n;){var a=e.charAt(n-i-1);if(a!==t||r){if(a===t||!r)break;i++}else i++}return e.substr(0,n-i)}var x=function(e,t){if(t){if(i.test(e))return e.replace(a,u)}else if(s.test(e))return e.replace(o,u);return e},S=d,T=function(e,t){e=e.source||e,t=t||"";var r={replace:function(t,n){return n=(n=n.source||n).replace(f,"$1"),e=e.replace(t,n),r},getRegex:function(){return new RegExp(e,t)}};return r},k=function(e,t,r){if(e){var n;try{n=decodeURIComponent(d(r)).replace(h,"").toLowerCase()}catch(e){return null}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:")||0===n.indexOf("data:"))return null}t&&!p.test(r)&&(r=b(t,r));try{r=encodeURI(r).replace(/%25/g,"%")}catch(e){return null}return r},w={exec:function(){}},C=function(e){for(var t,r,n=1;n<arguments.length;n++)for(r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},L=function(e,t){var r=e.replace(/\|/g,(function(e,t,r){for(var n=!1,i=t;--i>=0&&"\\"===r[i];)n=!n;return n?"|":" |"})).split(/ \|/),n=0;if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r},A=E,D=function(e,t){if(-1===e.indexOf(t[1]))return-1;for(var r=e.length,n=0,i=0;i<r;i++)if("\\"===e[i])i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&--n<0)return i;return-1},O=function(e){e&&e.sanitize&&!e.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")},_=n.defaults,R=A,I=L,M=x,F=D;function P(e,t,r){var n=t.href,i=t.title?M(t.title):null,a=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:r,href:n,title:i,text:a}:{type:"image",raw:r,href:n,title:i,text:M(a)}}var N=function(){function e(e){this.options=e||_}var t=e.prototype;return t.space=function(e){var t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e,t){var r=this.rules.block.code.exec(e);if(r){var n=t[t.length-1];if(n&&"paragraph"===n.type)return{raw:r[0],text:r[0].trimRight()};var i=r[0].replace(/^ {4}/gm,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?i:R(i,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var r=t[0],n=function(e,t){var r=e.match(/^(\s+)(?:```)/);if(null===r)return t;var n=r[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=n.length?e.slice(n.length):e})).join("\n")}(r,t[3]||"");return{type:"code",raw:r,lang:t[2]?t[2].trim():t[2],text:n}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}},t.nptable=function(e){var t=this.rules.block.nptable.exec(e);if(t){var r={type:"table",header:I(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[],raw:t[0]};if(r.header.length===r.align.length){var n,i=r.align.length;for(n=0;n<i;n++)/^ *-+: *$/.test(r.align[n])?r.align[n]="right":/^ *:-+: *$/.test(r.align[n])?r.align[n]="center":/^ *:-+ *$/.test(r.align[n])?r.align[n]="left":r.align[n]=null;for(i=r.cells.length,n=0;n<i;n++)r.cells[n]=I(r.cells[n],r.header.length);return r}}},t.hr=function(e){var t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}},t.blockquote=function(e){var t=this.rules.block.blockquote.exec(e);if(t){var r=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],text:r}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){for(var r,n,i,a,s,o,l,u=t[0],c=t[2],d=c.length>1,f=")"===c[c.length-1],h={type:"list",raw:u,ordered:d,start:d?+c.slice(0,-1):"",loose:!1,items:[]},p=t[0].match(this.rules.block.item),g=!1,m=p.length,v=0;v<m;v++)u=r=p[v],n=r.length,~(r=r.replace(/^ *([*+-]|\d+[.)]) */,"")).indexOf("\n ")&&(n-=r.length,r=this.options.pedantic?r.replace(/^ {1,4}/gm,""):r.replace(new RegExp("^ {1,"+n+"}","gm"),"")),v!==m-1&&(i=this.rules.block.bullet.exec(p[v+1])[0],(d?1===i.length||!f&&")"===i[i.length-1]:i.length>1||this.options.smartLists&&i!==c)&&(a=p.slice(v+1).join("\n"),h.raw=h.raw.substring(0,h.raw.length-a.length),v=m-1)),s=g||/\n\n(?!\s*$)/.test(r),v!==m-1&&(g="\n"===r.charAt(r.length-1),s||(s=g)),s&&(h.loose=!0),l=void 0,(o=/^\[[ xX]\] /.test(r))&&(l=" "!==r[1],r=r.replace(/^\[[ xX]\] +/,"")),h.items.push({type:"list_item",raw:u,task:o,checked:l,loose:s,text:r});return h}},t.html=function(e){var t=this.rules.block.html.exec(e);if(t)return{type:this.options.sanitize?"paragraph":"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):M(t[0]):t[0]}},t.def=function(e){var t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}},t.table=function(e){var t=this.rules.block.table.exec(e);if(t){var r={type:"table",header:I(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(r.header.length===r.align.length){r.raw=t[0];var n,i=r.align.length;for(n=0;n<i;n++)/^ *-+: *$/.test(r.align[n])?r.align[n]="right":/^ *:-+: *$/.test(r.align[n])?r.align[n]="center":/^ *:-+ *$/.test(r.align[n])?r.align[n]="left":r.align[n]=null;for(i=r.cells.length,n=0;n<i;n++)r.cells[n]=I(r.cells[n].replace(/^ *\| *| *\| *$/g,""),r.header.length);return r}}},t.lheading=function(e){var t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1]}},t.paragraph=function(e){var t=this.rules.block.paragraph.exec(e);if(t)return{type:"paragraph",raw:t[0],text:"\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1]}},t.text=function(e,t){var r=this.rules.block.text.exec(e);if(r){var n=t[t.length-1];return n&&"text"===n.type?{raw:r[0],text:r[0]}:{type:"text",raw:r[0],text:r[0]}}},t.escape=function(e){var t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:M(t[1])}},t.tag=function(e,t,r){var n=this.rules.inline.tag.exec(e);if(n)return!t&&/^<a /i.test(n[0])?t=!0:t&&/^<\/a>/i.test(n[0])&&(t=!1),!r&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?r=!0:r&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(r=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:t,inRawBlock:r,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):M(n[0]):n[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var r=F(t[2],"()");if(r>-1){var n=(0===t[0].indexOf("!")?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,n).trim(),t[3]=""}var i=t[2],a="";if(this.options.pedantic){var s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);s?(i=s[1],a=s[3]):a=""}else a=t[3]?t[3].slice(1,-1):"";return P(t,{href:(i=i.trim().replace(/^<([\s\S]*)>$/,"$1"))?i.replace(this.rules.inline._escapes,"$1"):i,title:a?a.replace(this.rules.inline._escapes,"$1"):a},t[0])}},t.reflink=function(e,t){var r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){var n=(r[2]||r[1]).replace(/\s+/g," ");if(!(n=t[n.toLowerCase()])||!n.href){var i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return P(r,n,r[0])}},t.strong=function(e,t,r){void 0===r&&(r="");var n=this.rules.inline.strong.start.exec(e);if(n&&(!n[1]||n[1]&&(""===r||this.rules.inline.punctuation.exec(r)))){t=t.slice(-1*e.length);var i,a="**"===n[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(a.lastIndex=0;null!=(n=a.exec(t));)if(i=this.rules.inline.strong.middle.exec(t.slice(0,n.index+3)))return{type:"strong",raw:e.slice(0,i[0].length),text:e.slice(2,i[0].length-2)}}},t.em=function(e,t,r){void 0===r&&(r="");var n=this.rules.inline.em.start.exec(e);if(n&&(!n[1]||n[1]&&(""===r||this.rules.inline.punctuation.exec(r)))){t=t.slice(-1*e.length);var i,a="*"===n[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(a.lastIndex=0;null!=(n=a.exec(t));)if(i=this.rules.inline.em.middle.exec(t.slice(0,n.index+2)))return{type:"em",raw:e.slice(0,i[0].length),text:e.slice(1,i[0].length-1)}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var r=t[2].replace(/\n/g," "),n=/[^ ]/.test(r),i=r.startsWith(" ")&&r.endsWith(" ");return n&&i&&(r=r.substring(1,r.length-1)),r=M(r,!0),{type:"codespan",raw:t[0],text:r}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[1]}},t.autolink=function(e,t){var r,n,i=this.rules.inline.autolink.exec(e);if(i)return n="@"===i[2]?"mailto:"+(r=M(this.options.mangle?t(i[1]):i[1])):r=M(i[1]),{type:"link",raw:i[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}},t.url=function(e,t){var r;if(r=this.rules.inline.url.exec(e)){var n,i;if("@"===r[2])i="mailto:"+(n=M(this.options.mangle?t(r[0]):r[0]));else{var a;do{a=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])[0]}while(a!==r[0]);n=M(r[0]),i="www."===r[1]?"http://"+n:n}return{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}},t.inlineText=function(e,t,r){var n,i=this.rules.inline.text.exec(e);if(i)return n=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):M(i[0]):i[0]:M(this.options.smartypants?r(i[0]):i[0]),{type:"text",raw:i[0],text:n}},e}(),B=w,j=T,U=C,H={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\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{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:B,table:B,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};H.def=j(H.def).replace("label",H._label).replace("title",H._title).getRegex(),H.bullet=/(?:[*+-]|\d{1,9}[.)])/,H.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,H.item=j(H.item,"gm").replace(/bull/g,H.bullet).getRegex(),H.list=j(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=j(H.html,"i").replace("comment",H._comment).replace("tag",H._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),H.paragraph=j(H._paragraph).replace("hr",H.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").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|!--)").replace("tag",H._tag).getRegex(),H.blockquote=j(H.blockquote).replace("paragraph",H.paragraph).getRegex(),H.normal=U({},H),H.gfm=U({},H.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),H.gfm.nptable=j(H.gfm.nptable).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|!--)").replace("tag",H._tag).getRegex(),H.gfm.table=j(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|!--)").replace("tag",H._tag).getRegex(),H.pedantic=U({},H.normal,{html:j("^ *(?: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]+?) *(?:#+ *)?(?:\n+|$)/,fences:B,paragraph:j(H.normal._paragraph).replace("hr",H.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",H.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var G={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:B,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)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:B,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};G.punctuation=j(G.punctuation).replace(/punctuation/g,G._punctuation).getRegex(),G._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",G._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",G.em.start=j(G.em.start).replace(/punctuation/g,G._punctuation).getRegex(),G.em.middle=j(G.em.middle).replace(/punctuation/g,G._punctuation).replace(/overlapSkip/g,G._overlapSkip).getRegex(),G.em.endAst=j(G.em.endAst,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.em.endUnd=j(G.em.endUnd,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.strong.start=j(G.strong.start).replace(/punctuation/g,G._punctuation).getRegex(),G.strong.middle=j(G.strong.middle).replace(/punctuation/g,G._punctuation).replace(/blockSkip/g,G._blockSkip).getRegex(),G.strong.endAst=j(G.strong.endAst,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.strong.endUnd=j(G.strong.endUnd,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.blockSkip=j(G._blockSkip,"g").getRegex(),G.overlapSkip=j(G._overlapSkip,"g").getRegex(),G._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,G._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,G._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])?)+(?![-_])/,G.autolink=j(G.autolink).replace("scheme",G._scheme).replace("email",G._email).getRegex(),G._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,G.tag=j(G.tag).replace("comment",H._comment).replace("attribute",G._attribute).getRegex(),G._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,G._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,G._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,G.link=j(G.link).replace("label",G._label).replace("href",G._href).replace("title",G._title).getRegex(),G.reflink=j(G.reflink).replace("label",G._label).getRegex(),G.reflinkSearch=j(G.reflinkSearch,"g").replace("reflink",G.reflink).replace("nolink",G.nolink).getRegex(),G.normal=U({},G),G.pedantic=U({},G.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:j(/^!?\[(label)\]\((.*?)\)/).replace("label",G._label).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",G._label).getRegex()}),G.gfm=U({},G.normal,{escape:j(G.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)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),G.gfm.url=j(G.gfm.url,"i").replace("email",G.gfm._extended_email).getRegex(),G.breaks=U({},G.gfm,{br:j(G.br).replace("{2,}","*").getRegex(),text:j(G.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var W={block:H,inline:G},z=n.defaults,K=W.block,V=W.inline;function q(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function $(e){var t,r,n="",i=e.length;for(t=0;t<i;t++)r=e.charCodeAt(t),Math.random()>.5&&(r="x"+r.toString(16)),n+="&#"+r+";";return n}var Y=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||z,this.options.tokenizer=this.options.tokenizer||new N,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:K.normal,inline:V.normal};this.options.pedantic?(t.block=K.pedantic,t.inline=V.pedantic):this.options.gfm&&(t.block=K.gfm,this.options.breaks?t.inline=V.breaks:t.inline=V.gfm),this.tokenizer.rules=t}t.lex=function(e,r){return new t(r).lex(e)};var r,n,i,a=t.prototype;return a.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},a.blockTokens=function(e,t,r){var n,i,a,s;for(void 0===t&&(t=[]),void 0===r&&(r=!0),e=e.replace(/^ +$/gm,"");e;)if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),n.type&&t.push(n);else if(n=this.tokenizer.code(e,t))e=e.substring(n.raw.length),n.type?t.push(n):((s=t[t.length-1]).raw+="\n"+n.raw,s.text+="\n"+n.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.nptable(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),n.tokens=this.blockTokens(n.text,[],r),t.push(n);else if(n=this.tokenizer.list(e)){for(e=e.substring(n.raw.length),a=n.items.length,i=0;i<a;i++)n.items[i].tokens=this.blockTokens(n.items[i].text,[],!1);t.push(n)}else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(r&&(n=this.tokenizer.def(e)))e=e.substring(n.raw.length),this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else if(r&&(n=this.tokenizer.paragraph(e)))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.text(e,t))e=e.substring(n.raw.length),n.type?t.push(n):((s=t[t.length-1]).raw+="\n"+n.raw,s.text+="\n"+n.text);else if(e){var o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}throw new Error(o)}return t},a.inline=function(e){var t,r,n,i,a,s,o=e.length;for(t=0;t<o;t++)switch((s=e[t]).type){case"paragraph":case"text":case"heading":s.tokens=[],this.inlineTokens(s.text,s.tokens);break;case"table":for(s.tokens={header:[],cells:[]},i=s.header.length,r=0;r<i;r++)s.tokens.header[r]=[],this.inlineTokens(s.header[r],s.tokens.header[r]);for(i=s.cells.length,r=0;r<i;r++)for(a=s.cells[r],s.tokens.cells[r]=[],n=0;n<a.length;n++)s.tokens.cells[r][n]=[],this.inlineTokens(a[n],s.tokens.cells[r][n]);break;case"blockquote":this.inline(s.tokens);break;case"list":for(i=s.items.length,r=0;r<i;r++)this.inline(s.items[r].tokens)}return e},a.inlineTokens=function(e,t,r,n,i){var a;void 0===t&&(t=[]),void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i="");var s,o=e;if(this.tokens.links){var l=Object.keys(this.tokens.links);if(l.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(o));)l.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(o));)o=o.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;e;)if(a=this.tokenizer.escape(e))e=e.substring(a.raw.length),t.push(a);else if(a=this.tokenizer.tag(e,r,n))e=e.substring(a.raw.length),r=a.inLink,n=a.inRawBlock,t.push(a);else if(a=this.tokenizer.link(e))e=e.substring(a.raw.length),"link"===a.type&&(a.tokens=this.inlineTokens(a.text,[],!0,n)),t.push(a);else if(a=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(a.raw.length),"link"===a.type&&(a.tokens=this.inlineTokens(a.text,[],!0,n)),t.push(a);else if(a=this.tokenizer.strong(e,o,i))e=e.substring(a.raw.length),a.tokens=this.inlineTokens(a.text,[],r,n),t.push(a);else if(a=this.tokenizer.em(e,o,i))e=e.substring(a.raw.length),a.tokens=this.inlineTokens(a.text,[],r,n),t.push(a);else if(a=this.tokenizer.codespan(e))e=e.substring(a.raw.length),t.push(a);else if(a=this.tokenizer.br(e))e=e.substring(a.raw.length),t.push(a);else if(a=this.tokenizer.del(e))e=e.substring(a.raw.length),a.tokens=this.inlineTokens(a.text,[],r,n),t.push(a);else if(a=this.tokenizer.autolink(e,$))e=e.substring(a.raw.length),t.push(a);else if(r||!(a=this.tokenizer.url(e,$))){if(a=this.tokenizer.inlineText(e,n,q))e=e.substring(a.raw.length),i=a.raw.slice(-1),t.push(a);else if(e){var u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}throw new Error(u)}}else e=e.substring(a.raw.length),t.push(a);return t},r=t,i=[{key:"rules",get:function(){return{block:K,inline:V}}}],(n=null)&&e(r.prototype,n),i&&e(r,i),t}(),X=n.defaults,Z=k,Q=x,J=function(){function e(e){this.options=e||X}var t=e.prototype;return t.code=function(e,t,r){var n=(t||"").match(/\S*/)[0];if(this.options.highlight){var i=this.options.highlight(e,n);null!=i&&i!==e&&(r=!0,e=i)}return n?'<pre><code class="'+this.options.langPrefix+Q(n,!0)+'">'+(r?e:Q(e,!0))+"</code></pre>\n":"<pre><code>"+(r?e:Q(e,!0))+"</code></pre>\n"},t.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},t.html=function(e){return e},t.heading=function(e,t,r,n){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+n.slug(r)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},t.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},t.list=function(e,t,r){var n=t?"ol":"ul";return"<"+n+(t&&1!==r?' start="'+r+'"':"")+">\n"+e+"</"+n+">\n"},t.listitem=function(e){return"<li>"+e+"</li>\n"},t.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},t.paragraph=function(e){return"<p>"+e+"</p>\n"},t.table=function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"},t.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},t.tablecell=function(e,t){var r=t.header?"th":"td";return(t.align?"<"+r+' align="'+t.align+'">':"<"+r+">")+e+"</"+r+">\n"},t.strong=function(e){return"<strong>"+e+"</strong>"},t.em=function(e){return"<em>"+e+"</em>"},t.codespan=function(e){return"<code>"+e+"</code>"},t.br=function(){return this.options.xhtml?"<br/>":"<br>"},t.del=function(e){return"<del>"+e+"</del>"},t.link=function(e,t,r){if(null===(e=Z(this.options.sanitize,this.options.baseUrl,e)))return r;var n='<a href="'+Q(e)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+r+"</a>"},t.image=function(e,t,r){if(null===(e=Z(this.options.sanitize,this.options.baseUrl,e)))return r;var n='<img src="'+e+'" alt="'+r+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">"},t.text=function(e){return e},e}(),ee=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,r){return""+r},t.image=function(e,t,r){return""+r},t.br=function(){return""},e}(),te=function(){function e(){this.seen={}}return e.prototype.slug=function(e){var t=e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t)){var r=t;do{this.seen[r]++,t=r+"-"+this.seen[r]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t},e}(),re=n.defaults,ne=S,ie=function(){function e(e){this.options=e||re,this.options.renderer=this.options.renderer||new J,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ee,this.slugger=new te}e.parse=function(t,r){return new e(r).parse(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var r,n,i,a,s,o,l,u,c,d,f,h,p,g,m,v,y,b,E="",x=e.length;for(r=0;r<x;r++)switch((d=e[r]).type){case"space":continue;case"hr":E+=this.renderer.hr();continue;case"heading":E+=this.renderer.heading(this.parseInline(d.tokens),d.depth,ne(this.parseInline(d.tokens,this.textRenderer)),this.slugger);continue;case"code":E+=this.renderer.code(d.text,d.lang,d.escaped);continue;case"table":for(u="",l="",a=d.header.length,n=0;n<a;n++)l+=this.renderer.tablecell(this.parseInline(d.tokens.header[n]),{header:!0,align:d.align[n]});for(u+=this.renderer.tablerow(l),c="",a=d.cells.length,n=0;n<a;n++){for(l="",s=(o=d.tokens.cells[n]).length,i=0;i<s;i++)l+=this.renderer.tablecell(this.parseInline(o[i]),{header:!1,align:d.align[i]});c+=this.renderer.tablerow(l)}E+=this.renderer.table(u,c);continue;case"blockquote":c=this.parse(d.tokens),E+=this.renderer.blockquote(c);continue;case"list":for(f=d.ordered,h=d.start,p=d.loose,a=d.items.length,c="",n=0;n<a;n++)v=(m=d.items[n]).checked,y=m.task,g="",m.task&&(b=this.renderer.checkbox(v),p?m.tokens.length>0&&"text"===m.tokens[0].type?(m.tokens[0].text=b+" "+m.tokens[0].text,m.tokens[0].tokens&&m.tokens[0].tokens.length>0&&"text"===m.tokens[0].tokens[0].type&&(m.tokens[0].tokens[0].text=b+" "+m.tokens[0].tokens[0].text)):m.tokens.unshift({type:"text",text:b}):g+=b),g+=this.parse(m.tokens,p),c+=this.renderer.listitem(g,y,v);E+=this.renderer.list(c,f,h);continue;case"html":E+=this.renderer.html(d.text);continue;case"paragraph":E+=this.renderer.paragraph(this.parseInline(d.tokens));continue;case"text":for(c=d.tokens?this.parseInline(d.tokens):d.text;r+1<x&&"text"===e[r+1].type;)c+="\n"+((d=e[++r]).tokens?this.parseInline(d.tokens):d.text);E+=t?this.renderer.paragraph(c):c;continue;default:var S='Token with "'+d.type+'" type was not found.';if(this.options.silent)return void console.error(S);throw new Error(S)}return E},t.parseInline=function(e,t){t=t||this.renderer;var r,n,i="",a=e.length;for(r=0;r<a;r++)switch((n=e[r]).type){case"escape":i+=t.text(n.text);break;case"html":i+=t.html(n.text);break;case"link":i+=t.link(n.href,n.title,this.parseInline(n.tokens,t));break;case"image":i+=t.image(n.href,n.title,n.text);break;case"strong":i+=t.strong(this.parseInline(n.tokens,t));break;case"em":i+=t.em(this.parseInline(n.tokens,t));break;case"codespan":i+=t.codespan(n.text);break;case"br":i+=t.br();break;case"del":i+=t.del(this.parseInline(n.tokens,t));break;case"text":i+=t.text(n.text);break;default:var s='Token with "'+n.type+'" type was not found.';if(this.options.silent)return void console.error(s);throw new Error(s)}return i},e}(),ae=C,se=O,oe=x,le=n.getDefaults,ue=n.changeDefaults,ce=n.defaults;function de(e,t,r){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof t&&(r=t,t=null),t=ae({},de.defaults,t||{}),se(t),r){var n,i=t.highlight;try{n=Y.lex(e,t)}catch(e){return r(e)}var a=function(e){var a;if(!e)try{a=ie.parse(n,t)}catch(t){e=t}return t.highlight=i,e?r(e):r(null,a)};if(!i||i.length<3)return a();if(delete t.highlight,!n.length)return a();var s=0;return de.walkTokens(n,(function(e){"code"===e.type&&(s++,setTimeout((function(){i(e.text,e.lang,(function(t,r){if(t)return a(t);null!=r&&r!==e.text&&(e.text=r,e.escaped=!0),0==--s&&a()}))}),0))})),void(0===s&&a())}try{var o=Y.lex(e,t);return t.walkTokens&&de.walkTokens(o,t.walkTokens),ie.parse(o,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+oe(e.message+"",!0)+"</pre>";throw e}}return de.options=de.setOptions=function(e){return ae(de.defaults,e),ue(de.defaults),de},de.getDefaults=le,de.defaults=ce,de.use=function(e){var t=ae({},e);if(e.renderer&&function(){var r=de.defaults.renderer||new J,n=function(t){var n=r[t];r[t]=function(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=e.renderer[t].apply(r,a);return!1===o&&(o=n.apply(r,a)),o}};for(var i in e.renderer)n(i);t.renderer=r}(),e.tokenizer&&function(){var r=de.defaults.tokenizer||new N,n=function(t){var n=r[t];r[t]=function(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=e.tokenizer[t].apply(r,a);return!1===o&&(o=n.apply(r,a)),o}};for(var i in e.tokenizer)n(i);t.tokenizer=r}(),e.walkTokens){var r=de.defaults.walkTokens;t.walkTokens=function(t){e.walkTokens(t),r&&r(t)}}de.setOptions(t)},de.walkTokens=function(e,t){for(var n,i=r(e);!(n=i()).done;){var a=n.value;switch(t(a),a.type){case"table":for(var s,o=r(a.tokens.header);!(s=o()).done;){var l=s.value;de.walkTokens(l,t)}for(var u,c=r(a.tokens.cells);!(u=c()).done;)for(var d,f=r(u.value);!(d=f()).done;){var h=d.value;de.walkTokens(h,t)}break;case"list":de.walkTokens(a.items,t);break;default:a.tokens&&de.walkTokens(a.tokens,t)}}},de.Parser=ie,de.parser=ie.parse,de.Renderer=J,de.TextRenderer=ee,de.Lexer=Y,de.lexer=Y.lex,de.Tokenizer=N,de.Slugger=te,de.parse=de,de}()},ELLl:
|
|
|
/*!*************************************************************!*\
|
|
|
!*** ./node_modules/codemirror/addon/edit/closebrackets.js ***!
|
|
|
\*************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){!function(e){var t={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},r=e.Pos;function n(e,r){return"pairs"==r&&"string"==typeof e?e:"object"==typeof e&&null!=e[r]?e[r]:t[r]}e.defineOption("autoCloseBrackets",!1,(function(t,r,s){s&&s!=e.Init&&(t.removeKeyMap(i),t.state.closeBrackets=null),r&&(a(n(r,"pairs")),t.state.closeBrackets=r,t.addKeyMap(i))}));var i={Backspace:function(t){var i=o(t);if(!i||t.getOption("disableInput"))return e.Pass;for(var a=n(i,"pairs"),s=t.listSelections(),u=0;u<s.length;u++){if(!s[u].empty())return e.Pass;var c=l(t,s[u].head);if(!c||a.indexOf(c)%2!=0)return e.Pass}for(u=s.length-1;u>=0;u--){var d=s[u].head;t.replaceRange("",r(d.line,d.ch-1),r(d.line,d.ch+1),"+delete")}},Enter:function(t){var r=o(t),i=r&&n(r,"explode");if(!i||t.getOption("disableInput"))return e.Pass;for(var a=t.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return e.Pass;var u=l(t,a[s].head);if(!u||i.indexOf(u)%2!=0)return e.Pass}t.operation((function(){var e=t.lineSeparator()||"\n";t.replaceSelection(e+e,null),t.execCommand("goCharLeft"),a=t.listSelections();for(var r=0;r<a.length;r++){var n=a[r].head.line;t.indentLine(n,null,!0),t.indentLine(n+1,null,!0)}}))}};function a(e){for(var t=0;t<e.length;t++){var r=e.charAt(t),n="'"+r+"'";i[n]||(i[n]=s(r))}}function s(t){return function(i){return function(t,i){var a=o(t);if(!a||t.getOption("disableInput"))return e.Pass;var s=n(a,"pairs"),l=s.indexOf(i);if(-1==l)return e.Pass;for(var c,d=n(a,"closeBefore"),f=n(a,"triples"),h=s.charAt(l+1)==i,p=t.listSelections(),g=l%2==0,m=0;m<p.length;m++){var v,y=p[m],b=y.head,E=t.getRange(b,r(b.line,b.ch+1));if(g&&!y.empty())v="surround";else if(!h&&g||E!=i)if(h&&b.ch>1&&f.indexOf(i)>=0&&t.getRange(r(b.line,b.ch-2),b)==i+i){if(b.ch>2&&/\bstring/.test(t.getTokenTypeAt(r(b.line,b.ch-2))))return e.Pass;v="addFour"}else if(h){var x=0==b.ch?" ":t.getRange(r(b.line,b.ch-1),b);if(e.isWordChar(E)||x==i||e.isWordChar(x))return e.Pass;v="both"}else{if(!g||!(0===E.length||/\s/.test(E)||d.indexOf(E)>-1))return e.Pass;v="both"}else v=h&&u(t,b)?"both":f.indexOf(i)>=0&&t.getRange(b,r(b.line,b.ch+3))==i+i+i?"skipThree":"skip";if(c){if(c!=v)return e.Pass}else c=v}var S=l%2?s.charAt(l-1):i,T=l%2?i:s.charAt(l+1);t.operation((function(){if("skip"==c)t.execCommand("goCharRight");else if("skipThree"==c)for(var n=0;n<3;n++)t.execCommand("goCharRight");else if("surround"==c){var i=t.getSelections();for(n=0;n<i.length;n++)i[n]=S+i[n]+T;for(t.replaceSelections(i,"around"),i=t.listSelections().slice(),n=0;n<i.length;n++)i[n]=(a=i[n],s=void 0,s=e.cmpPos(a.anchor,a.head)>0,{anchor:new r(a.anchor.line,a.anchor.ch+(s?-1:1)),head:new r(a.head.line,a.head.ch+(s?1:-1))});t.setSelections(i)}else"both"==c?(t.replaceSelection(S+T,null),t.triggerElectric(S+T),t.execCommand("goCharLeft")):"addFour"==c&&(t.replaceSelection(S+S+S+S,"before"),t.execCommand("goCharRight"));var a,s}))}(i,t)}}function o(e){var t=e.state.closeBrackets;return!t||t.override?t:e.getModeAt(e.getCursor()).closeBrackets||t}function l(e,t){var n=e.getRange(r(t.line,t.ch-1),r(t.line,t.ch+1));return 2==n.length?n:null}function u(e,t){var n=e.getTokenAt(r(t.line,t.ch+1));return/\bstring/.test(n.type)&&n.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}a(t.pairs+"`")}(r(/*! ../../lib/codemirror */"VrN/"))},GfqC:
|
|
|
/*!********************************************************!*\
|
|
|
!*** ./node_modules/rc-upload/es/index.js + 6 modules ***!
|
|
|
\********************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,r){"use strict";var n=r("q1tI"),i=r.n(n),a=r("TSYQ"),s=r.n(a);function o(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function l(e){var t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress(t)});var r=new FormData;e.data&&Object.keys(e.data).forEach((function(t){var n=e.data[t];Array.isArray(n)?n.forEach((function(e){r.append(t+"[]",e)})):r.append(t,e.data[t])})),e.file instanceof Blob?r.append(e.filename,e.file,e.file.name):r.append(e.filename,e.file),t.onerror=function(t){e.onError(t)},t.onload=function(){return t.status<200||t.status>=300?e.onError(function(e,t){var r="cannot "+e.method+" "+e.action+" "+t.status+"'",n=new Error(r);return n.status=t.status,n.method=e.method,n.url=e.action,n}(e,t),o(t)):e.onSuccess(o(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);var n=e.headers||{};return null!==n["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(n).forEach((function(e){null!==n[e]&&t.setRequestHeader(e,n[e])})),t.send(r),{abort:function(){t.abort()}}}var u=+new Date,c=0;function d(){return"rc-upload-"+u+"-"+ ++c}var f=function(e,t){if(e&&t){var r=Array.isArray(t)?t:t.split(","),n=e.name||"",i=e.type||"",a=i.replace(/\/.*$/,"");return r.some((function(e){var t,r,s=e.trim();return"."===s.charAt(0)?(t=n.toLowerCase(),r=s.toLowerCase(),-1!==t.indexOf(r,t.length-r.length)):/\/\*$/.test(s)?a===s.replace(/\/.*$/,""):i===s}))}return!0};var h=function(e,t,r){var n=function e(n,i){i=i||"",n.isFile?n.file((function(e){r(e)&&(n.fullPath&&!e.webkitRelativePath&&(Object.defineProperties(e,{webkitRelativePath:{writable:!0}}),e.webkitRelativePath=n.fullPath.replace(/^\//,""),Object.defineProperties(e,{webkitRelativePath:{writable:!1}})),t([e]))})):n.isDirectory&&function(e,t){var r=e.createReader(),n=[];!function e(){r.readEntries((function(r){var i=Array.prototype.slice.apply(r);n=n.concat(i),!i.length?t(n):e()}))}()}(n,(function(t){t.forEach((function(t){e(t,""+i+n.name+"/")}))}))};e.forEach((function(e){n(e.webkitGetAsEntry())}))},p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},m=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var E=function(e){function t(){var e,r,n;y(this,t);for(var i=arguments.length,a=Array(i),s=0;s<i;s++)a[s]=arguments[s];return r=n=b(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),n.state={uid:d()},n.reqs={},n.onChange=function(e){var t=e.target.files;n.uploadFiles(t),n.reset()},n.onClick=function(e){var t=n.fileInput;if(t){var r=n.props,i=r.children,a=r.onClick;i&&"button"===i.type&&(t.parentNode.focus(),t.parentNode.querySelector("button").blur()),t.click(),a&&a(e)}},n.onKeyDown=function(e){"Enter"===e.key&&n.onClick()},n.onFileDrop=function(e){var t=n.props.multiple;if(e.preventDefault(),"dragover"!==e.type)if(n.props.directory)h(Array.prototype.slice.call(e.dataTransfer.items),n.uploadFiles,(function(e){return f(e,n.props.accept)}));else{var r=Array.prototype.slice.call(e.dataTransfer.files).filter((function(e){return f(e,n.props.accept)}));!1===t&&(r=r.slice(0,1)),n.uploadFiles(r)}},n.uploadFiles=function(e){var t=Array.prototype.slice.call(e);t.map((function(e){return e.uid=d(),e})).forEach((function(e){n.upload(e,t)}))},n.saveFileInput=function(e){n.fileInput=e},b(n,r)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),m(t,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(e,t){var r=this,n=this.props;if(!n.beforeUpload)return setTimeout((function(){return r.post(e)}),0);var i=n.beforeUpload(e,t);i&&i.then?i.then((function(t){var n=Object.prototype.toString.call(t);return"[object File]"===n||"[object Blob]"===n?r.post(t):r.post(e)})).catch((function(e){console.log(e)})):!1!==i&&setTimeout((function(){return r.post(e)}),0)}},{key:"post",value:function(e){var t=this;if(this._isMounted){var r=this.props,n=r.onStart,i=r.onProgress,a=r.transformFile,s=void 0===a?function(e){return e}:a;new Promise((function(t){var n=r.action;return"function"==typeof n&&(n=n(e)),t(n)})).then((function(a){var o=e.uid,u=r.customRequest||l;Promise.resolve(s(e)).then((function(e){var t=r.data;return"function"==typeof t&&(t=t(e)),Promise.all([e,t])})).catch((function(e){console.error(e)})).then((function(s){var l=g(s,2),c=l[0],d=l[1],f={action:a,filename:r.name,data:d,file:c,headers:r.headers,withCredentials:r.withCredentials,method:r.method||"post",onProgress:i?function(t){i(t,e)}:null,onSuccess:function(n,i){delete t.reqs[o],r.onSuccess(n,e,i)},onError:function(n,i){delete t.reqs[o],r.onError(n,i,e)}};n(e),t.reqs[o]=u(f)}))}))}}},{key:"reset",value:function(){this.setState({uid:d()})}},{key:"abort",value:function(e){var t=this.reqs;if(e){var r=e;e&&e.uid&&(r=e.uid),t[r]&&t[r].abort&&t[r].abort(),delete t[r]}else Object.keys(t).forEach((function(e){t[e]&&t[e].abort&&t[e].abort(),delete t[e]}))}},{key:"render",value:function(){var e,t,r=this.props,n=r.component,a=r.prefixCls,o=r.className,l=r.disabled,u=r.id,c=r.style,d=r.multiple,f=r.accept,h=r.children,g=r.directory,m=r.openFileDialogOnClick,y=r.onMouseEnter,b=r.onMouseLeave,E=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(r,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),x=s()((v(e={},a,!0),v(e,a+"-disabled",l),v(e,o,o),e)),S=l?{}:{onClick:m?this.onClick:function(){},onKeyDown:m?this.onKeyDown:function(){},onMouseEnter:y,onMouseLeave:b,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return i.a.createElement(n,p({},S,{className:x,role:"button",style:c}),i.a.createElement("input",p({},(t=E,Object.keys(t).reduce((function(e,r){return"data-"!==r.substr(0,5)&&"aria-"!==r.substr(0,5)&&"role"!==r||(e[r]=t[r]),e}),{})),{id:u,type:"file",ref:this.saveFileInput,onClick:function(e){return e.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:f,directory:g?"directory":null,webkitdirectory:g?"webkitdirectory":null,multiple:d,onChange:this.onChange})),h)}}]),t}(n.Component),x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},S=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function w(){}var C=function(e){function t(){var e,r,n;T(this,t);for(var i=arguments.length,a=Array(i),s=0;s<i;s++)a[s]=arguments[s];return r=n=k(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),n.saveUploader=function(e){n.uploader=e},k(n,r)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),S(t,[{key:"abort",value:function(e){this.uploader.abort(e)}},{key:"render",value:function(){return i.a.createElement(E,x({},this.props,{ref:this.saveUploader}))}}]),t}(n.Component);C.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:w,onError:w,onSuccess:w,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var L=C;t.a=L},HmJG:
|
|
|
/*!****************************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/upload-image/index.less ***!
|
|
|
\****************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){},LdHM:
|
|
|
/*!********************************************************!*\
|
|
|
!*** ./node_modules/rc-select/es/index.js + 6 modules ***!
|
|
|
\********************************************************/
|
|
|
/*! exports provided: Option, OptGroup, default */
|
|
|
/*! exports used: OptGroup, Option, default */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/TransBtn.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/generate.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/commonUtil.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/valueUtil.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMemo.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/pickAttrs.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-virtual-list/es/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,r){"use strict";r.d(t,"b",(function(){return x})),r.d(t,"a",(function(){return T}));var n=r("1OyB"),i=r("vuIU"),a=r("Ji7U"),s=r("LK+K"),o=r("q1tI"),l=r("rePB"),u=r("Ff2n"),c=r("ODXe"),d=r("4IlW"),f=r("bX4T"),h=r("YrtM"),p=r("TSYQ"),g=r.n(p),m=r("+nKL"),v=r("8OUc"),y=o.forwardRef((function(e,t){var r=e.prefixCls,n=e.id,i=e.flattenOptions,a=e.childrenAsData,s=e.values,p=e.searchValue,y=e.multiple,b=e.defaultActiveFirstOption,E=e.height,x=e.itemHeight,S=e.notFoundContent,T=e.open,k=e.menuItemSelectedIcon,w=e.virtual,C=e.onSelect,L=e.onToggleOpen,A=e.onActiveValue,D=e.onScroll,O=e.onMouseEnter,_="".concat(r,"-item"),R=Object(h.a)((function(){return i}),[T,i],(function(e,t){return t[0]&&e[1]!==t[1]})),I=o.useRef(null),M=function(e){e.preventDefault()},F=function(e){I.current&&I.current.scrollTo({index:e})},P=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=R.length,n=0;n<r;n+=1){var i=(e+n*t+r)%r,a=R[i],s=a.group,o=a.data;if(!s&&!o.disabled)return i}return-1},N=o.useState((function(){return P(0)})),B=Object(c.a)(N,2),j=B[0],U=B[1],H=function(e){U(e);var t=R[e];t?A(t.data.value,e):A(null,-1)};o.useEffect((function(){H(!1!==b?P(0):-1)}),[R.length,p]),o.useEffect((function(){var e=setTimeout((function(){if(!y&&T&&1===s.size){var e=Array.from(s)[0],t=R.findIndex((function(t){return t.data.value===e}));H(t),F(t)}}));return function(){return clearTimeout(e)}}),[T]);var G=function(e){void 0!==e&&C(e,{selected:!s.has(e)}),y||L(!1)};if(o.useImperativeHandle(t,(function(){return{onKeyDown:function(e){var t=e.which;switch(t){case d.a.UP:case d.a.DOWN:var r=0;if(t===d.a.UP?r=-1:t===d.a.DOWN&&(r=1),0!==r){var n=P(j+r,r);F(n),H(n)}break;case d.a.ENTER:var i=R[j];i&&!i.data.disabled?G(i.data.value):G(void 0),T&&e.preventDefault();break;case d.a.ESC:L(!1)}},onKeyUp:function(){},scrollTo:function(e){F(e)}}})),0===R.length)return o.createElement("div",{role:"listbox",id:"".concat(n,"_list"),className:"".concat(_,"-empty"),onMouseDown:M},S);function W(e){var t=R[e];if(!t)return null;var r=t.data||{},i=r.value,l=r.label,u=r.children,c=Object(f.a)(r,!0),d=a?u:l;return t?o.createElement("div",Object.assign({"aria-label":"string"==typeof d?d:null},c,{key:e,role:"option",id:"".concat(n,"_list_").concat(e),"aria-selected":s.has(i)}),i):null}return o.createElement(o.Fragment,null,o.createElement("div",{role:"listbox",id:"".concat(n,"_list"),style:{height:0,width:0,overflow:"hidden"}},W(j-1),W(j),W(j+1)),o.createElement(m.a,{itemKey:"key",ref:I,data:R,height:E,itemHeight:x,fullHeight:!1,onMouseDown:M,onScroll:D,virtual:w,onMouseEnter:O},(function(e,t){var r,n=e.group,i=e.groupOption,c=e.data,d=c.label,f=c.key;if(n)return o.createElement("div",{className:g()(_,"".concat(_,"-group"))},void 0!==d?d:f);var h=c.disabled,p=c.value,m=c.title,y=c.children,b=c.style,E=c.className,x=Object(u.a)(c,["disabled","value","title","children","style","className"]),S=s.has(p),T="".concat(_,"-option"),w=g()(_,T,E,(r={},Object(l.a)(r,"".concat(T,"-grouped"),i),Object(l.a)(r,"".concat(T,"-active"),j===t&&!h),Object(l.a)(r,"".concat(T,"-disabled"),h),Object(l.a)(r,"".concat(T,"-selected"),S),r)),C=a?y:d,L=!k||"function"==typeof k||S;return o.createElement("div",Object.assign({},x,{"aria-selected":S,className:w,title:m,onMouseMove:function(){j===t||h||H(t)},onClick:function(){h||G(p)},style:b}),o.createElement("div",{className:"".concat(T,"-content")},C||p),o.isValidElement(k)||S,L&&o.createElement(v.a,{className:"".concat(_,"-option-state"),customizeIcon:k,customizeIconProps:{isSelected:S}},S?"✓":null))})))}));y.displayName="OptionList";var b=y,E=function(){return null};E.isSelectOption=!0;var x=E,S=function(){return null};S.isSelectOptGroup=!0;var T=S,k=r("VTBJ"),w=r("Zm9Q");function C(e){var t=e.key,r=e.props,n=r.children,i=r.value,a=Object(u.a)(r,["children","value"]);return Object(k.a)({key:t,value:void 0!==i?i:t,children:n},a)}function L(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object(w.a)(e).map((function(e,r){if(!o.isValidElement(e)||!e.type)return null;var n=e.type.isSelectOptGroup,i=e.key,a=e.props,s=a.children,l=Object(u.a)(a,["children"]);return t||!n?C(e):Object(k.a)(Object(k.a)({key:"__RC_SELECT_GRP__".concat(null===i?r:i,"__"),label:i},l),{},{options:L(s)})})).filter((function(e){return e}))}var A=r("2Qr1"),D=r("qNPg"),O=r("U8pU"),_=r("Kwbf"),R=r("WKfj");var I=function(e){var t=e.mode,r=e.options,n=e.children,i=e.backfill,a=e.allowClear,s=e.placeholder,l=e.getInputElement,u=e.showSearch,c=e.onSearch,d=e.defaultOpen,f=e.autoFocus,h=e.labelInValue,p=e.value,g=e.inputValue,m=e.optionLabelProp,v="multiple"===t||"tags"===t,y=void 0!==u?u:v||"combobox"===t,b=r||L(n);if(Object(_.a)("tags"!==t||b.every((function(e){return!e.disabled})),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),"tags"===t||"combobox"===t){var E=b.some((function(e){return e.options?e.options.some((function(e){return"number"==typeof("value"in e?e.value:e.key)})):"number"==typeof("value"in e?e.value:e.key)}));Object(_.a)(!E,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(_.a)("combobox"!==t||!m,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(_.a)("combobox"===t||!i,"`backfill` only works with `combobox` mode."),Object(_.a)("combobox"===t||!l,"`getInputElement` only work with `combobox` mode."),Object(_.b)("combobox"!==t||!l||!a||!s,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),c&&!y&&"combobox"!==t&&"tags"!==t&&Object(_.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(_.b)(!d||f,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),null!=p){var x=Object(R.d)(p);Object(_.a)(!h||x.every((function(e){return"object"===Object(O.a)(e)&&("key"in e||"value"in e)})),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(_.a)(!v||Array.isArray(p),"`value` should be array when `mode` is `multiple` or `tags`")}if(n){var S=null;Object(w.a)(n).some((function(e){if(!o.isValidElement(e)||!e.type)return!1;var t=e.type;return!t.isSelectOption&&(t.isSelectOptGroup?!Object(w.a)(e.props.children).every((function(t){return!(o.isValidElement(t)&&e.type&&!t.type.isSelectOption)||(S=t.type,!1)})):(S=t,!0))})),S&&Object(_.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(S.displayName||S.name||S,"`.")),Object(_.a)(void 0===g,"`inputValue` is deprecated, please use `searchValue` instead.")}},M=Object(D.a)({prefixCls:"rc-select",components:{optionList:b},convertChildrenToData:L,flattenOptions:A.d,getLabeledValue:A.e,filterOptions:A.b,isValueDisabled:A.g,findValueOption:A.c,warningProps:I,fillOptionsWithMissingValue:A.a}),F=function(e){Object(a.a)(r,e);var t=Object(s.a)(r);function r(){var e;return Object(n.a)(this,r),(e=t.apply(this,arguments)).selectRef=o.createRef(),e.focus=function(){e.selectRef.current.focus()},e.blur=function(){e.selectRef.current.blur()},e}return Object(i.a)(r,[{key:"render",value:function(){return o.createElement(M,Object.assign({ref:this.selectRef},this.props))}}]),r}(o.Component);F.Option=x,F.OptGroup=T;var P=F;t.c=P},M8RZ:
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/components/modal.tsx ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/classCallCheck */"fWQN"),i=r(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createClass */"mtLc"),a=r(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/inherits */"yKVA"),s=r(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createSuper */"879j"),o=r(/*! react */"q1tI"),l=r.n(o),u=r(/*! react-dom */"i8i4"),c=function(e){Object(a.a)(r,e);var t=Object(s.a)(r);function r(e){var i;Object(n.a)(this,r),i=t.call(this,e);var a=window.document;return i.node=a.createElement("div"),a.body.appendChild(i.node),i}return Object(i.a)(r,[{key:"render",value:function(){var e=this.props.children;return Object(u.createPortal)(e,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),r}(l.a.Component)},Ot1p:
|
|
|
/*!**************************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/index.tsx + 6 modules ***!
|
|
|
\**************************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/markdown-editor/code-block/index.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/modal.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/useInterval.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/tasks/util.js because of ./src/pages/tasks/index.jsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/codemirror/lib/codemirror.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */function(e,t,r){"use strict";r("2qtc");var n=r("kLXV"),i=r("rAM+"),a=(r("miYZ"),r("tsqr")),s=r("tJVT"),o=r("jrin"),l=r("q1tI"),u=r.n(l),c=r("VrN/"),d=r.n(c),f=r("bdgK"),h=(r("p77/"),r("Bd2K"),r("ELLl"),r("19Vz"),r("lZu9"),r("+NIl"),r("kSUc"),r("9Bee")),p=function(e){var t=e.value,r=void 0===t?"":t,n=(e.className,e.showTextOnly,e.showLines,e.style,Object(l.useMemo)((function(){return""}),[r]));return u.a.createElement(u.a.Fragment,null,u.a.createElement("div",{dangerouslySetInnerHTML:{__html:n}}))},g=r("0Owb"),m=(r("dejd"),r("C+DQ"),[{title:"粗体",icon:"icon-bold",actionName:"bold"},{title:"斜体",icon:"icon-italic",actionName:"italic"},"|",{title:"无序列表",icon:"icon-unorder-list",actionName:"list-ul"},{title:"有序列表",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"行内代码",icon:"icon-code",actionName:"code"},{title:"代码块(多语言风格)",icon:"icon-file-code",actionName:"code-block"},{title:"链接",icon:"icon-link",actionName:"link"},"|",{title:"行内公式",icon:"icon-sum",actionName:"inline-latex"},{title:"多行公式",icon:"icon-formula",actionName:"latex"},"|",{title:"添加图片",icon:"icon-picture",actionName:"upload-image"},{title:"表格",icon:"icon-table",actionName:"add-table"},"|",{title:"换行",icon:"icon-minus",actionName:"line-break"},{title:"清空",icon:"icon-eraser",actionName:"eraser"}]);function v(e){var t=e.onActionCallback,r=e.title,n=e.icon,i=e.actionName,a=e.className,s=void 0===a?"":a,o=e.children;return u.a.createElement("a",{title:r,className:s,onClick:function(){t(i)}},u.a.createElement("i",{className:"md-iconfont ".concat(n)}),o)}var y=function(e){var t=e.watch,r=e.showNullButton,n=e.onActionCallback,i=e.fullScreen,a=e.insertTemp,s=e.hidetoolBar,o=[].concat(m,[{title:"".concat(t?"关闭实时预览":"开启实时预览"),icon:"".concat(t?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return u.a.createElement("ul",{className:"markdown-toolbar-container"},!s&&o.map((function(e,t){return u.a.createElement("li",{key:t},e.actionName?u.a.createElement(v,Object(g.a)({},e,{onActionCallback:n})):u.a.createElement("span",{className:"v-line"}))})),r?u.a.createElement("li",null,u.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:n},u.a.createElement("span",{className:"fill-tip"},"点击插入\b填空项"))):null,a&&u.a.createElement("li",null,u.a.createElement(v,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(a),onActionCallback:n},u.a.createElement("span",{className:"fill-tip"},"插入模板"))),u.a.createElement("li",{className:"btn-full-screen"},u.a.createElement(v,{icon:"".concat(i?"icon-shrink":"icon-enlarge"),title:i?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:n})))},b=r("M8RZ"),E=(r("+L6B"),r("2/Rp")),x=(r("y8nQ"),r("Vl3Y")),S=(r("5NDa"),r("5rEg")),T={labelCol:{span:4},wrapperCol:{span:20}},k=function(e){var t=e.callback,r=e.onCancel;return u.a.createElement(x.a,Object(g.a)({},T,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){t(e)}}),u.a.createElement(x.a.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}]},u.a.createElement(S.a,null)),u.a.createElement(x.a.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}]},u.a.createElement(S.a,null)),u.a.createElement("div",{className:"flex-container flex-end"},u.a.createElement(E.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),u.a.createElement(E.a,{type:"ghost",onClick:r},"取消")))},w=r("7ahc"),C=(r("HmJG"),r("BjJ7")),L=x.a.useForm,A={width:280,marginRight:10},D={labelCol:{span:5},wrapperCol:{span:19}},O=function(e){var t=e.callback,r=e.onCancel,n=L(),i=Object(s.a)(n,1)[0];function a(e,t){i.setFieldsValue({src:"/api/attachments/".concat(e.id),type:t.type})}return u.a.createElement(x.a,Object(g.a)({form:i},D,{className:"upload-image-panel",onFinish:function(e){t(e)}}),u.a.createElement(x.a.Item,{label:"图片地址",required:!0},u.a.createElement("div",{className:"flex-container"},u.a.createElement(x.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入图片地址"}]},u.a.createElement(S.a,{style:A})),u.a.createElement(_,{onFileChange:function(e){R(e.target.files[0],a)}}))),u.a.createElement(x.a.Item,{label:"图片描述",name:"alt",rules:[{required:!0,message:"请输入图片描述"}]},u.a.createElement(S.a,{style:{width:264}})),u.a.createElement(x.a.Item,{style:{textAlign:"right"}},u.a.createElement(E.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),u.a.createElement(E.a,{type:"ghost",onClick:r},"取消")))};function _(e){var t=e.onFileChange;return u.a.createElement("a",{className:"upload-button"},"本地上传",u.a.createElement("input",{type:"file",onChange:t}))}function R(e,t){if(!e)throw new String("没有文件");var r=new FormData;r.append("editormd-image-file",e),r.append("file_param_name","editormd-image-file"),r.append("byxhr","true");var n=new window.XMLHttpRequest;n.withCredentials=!0,n.addEventListener("load",(function(r){t(JSON.parse(r.target.responseText),e)}),!1),n.addEventListener("error",(function(e){console.error(e)}),!1),n.open("POST","".concat(C.a,"/api/attachments.json")),n.send(r)}r("giR+");var I,M,F=r("fyUT"),P=(r("7Kak"),r("9yH6")),N=P.a.Group,B={margin:"0 8px"},j=function(e){var t=e.callback,r=e.onCancel;return u.a.createElement(x.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){t(e)}},u.a.createElement("div",{className:"flex-container"},u.a.createElement("span",{style:B},"单元格数:"),u.a.createElement("span",{style:B},"行数"),u.a.createElement(x.a.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}]},u.a.createElement(F.a,null)),u.a.createElement("span",{style:B},"列数"),u.a.createElement(x.a.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}]},u.a.createElement(F.a,null))),u.a.createElement("div",{className:"flex-container",style:{marginTop:12}},u.a.createElement("span",{style:B},"对齐方式:"),u.a.createElement(x.a.Item,{name:"align"},u.a.createElement(N,null,u.a.createElement(P.a,{value:"default"},u.a.createElement("i",{className:"fa fa-align-justify"})),u.a.createElement(P.a,{value:"left"},u.a.createElement("i",{className:"fa fa-align-left"})),u.a.createElement(P.a,{value:"center"},u.a.createElement("i",{className:"fa fa-align-center"})),u.a.createElement(P.a,{value:"right"},u.a.createElement("i",{className:"fa fa-align-right"}))))),u.a.createElement("div",{className:"flex-container flex-end"},u.a.createElement(E.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),u.a.createElement(E.a,{type:"ghost",onClick:r},"取消")))},U=r("m3rI"),H="------------",G={default:H,left:":".concat(H),center:":".concat(H,":"),right:"".concat(H,":")},W=r("9VGf");function z(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var K=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",V=(I={},Object(o.a)(I,K+"-B","bold"),Object(o.a)(I,K+"-I","italic"),I),q=(M={},Object(o.a)(M,"link","添加链接"),Object(o.a)(M,"code-block","添加代码块"),Object(o.a)(M,"upload-image","添加图片"),Object(o.a)(M,"add-table","添加表格"),M);t.a=function(e){var t=e.defaultValue,r=void 0===t?"":t,c=e.onChange,g=e.width,m=void 0===g?"100%":g,v=e.height,E=void 0===v?400:v,x=e.miniToolbar,S=void 0!==x&&x,T=e.isFocus,C=void 0!==T&&T,L=e.watch,A=e.insertTemp,D=e.mode,_=void 0===D?"markdown":D,I=e.id,M=void 0===I?"markdown-editor-id":I,F=e.showResizeBar,P=void 0!==F&&F,N=e.noStorage,B=void 0!==N&&N,H=e.showNullButton,K=void 0!==H&&H,$=e.hidetoolBar,Y=void 0!==$&&$,X=e.fullScreen,Z=void 0!==X&&X,Q=e.onBlur,J=e.onCMBeforeChange,ee=e.onFullScreen,te=e.className,re=void 0===te?"":te,ne=e.disablePaste,ie=void 0!==ne&&ne,ae=e.placeholder,se=void 0===ae?"":ae,oe=e.values,le=void 0===oe?"":oe,ue=Object(l.useState)(null),ce=Object(s.a)(ue,2),de=ce[0],fe=ce[1],he=Object(l.useState)(r),pe=Object(s.a)(he,2),ge=pe[0],me=pe[1],ve=Object(l.useState)(L),ye=Object(s.a)(ve,2),be=ye[0],Ee=ye[1],xe=Object(l.useState)(Z),Se=Object(s.a)(xe,2),Te=Se[0],ke=Se[1],we=Object(l.useState)(""),Ce=Object(s.a)(we,2),Le=Ce[0],Ae=Ce[1],De=Object(l.useState)(0),Oe=Object(s.a)(De,2),_e=Oe[0],Re=Oe[1],Ie=Object(l.useState)(E),Me=Object(s.a)(Ie,2),Fe=Me[0],Pe=Me[1],Ne=Object(l.useState)(!1),Be=Object(s.a)(Ne,2),je=(Be[0],Be[1]),Ue=Object(l.useRef)(),He=Object(l.useRef)(),Ge=Object(l.useRef)(),We=Object(l.useRef)();Object(l.useEffect)((function(){me(le),null==de||de.setValue(le)}),[le]),Object(l.useEffect)((function(){null==ee||ee(Te)}),[Te]),Object(l.useEffect)((function(){if(Ue.current){var e=d.a.fromTextArea(Ue.current,{mode:_,lineNumbers:!S,lineWrapping:!0,value:r,autoCloseTags:!0,autoCloseBrackets:!0});function t(t,r){if(!ie){var n=r.clipboardData;if(n){var i=n.types.toString(),s=n.items,o=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"];if("Files"===i||n.types.indexOf("Files")>-1){if(r.preventDefault(),"stex"==_)return;try{var l,u=s[1];"file"===(null===(l=s[0])||void 0===l?void 0:l.kind)&&(u=s[0]);var c=u.getAsFile(),d=c.name.split(".").pop();R(c,(function(t){var r,n,i;t.id?(null==c||null===(r=c.type)||void 0===r?void 0:r.indexOf("image"))>-1?e.replaceSelection(".concat(t.content_type,")")):(null==c||null===(n=c.type)||void 0===n?void 0:n.indexOf("video"))>-1?e.replaceSelection('<video width="100%" controls src="'.concat(U.a.API_SERVER,"/api/attachments/").concat(t.id,'"></video>')):(null==c||null===(i=c.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?e.replaceSelection('<a href="'.concat(U.a.API_SERVER,"/api/attachments/").concat(t.id,"?type=").concat(c.type,'&disposition=inline" target="_blank">').concat(c.name,"</a>")):o.includes(d)?e.replaceSelection('<a href="'.concat(U.a.API_SERVER,"/api/attachments/").concat(t.id,'?type=office&disposition=inline" target="_blank">').concat(c.name,"</a>")):e.replaceSelection("[".concat(c.name,"](").concat(U.a.API_SERVER,"/api/attachments/").concat(t.id,"?type=").concat(t.content_type,")")):401===(null==t?void 0:t.status)&&(document.location.href="/user/login")}))}catch(r){a.b.warn("请使用chrome浏览器粘贴")}return!0}return!0}return!0}r.preventDefault()}return C&&e.focus(),e.on("paste",t),fe(e),function(){e.off("paste",t)}}}),[]);var ze=Object(l.useCallback)((function(){He.current}),[Fe,He,Te]);Object(l.useEffect)((function(){if(de){var e=function(){var e=new f.default((function(e){var t,r=Object(i.a)(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;(n.target.offsetHeight>0||n.target.offsetWidth>0)&&(ze(),de.setSize("100%","100%"),de.refresh())}}catch(e){r.e(e)}finally{r.f()}}));return e.observe(Ue.current.parentElement),e}();return function(){e.unobserve(Ue.current.parentElement)}}}),[de,ze]),Object(l.useEffect)((function(){if(de){for(var e=[],t=function(){var t=n[r],i=(a=Object(s.a)(t,2))[0],l=a[1],u=Object(o.a)({},i,(function(){Ke(l)}));e.push(u),de.addKeyMap(u)},r=0,n=Object.entries(V);r<n.length;r++){var a;t()}return function(){var t,r=Object(i.a)(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;de.removeKeyMap(n)}}catch(e){r.e(e)}finally{r.f()}}}}),[de]),Object(l.useEffect)((function(){Z!==Te&&ke(Z)}),[Z]),Object(W.a)((function(){if(!B&&_e>0){var e=(new Date).getTime(),t=window.sessionStorage.getItem(M);e>=_e+1e4&&(!t||t!==ge)&&(window.sessionStorage.setItem(M,ge),je(!0))}}),1e4),Object(l.useEffect)((function(){Ee(L)}),[de,L]),Object(l.useEffect)((function(){de&&C&&de.focus()}),[de,C]),Object(l.useEffect)((function(){if(be&&de){var e=de.getScrollerElement();function t(e){var t=e.target;if(We.current){var r=t.scrollTop/t.scrollHeight;We.current.scrollTop=We.current.scrollHeight*r}}return e.addEventListener("scroll",t),function(){e.removeEventListener("scroll",t)}}}),[de,be]),Object(l.useEffect)((function(){if(de&&J){function e(e,t){J(e,t)}return de.on("beforeChange",e),function(){de.off("beforeChange",e)}}}),[de,J]),Object(l.useEffect)((function(){if(de&&Q){function e(){Q(de.getValue())}return de.on("blur",e),function(){de.off("blur",e)}}}),[de,Q]),Object(l.useEffect)((function(){if(de){function e(e){var t=e.getValue();me(t),Re((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),c&&c(t)}return de.on("change",e),function(){de.off("change",e)}}}),[de,c]),Object(l.useEffect)((function(){de&&(null==r?(de.setValue(""),me("")):r!==de.getValue()&&(de.setValue(r),me(r),de.setCursor(de.lineCount(),0)))}),[de,r]);var Ke=Object(l.useCallback)((function(e){var t=de.getCursor(),r=de.getSelection(),n=r.split("\n");switch(e){case"bold":return de.replaceSelection("**"+r+"**"),""===r&&de.setCursor(t.line,t.ch+2),de.focus();case"italic":return de.replaceSelection("*"+r+"*"),""===r&&de.setCursor(t.line,t.ch+1),de.focus();case"code":return de.replaceSelection("`"+r+"`"),""===r&&de.setCursor(t.line,t.ch+1),de.focus();case"inline-latex":return de.replaceSelection("`$$"+r+"$$`"),""===r&&de.setCursor(t.line,t.ch+3),de.focus();case"latex":return de.replaceSelection("```latex\n"+r+"\n```"),de.setCursor(t.line+1,r.length+1),de.focus();case"line-break":return de.replaceSelection("<br/>\n"),de.focus();case"list-ul":return""===r?de.replaceSelection("- "+r):de.replaceSelection(n.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),de.focus();case"list-ol":return""===r?de.replaceSelection("1. "+r):de.replaceSelection(n.map((function(e,t){return""===e?"":"".concat(t+1,". ").concat(e)})).join("\n")),de.focus();case"add-null-ch":return""===r&&de.setCursor(t.line,t.ch+1),de.replaceSelection("▁"),de.focus();case"inster-template-1":return""===r&&de.setCursor(t.line,t.ch),de.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),de.focus();case"eraser":return de.setValue(""),de.focus();case"trigger-watch":return Ee(!be),de.focus();case"trigger-full-screen":return ke(!Te),de.focus();case"link":return void Ae("link");case"code-block":return void Ae("code-block");case"upload-image":return void Ae("upload-image");case"add-table":return void Ae("add-table");default:throw new Error}}),[de,be,Te]),Ve=Object(l.useCallback)((function(e){switch(Ae(""),Le){case"link":var t=e.title,r=e.link;return de.replaceSelection("[".concat(t,"](").concat(r,")")),de.focus();case"code-block":var n=e.language,i=e.content;return de.replaceSelection(["```"+n,i,"```"].join("\n")),de.focus();case"upload-image":var a=e.src,s=e.alt;return de.replaceSelection(".concat(a,' "').concat(s,'" )')),de.focus();case"add-table":for(var o=e.row,l=e.col,u=e.align,c="\n",d=0;d<o;d++){for(var f=[],h=[],p=0;p<l;p++)1===d&&h.push(G[u]),f.push(" ");1===d&&(c+="| ".concat(h.join(" | ")," |\n")),c+="| ".concat(f.join(1===l?"":" | ")," |\n")}return de.replaceSelection(c+"\n"),de.focus();default:throw new Error}}),[de,Le]),qe=Object(l.useMemo)((function(){switch(Le){case"link":return u.a.createElement(k,{callback:Ve,onCancel:$e});case"code-block":return u.a.createElement(w.b,{callback:Ve,onCancel:$e});case"upload-image":return u.a.createElement(O,{callback:Ve,onCancel:$e});case"add-table":return u.a.createElement(j,{callback:Ve,onCancel:$e});default:return null}}),[Le]);function $e(){Ae("")}Object(l.useEffect)((function(){if(Ge.current){var e=Ge.current,t=!1,r=0;function n(e){t=!0,r=e.pageY}function i(){t=!1}function a(e){if(t){var n=e.pageY-r;n<0&&(n=0),n>300&&(n=300),Pe(E+n+"px")}}return e.addEventListener("mousedown",n),document.addEventListener("mousemove",a),document.addEventListener("mouseup",i),function(){e.removeEventListener("mousedown",n),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",i)}}}),[de,Ge]),Object(l.useEffect)((function(){Pe(E)}),[E]);var Ye={width:z(m),height:z(Fe)};Object(l.useMemo)((function(){if(_e){var e=new Date(_e),t=e.getHours(),r=e.getMinutes(),n=e.getSeconds();return r=r<10?"0"+r:r,n=n<10?"0"+n:n,"".concat(t=t<10?"0"+t:t,":").concat(r,":").concat(n)}return 0}),[_e]);return u.a.createElement(l.Fragment,null,u.a.createElement("div",{className:"markdown-editor-wrapper",ref:He},u.a.createElement("div",{className:"markdown-editor-container ".concat(re," ").concat(be?"on-preview":""," ").concat(S?"mini":""," ").concat(Te?"full-screen":""),style:Ye},u.a.createElement(y,{insertTemp:A,watch:be,fullScreen:Te,showNullButton:K,onActionCallback:Ke,hidetoolBar:Y}),u.a.createElement("div",{className:"markdown-editor-body"},u.a.createElement("div",{className:"codemirror-container"},u.a.createElement("textarea",{ref:Ue,placeholder:se})),be?u.a.createElement("div",{ref:We,className:"preview-container"},"stex"===_&&u.a.createElement(p,{value:ge}),"stex"!==_&&u.a.createElement(h.a,{value:ge})):null))),P?u.a.createElement("a",{ref:Ge,className:"editor-resize"}):null,u.a.createElement(b.a,null,q[Le]?u.a.createElement(n.a,{centered:!0,title:q[Le],visible:!0,onCancel:$e,footer:null},qe):null))}},SJMd:
|
|
|
/*!****************************************************!*\
|
|
|
!*** ./node_modules/code-prettify/src/prettify.js ***!
|
|
|
\****************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t){window.PR_SHOULD_USE_CONTINUATION=!0,function(){var e=window,t=["break,continue,do,else,for,if,return,while"],r=[[t,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],n=[r,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],i=[r,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],a=[r,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],s=[r,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],o="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",l=[t,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],u=[t,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],c=[t,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],d=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;function f(e,t,r,n,i){if(r){var a={sourceNode:e,pre:1,langExtension:null,numberLines:null,sourceCode:r,spans:null,basePos:t,decorations:null};n(a),i.push.apply(i,a.decorations)}}var h=/\S/;function p(e){for(var t=void 0,r=e.firstChild;r;r=r.nextSibling){var n=r.nodeType;t=1===n?t?e:r:3===n&&h.test(r.nodeValue)?e:t}return t===e?void 0:t}function g(e,t){var r,n={};!function(){for(var i=e.concat(t),a=[],s={},o=0,l=i.length;o<l;++o){var u=i[o],c=u[3];if(c)for(var d=c.length;--d>=0;)n[c.charAt(d)]=u;var f=u[1],h=""+f;s.hasOwnProperty(h)||(a.push(f),s[h]=null)}a.push(/[\0-\uffff]/),r=function(e){for(var t=0,r=!1,n=!1,i=0,a=e.length;i<a;++i){if((f=e[i]).ignoreCase)n=!0;else if(/[a-z]/i.test(f.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){r=!0,n=!1;break}}var s={b:8,t:9,n:10,v:11,f:12,r:13};function o(e){var t=e.charCodeAt(0);if(92!==t)return t;var r=e.charAt(1);return(t=s[r])||("0"<=r&&r<="7"?parseInt(e.substring(1),8):"u"===r||"x"===r?parseInt(e.substring(2),16):e.charCodeAt(1))}function l(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);var t=String.fromCharCode(e);return"\\"===t||"-"===t||"]"===t||"^"===t?"\\"+t:t}function u(e){var t=e.substring(1,e.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),r=[],n="^"===t[0],i=["["];n&&i.push("^");for(var a=n?1:0,s=t.length;a<s;++a){var u=t[a];if(/\\[bdsw]/i.test(u))i.push(u);else{var c,d=o(u);a+2<s&&"-"===t[a+1]?(c=o(t[a+2]),a+=2):c=d,r.push([d,c]),c<65||d>122||(c<65||d>90||r.push([32|Math.max(65,d),32|Math.min(c,90)]),c<97||d>122||r.push([-33&Math.max(97,d),-33&Math.min(c,122)]))}}r.sort((function(e,t){return e[0]-t[0]||t[1]-e[1]}));var f=[],h=[];for(a=0;a<r.length;++a){(p=r[a])[0]<=h[1]+1?h[1]=Math.max(h[1],p[1]):f.push(h=p)}for(a=0;a<f.length;++a){var p=f[a];i.push(l(p[0])),p[1]>p[0]&&(p[1]+1>p[0]&&i.push("-"),i.push(l(p[1])))}return i.push("]"),i.join("")}function c(e){for(var n=e.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),i=n.length,a=[],s=0,o=0;s<i;++s){if("("===(d=n[s]))++o;else if("\\"===d.charAt(0)){(c=+d.substring(1))&&(c<=o?a[c]=-1:n[s]=l(c))}}for(s=1;s<a.length;++s)-1===a[s]&&(a[s]=++t);for(s=0,o=0;s<i;++s){if("("===(d=n[s]))a[++o]||(n[s]="(?:");else if("\\"===d.charAt(0)){var c;(c=+d.substring(1))&&c<=o&&(n[s]="\\"+a[c])}}for(s=0;s<i;++s)"^"===n[s]&&"^"!==n[s+1]&&(n[s]="");if(e.ignoreCase&&r)for(s=0;s<i;++s){var d,f=(d=n[s]).charAt(0);d.length>=2&&"["===f?n[s]=u(d):"\\"!==f&&(n[s]=d.replace(/[a-zA-Z]/g,(function(e){var t=e.charCodeAt(0);return"["+String.fromCharCode(-33&t,32|t)+"]"})))}return n.join("")}var d=[];for(i=0,a=e.length;i<a;++i){var f;if((f=e[i]).global||f.multiline)throw new Error(""+f);d.push("(?:"+c(f)+")")}return new RegExp(d.join("|"),n?"gi":"g")}(a)}();var i=t.length,a=function(e){for(var s=e.sourceCode,o=e.basePos,l=e.sourceNode,u=[o,"pln"],c=0,d=s.match(r)||[],h={},p=0,g=d.length;p<g;++p){var m,v=d[p],y=h[v],b=void 0;if("string"==typeof y)m=!1;else{var E=n[v.charAt(0)];if(E)b=v.match(E[1]),y=E[0];else{for(var S=0;S<i;++S)if(E=t[S],b=v.match(E[1])){y=E[0];break}b||(y="pln")}!(m=y.length>=5&&"lang-"===y.substring(0,5))||b&&"string"==typeof b[1]||(m=!1,y="src"),m||(h[v]=y)}var T=c;if(c+=v.length,m){var k=b[1],w=v.indexOf(k),C=w+k.length;b[2]&&(w=(C=v.length-b[2].length)-k.length);var L=y.substring(5);f(l,o+T,v.substring(0,w),a,u),f(l,o+T+w,k,x(L,k),u),f(l,o+T+C,v.substring(C),a,u)}else u.push(o+T,y)}e.decorations=u};return a}function m(e){var t=[],r=[];e.tripleQuotedStrings?t.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):e.multiLineStrings?t.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):t.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),e.verbatimStrings&&r.push(["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var n=e.hashComments;n&&(e.cStyleComments?(n>1?t.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):t.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),r.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):t.push(["com",/^#[^\r\n]*/,null,"#"])),e.cStyleComments&&(r.push(["com",/^\/\/[^\r\n]*/,null]),r.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var i=e.regexLiterals;if(i){var a=i>1?"":"\n\r",s=a?".":"[\\S\\s]",o="/(?=[^/*"+a+"])(?:[^/\\x5B\\x5C"+a+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+a+"]|\\x5C"+s+")*(?:\\x5D|$))+/";r.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+o+")")])}var l=e.types;l&&r.push(["typ",l]);var u=(""+e.keywords).replace(/^ | $/g,"");u.length&&r.push(["kwd",new RegExp("^(?:"+u.replace(/[\s,]+/g,"|")+")\\b"),null]),t.push(["pln",/^\s+/,null," \r\n\t "]);var c="^.[^\\s\\w.$@'\"`/\\\\]*";return e.regexLiterals&&(c+="(?!s*/)"),r.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,null],["lit",new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(c),null]),g(t,r)}var v=m({keywords:[n,a,i,s,o,l,u,c],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function y(e,t,r){for(var n=/(?:^|\s)nocode(?:\s|$)/,i=/\r\n?|\n/,a=e.ownerDocument,s=a.createElement("li");e.firstChild;)s.appendChild(e.firstChild);var o=[s];function l(e){var t=e.nodeType;if(1!=t||n.test(e.className)){if((3==t||4==t)&&r){var s=e.nodeValue,o=s.match(i);if(o){var c=s.substring(0,o.index);e.nodeValue=c;var d=s.substring(o.index+o[0].length);if(d)e.parentNode.insertBefore(a.createTextNode(d),e.nextSibling);u(e),c||e.parentNode.removeChild(e)}}}else if("br"===e.nodeName)u(e),e.parentNode&&e.parentNode.removeChild(e);else for(var f=e.firstChild;f;f=f.nextSibling)l(f)}function u(e){for(;!e.nextSibling;)if(!(e=e.parentNode))return;for(var t,r=function e(t,r){var n=r?t.cloneNode(!1):t,i=t.parentNode;if(i){var a=e(i,1),s=t.nextSibling;a.appendChild(n);for(var o=s;o;o=s)s=o.nextSibling,a.appendChild(o)}return n}(e.nextSibling,0);(t=r.parentNode)&&1===t.nodeType;)r=t;o.push(r)}for(var c=0;c<o.length;++c)l(o[c]);t===(0|t)&&o[0].setAttribute("value",t);var d=a.createElement("ol");d.className="linenums";for(var f=Math.max(0,t-1|0)||0,h=(c=0,o.length);c<h;++c)(s=o[c]).className="L"+(c+f)%10,s.firstChild||s.appendChild(a.createTextNode(" ")),d.appendChild(s);e.appendChild(d)}var b={};function E(t,r){for(var n=r.length;--n>=0;){var i=r[n];b.hasOwnProperty(i)?e.console&&console.warn("cannot override language handler %s",i):b[i]=t}}function x(e,t){return e&&b.hasOwnProperty(e)||(e=/^\s*</.test(t)?"default-markup":"default-code"),b[e]}function S(t){var r,n,i,a,s,o,l,u=t.langExtension;try{var c=(r=t.sourceNode,n=t.pre,i=/(?:^|\s)nocode(?:\s|$)/,a=[],s=0,o=[],l=0,function e(t){var r=t.nodeType;if(1==r){if(i.test(t.className))return;for(var u=t.firstChild;u;u=u.nextSibling)e(u);var c=t.nodeName.toLowerCase();"br"!==c&&"li"!==c||(a[l]="\n",o[l<<1]=s++,o[l++<<1|1]=t)}else if(3==r||4==r){var d=t.nodeValue;d.length&&(d=n?d.replace(/\r\n?/g,"\n"):d.replace(/[ \t\r\n]+/g," "),a[l]=d,o[l<<1]=s,s+=d.length,o[l++<<1|1]=t)}}(r),{sourceCode:a.join("").replace(/\n$/,""),spans:o}),d=c.sourceCode;t.sourceCode=d,t.spans=c.spans,t.basePos=0,x(u,d)(t),function(e){var t=/\bMSIE\s(\d+)/.exec(navigator.userAgent);t=t&&+t[1]<=8;var r,n,i=/\n/g,a=e.sourceCode,s=a.length,o=0,l=e.spans,u=l.length,c=0,d=e.decorations,f=d.length,h=0;for(d[f]=s,n=r=0;n<f;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;for(f=r,n=r=0;n<f;){for(var p=d[n],g=d[n+1],m=n+2;m+2<=f&&d[m+1]===g;)m+=2;d[r++]=p,d[r++]=g,n=m}f=d.length=r;var v=e.sourceNode,y="";v&&(y=v.style.display,v.style.display="none");try{for(;c<u;){l[c];var b,E=l[c+2]||s,x=d[h+2]||s,S=(m=Math.min(E,x),l[c+1]);if(1!==S.nodeType&&(b=a.substring(o,m))){t&&(b=b.replace(i,"\r")),S.nodeValue=b;var T=S.ownerDocument,k=T.createElement("span");k.className=d[h+1];var w=S.parentNode;w.replaceChild(k,S),k.appendChild(S),o<E&&(l[c+1]=S=T.createTextNode(a.substring(m,E)),w.insertBefore(S,k.nextSibling))}(o=m)>=E&&(c+=2),o>=x&&(h+=2)}}finally{v&&(v.style.display=y)}}(t)}catch(t){e.console&&console.log(t&&t.stack||t)}}function T(e,t,r){var n=r||!1,i=t||null,a=document.createElement("div");return a.innerHTML="<pre>"+e+"</pre>",a=a.firstChild,n&&y(a,n,!0),S({langExtension:i,numberLines:n,sourceNode:a,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null}),a.innerHTML}function k(t,r){var n=r||document.body,i=n.ownerDocument||document;function a(e){return n.getElementsByTagName(e)}for(var s=[a("pre"),a("code"),a("xmp")],o=[],l=0;l<s.length;++l)for(var u=0,c=s[l].length;u<c;++u)o.push(s[l][u]);s=null;var d=Date;d.now||(d={now:function(){return+new Date}});var f=0,h=/\blang(?:uage)?-([\w.]+)(?!\S)/,g=/\bprettyprint\b/,m=/\bprettyprinted\b/,v=/pre|xmp/i,b=/^code$/i,E=/^(?:pre|code|xmp)$/i,x={};!function r(){for(var n=e.PR_SHOULD_USE_CONTINUATION?d.now()+250:1/0;f<o.length&&d.now()<n;f++){for(var a=o[f],s=x,l=a;l=l.previousSibling;){var u=l.nodeType,c=(7===u||8===u)&&l.nodeValue;if(c?!/^\??prettify\b/.test(c):3!==u||/\S/.test(l.nodeValue))break;if(c){s={},c.replace(/\b(\w+)=([\w:.%+-]+)/g,(function(e,t,r){s[t]=r}));break}}var T=a.className;if((s!==x||g.test(T))&&!m.test(T)){for(var k=!1,w=a.parentNode;w;w=w.parentNode){var C=w.tagName;if(E.test(C)&&w.className&&g.test(w.className)){k=!0;break}}if(!k){a.className+=" prettyprinted";var L,A,D=s.lang;if(!D)!(D=T.match(h))&&(L=p(a))&&b.test(L.tagName)&&(D=L.className.match(h)),D&&(D=D[1]);if(v.test(a.tagName))A=1;else{var O=a.currentStyle,_=i.defaultView,R=O?O.whiteSpace:_&&_.getComputedStyle?_.getComputedStyle(a,null).getPropertyValue("white-space"):0;A=R&&"pre"===R.substring(0,3)}var I=s.linenums;(I="true"===I||+I)||(I=!!(I=T.match(/\blinenums\b(?::(\d+))?/))&&(!I[1]||!I[1].length||+I[1])),I&&y(a,I,A),S({langExtension:D,sourceNode:a,numberLines:I,pre:A,sourceCode:null,basePos:null,spans:null,decorations:null})}}}f<o.length?e.setTimeout(r,250):"function"==typeof t&&t()}()}E(v,["default-code"]),E(g([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),E(g([["pln",/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],["pun",/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),E(g([],[["atv",/^[\s\S]+/]]),["uq.val"]),E(m({keywords:n,hashComments:!0,cStyleComments:!0,types:d}),["c","cc","cpp","cxx","cyc","m"]),E(m({keywords:"null,true,false"}),["json"]),E(m({keywords:a,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:d}),["cs"]),E(m({keywords:i,cStyleComments:!0}),["java"]),E(m({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),E(m({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),E(m({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),E(m({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),E(m({keywords:s,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),E(m({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),E(g([],[["str",/^[\s\S]+/]]),["regex"]);var w=e.PR={createSimpleLexer:g,registerLangHandler:E,sourceDecorator:m,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:T,prettyPrint:k},C=e.define;"function"==typeof C&&C.amd&&C("google-code-prettify",[],(function(){return w}))}()},"T+//":
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./src/pages/Three/index.tsx + 4 modules ***!
|
|
|
\***********************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! all exports used */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@ant-design/icons/es/icons/ExclamationCircleOutlined.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@ant-design/icons/es/icons/PlusSquareOutlined.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Three/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/.umi-production/core/umiExports.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/markdown-editor/index.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/service/competitions.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/authority.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/fetch.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/layout/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/layout/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/menu/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/menu/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/popover/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/popover/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/upload/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/upload/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,r){"use strict";r.r(t);r("Q9mQ");var n=r("diRs"),i=(r("2qtc"),r("kLXV")),a=(r("miYZ"),r("tsqr")),s=r("9og8"),o=r("tJVT"),l=(r("B9cy"),r("Ol7k")),u=(r("lUTK"),r("BvKs")),c=r("WmNS"),d=r.n(c),f=r("q1tI"),h=r.n(f),p=r("m3rI"),g=r("p0QG"),m=r.n(g),v=r("ErOA"),y=r("9kvl"),b=r("RCxd"),E=r("xGfz"),x=r("xKgJ"),S=(r("5NDa"),r("5rEg"));var T=Object(y.a)((function(e){return{user:e.user}}))((function(e){e.user;var t=e.CategoryId,r=e.IsShow,n=e.setIsShow,l=(e.dispatch,e.init),u=Object(f.useState)(),c=Object(o.a)(u,2),p=c[0],g=c[1];return h.a.createElement(i.a,{title:t?"新建三级类目":"新建二级类目",width:424,onCancel:function(){n(!1)},onOk:Object(s.a)(d.a.mark((function e(){return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(p){e.next=3;break}return a.b.error("栏目名不能为空"),e.abrupt("return");case 3:return e.next=5,Object(v.a)("/api/programas.json",{method:"post",body:{name:p,parent_id:t}});case 5:0===e.sent.status&&(a.b.info("创建成功"),n(!1),g(""),l());case 7:case"end":return e.stop()}}),e)}))),visible:r},h.a.createElement(S.a,{value:p,onChange:function(e){return g(e.target.value)},placeholder:"请输入不超过10个汉字的名称",maxLength:10}))}));var k=Object(y.a)((function(e){return{user:e.user}}))((function(e){e.user;var t=e.CategoryId,r=e.name,n=e.IsShow,l=e.setIsShow,u=(e.dispatch,e.init),c=Object(f.useState)(),p=Object(o.a)(c,2),g=p[0],m=p[1];return Object(f.useEffect)((function(){m(r)}),[r]),h.a.createElement(i.a,{title:"目录重命名",width:424,onCancel:function(){l(!1)},onOk:Object(s.a)(d.a.mark((function e(){return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g){e.next=3;break}return a.b.error("栏目名不能为空"),e.abrupt("return");case 3:return e.next=5,Object(v.a)("/api/programas/".concat(t,"/rename.json"),{method:"put",body:{name:g,id:t}});case 5:0===e.sent.status&&(a.b.info("修改成功"),l(!1),m(""),u());case 7:case"end":return e.stop()}}),e)}))),visible:n},h.a.createElement(S.a,{value:g,onChange:function(e){return m(e.target.value)},placeholder:"请输入不超过10个汉字的名称",maxLength:10}))})),w=(r("+L6B"),r("2/Rp")),C=r("9Bee");var L=Object(y.a)((function(e){return{user:e.user}}))((function(e){e.user;var t,r,n,i,a=e.ItemData,s=e.setIssee;return e.dispatch,e.init,h.a.createElement("div",null,h.a.createElement("div",{style:{textAlign:"right"}},Object(x.v)()&&h.a.createElement(w.a,{onClick:function(){return s(!1)}},"编辑")),h.a.createElement(C.a,{value:a.content}),(null==a||null===(t=a.attachment)||void 0===t?void 0:t.id)&&h.a.createElement("div",null,h.a.createElement("a",{href:null==a||null===(r=a.attachment)||void 0===r?void 0:r.url,target:"_self",download:null==a||null===(n=a.attachment)||void 0===n?void 0:n.title},h.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),h.a.createElement("span",{style:{color:"#000000"}},null==a||null===(i=a.attachment)||void 0===i?void 0:i.title))))})),A=(r("DZo9"),r("8z0m")),D=r("Ot1p"),O=r("hJwl");var _=Object(y.a)((function(e){return{user:e.user}}))((function(e){e.user;var t,r,n=e.ItemData,i=e.setIssee,l=e.CategoryId,u=(e.dispatch,e.init,Object(f.useState)([])),c=Object(o.a)(u,2),g=c[0],m=c[1],y=Object(f.useState)(n.content),b=Object(o.a)(y,2),E=b[0],x=b[1],S={name:"file",multiple:!0,action:p.a.API_SERVER+"/api/attachments.json",defaultFileList:(r=[],null==n||null===(t=n.attachments)||void 0===t||t.map((function(e){var t={uid:null==e?void 0:e.id,name:e.title,response:{id:e.id}};r.push(t)})),r),onRemove:function(e){Object(O.t)({id:e.uid})},onChange:function(e){console.log("info",e);var t=e.file.status;"removed"===t&&m(e.fileList),"done"===t?(m(e.fileList),a.b.success("".concat(e.file.name," 文件上传成功"))):"error"===t&&a.b.error("".concat(e.file.name," 文件上传失败"))},beforeUpload:function(e){var t=e.size/1024/1024<150;return t||a.b.info("文件大小必须小于150MB"),t}};function T(){return(T=Object(s.a)(d.a.mark((function e(){return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(v.a)("/api/programas/".concat(l,"/update_content.json"),{method:"put",body:{id:l,content:E,attachment_id:k(g)}});case 2:e.sent&&(a.b.info("提交成功"),i(!0));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(e){var t;return e&&e.map((function(e){t=e.response.id})),t}return h.a.createElement("div",null,h.a.createElement(D.a,{defaultValue:E,onChange:function(e){return x(e)}}),h.a.createElement(A.a,S,h.a.createElement(w.a,{className:"uploadBtn"},"上传附件"),"(单个文件150M以内)"),h.a.createElement("p",{style:{marginTop:"10px"}},h.a.createElement(w.a,{style:{width:"90px"},onClick:function(){return function(){return T.apply(this,arguments)}()}},"提交"),h.a.createElement(w.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return i(!0)}},"取消")))})),R=u.a.SubMenu,I=(l.a.Content,l.a.Sider);t.default=Object(y.a)((function(e){return{user:e.user,globalSetting:e.globalSetting}}))((function(e){e.user,e.dispatch;var t,r=e.globalSetting,l=Object(f.useState)(),c=Object(o.a)(l,2),g=(c[0],c[1],Object(f.useState)(!1)),y=Object(o.a)(g,2),S=y[0],w=y[1],C=Object(f.useState)(),A=Object(o.a)(C,2),D=A[0],O=A[1],M=Object(f.useState)(),F=Object(o.a)(M,2),P=F[0],N=F[1],B=Object(f.useState)(!1),j=Object(o.a)(B,2),U=j[0],H=j[1],G=Object(f.useState)(""),W=Object(o.a)(G,2),z=W[0],K=W[1],V=Object(f.useState)(""),q=Object(o.a)(V,2),$=q[0],Y=q[1],X=Object(f.useState)(!0),Z=Object(o.a)(X,2),Q=Z[0],J=Z[1];function ee(){return te.apply(this,arguments)}function te(){return(te=Object(s.a)(d.a.mark((function e(){var t;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(v.a)("/api/programas.json",{method:"get"});case 2:(t=e.sent)&&O(null==t?void 0:t.programas);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}Object(f.useEffect)((function(){ee()}),[]),console.log("globalSetting",r);var re=function(){var e=Object(s.a)(d.a.mark((function e(t,r,n){return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t,e.next=1===e.t0?3:2===e.t0?6:3===e.t0?10:4===e.t0?15:17;break;case 3:return N(null==r?void 0:r.id),w(!0),e.abrupt("break",17);case 6:return N(null==r?void 0:r.id),H(!0),K(null==r?void 0:r.name),e.abrupt("break",17);case 10:return e.next=12,Object(v.a)("/api/programas/".concat(null==r?void 0:r.id,"/top.json"),{method:"post",body:{id:null==r?void 0:r.id}});case 12:return 0===e.sent.status&&ee(),e.abrupt("break",17);case 15:return ne(h.a.createElement("p",null,"删除之后不能恢复,",h.a.createElement("br",null),"是否确认删除?"),Object(s.a)(d.a.mark((function e(){return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(v.a)("/api/programas/".concat(null==r?void 0:r.id,".json"),{method:"delete",body:{id:null==r?void 0:r.id}});case 2:0===e.sent.status&&(a.b.info("删除成功"),ee());case 4:case"end":return e.stop()}}),e)})))),e.abrupt("break",17);case 17:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),ne=function(e,t){i.a.confirm({centered:!0,title:"提示",icon:h.a.createElement(b.a,null),content:e,okText:"确认",onOk:function(){return t()},cancelText:"取消"})},ie=function(e,t){return h.a.createElement("div",{className:m.a.leftMenuActions},1===t&&h.a.createElement("p",{className:"current",onClick:function(){return re(1,e,t)}},"新建"),h.a.createElement("p",{className:"current",onClick:function(){return re(2,e,t)}},"重命名"),h.a.createElement("p",{className:"current",onClick:function(){return re(3,e,t)}},"置顶"),h.a.createElement("p",{className:"current",onClick:function(){return re(4,e,t)}},"删除"))};function ae(){return se.apply(this,arguments)}function se(){return(se=Object(s.a)(d.a.mark((function e(){var t;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(v.a)("/api/programas/".concat(P,"/content.json"),{method:"get",params:{id:P}});case 2:(t=e.sent)&&Y(t);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return h.a.createElement("div",{style:{marginBottom:"40px"}},h.a.createElement("img",{style:{width:"100%"},src:p.a.IMG_SERVER+"/".concat(null==r||null===(t=r.setting)||void 0===t?void 0:t.shixun_banner_url)}),h.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},h.a.createElement(I,{width:244,className:m.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},h.a.createElement(u.a,{mode:"inline"},null==D?void 0:D.map((function(e,t){var r;return(null==e?void 0:e.children.length)>0?h.a.createElement(R,{title:h.a.createElement("span",{className:"font16"},h.a.createElement("span",null,e.name),!Object(x.v)()&&h.a.createElement("span",null),Object(x.v)()&&h.a.createElement(n.a,{placement:"right",content:function(){return ie(e,1)},trigger:"hover"},h.a.createElement("span",{className:["iconfont icon-sandian",m.a.actions].join(" ")})))},null==e||null===(r=e.children)||void 0===r?void 0:r.map((function(e,t){return h.a.createElement(u.a.Item,{className:null===m.a||void 0===m.a?void 0:m.a.SubMentItem,onClick:function(){N(null==e?void 0:e.id),P=null==e?void 0:e.id,ae()}},h.a.createElement("span",{style:{flex:"1"}},null==e?void 0:e.name),Object(x.v)()&&h.a.createElement(n.a,{placement:"right",content:function(){return ie(e,2)},trigger:"hover"},h.a.createElement("span",{className:["iconfont icon-sandian",m.a.actions].join(" ")})))}))):h.a.createElement(u.a.Item,{className:null===m.a||void 0===m.a?void 0:m.a.SubMentItem,onClick:function(){N(null==e?void 0:e.id),P=null==e?void 0:e.id,ae()}},h.a.createElement("span",{style:{flex:"1"}},null==e?void 0:e.name),Object(x.v)()&&h.a.createElement(n.a,{placement:"right",content:function(){return ie(e,1)},trigger:"hover"},h.a.createElement("span",{className:["iconfont icon-sandian",m.a.actions].join(" ")})))})),h.a.createElement(u.a.Item,{onClick:function(){N(""),P="",w(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:h.a.createElement(E.a,{style:{color:"#0152d9",fontSize:"16px"}})},"新增二级类目"))),h.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Q&&h.a.createElement(L,{ItemData:$,setIssee:J}),!1===Q&&h.a.createElement(_,{ItemData:$,setIssee:J,CategoryId:P}))),h.a.createElement(T,{CategoryId:P,IsShow:S,setIsShow:w,init:ee}),h.a.createElement(k,{CategoryId:P,name:z,IsShow:U,setIsShow:H,init:ee}))}))},"VrN/":
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./node_modules/codemirror/lib/codemirror.js ***!
|
|
|
\***************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! all exports used */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),a=/Edge\/(\d+)/.exec(e),s=n||i||a,o=s&&(n?document.documentMode||6:+(a||i)[1]),l=!a&&/WebKit\//.test(e),u=l&&/Qt\/\d+\.\d+/.test(e),c=!a&&/Chrome\//.test(e),d=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!a&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),m=/Android/.test(e),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),E=/win/i.test(t),x=d&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(d=!1,l=!0);var S=y&&(u||d&&(null==x||x<12.11)),T=r||s&&o>=9;function k(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var w,C=function(e,t){var r=e.className,n=k(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function L(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function A(e,t){return L(e).appendChild(t)}function D(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var a=0;a<t.length;++a)i.appendChild(t[a]);return i}function O(e,t,r,n){var i=D(e,t,r,n);return i.setAttribute("role","presentation"),i}function _(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function R(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function I(e,t){var r=e.className;k(t).test(r)||(e.className+=(r?" ":"")+t)}function M(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!k(r[n]).test(t)&&(t+=" "+r[n]);return t}w=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var F=function(e){e.select()};function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function B(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var a=n||0,s=i||0;;){var o=e.indexOf("\t",a);if(o<0||o>=t)return s+(t-a);s+=o-a,s+=r-s%r,a=o+1}}g?F=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:s&&(F=function(e){try{e.select()}catch(e){}});var j=function(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)};function U(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}j.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},j.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};var H={toString:function(){return"CodeMirror.Pass"}},G={scroll:!1},W={origin:"*mouse"},z={origin:"+move"};function K(e,t,r){for(var n=0,i=0;;){var a=e.indexOf("\t",n);-1==a&&(a=e.length);var s=a-n;if(a==e.length||i+s>=t)return n+Math.min(s,t-i);if(i+=a-n,n=a+1,(i+=r-i%r)>=t)return n}}var V=[""];function q(e){for(;V.length<=e;)V.push($(V)+" ");return V[e]}function $(e){return e[e.length-1]}function Y(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function X(){}function Z(e,t){var r;return Object.create?r=Object.create(e):(X.prototype=e,r=new X),t&&N(t,r),r}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function J(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&J(e))||t.test(e):J(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ne(e){return e.charCodeAt(0)>=768&&re.test(e)}function ie(e,t,r){for(;(r<0?t>0:t<e.length)&&ne(e.charAt(t));)t+=r;return t}function ae(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,a=n<0?Math.ceil(i):Math.floor(i);if(a==t)return e(a)?t:r;e(a)?r=a:t=a+n}}var se=null;function oe(e,t,r){var n;se=null;for(var i=0;i<e.length;++i){var a=e[i];if(a.from<t&&a.to>t)return i;a.to==t&&(a.from!=a.to&&"before"==r?n=i:se=i),a.from==t&&(a.from!=a.to&&"before"!=r?n=i:se=i)}return null!=n?n:se}var le=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,r=/[LRr]/,n=/[Lb1n]/,i=/[1n]/;function a(e,t,r){this.level=e,this.from=t,this.to=r}return function(s,o){var l="ltr"==o?"L":"R";if(0==s.length||"ltr"==o&&!e.test(s))return!1;for(var u,c=s.length,d=[],f=0;f<c;++f)d.push((u=s.charCodeAt(f))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":8204==u?"b":"L");for(var h=0,p=l;h<c;++h){var g=d[h];"m"==g?d[h]=p:p=g}for(var m=0,v=l;m<c;++m){var y=d[m];"1"==y&&"r"==v?d[m]="n":r.test(y)&&(v=y,"r"==y&&(d[m]="R"))}for(var b=1,E=d[0];b<c-1;++b){var x=d[b];"+"==x&&"1"==E&&"1"==d[b+1]?d[b]="1":","!=x||E!=d[b+1]||"1"!=E&&"n"!=E||(d[b]=E),E=x}for(var S=0;S<c;++S){var T=d[S];if(","==T)d[S]="N";else if("%"==T){var k=void 0;for(k=S+1;k<c&&"%"==d[k];++k);for(var w=S&&"!"==d[S-1]||k<c&&"1"==d[k]?"1":"N",C=S;C<k;++C)d[C]=w;S=k-1}}for(var L=0,A=l;L<c;++L){var D=d[L];"L"==A&&"1"==D?d[L]="L":r.test(D)&&(A=D)}for(var O=0;O<c;++O)if(t.test(d[O])){var _=void 0;for(_=O+1;_<c&&t.test(d[_]);++_);for(var R="L"==(O?d[O-1]:l),I=R==("L"==(_<c?d[_]:l))?R?"L":"R":l,M=O;M<_;++M)d[M]=I;O=_-1}for(var F,P=[],N=0;N<c;)if(n.test(d[N])){var B=N;for(++N;N<c&&n.test(d[N]);++N);P.push(new a(0,B,N))}else{var j=N,U=P.length,H="rtl"==o?1:0;for(++N;N<c&&"L"!=d[N];++N);for(var G=j;G<N;)if(i.test(d[G])){j<G&&(P.splice(U,0,new a(1,j,G)),U+=H);var W=G;for(++G;G<N&&i.test(d[G]);++G);P.splice(U,0,new a(2,W,G)),U+=H,j=G}else++G;j<N&&P.splice(U,0,new a(1,j,N))}return"ltr"==o&&(1==P[0].level&&(F=s.match(/^\s+/))&&(P[0].from=F[0].length,P.unshift(new a(0,0,F[0].length))),1==$(P).level&&(F=s.match(/\s+$/))&&($(P).to-=F[0].length,P.push(new a(0,c-F[0].length,c)))),"rtl"==o?P.reverse():P}}();function ue(e,t){var r=e.order;return null==r&&(r=e.order=le(e.text,t)),r}var ce=[],de=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||ce).concat(r)}};function fe(e,t){return e._handlers&&e._handlers[t]||ce}function he(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var a=U(i,r);a>-1&&(n[t]=i.slice(0,a).concat(i.slice(a+1)))}}}function pe(e,t){var r=fe(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function ge(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),pe(e,r||t.type,e,t),xe(t)||t.codemirrorIgnore}function me(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==U(r,t[n])&&r.push(t[n])}function ve(e,t){return fe(e,t).length>0}function ye(e){e.prototype.on=function(e,t){de(this,e,t)},e.prototype.off=function(e,t){he(this,e,t)}}function be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ee(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function xe(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Se(e){be(e),Ee(e)}function Te(e){return e.target||e.srcElement}function ke(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var we,Ce,Le=function(){if(s&&o<9)return!1;var e=D("div");return"draggable"in e||"dragDrop"in e}();function Ae(e){if(null==we){var t=D("span","");A(e,D("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(we=t.offsetWidth<=1&&t.offsetHeight>2&&!(s&&o<8))}var r=we?D("span",""):D("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function De(e){if(null!=Ce)return Ce;var t=A(e,document.createTextNode("AخA")),r=w(t,0,1).getBoundingClientRect(),n=w(t,1,2).getBoundingClientRect();return L(e),!(!r||r.left==r.right)&&(Ce=n.right-r.right<3)}var Oe,_e=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var a=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),s=a.indexOf("\r");-1!=s?(r.push(a.slice(0,s)),t+=s+1):(r.push(a),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Re=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Ie="oncopy"in(Oe=D("div"))||(Oe.setAttribute("oncopy","return;"),"function"==typeof Oe.oncopy),Me=null,Fe={},Pe={};function Ne(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Fe[e]=t}function Be(e){if("string"==typeof e&&Pe.hasOwnProperty(e))e=Pe[e];else if(e&&"string"==typeof e.name&&Pe.hasOwnProperty(e.name)){var t=Pe[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Be("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Be("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function je(e,t){t=Be(t);var r=Fe[t.name];if(!r)return je(e,"text/plain");var n=r(e,t);if(Ue.hasOwnProperty(t.name)){var i=Ue[t.name];for(var a in i)i.hasOwnProperty(a)&&(n.hasOwnProperty(a)&&(n["_"+a]=n[a]),n[a]=i[a])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var s in t.modeProps)n[s]=t.modeProps[s];return n}var Ue={};function He(e,t){N(t,Ue.hasOwnProperty(e)?Ue[e]:Ue[e]={})}function Ge(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function We(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function ze(e,t,r){return!e.startState||e.startState(t,r)}var Ke=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function Ve(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],a=i.chunkSize();if(t<a){r=i;break}t-=a}return r.lines[t]}function qe(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,(function(e){var a=e.text;i==r.line&&(a=a.slice(0,r.ch)),i==t.line&&(a=a.slice(t.ch)),n.push(a),++i})),n}function $e(e,t,r){var n=[];return e.iter(t,r,(function(e){n.push(e.text)})),n}function Ye(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Xe(e){if(null==e.parent)return null;for(var t=e.parent,r=U(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function Ze(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],a=i.height;if(t<a){e=i;continue e}t-=a,r+=i.chunkSize()}return r}while(!e.lines);for(var s=0;s<e.lines.length;++s){var o=e.lines[s].height;if(t<o)break;t-=o}return r+s}function Qe(e,t){return t>=e.first&&t<e.first+e.size}function Je(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,r){if(void 0===r&&(r=null),!(this instanceof et))return new et(e,t,r);this.line=e,this.ch=t,this.sticky=r}function tt(e,t){return e.line-t.line||e.ch-t.ch}function rt(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function nt(e){return et(e.line,e.ch)}function it(e,t){return tt(e,t)<0?t:e}function at(e,t){return tt(e,t)<0?e:t}function st(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ot(e,t){if(t.line<e.first)return et(e.first,0);var r=e.first+e.size-1;return t.line>r?et(r,Ve(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?et(e.line,t):r<0?et(e.line,0):e}(t,Ve(e,t.line).text.length)}function lt(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ot(e,t[n]);return r}Ke.prototype.eol=function(){return this.pos>=this.string.length},Ke.prototype.sol=function(){return this.pos==this.lineStart},Ke.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ke.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ke.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ke.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ke.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ke.prototype.skipToEnd=function(){this.pos=this.string.length},Ke.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ke.prototype.backUp=function(e){this.pos-=e},Ke.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=B(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Ke.prototype.indentation=function(){return B(this.string,null,this.tabSize)-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Ke.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ke.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ke.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ke.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ke.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ut=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function dt(e,t,r,n){var i=[e.state.modeGen],a={};Et(e,t.text,e.doc.mode,r,(function(e,t){return i.push(e,t)}),a,n);for(var s=r.state,o=function(n){r.baseTokens=i;var o=e.state.overlays[n],l=1,u=0;r.state=!0,Et(e,t.text,o.mode,r,(function(e,t){for(var r=l;u<e;){var n=i[l];n>e&&i.splice(l,1,e,i[l+1],n),l+=2,u=Math.min(e,n)}if(t)if(o.opaque)i.splice(r,l-r,e,"overlay "+t),l=r+2;else for(;r<l;r+=2){var a=i[r+1];i[r+1]=(a?a+" ":"")+"overlay "+t}}),a),r.state=s,r.baseTokens=null,r.baseTokenPos=1},l=0;l<e.state.overlays.length;++l)o(l);return{styles:i,classes:a.bgClass||a.textClass?a:null}}function ft(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=ht(e,Xe(t)),i=t.text.length>e.options.maxHighlightLength&&Ge(e.doc.mode,n.state),a=dt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=a.styles,a.classes?t.styleClasses=a.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ht(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new ct(n,!0,t);var a=function(e,t,r){for(var n,i,a=e.doc,s=r?-1:t-(e.doc.mode.innerMode?1e3:100),o=t;o>s;--o){if(o<=a.first)return a.first;var l=Ve(a,o-1),u=l.stateAfter;if(u&&(!r||o+(u instanceof ut?u.lookAhead:0)<=a.modeFrontier))return o;var c=B(l.text,null,e.options.tabSize);(null==i||n>c)&&(i=o-1,n=c)}return i}(e,t,r),s=a>n.first&&Ve(n,a-1).stateAfter,o=s?ct.fromSaved(n,s,a):new ct(n,ze(n.mode),a);return n.iter(a,t,(function(r){pt(e,r.text,o);var n=o.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?o.save():null,o.nextLine()})),r&&(n.modeFrontier=o.line),o}function pt(e,t,r,n){var i=e.doc.mode,a=new Ke(t,e.options.tabSize,r);for(a.start=a.pos=n||0,""==t&>(i,r.state);!a.eol();)mt(i,a,r.state),a.start=a.pos}function gt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=We(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function mt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=We(e,r).mode);var a=e.token(t,r);if(t.pos>t.start)return a}throw new Error("Mode "+e.name+" failed to advance stream.")}ct.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ct.fromSaved=function(e,t,r){return t instanceof ut?new ct(e,Ge(e.mode,t.state),r,t.lookAhead):new ct(e,Ge(e.mode,t),r)},ct.prototype.save=function(e){var t=!1!==e?Ge(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ut(t,this.maxLookAhead):t};var vt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function yt(e,t,r,n){var i,a,s=e.doc,o=s.mode,l=Ve(s,(t=ot(s,t)).line),u=ht(e,t.line,r),c=new Ke(l.text,e.options.tabSize,u);for(n&&(a=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=mt(o,c,u.state),n&&a.push(new vt(c,i,Ge(s.mode,u.state)));return n?a:new vt(c,i,u.state)}function bt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Et(e,t,r,n,i,a,s){var o=r.flattenSpans;null==o&&(o=e.options.flattenSpans);var l,u=0,c=null,d=new Ke(t,e.options.tabSize,n),f=e.options.addModeClass&&[null];for(""==t&&bt(gt(r,n.state),a);!d.eol();){if(d.pos>e.options.maxHighlightLength?(o=!1,s&&pt(e,t,n,d.pos),d.pos=t.length,l=null):l=bt(mt(r,d,n.state,f),a),f){var h=f[0].name;h&&(l="m-"+(l?h+" "+l:h))}if(!o||c!=l){for(;u<d.start;)i(u=Math.min(d.start,u+5e3),c);c=l}d.start=d.pos}for(;u<d.pos;){var p=Math.min(d.pos,u+5e3);i(p,c),u=p}}var xt=!1,St=!1;function Tt(e,t,r){this.marker=e,this.from=t,this.to=r}function kt(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function wt(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Ct(e,t){if(t.full)return null;var r=Qe(e,t.from.line)&&Ve(e,t.from.line).markedSpans,n=Qe(e,t.to.line)&&Ve(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,a=t.to.ch,s=0==tt(t.from,t.to),o=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var a=e[i],s=a.marker;if(null==a.from||(s.inclusiveLeft?a.from<=t:a.from<t)||a.from==t&&"bookmark"==s.type&&(!r||!a.marker.insertLeft)){var o=null==a.to||(s.inclusiveRight?a.to>=t:a.to>t);(n||(n=[])).push(new Tt(s,a.from,o?null:a.to))}}return n}(r,i,s),l=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var a=e[i],s=a.marker;if(null==a.to||(s.inclusiveRight?a.to>=t:a.to>t)||a.from==t&&"bookmark"==s.type&&(!r||a.marker.insertLeft)){var o=null==a.from||(s.inclusiveLeft?a.from<=t:a.from<t);(n||(n=[])).push(new Tt(s,o?null:a.from-t,null==a.to?null:a.to-t))}}return n}(n,a,s),u=1==t.text.length,c=$(t.text).length+(u?i:0);if(o)for(var d=0;d<o.length;++d){var f=o[d];if(null==f.to){var h=kt(l,f.marker);h?u&&(f.to=null==h.to?null:h.to+c):f.to=i}}if(l)for(var p=0;p<l.length;++p){var g=l[p];null!=g.to&&(g.to+=c),null==g.from?kt(o,g.marker)||(g.from=c,u&&(o||(o=[])).push(g)):(g.from+=c,u&&(o||(o=[])).push(g))}o&&(o=Lt(o)),l&&l!=o&&(l=Lt(l));var m=[o];if(!u){var v,y=t.text.length-2;if(y>0&&o)for(var b=0;b<o.length;++b)null==o[b].to&&(v||(v=[])).push(new Tt(o[b].marker,null,null));for(var E=0;E<y;++E)m.push(v);m.push(l)}return m}function Lt(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function At(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Dt(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Ot(e){return e.inclusiveLeft?-1:0}function _t(e){return e.inclusiveRight?1:0}function Rt(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),a=tt(n.from,i.from)||Ot(e)-Ot(t);if(a)return-a;var s=tt(n.to,i.to)||_t(e)-_t(t);return s||t.id-e.id}function It(e,t){var r,n=St&&e.markedSpans;if(n)for(var i=void 0,a=0;a<n.length;++a)(i=n[a]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||Rt(r,i.marker)<0)&&(r=i.marker);return r}function Mt(e){return It(e,!0)}function Ft(e){return It(e,!1)}function Pt(e,t){var r,n=St&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var a=n[i];a.marker.collapsed&&(null==a.from||a.from<t)&&(null==a.to||a.to>t)&&(!r||Rt(r,a.marker)<0)&&(r=a.marker)}return r}function Nt(e,t,r,n,i){var a=Ve(e,t),s=St&&a.markedSpans;if(s)for(var o=0;o<s.length;++o){var l=s[o];if(l.marker.collapsed){var u=l.marker.find(0),c=tt(u.from,r)||Ot(l.marker)-Ot(i),d=tt(u.to,n)||_t(l.marker)-_t(i);if(!(c>=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?tt(u.to,r)>=0:tt(u.to,r)>0)||c>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?tt(u.from,n)<=0:tt(u.from,n)<0)))return!0}}}function Bt(e){for(var t;t=Mt(e);)e=t.find(-1,!0).line;return e}function jt(e,t){var r=Ve(e,t),n=Bt(r);return r==n?t:Xe(n)}function Ut(e,t){if(t>e.lastLine())return t;var r,n=Ve(e,t);if(!Ht(e,n))return t;for(;r=Ft(n);)n=r.find(1,!0).line;return Xe(n)+1}function Ht(e,t){var r=St&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Gt(e,t,n))return!0}}function Gt(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Gt(e,n.line,kt(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,a=0;a<t.markedSpans.length;++a)if((i=t.markedSpans[a]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Gt(e,t,i))return!0}function Wt(e){for(var t=0,r=(e=Bt(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var a=r.parent;a;a=(r=a).parent)for(var s=0;s<a.children.length;++s){var o=a.children[s];if(o==r)break;t+=o.height}return t}function zt(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Mt(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Ft(n);){var a=t.find(0,!0);r-=n.text.length-a.from.ch,r+=(n=a.to.line).text.length-a.to.ch}return r}function Kt(e){var t=e.display,r=e.doc;t.maxLine=Ve(r,r.first),t.maxLineLength=zt(t.maxLine),t.maxLineChanged=!0,r.iter((function(e){var r=zt(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var Vt=function(e,t,r){this.text=e,Dt(this,t),this.height=r?r(this):1};function qt(e){e.parent=null,At(e)}Vt.prototype.lineNo=function(){return Xe(this)},ye(Vt);var $t={},Yt={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Yt:$t;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var r=O("span",null,null,l?"padding-right: .1px":null),n={pre:O("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var a=i?t.rest[i-1]:t.line,s=void 0;n.pos=0,n.addToken=Jt,De(e.display.measure)&&(s=ue(a,e.doc.direction))&&(n.addToken=er(n.addToken,s)),n.map=[],rr(a,n,ft(e,a,t!=e.display.externalMeasured&&Xe(a))),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=M(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=M(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Ae(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(l){var o=n.content.lastChild;(/\bcm-tab\b/.test(o.className)||o.querySelector&&o.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=M(n.pre.className,n.textClass||"")),n}function Qt(e){var t=D("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,n,i,a,l){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var a=e.charAt(i);" "!=a||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(a=" "),n+=a,r=" "==a}return n}(t,e.trailingSpace):t,d=e.cm.state.specialChars,f=!1;if(d.test(t)){u=document.createDocumentFragment();for(var h=0;;){d.lastIndex=h;var p=d.exec(t),g=p?p.index-h:t.length-h;if(g){var m=document.createTextNode(c.slice(h,h+g));s&&o<9?u.appendChild(D("span",[m])):u.appendChild(m),e.map.push(e.pos,e.pos+g,m),e.col+=g,e.pos+=g}if(!p)break;h+=g+1;var v=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(v=u.appendChild(D("span",q(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=u.appendChild(D("span","\r"==p[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),s&&o<9?u.appendChild(D("span",[v])):u.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),s&&o<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),r||n||i||f||a||l){var E=r||"";n&&(E+=n),i&&(E+=i);var x=D("span",[u],E,a);if(l)for(var S in l)l.hasOwnProperty(S)&&"style"!=S&&"class"!=S&&x.setAttribute(S,l[S]);return e.content.appendChild(x)}e.content.appendChild(u)}}function er(e,t){return function(r,n,i,a,s,o,l){i=i?i+" cm-force-border":"cm-force-border";for(var u=r.pos,c=u+n.length;;){for(var d=void 0,f=0;f<t.length&&!((d=t[f]).to>u&&d.from<=u);f++);if(d.to>=c)return e(r,n,i,a,s,o,l);e(r,n.slice(0,d.to-u),i,a,null,o,l),a=null,n=n.slice(d.to-u),u=d.to}}}function tr(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function rr(e,t,r){var n=e.markedSpans,i=e.text,a=0;if(n)for(var s,o,l,u,c,d,f,h=i.length,p=0,g=1,m="",v=0;;){if(v==p){l=u=c=o="",f=null,d=null,v=1/0;for(var y=[],b=void 0,E=0;E<n.length;++E){var x=n[E],S=x.marker;if("bookmark"==S.type&&x.from==p&&S.widgetNode)y.push(S);else if(x.from<=p&&(null==x.to||x.to>p||S.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,u=""),S.className&&(l+=" "+S.className),S.css&&(o=(o?o+";":"")+S.css),S.startStyle&&x.from==p&&(c+=" "+S.startStyle),S.endStyle&&x.to==v&&(b||(b=[])).push(S.endStyle,x.to),S.title&&((f||(f={})).title=S.title),S.attributes)for(var T in S.attributes)(f||(f={}))[T]=S.attributes[T];S.collapsed&&(!d||Rt(d.marker,S)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==v&&(u+=" "+b[k]);if(!d||d.from==p)for(var w=0;w<y.length;++w)tr(t,0,y[w]);if(d&&(d.from||0)==p){if(tr(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(p>=h)break;for(var C=Math.min(h,v);;){if(m){var L=p+m.length;if(!d){var A=L>C?m.slice(0,C-p):m;t.addToken(t,A,s?s+l:l,c,p+A.length==v?u:"",o,f)}if(L>=C){m=m.slice(C-p),p=C;break}p=L,c=""}m=i.slice(a,a=r[g++]),s=Xt(r[g++],t.cm.options)}}else for(var D=1;D<r.length;D+=2)t.addToken(t,i.slice(a,a=r[D]),Xt(r[D+1],t.cm.options))}function nr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Ft(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?Xe($(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Ht(e,t)}function ir(e,t,r){for(var n,i=[],a=t;a<r;a=n){var s=new nr(e.doc,Ve(e.doc,a),a);n=a+s.size,i.push(s)}return i}var ar=null,sr=null;function or(e,t){var r=fe(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);ar?n=ar.delayedCallbacks:sr?n=sr:(n=sr=[],setTimeout(lr,0));for(var a=function(e){n.push((function(){return r[e].apply(null,i)}))},s=0;s<r.length;++s)a(s)}}function lr(){var e=sr;sr=null;for(var t=0;t<e.length;++t)e[t]()}function ur(e,t,r,n){for(var i=0;i<t.changes.length;i++){var a=t.changes[i];"text"==a?fr(e,t):"gutter"==a?pr(e,t,r,n):"class"==a?hr(e,t):"widget"==a&&gr(e,t,n)}t.changes=null}function cr(e){return e.node==e.text&&(e.node=D("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),s&&o<8&&(e.node.style.zIndex=2)),e.node}function dr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Zt(e,t)}function fr(e,t){var r=t.text.className,n=dr(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,hr(e,t)):r&&(t.text.className=r)}function hr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=cr(t);t.background=n.insertBefore(D("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?cr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function pr(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=cr(t);t.gutterBackground=D("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var a=t.line.gutterMarkers;if(e.options.lineNumbers||a){var s=cr(t),o=t.gutter=D("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(o),s.insertBefore(o,t.text),t.line.gutterClass&&(o.className+=" "+t.line.gutterClass),!e.options.lineNumbers||a&&a["CodeMirror-linenumbers"]||(t.lineNumber=o.appendChild(D("div",Je(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),a)for(var l=0;l<e.display.gutterSpecs.length;++l){var u=e.display.gutterSpecs[l].className,c=a.hasOwnProperty(u)&&a[u];c&&o.appendChild(D("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function gr(e,t,r){t.alignable&&(t.alignable=null);for(var n=k("CodeMirror-linewidget"),i=t.node.firstChild,a=void 0;i;i=a)a=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);vr(e,t,r)}function mr(e,t,r,n){var i=dr(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),hr(e,t),pr(e,t,r,n),vr(e,t,n),t.node}function vr(e,t,r){if(yr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)yr(e,t.rest[n],t,r,!1)}function yr(e,t,r,n,i){if(t.widgets)for(var a=cr(r),s=0,o=t.widgets;s<o.length;++s){var l=o[s],u=D("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),br(l,u,r,n),e.display.input.setUneditable(u),i&&l.above?a.insertBefore(u,r.gutter||r.text):a.appendChild(u),or(l,"redraw")}}function br(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function Er(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!_(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),A(t.display.measure,D("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function xr(e,t){for(var r=Te(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Sr(e){return e.lineSpace.offsetTop}function Tr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function kr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=A(e.measure,D("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function wr(e){return 50-e.display.nativeBarWidth}function Cr(e){return e.display.scroller.clientWidth-wr(e)-e.display.barWidth}function Lr(e){return e.display.scroller.clientHeight-wr(e)-e.display.barHeight}function Ar(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(Xe(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Dr(e,t,r,n){return Rr(e,_r(e,t),r,n)}function Or(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[cn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function _r(e,t){var r=Xe(t),n=Or(e,r);n&&!n.text?n=null:n&&n.changes&&(ur(e,n,r,an(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=Xe(t=Bt(t)),n=e.display.externalMeasured=new nr(e.doc,t,r);n.lineN=r;var i=n.built=Zt(e,n);return n.text=i.pre,A(e.display.lineMeasure,i.pre),n}(e,t));var i=Ar(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Rr(e,t,r,n,i){t.before&&(r=-1);var a,l=r+(n||"");return t.cache.hasOwnProperty(l)?a=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,r){var n=e.options.lineWrapping,i=n&&Cr(e);if(!t.measure.heights||n&&t.measure.width!=i){var a=t.measure.heights=[];if(n){t.measure.width=i;for(var s=t.text.firstChild.getClientRects(),o=0;o<s.length-1;o++){var l=s[o],u=s[o+1];Math.abs(l.bottom-u.bottom)>2&&a.push((l.bottom+u.top)/2-r.top)}}a.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(a=function(e,t,r,n){var i,a=Fr(t.map,r,n),l=a.node,u=a.start,c=a.end,d=a.collapse;if(3==l.nodeType){for(var f=0;f<4;f++){for(;u&&ne(t.line.text.charAt(a.coverStart+u));)--u;for(;a.coverStart+c<a.coverEnd&&ne(t.line.text.charAt(a.coverStart+c));)++c;if((i=s&&o<9&&0==u&&c==a.coverEnd-a.coverStart?l.parentNode.getBoundingClientRect():Pr(w(l,u,c).getClientRects(),n)).left||i.right||0==u)break;c=u,u-=1,d="right"}s&&o<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Me)return Me;var t=A(e,D("span","x")),r=t.getBoundingClientRect(),n=w(t,0,1).getBoundingClientRect();return Me=Math.abs(r.left-n.left)>1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var h;u>0&&(d=n="right"),i=e.options.lineWrapping&&(h=l.getClientRects()).length>1?h["right"==n?h.length-1:0]:l.getBoundingClientRect()}if(s&&o<9&&!u&&(!i||!i.left&&!i.right)){var p=l.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+nn(e.display),top:p.top,bottom:p.bottom}:Mr}for(var g=i.top-t.rect.top,m=i.bottom-t.rect.top,v=(g+m)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(v<y[b]);b++);var E=b?y[b-1]:0,x=y[b],S={left:("right"==d?i.right:i.left)-t.rect.left,right:("left"==d?i.left:i.right)-t.rect.left,top:E,bottom:x};return i.left||i.right||(S.bogus=!0),e.options.singleCursorHeightPerLine||(S.rtop=g,S.rbottom=m),S}(e,t,r,n)).bogus||(t.cache[l]=a)),{left:a.left,right:a.right,top:i?a.rtop:a.top,bottom:i?a.rbottom:a.bottom}}var Ir,Mr={left:0,right:0,top:0,bottom:0};function Fr(e,t,r){for(var n,i,a,s,o,l,u=0;u<e.length;u+=3)if(o=e[u],l=e[u+1],t<o?(i=0,a=1,s="left"):t<l?a=1+(i=t-o):(u==e.length-3||t==l&&e[u+3]>t)&&(i=(a=l-o)-1,t>=l&&(s="right")),null!=i){if(n=e[u+2],o==l&&r==(n.insertLeft?"left":"right")&&(s=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],s="left";if("right"==r&&i==l-o)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)n=e[(u+=3)+2],s="right";break}return{node:n,start:i,end:a,collapse:s,coverStart:o,coverEnd:l}}function Pr(e,t){var r=Mr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Nr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Br(e){e.display.externalMeasure=null,L(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Nr(e.display.view[t])}function jr(e){Br(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Ur(){return c&&m?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Hr(){return c&&m?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Gr(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=Er(e.widgets[r]));return t}function Wr(e,t,r,n,i){if(!i){var a=Gr(t);r.top+=a,r.bottom+=a}if("line"==n)return r;n||(n="local");var s=Wt(t);if("local"==n?s+=Sr(e.display):s-=e.display.viewOffset,"page"==n||"window"==n){var o=e.display.lineSpace.getBoundingClientRect();s+=o.top+("window"==n?0:Hr());var l=o.left+("window"==n?0:Ur());r.left+=l,r.right+=l}return r.top+=s,r.bottom+=s,r}function zr(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Ur(),i-=Hr();else if("local"==r||!r){var a=e.display.sizer.getBoundingClientRect();n+=a.left,i+=a.top}var s=e.display.lineSpace.getBoundingClientRect();return{left:n-s.left,top:i-s.top}}function Kr(e,t,r,n,i){return n||(n=Ve(e.doc,t.line)),Wr(e,n,Dr(e,n,t.ch,i),r)}function Vr(e,t,r,n,i,a){function s(t,s){var o=Rr(e,i,t,s?"right":"left",a);return s?o.left=o.right:o.right=o.left,Wr(e,n,o,r)}n=n||Ve(e.doc,t.line),i||(i=_r(e,n));var o=ue(n,e.doc.direction),l=t.ch,u=t.sticky;if(l>=n.text.length?(l=n.text.length,u="before"):l<=0&&(l=0,u="after"),!o)return s("before"==u?l-1:l,"before"==u);function c(e,t,r){return s(r?e-1:e,1==o[t].level!=r)}var d=oe(o,l,u),f=se,h=c(l,d,"before"==u);return null!=f&&(h.other=c(l,f,"before"!=u)),h}function qr(e,t){var r=0;t=ot(e.doc,t),e.options.lineWrapping||(r=nn(e.display)*t.ch);var n=Ve(e.doc,t.line),i=Wt(n)+Sr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function $r(e,t,r,n,i){var a=et(e,t,r);return a.xRel=i,n&&(a.outside=n),a}function Yr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return $r(n.first,0,null,-1,-1);var i=Ze(n,r),a=n.first+n.size-1;if(i>a)return $r(n.first+n.size-1,Ve(n,a).text.length,null,1,1);t<0&&(t=0);for(var s=Ve(n,i);;){var o=Jr(e,s,i,t,r),l=Pt(s,o.ch+(o.xRel>0||o.outside>0?1:0));if(!l)return o;var u=l.find(1);if(u.line==i)return u;s=Ve(n,i=u.line)}}function Xr(e,t,r,n){n-=Gr(t);var i=t.text.length,a=ae((function(t){return Rr(e,r,t-1).bottom<=n}),i,0);return{begin:a,end:i=ae((function(t){return Rr(e,r,t).top>n}),a,i)}}function Zr(e,t,r,n){return r||(r=_r(e,t)),Xr(e,t,r,Wr(e,t,Rr(e,r,n),"line").top)}function Qr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Jr(e,t,r,n,i){i-=Wt(t);var a=_r(e,t),s=Gr(t),o=0,l=t.text.length,u=!0,c=ue(t,e.doc.direction);if(c){var d=(e.options.lineWrapping?tn:en)(e,t,r,a,c,n,i);o=(u=1!=d.level)?d.from:d.to-1,l=u?d.to:d.from-1}var f,h,p=null,g=null,m=ae((function(t){var r=Rr(e,a,t);return r.top+=s,r.bottom+=s,!!Qr(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)}),o,l),v=!1;if(g){var y=n-g.left<g.right-n,b=y==u;m=p+(b?0:1),h=b?"after":"before",f=y?g.left:g.right}else{u||m!=l&&m!=o||m++,h=0==m?"after":m==t.text.length?"before":Rr(e,a,m-(u?1:0)).bottom+s<=i==u?"after":"before";var E=Vr(e,et(r,m,h),"line",t,a);f=E.left,v=i<E.top?-1:i>=E.bottom?1:0}return $r(r,m=ie(t.text,m,1),h,v,n-f)}function en(e,t,r,n,i,a,s){var o=ae((function(o){var l=i[o],u=1!=l.level;return Qr(Vr(e,et(r,u?l.to:l.from,u?"before":"after"),"line",t,n),a,s,!0)}),0,i.length-1),l=i[o];if(o>0){var u=1!=l.level,c=Vr(e,et(r,u?l.from:l.to,u?"after":"before"),"line",t,n);Qr(c,a,s,!0)&&c.top>s&&(l=i[o-1])}return l}function tn(e,t,r,n,i,a,s){var o=Xr(e,t,n,s),l=o.begin,u=o.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,d=null,f=0;f<i.length;f++){var h=i[f];if(!(h.from>=u||h.to<=l)){var p=Rr(e,n,1!=h.level?Math.min(u,h.to)-1:Math.max(l,h.from)).right,g=p<a?a-p+1e9:p-a;(!c||d>g)&&(c=h,d=g)}}return c||(c=i[i.length-1]),c.from<l&&(c={from:l,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function rn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ir){Ir=D("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ir.appendChild(document.createTextNode("x")),Ir.appendChild(D("br"));Ir.appendChild(document.createTextNode("x"))}A(e.measure,Ir);var r=Ir.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),L(e.measure),r||1}function nn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=D("span","xxxxxxxxxx"),r=D("pre",[t],"CodeMirror-line-like");A(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function an(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,a=t.gutters.firstChild,s=0;a;a=a.nextSibling,++s){var o=e.display.gutterSpecs[s].className;r[o]=a.offsetLeft+a.clientLeft+i,n[o]=a.clientWidth}return{fixedPos:sn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function sn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function on(e){var t=rn(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/nn(e.display)-3);return function(i){if(Ht(e.doc,i))return 0;var a=0;if(i.widgets)for(var s=0;s<i.widgets.length;s++)i.widgets[s].height&&(a+=i.widgets[s].height);return r?a+(Math.ceil(i.text.length/n)||1)*t:a+t}}function ln(e){var t=e.doc,r=on(e);t.iter((function(e){var t=r(e);t!=e.height&&Ye(e,t)}))}function un(e,t,r,n){var i=e.display;if(!r&&"true"==Te(t).getAttribute("cm-not-content"))return null;var a,s,o=i.lineSpace.getBoundingClientRect();try{a=t.clientX-o.left,s=t.clientY-o.top}catch(e){return null}var l,u=Yr(e,a,s);if(n&&u.xRel>0&&(l=Ve(e.doc,u.line).text).length==u.ch){var c=B(l,l.length,e.options.tabSize)-l.length;u=et(u.line,Math.max(0,Math.round((a-kr(e.display).left)/nn(e.display))-c))}return u}function cn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function dn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)St&&jt(e.doc,t)<i.viewTo&&hn(e);else if(r<=i.viewFrom)St&&Ut(e.doc,r+n)>i.viewFrom?hn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)hn(e);else if(t<=i.viewFrom){var a=pn(e,r,r+n,1);a?(i.view=i.view.slice(a.index),i.viewFrom=a.lineN,i.viewTo+=n):hn(e)}else if(r>=i.viewTo){var s=pn(e,t,t,-1);s?(i.view=i.view.slice(0,s.index),i.viewTo=s.lineN):hn(e)}else{var o=pn(e,t,t,-1),l=pn(e,r,r+n,1);o&&l?(i.view=i.view.slice(0,o.index).concat(ir(e,o.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):hn(e)}var u=i.externalMeasured;u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function fn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var a=n.view[cn(e,t)];if(null!=a.node){var s=a.changes||(a.changes=[]);-1==U(s,r)&&s.push(r)}}}function hn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pn(e,t,r,n){var i,a=cn(e,t),s=e.display.view;if(!St||r==e.doc.first+e.doc.size)return{index:a,lineN:r};for(var o=e.display.viewFrom,l=0;l<a;l++)o+=s[l].size;if(o!=t){if(n>0){if(a==s.length-1)return null;i=o+s[a].size-t,a++}else i=o-t;t+=i,r+=i}for(;jt(e.doc,r)!=r;){if(a==(n<0?0:s.length-1))return null;r+=n*s[a-(n<0?1:0)].size,a+=n}return{index:a,lineN:r}}function gn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function mn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),a=n.selection=document.createDocumentFragment(),s=0;s<r.sel.ranges.length;s++)if(t||s!=r.sel.primIndex){var o=r.sel.ranges[s];if(!(o.from().line>=e.display.viewTo||o.to().line<e.display.viewFrom)){var l=o.empty();(l||e.options.showCursorWhenSelecting)&&yn(e,o.head,i),l||En(e,o,a)}}return n}function yn(e,t,r){var n=Vr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(D("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var a=r.appendChild(D("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="",a.style.left=n.other.left+"px",a.style.top=n.other.top+"px",a.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function bn(e,t){return e.top-t.top||e.left-t.left}function En(e,t,r){var n=e.display,i=e.doc,a=document.createDocumentFragment(),s=kr(e.display),o=s.left,l=Math.max(n.sizerWidth,Cr(e)-n.sizer.offsetLeft)-s.right,u="ltr"==i.direction;function c(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),a.appendChild(D("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?l-e:r)+"px;\n height: "+(n-t)+"px"))}function d(t,r,n){var a,s,d=Ve(i,t),f=d.text.length;function h(r,n){return Kr(e,et(t,r),"div",d,n)}function p(t,r,n){var i=Zr(e,d,null,t),a="ltr"==r==("after"==n)?"left":"right";return h("after"==n?i.begin:i.end-(/\s/.test(d.text.charAt(i.end-1))?2:1),a)[a]}var g=ue(d,i.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,a=0;a<e.length;++a){var s=e[a];(s.from<r&&s.to>t||t==r&&s.to==t)&&(n(Math.max(s.from,t),Math.min(s.to,r),1==s.level?"rtl":"ltr",a),i=!0)}i||n(t,r,"ltr")}(g,r||0,null==n?f:n,(function(e,t,i,d){var m="ltr"==i,v=h(e,m?"left":"right"),y=h(t-1,m?"right":"left"),b=null==r&&0==e,E=null==n&&t==f,x=0==d,S=!g||d==g.length-1;if(y.top-v.top<=3){var T=(u?E:b)&&S,k=(u?b:E)&&x?o:(m?v:y).left,w=T?l:(m?y:v).right;c(k,v.top,w-k,v.bottom)}else{var C,L,A,D;m?(C=u&&b&&x?o:v.left,L=u?l:p(e,i,"before"),A=u?o:p(t,i,"after"),D=u&&E&&S?l:y.right):(C=u?p(e,i,"before"):o,L=!u&&b&&x?l:v.right,A=!u&&E&&S?o:y.left,D=u?p(t,i,"after"):l),c(C,v.top,L-C,v.bottom),v.bottom<y.top&&c(o,v.bottom,null,y.top),c(A,y.top,D-A,y.bottom)}(!a||bn(v,a)<0)&&(a=v),bn(y,a)<0&&(a=y),(!s||bn(v,s)<0)&&(s=v),bn(y,s)<0&&(s=y)})),{start:a,end:s}}var f=t.from(),h=t.to();if(f.line==h.line)d(f.line,f.ch,h.ch);else{var p=Ve(i,f.line),g=Ve(i,h.line),m=Bt(p)==Bt(g),v=d(f.line,f.ch,m?p.text.length+1:null).end,y=d(h.line,m?0:null,h.ch).start;m&&(v.top<y.top-2?(c(v.right,v.top,null,v.bottom),c(o,y.top,y.left,y.bottom)):c(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&c(o,v.bottom,null,y.top)}r.appendChild(a)}function xn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){e.hasFocus()||wn(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Sn(e){e.state.focused||(e.display.input.focus(),kn(e))}function Tn(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,wn(e))}),100)}function kn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(pe(e,"focus",e,t),e.state.focused=!0,I(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),l&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),xn(e))}function wn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(pe(e,"blur",e,t),e.state.focused=!1,C(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Cn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],a=e.options.lineWrapping,l=void 0,u=0;if(!i.hidden){if(s&&o<8){var c=i.node.offsetTop+i.node.offsetHeight;l=c-r,r=c}else{var d=i.node.getBoundingClientRect();l=d.bottom-d.top,!a&&i.text.firstChild&&(u=i.text.firstChild.getBoundingClientRect().right-d.left-1)}var f=i.line.height-l;if((f>.005||f<-.005)&&(Ye(i.line,l),Ln(i.line),i.rest))for(var h=0;h<i.rest.length;h++)Ln(i.rest[h]);if(u>e.display.sizerWidth){var p=Math.ceil(u/nn(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Ln(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function An(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Sr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,a=Ze(t,n),s=Ze(t,i);if(r&&r.ensure){var o=r.ensure.from.line,l=r.ensure.to.line;o<a?(a=o,s=Ze(t,Wt(Ve(t,o))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=s&&(a=Ze(t,Wt(Ve(t,l))-e.wrapper.clientHeight),s=l)}return{from:a,to:Math.max(s,a+1)}}function Dn(e,t){var r=e.display,n=rn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,a=Lr(e),s={};t.bottom-t.top>a&&(t.bottom=t.top+a);var o=e.doc.height+Tr(r),l=t.top<n,u=t.bottom>o-n;if(t.top<i)s.scrollTop=l?0:t.top;else if(t.bottom>i+a){var c=Math.min(t.top,(u?o:t.bottom)-a);c!=i&&(s.scrollTop=c)}var d=e.options.fixedGutter?0:r.gutters.offsetWidth,f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft-d,h=Cr(e)-r.gutters.offsetWidth,p=t.right-t.left>h;return p&&(t.right=t.left+h),t.left<10?s.scrollLeft=0:t.left<f?s.scrollLeft=Math.max(0,t.left+d-(p?0:10)):t.right>h+f-3&&(s.scrollLeft=t.right+(p?0:10)-h),s}function On(e,t){null!=t&&(In(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function _n(e){In(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Rn(e,t,r){null==t&&null==r||In(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function In(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Mn(e,qr(e,t.from),qr(e,t.to),t.margin))}function Mn(e,t,r,n){var i=Dn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Rn(e,i.scrollLeft,i.scrollTop)}function Fn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||li(e,{top:t}),Pn(e,t,!0),r&&li(e),ni(e,100))}function Pn(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Nn(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,di(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Bn(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Tr(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+wr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var jn=function(e,t,r){this.cm=r;var n=this.vert=D("div",[D("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=D("div",[D("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),de(n,"scroll",(function(){n.clientHeight&&t(n.scrollTop,"vertical")})),de(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,s&&o<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};jn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var a=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+a)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},jn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},jn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},jn.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new j,this.disableVert=new j},jn.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto",t.set(1e3,(function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)}))},jn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Un=function(){};function Hn(e,t){t||(t=Bn(e));var r=e.display.barWidth,n=e.display.barHeight;Gn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Cn(e),Gn(e,Bn(e)),r=e.display.barWidth,n=e.display.barHeight}function Gn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Un.prototype.update=function(){return{bottom:0,right:0}},Un.prototype.setScrollLeft=function(){},Un.prototype.setScrollTop=function(){},Un.prototype.clear=function(){};var Wn={native:jn,null:Un};function zn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&C(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Wn[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),de(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,r){"horizontal"==r?Nn(e,t):Fn(e,t)}),e),e.display.scrollbars.addClass&&I(e.display.wrapper,e.display.scrollbars.addClass)}var Kn=0;function Vn(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Kn},t=e.curOp,ar?ar.ops.push(t):t.ownsGroup=ar={ops:[t],delayedCallbacks:[]}}function qn(e){var t=e.curOp;t&&function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{ar=null,t(r)}}(t,(function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)$n(t[r]);for(var n=0;n<t.length;n++)Yn(t[n]);for(var i=0;i<t.length;i++)Xn(t[i]);for(var a=0;a<t.length;a++)Zn(t[a]);for(var s=0;s<t.length;s++)Qn(t[s])}(e)}))}function $n(e){var t=e.cm,r=t.display;!function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=wr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=wr(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Kt(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ai(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Yn(e){e.updatedDisplay=e.mustUpdate&&si(e.cm,e.update)}function Xn(e){var t=e.cm,r=t.display;e.updatedDisplay&&Cn(t),e.barMeasure=Bn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Dr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+wr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Cr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Zn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Nn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==R();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Hn(t,e.barMeasure),e.updatedDisplay&&ci(t,e.barMeasure),e.selectionChanged&&xn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Sn(e.cm)}function Qn(e){var t=e.cm,r=t.display,n=t.doc;e.updatedDisplay&&oi(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&Pn(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Nn(t,e.scrollLeft,!0,!0),e.scrollToPos&&function(e,t){if(!ge(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var a=D("div","",null,"position: absolute;\n top: "+(t.top-r.viewOffset-Sr(e.display))+"px;\n height: "+(t.bottom-t.top+wr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(i),e.display.lineSpace.removeChild(a)}}}(t,function(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var a=0;a<5;a++){var s=!1,o=Vr(e,t),l=r&&r!=t?Vr(e,r):o,u=Dn(e,i={left:Math.min(o.left,l.left),top:Math.min(o.top,l.top)-n,right:Math.max(o.left,l.left),bottom:Math.max(o.bottom,l.bottom)+n}),c=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=u.scrollTop&&(Fn(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(s=!0)),null!=u.scrollLeft&&(Nn(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(s=!0)),!s)break}return i}(t,ot(n,e.scrollToPos.from),ot(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(i)for(var s=0;s<i.length;++s)i[s].lines.length||pe(i[s],"hide");if(a)for(var o=0;o<a.length;++o)a[o].lines.length&&pe(a[o],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Jn(e,t){if(e.curOp)return t();Vn(e);try{return t()}finally{qn(e)}}function ei(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Vn(e);try{return t.apply(e,arguments)}finally{qn(e)}}}function ti(e){return function(){if(this.curOp)return e.apply(this,arguments);Vn(this);try{return e.apply(this,arguments)}finally{qn(this)}}}function ri(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Vn(t);try{return e.apply(this,arguments)}finally{qn(t)}}}function ni(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(ii,e))}function ii(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=ht(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(a){if(n.line>=e.display.viewFrom){var s=a.styles,o=a.text.length>e.options.maxHighlightLength?Ge(t.mode,n.state):null,l=dt(e,a,n,!0);o&&(n.state=o),a.styles=l.styles;var u=a.styleClasses,c=l.classes;c?a.styleClasses=c:u&&(a.styleClasses=null);for(var d=!s||s.length!=a.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!d&&f<s.length;++f)d=s[f]!=a.styles[f];d&&i.push(n.line),a.stateAfter=n.save(),n.nextLine()}else a.text.length<=e.options.maxHighlightLength&&pt(e,a.text,n),a.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return ni(e,e.options.workDelay),!0})),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Jn(e,(function(){for(var t=0;t<i.length;t++)fn(e,i[t],"text")}))}}var ai=function(e,t,r){var n=e.display;this.viewport=t,this.visible=An(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Cr(e),this.force=r,this.dims=an(e),this.events=[]};function si(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return hn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==gn(e))return!1;fi(e)&&(hn(e),t.dims=an(e));var i=n.first+n.size,a=Math.max(t.visible.from-e.options.viewportMargin,n.first),s=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<a&&a-r.viewFrom<20&&(a=Math.max(n.first,r.viewFrom)),r.viewTo>s&&r.viewTo-s<20&&(s=Math.min(i,r.viewTo)),St&&(a=jt(e.doc,a),s=Ut(e.doc,s));var o=a!=r.viewFrom||s!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=ir(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=ir(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(cn(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(ir(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,cn(e,r)))),n.viewTo=r}(e,a,s),r.viewOffset=Wt(Ve(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var u=gn(e);if(!o&&0==u&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=R();if(!t||!_(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&_(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return u>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,i=e.options.lineNumbers,a=n.lineDiv,s=a.firstChild;function o(t){var r=t.nextSibling;return l&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var u=n.view,c=n.viewFrom,d=0;d<u.length;d++){var f=u[d];if(f.hidden);else if(f.node&&f.node.parentNode==a){for(;s!=f.node;)s=o(s);var h=i&&null!=t&&t<=c&&f.lineNumber;f.changes&&(U(f.changes,"gutter")>-1&&(h=!1),ur(e,f,c,r)),h&&(L(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(Je(e.options,c)))),s=f.node.nextSibling}else{var p=mr(e,f,c,r);a.insertBefore(p,s)}c+=f.size}for(;s;)s=o(s)}(e,r.updateLineNumbers,t.dims),u>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=R()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&_(document.body,e.anchorNode)&&_(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(c),L(r.cursorDiv),L(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,o&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ni(e,400)),r.updateLineNumbers=null,!0}function oi(e,t){for(var r=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Cr(e))n&&(t.visible=An(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Tr(e.display)-Lr(e),r.top)}),t.visible=An(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!si(e,t))break;Cn(e);var i=Bn(e);mn(e),Hn(e,i),ci(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function li(e,t){var r=new ai(e,t);if(si(e,r)){Cn(e),oi(e,r);var n=Bn(e);mn(e),Hn(e,n),ci(e,n),r.finish()}}function ui(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ci(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+wr(e)+"px"}function di(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=sn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,a=n+"px",s=0;s<r.length;s++)if(!r[s].hidden){e.options.fixedGutter&&(r[s].gutter&&(r[s].gutter.style.left=a),r[s].gutterBackground&&(r[s].gutterBackground.style.left=a));var o=r[s].alignable;if(o)for(var l=0;l<o.length;l++)o[l].style.left=a}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function fi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=Je(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(D("div",[D("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),a=i.firstChild.offsetWidth,s=i.offsetWidth-a;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(a,n.lineGutter.offsetWidth-s)+1,n.lineNumWidth=n.lineNumInnerWidth+s,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",ui(e.display),!0}return!1}function hi(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var a=e[i],s=null;if("string"!=typeof a&&(s=a.style,a=a.className),"CodeMirror-linenumbers"==a){if(!t)continue;n=!0}r.push({className:a,style:s})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function pi(e){var t=e.gutters,r=e.gutterSpecs;L(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],a=i.className,s=i.style,o=t.appendChild(D("div",null,"CodeMirror-gutter "+a));s&&(o.style.cssText=s),"CodeMirror-linenumbers"==a&&(e.lineGutter=o,o.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",ui(e)}function gi(e){pi(e.display),dn(e),di(e)}function mi(e,t,n,i){var a=this;this.input=n,a.scrollbarFiller=D("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=D("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=O("div",null,"CodeMirror-code"),a.selectionDiv=D("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=D("div",null,"CodeMirror-cursors"),a.measure=D("div",null,"CodeMirror-measure"),a.lineMeasure=D("div",null,"CodeMirror-measure"),a.lineSpace=O("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var u=O("div",[a.lineSpace],"CodeMirror-lines");a.mover=D("div",[u],null,"position: relative"),a.sizer=D("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=D("div",null,null,"position: absolute; height: 50px; width: 1px;"),a.gutters=D("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=D("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=D("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),s&&o<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),l||r&&v||(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=hi(i.gutters,i.lineNumbers),pi(a),n.init(a)}ai.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},ai.prototype.finish=function(){for(var e=0;e<this.events.length;e++)pe.apply(null,this.events[e])};var vi=0,yi=null;function bi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function Ei(e){var t=bi(e);return t.x*=yi,t.y*=yi,t}function xi(e,t){var n=bi(t),i=n.x,a=n.y,s=e.display,o=s.scroller,u=o.scrollWidth>o.clientWidth,c=o.scrollHeight>o.clientHeight;if(i&&u||a&&c){if(a&&y&&l)e:for(var f=t.target,h=s.view;f!=o;f=f.parentNode)for(var p=0;p<h.length;p++)if(h[p].node==f){e.display.currentWheelTarget=f;break e}if(i&&!r&&!d&&null!=yi)return a&&c&&Fn(e,Math.max(0,o.scrollTop+a*yi)),Nn(e,Math.max(0,o.scrollLeft+i*yi)),(!a||a&&c)&&be(t),void(s.wheelStartX=null);if(a&&null!=yi){var g=a*yi,m=e.doc.scrollTop,v=m+s.wrapper.clientHeight;g<0?m=Math.max(0,m+g-50):v=Math.min(e.doc.height,v+g+50),li(e,{top:m,bottom:v})}vi<20&&(null==s.wheelStartX?(s.wheelStartX=o.scrollLeft,s.wheelStartY=o.scrollTop,s.wheelDX=i,s.wheelDY=a,setTimeout((function(){if(null!=s.wheelStartX){var e=o.scrollLeft-s.wheelStartX,t=o.scrollTop-s.wheelStartY,r=t&&s.wheelDY&&t/s.wheelDY||e&&s.wheelDX&&e/s.wheelDX;s.wheelStartX=s.wheelStartY=null,r&&(yi=(yi*vi+r)/(vi+1),++vi)}}),200)):(s.wheelDX+=i,s.wheelDY+=a))}}s?yi=-.53:r?yi=15:c?yi=-.7:f&&(yi=-1/3);var Si=function(e,t){this.ranges=e,this.primIndex=t};Si.prototype.primary=function(){return this.ranges[this.primIndex]},Si.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!rt(r.anchor,n.anchor)||!rt(r.head,n.head))return!1}return!0},Si.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Ti(nt(this.ranges[t].anchor),nt(this.ranges[t].head));return new Si(e,this.primIndex)},Si.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Si.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(tt(t,n.from())>=0&&tt(e,n.to())<=0)return r}return-1};var Ti=function(e,t){this.anchor=e,this.head=t};function ki(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort((function(e,t){return tt(e.from(),t.from())})),r=U(t,i);for(var a=1;a<t.length;a++){var s=t[a],o=t[a-1],l=tt(o.to(),s.from());if(n&&!s.empty()?l>0:l>=0){var u=at(o.from(),s.from()),c=it(o.to(),s.to()),d=o.empty()?s.from()==s.head:o.from()==o.head;a<=r&&--r,t.splice(--a,2,new Ti(d?c:u,d?u:c))}}return new Si(t,r)}function wi(e,t){return new Si([new Ti(e,t||e)],0)}function Ci(e){return e.text?et(e.from.line+e.text.length-1,$(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Li(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return Ci(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Ci(t).ch-t.to.ch),et(r,n)}function Ai(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new Ti(Li(i.anchor,t),Li(i.head,t)))}return ki(e.cm,r,e.sel.primIndex)}function Di(e,t,r){return e.line==t.line?et(r.line,e.ch-t.ch+r.ch):et(r.line+(e.line-t.line),e.ch)}function Oi(e){e.doc.mode=je(e.options,e.doc.modeOption),_i(e)}function _i(e){e.doc.iter((function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)})),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ni(e,100),e.state.modeGen++,e.curOp&&dn(e)}function Ri(e,t){return 0==t.from.ch&&0==t.to.ch&&""==$(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ii(e,t,r,n){function i(e){return r?r[e]:null}function a(e,r,i){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),At(e),Dt(e,r);var i=n?n(e):1;i!=e.height&&Ye(e,i)}(e,r,i,n),or(e,"change",e,t)}function s(e,t){for(var r=[],a=e;a<t;++a)r.push(new Vt(u[a],i(a),n));return r}var o=t.from,l=t.to,u=t.text,c=Ve(e,o.line),d=Ve(e,l.line),f=$(u),h=i(u.length-1),p=l.line-o.line;if(t.full)e.insert(0,s(0,u.length)),e.remove(u.length,e.size-u.length);else if(Ri(e,t)){var g=s(0,u.length-1);a(d,d.text,h),p&&e.remove(o.line,p),g.length&&e.insert(o.line,g)}else if(c==d)if(1==u.length)a(c,c.text.slice(0,o.ch)+f+c.text.slice(l.ch),h);else{var m=s(1,u.length-1);m.push(new Vt(f+c.text.slice(l.ch),h,n)),a(c,c.text.slice(0,o.ch)+u[0],i(0)),e.insert(o.line+1,m)}else if(1==u.length)a(c,c.text.slice(0,o.ch)+u[0]+d.text.slice(l.ch),i(0)),e.remove(o.line+1,p);else{a(c,c.text.slice(0,o.ch)+u[0],i(0)),a(d,f+d.text.slice(l.ch),h);var v=s(1,u.length-1);p>1&&e.remove(o.line+1,p-1),e.insert(o.line+1,v)}or(e,"change",e,t)}function Mi(e,t,r){!function e(n,i,a){if(n.linked)for(var s=0;s<n.linked.length;++s){var o=n.linked[s];if(o.doc!=i){var l=a&&o.sharedHist;r&&!l||(t(o.doc,l),e(o.doc,n,l))}}}(e,null,!0)}function Fi(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,ln(e),Oi(e),Pi(e),e.options.lineWrapping||Kt(e),e.options.mode=t.modeOption,dn(e)}function Pi(e){("rtl"==e.doc.direction?I:C)(e.display.lineDiv,"CodeMirror-rtl")}function Ni(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Bi(e,t){var r={from:nt(t.from),to:Ci(t),text:qe(e,t.from,t.to)};return Wi(e,r,t.from.line,t.to.line+1),Mi(e,(function(e){return Wi(e,r,t.from.line,t.to.line+1)}),!0),r}function ji(e){for(;e.length&&$(e).ranges;)e.pop()}function Ui(e,t,r,n){var i=e.history;i.undone.length=0;var a,s,o=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(a=function(e,t){return t?(ji(e.done),$(e.done)):e.done.length&&!$(e.done).ranges?$(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),$(e.done)):void 0}(i,i.lastOp==n)))s=$(a.changes),0==tt(t.from,t.to)&&0==tt(t.from,s.to)?s.to=Ci(t):a.changes.push(Bi(e,t));else{var l=$(i.done);for(l&&l.ranges||Gi(e.sel,i.done),a={changes:[Bi(e,t)],generation:i.generation},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||pe(e,"historyAdded")}function Hi(e,t,r,n){var i=e.history,a=n&&n.origin;r==i.lastSelOp||a&&i.lastSelOrigin==a&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==a||function(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,a,$(i.done),t))?i.done[i.done.length-1]=t:Gi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=a,i.lastSelOp=r,n&&!1!==n.clearRedo&&ji(i.undone)}function Gi(e,t){var r=$(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Wi(e,t,r,n){var i=t["spans_"+e.id],a=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),(function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[a]=r.markedSpans),++a}))}function zi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Ki(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(zi(r[i]));return n}(e,t),n=Ct(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var a=r[i],s=n[i];if(a&&s)e:for(var o=0;o<s.length;++o){for(var l=s[o],u=0;u<a.length;++u)if(a[u].marker==l.marker)continue e;a.push(l)}else s&&(r[i]=s)}return r}function Vi(e,t,r){for(var n=[],i=0;i<e.length;++i){var a=e[i];if(a.ranges)n.push(r?Si.prototype.deepCopy.call(a):a);else{var s=a.changes,o=[];n.push({changes:o});for(var l=0;l<s.length;++l){var u=s[l],c=void 0;if(o.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&U(t,Number(c[1]))>-1&&($(o)[d]=u[d],delete u[d])}}}return n}function qi(e,t,r,n){if(n){var i=e.anchor;if(r){var a=tt(t,i)<0;a!=tt(r,i)<0?(i=t,t=r):a!=tt(t,r)<0&&(t=r)}return new Ti(i,t)}return new Ti(r||t,t)}function $i(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ji(e,new Si([qi(e.sel.primary(),t,r,i)],0),n)}function Yi(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),a=0;a<e.sel.ranges.length;a++)n[a]=qi(e.sel.ranges[a],t[a],null,i);Ji(e,ki(e.cm,n,e.sel.primIndex),r)}function Xi(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Ji(e,ki(e.cm,i,e.sel.primIndex),n)}function Zi(e,t,r,n){Ji(e,wi(t,r),n)}function Qi(e,t,r){var n=e.history.done,i=$(n);i&&i.ranges?(n[n.length-1]=t,ea(e,t,r)):Ji(e,t,r)}function Ji(e,t,r){ea(e,t,r),Hi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function ea(e,t,r){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=function(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new Ti(ot(e,t[r].anchor),ot(e,t[r].head))},origin:r&&r.origin};return pe(e,"beforeSelectionChange",e,n),e.cm&&pe(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?ki(e.cm,n.ranges,n.ranges.length-1):t}(e,t,r));var n=r&&r.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1);ta(e,na(e,t,n,!0)),r&&!1===r.scroll||!e.cm||_n(e.cm)}function ta(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,me(e.cm)),or(e,"cursorActivity",e))}function ra(e){ta(e,na(e,e.sel,null,!1))}function na(e,t,r,n){for(var i,a=0;a<t.ranges.length;a++){var s=t.ranges[a],o=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[a],l=aa(e,s.anchor,o&&o.anchor,r,n),u=aa(e,s.head,o&&o.head,r,n);(i||l!=s.anchor||u!=s.head)&&(i||(i=t.ranges.slice(0,a)),i[a]=new Ti(l,u))}return i?ki(e.cm,i,t.primIndex):t}function ia(e,t,r,n,i){var a=Ve(e,t.line);if(a.markedSpans)for(var s=0;s<a.markedSpans.length;++s){var o=a.markedSpans[s],l=o.marker,u="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,c="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==o.from||(u?o.from<=t.ch:o.from<t.ch))&&(null==o.to||(c?o.to>=t.ch:o.to>t.ch))){if(i&&(pe(l,"beforeCursorEnter"),l.explicitlyCleared)){if(a.markedSpans){--s;continue}break}if(!l.atomic)continue;if(r){var d=l.find(n<0?1:-1),f=void 0;if((n<0?c:u)&&(d=sa(e,d,-n,d&&d.line==t.line?a:null)),d&&d.line==t.line&&(f=tt(d,r))&&(n<0?f<0:f>0))return ia(e,d,t,n,i)}var h=l.find(n<0?-1:1);return(n<0?u:c)&&(h=sa(e,h,n,h.line==t.line?a:null)),h?ia(e,h,t,n,i):null}}return t}function aa(e,t,r,n,i){var a=n||1,s=ia(e,t,r,a,i)||!i&&ia(e,t,r,a,!0)||ia(e,t,r,-a,i)||!i&&ia(e,t,r,-a,!0);return s||(e.cantEdit=!0,et(e.first,0))}function sa(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ot(e,et(t.line-1)):null:r>0&&t.ch==(n||Ve(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+r)}function oa(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),G)}function la(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,a){t&&(n.from=ot(e,t)),r&&(n.to=ot(e,r)),i&&(n.text=i),void 0!==a&&(n.origin=a)}),pe(e,"beforeChange",e,n),e.cm&&pe(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function ua(e,t,r){if(e.cm){if(!e.cm.curOp)return ei(e.cm,ua)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))||(t=la(e,t,!0))){var n=xt&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=U(n,r)||(n||(n=[])).push(r)}})),!n)return null;for(var i=[{from:t,to:r}],a=0;a<n.length;++a)for(var s=n[a],o=s.find(0),l=0;l<i.length;++l){var u=i[l];if(!(tt(u.to,o.from)<0||tt(u.from,o.to)>0)){var c=[l,1],d=tt(u.from,o.from),f=tt(u.to,o.to);(d<0||!s.inclusiveLeft&&!d)&&c.push({from:u.from,to:o.from}),(f>0||!s.inclusiveRight&&!f)&&c.push({from:o.to,to:u.to}),i.splice.apply(i,c),l+=c.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)ca(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else ca(e,t)}}function ca(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var r=Ai(e,t);Ui(e,t,r,e.cm?e.cm.curOp.id:NaN),ha(e,t,r,Ct(e,t));var n=[];Mi(e,(function(e,r){r||-1!=U(n,e.history)||(va(e.history,t),n.push(e.history)),ha(e,t,null,Ct(e,t))}))}}function da(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,a=e.history,s=e.sel,o="undo"==t?a.done:a.undone,l="undo"==t?a.undone:a.done,u=0;u<o.length&&(i=o[u],r?!i.ranges||i.equals(e.sel):i.ranges);u++);if(u!=o.length){for(a.lastOrigin=a.lastSelOrigin=null;;){if(!(i=o.pop()).ranges){if(n)return void o.push(i);break}if(Gi(i,l),r&&!i.equals(e.sel))return void Ji(e,i,{clearRedo:!1});s=i}var c=[];Gi(s,l),l.push({changes:c,generation:a.generation}),a.generation=i.generation||++a.maxGeneration;for(var d=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),f=function(r){var n=i.changes[r];if(n.origin=t,d&&!la(e,n,!1))return o.length=0,{};c.push(Bi(e,n));var a=r?Ai(e,n):$(o);ha(e,n,a,Ki(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:Ci(n)});var s=[];Mi(e,(function(e,t){t||-1!=U(s,e.history)||(va(e.history,n),s.push(e.history)),ha(e,n,null,Ki(e,n))}))},h=i.changes.length-1;h>=0;--h){var p=f(h);if(p)return p.v}}}}function fa(e,t){if(0!=t&&(e.first+=t,e.sel=new Si(Y(e.sel.ranges,(function(e){return new Ti(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){dn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)fn(e.cm,n,"gutter")}}function ha(e,t,r,n){if(e.cm&&!e.cm.curOp)return ei(e.cm,ha)(e,t,r,n);if(t.to.line<e.first)fa(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);fa(e,i),t={from:et(e.first,0),to:et(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var a=e.lastLine();t.to.line>a&&(t={from:t.from,to:et(a,Ve(e,a).text.length),text:[t.text[0]],origin:t.origin}),t.removed=qe(e,t.from,t.to),r||(r=Ai(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,a=t.from,s=t.to,o=!1,l=a.line;e.options.lineWrapping||(l=Xe(Bt(Ve(n,a.line))),n.iter(l,s.line+1,(function(e){if(e==i.maxLine)return o=!0,!0}))),n.sel.contains(t.from,t.to)>-1&&me(e),Ii(n,t,r,on(e)),e.options.lineWrapping||(n.iter(l,a.line+t.text.length,(function(e){var t=zt(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,o=!1)})),o&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=Ve(e,n).stateAfter;if(i&&(!(i instanceof ut)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}(n,a.line),ni(e,400);var u=t.text.length-(s.line-a.line)-1;t.full?dn(e):a.line!=s.line||1!=t.text.length||Ri(e.doc,t)?dn(e,a.line,s.line+1,u):fn(e,a.line,"text");var c=ve(e,"changes"),d=ve(e,"change");if(d||c){var f={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};d&&or(e,"change",e,f),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}(e.cm,t,n):Ii(e,t,n),ea(e,r,G),e.cantEdit&&aa(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}}function pa(e,t,r,n,i){var a;n||(n=r),tt(n,r)<0&&(r=(a=[n,r])[0],n=a[1]),"string"==typeof t&&(t=e.splitLines(t)),ua(e,{from:r,to:n,text:t,origin:i})}function ga(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function ma(e,t,r,n){for(var i=0;i<e.length;++i){var a=e[i],s=!0;if(a.ranges){a.copied||((a=e[i]=a.deepCopy()).copied=!0);for(var o=0;o<a.ranges.length;o++)ga(a.ranges[o].anchor,t,r,n),ga(a.ranges[o].head,t,r,n)}else{for(var l=0;l<a.changes.length;++l){var u=a.changes[l];if(r<u.from.line)u.from=et(u.from.line+n,u.from.ch),u.to=et(u.to.line+n,u.to.ch);else if(t<=u.to.line){s=!1;break}}s||(e.splice(0,i+1),i=0)}}}function va(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;ma(e.done,r,n,i),ma(e.undone,r,n,i)}function ya(e,t,r,n){var i=t,a=t;return"number"==typeof t?a=Ve(e,st(e,t)):i=Xe(t),null==i?null:(n(a,i)&&e.cm&&fn(e.cm,i,r),a)}function ba(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function Ea(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}Ti.prototype.from=function(){return at(this.anchor,this.head)},Ti.prototype.to=function(){return it(this.anchor,this.head)},Ti.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},ba.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,qt(i),or(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},Ea.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var a=Math.min(t,i-e),s=n.height;if(n.removeInner(e,a),this.height-=s-n.height,i==a&&(this.children.splice(r--,1),n.parent=null),0==(t-=a))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof ba))){var o=[];this.collapse(o),this.children=[new ba(o)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],a=i.chunkSize();if(e<=a){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var s=i.lines.length%25+25,o=s;o<i.lines.length;){var l=new ba(i.lines.slice(o,o+=25));i.height-=l.height,this.children.splice(++n,0,l),l.parent=this}i.lines=i.lines.slice(0,s),this.maybeSpill()}break}e-=a}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new Ea(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=U(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new Ea(e.children);n.parent=e,e.children=[n,t],e=n}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],a=i.chunkSize();if(e<a){var s=Math.min(t,a-e);if(i.iterN(e,s,r))return!0;if(0==(t-=s))break;e=0}else e-=a}}};var xa=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};function Sa(e,t,r){Wt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&On(e,r)}xa.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=Xe(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var a=Er(this);Ye(r,Math.max(0,r.height-a)),e&&(Jn(e,(function(){Sa(e,r,-a),fn(e,n,"widget")})),or(e,"lineWidgetCleared",e,this,n))}},xa.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=Er(this)-t;i&&(Ht(this.doc,n)||Ye(n,n.height+i),r&&Jn(r,(function(){r.curOp.forceUpdate=!0,Sa(r,n,i),or(r,"lineWidgetChanged",r,e,Xe(n))})))},ye(xa);var Ta=0,ka=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Ta};function wa(e,t,r,n,i){if(n&&n.shared)return function(e,t,r,n,i){(n=N(n)).shared=!1;var a=[wa(e,t,r,n,i)],s=a[0],o=n.widgetNode;return Mi(e,(function(e){o&&(n.widgetNode=o.cloneNode(!0)),a.push(wa(e,ot(e,t),ot(e,r),n,i));for(var l=0;l<e.linked.length;++l)if(e.linked[l].isParent)return;s=$(a)})),new Ca(a,s)}(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return ei(e.cm,wa)(e,t,r,n,i);var a=new ka(e,i),s=tt(t,r);if(n&&N(n,a,!1),s>0||0==s&&!1!==a.clearWhenEmpty)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=O("span",[a.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(Nt(e,t.line,t,r,a)||t.line!=r.line&&Nt(e,r.line,t,r,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");St=!0}a.addToHistory&&Ui(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var o,l=t.line,u=e.cm;if(e.iter(l,r.line+1,(function(e){u&&a.collapsed&&!u.options.lineWrapping&&Bt(e)==u.display.maxLine&&(o=!0),a.collapsed&&l!=t.line&&Ye(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Tt(a,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l})),a.collapsed&&e.iter(t.line,r.line+1,(function(t){Ht(e,t)&&Ye(t,0)})),a.clearOnEnter&&de(a,"beforeCursorEnter",(function(){return a.clear()})),a.readOnly&&(xt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),a.collapsed&&(a.id=++Ta,a.atomic=!0),u){if(o&&(u.curOp.updateMaxLine=!0),a.collapsed)dn(u,t.line,r.line+1);else if(a.className||a.startStyle||a.endStyle||a.css||a.attributes||a.title)for(var c=t.line;c<=r.line;c++)fn(u,c,"text");a.atomic&&ra(u.doc),or(u,"markerAdded",u,a)}return a}ka.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Vn(e),ve(this,"clear")){var r=this.find();r&&or(this,"clear",r.from,r.to)}for(var n=null,i=null,a=0;a<this.lines.length;++a){var s=this.lines[a],o=kt(s.markedSpans,this);e&&!this.collapsed?fn(e,Xe(s),"text"):e&&(null!=o.to&&(i=Xe(s)),null!=o.from&&(n=Xe(s))),s.markedSpans=wt(s.markedSpans,o),null==o.from&&this.collapsed&&!Ht(this.doc,s)&&e&&Ye(s,rn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var u=Bt(this.lines[l]),c=zt(u);c>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&dn(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ra(e.doc)),e&&or(e,"markerCleared",e,this,n,i),t&&qn(e),this.parent&&this.parent.clear()}},ka.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var a=this.lines[i],s=kt(a.markedSpans,this);if(null!=s.from&&(r=et(t?a:Xe(a),s.from),-1==e))return r;if(null!=s.to&&(n=et(t?a:Xe(a),s.to),1==e))return n}return r&&{from:r,to:n}},ka.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&Jn(n,(function(){var i=t.line,a=Xe(t.line),s=Or(n,a);if(s&&(Nr(s),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Ht(r.doc,i)&&null!=r.height){var o=r.height;r.height=null;var l=Er(r)-o;l&&Ye(i,i.height+l)}or(n,"markerChanged",n,e)}))},ka.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=U(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ka.prototype.detachLine=function(e){if(this.lines.splice(U(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(ka);var Ca=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function La(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),(function(e){return e.parent}))}function Aa(e){for(var t=function(t){var r=e[t],n=[r.primary.doc];Mi(r.primary.doc,(function(e){return n.push(e)}));for(var i=0;i<r.markers.length;i++){var a=r.markers[i];-1==U(n,a.doc)&&(a.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}Ca.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();or(this,"clear")}},Ca.prototype.find=function(e,t){return this.primary.find(e,t)},ye(Ca);var Da=0,Oa=function(e,t,r,n,i){if(!(this instanceof Oa))return new Oa(e,t,r,n,i);null==r&&(r=0),Ea.call(this,[new ba([new Vt("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var a=et(r,0);this.sel=wi(a),this.history=new Ni(null),this.id=++Da,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Ii(this,{from:a,to:a,text:e}),Ji(this,wi(a),G)};Oa.prototype=Z(Ea.prototype,{constructor:Oa,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=$e(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:ri((function(e){var t=et(this.first,0),r=this.first+this.size-1;ua(this,{from:t,to:et(r,Ve(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Rn(this.cm,0,0),Ji(this,wi(t),G)})),replaceRange:function(e,t,r,n){pa(this,e,t=ot(this,t),r=r?ot(this,r):t,n)},getRange:function(e,t,r){var n=qe(this,ot(this,e),ot(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Qe(this,e))return Ve(this,e)},getLineNumber:function(e){return Xe(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Ve(this,e)),Bt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ot(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ri((function(e,t,r){Zi(this,ot(this,"number"==typeof e?et(e,t||0):e),null,r)})),setSelection:ri((function(e,t,r){Zi(this,ot(this,e),ot(this,t||e),r)})),extendSelection:ri((function(e,t,r){$i(this,ot(this,e),t&&ot(this,t),r)})),extendSelections:ri((function(e,t){Yi(this,lt(this,e),t)})),extendSelectionsBy:ri((function(e,t){Yi(this,lt(this,Y(this.sel.ranges,e)),t)})),setSelections:ri((function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new Ti(ot(this,e[i].anchor),ot(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Ji(this,ki(this.cm,n,t),r)}})),addSelection:ri((function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Ti(ot(this,e),ot(this,t||e))),Ji(this,ki(this.cm,n,n.length-1),r)})),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=qe(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=qe(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:ri((function(e,t,r){for(var n=[],i=this.sel,a=0;a<i.ranges.length;a++){var s=i.ranges[a];n[a]={from:s.from(),to:s.to(),text:this.splitLines(e[a]),origin:r}}for(var o=t&&"end"!=t&&function(e,t,r){for(var n=[],i=et(e.first,0),a=i,s=0;s<t.length;s++){var o=t[s],l=Di(o.from,i,a),u=Di(Ci(o),i,a);if(i=o.to,a=u,"around"==r){var c=e.sel.ranges[s],d=tt(c.head,c.anchor)<0;n[s]=new Ti(d?u:l,d?l:u)}else n[s]=new Ti(l,l)}return new Si(n,e.sel.primIndex)}(this,n,t),l=n.length-1;l>=0;l--)ua(this,n[l]);o?Qi(this,o):this.cm&&_n(this.cm)})),undo:ri((function(){da(this,"undo")})),redo:ri((function(){da(this,"redo")})),undoSelection:ri((function(){da(this,"undo",!0)})),redoSelection:ri((function(){da(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Ni(this.history.maxGeneration),Mi(this,(function(t){return t.history=e.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Vi(this.history.done),undone:Vi(this.history.undone)}},setHistory:function(e){var t=this.history=new Ni(this.history.maxGeneration);t.done=Vi(e.done.slice(0),null,!0),t.undone=Vi(e.undone.slice(0),null,!0)},setGutterMarker:ri((function(e,t,r){return ya(this,e,"gutter",(function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&te(n)&&(e.gutterMarkers=null),!0}))})),clearGutter:ri((function(e){var t=this;this.iter((function(r){r.gutterMarkers&&r.gutterMarkers[e]&&ya(t,r,"gutter",(function(){return r.gutterMarkers[e]=null,te(r.gutterMarkers)&&(r.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t;if("number"==typeof e){if(!Qe(this,e))return null;if(t=e,!(e=Ve(this,e)))return null}else if(null==(t=Xe(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:ri((function(e,t,r){return ya(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(k(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0}))})),removeLineClass:ri((function(e,t,r){return ya(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var a=i.match(k(r));if(!a)return!1;var s=a.index+a[0].length;e[n]=i.slice(0,a.index)+(a.index&&s!=i.length?" ":"")+i.slice(s)||null}return!0}))})),addLineWidget:ri((function(e,t,r){return function(e,t,r,n){var i=new xa(e,r,n),a=e.cm;return a&&i.noHScroll&&(a.display.alignWidgets=!0),ya(e,t,"widget",(function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,a&&!Ht(e,t)){var n=Wt(t)<e.scrollTop;Ye(t,t.height+Er(i)),n&&On(a,i.height),a.curOp.forceUpdate=!0}return!0})),a&&or(a,"lineWidgetAdded",a,i,"number"==typeof t?t:Xe(t)),i}(this,e,t,r)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return wa(this,ot(this,e),ot(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return wa(this,e=ot(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=Ve(this,(e=ot(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=ot(this,e),t=ot(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,(function(a){var s=a.markedSpans;if(s)for(var o=0;o<s.length;o++){var l=s[o];null!=l.to&&i==e.line&&e.ch>=l.to||null==l.from&&i!=e.line||null!=l.from&&i==t.line&&l.from>=t.ch||r&&!r(l.marker)||n.push(l.marker.parent||l.marker)}++i})),n},getAllMarks:function(){var e=[];return this.iter((function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)})),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter((function(i){var a=i.text.length+n;if(a>e)return t=e,!0;e-=a,++r})),ot(this,et(r,t))},indexFromPos:function(e){var t=(e=ot(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,(function(e){t+=e.text.length+r})),t},copy:function(e){var t=new Oa($e(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Oa($e(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),a=e.clipPos(i.from),s=e.clipPos(i.to);if(tt(a,s)){var o=wa(e,a,s,n.primary,n.primary.type);n.markers.push(o),o.parent=n}}}(n,La(this)),n},unlinkDoc:function(e){if(e instanceof Cs&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Aa(La(this));break}if(e.history==this.history){var r=[e.id];Mi(e,(function(e){return r.push(e.id)}),!0),e.history=new Ni(null),e.history.done=Vi(this.history.done,r),e.history.undone=Vi(this.history.undone,r)}},iterLinkedDocs:function(e){Mi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):_e(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ri((function(e){var t;"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&Jn(t=this.cm,(function(){Pi(t),dn(t)})))}))}),Oa.prototype.eachLine=Oa.prototype.iter;var _a=0;function Ra(e){var t=this;if(Ia(t),!ge(t,e)&&!xr(t.display,e)){be(e),s&&(_a=+new Date);var r=un(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,a=Array(i),o=0,l=function(){++o==i&&ei(t,(function(){var e={from:r=ot(t.doc,r),to:r,text:t.doc.splitLines(a.filter((function(e){return null!=e})).join(t.doc.lineSeparator())),origin:"paste"};ua(t.doc,e),Qi(t.doc,wi(ot(t.doc,r),ot(t.doc,Ci(e))))}))()},u=function(e,r){if(t.options.allowDropFileTypes&&-1==U(t.options.allowDropFileTypes,e.type))l();else{var n=new FileReader;n.onerror=function(){return l()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(a[r]=e),l()},n.readAsText(e)}},c=0;c<n.length;c++)u(n[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var d=e.dataTransfer.getData("Text");if(d){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),ea(t.doc,wi(r,r)),f)for(var h=0;h<f.length;++h)pa(t.doc,"",f[h].anchor,f[h].head,"drag");t.replaceSelection(d,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Ia(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Ma(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var i=t[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation((function(){for(var t=0;t<r.length;t++)e(r[t])}))}}var Fa=!1;function Pa(){var e;Fa||(de(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Ma(Na)}),100))})),de(window,"blur",(function(){return Ma(wn)})),Fa=!0)}function Na(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Ba={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ja=0;ja<10;ja++)Ba[ja+48]=Ba[ja+96]=String(ja);for(var Ua=65;Ua<=90;Ua++)Ba[Ua]=String.fromCharCode(Ua);for(var Ha=1;Ha<=12;Ha++)Ba[Ha+111]=Ba[Ha+63235]="F"+Ha;var Ga={};function Wa(e){var t,r,n,i,a=e.split(/-(?!$)/);e=a[a.length-1];for(var s=0;s<a.length-1;s++){var o=a[s];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))t=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else{if(!/^s(hift)?$/i.test(o))throw new Error("Unrecognized modifier name: "+o);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function za(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Y(r.split(" "),Wa),a=0;a<i.length;a++){var s=void 0,o=void 0;a==i.length-1?(o=i.join(" "),s=n):(o=i.slice(0,a+1).join(" "),s="...");var l=t[o];if(l){if(l!=s)throw new Error("Inconsistent bindings for "+o)}else t[o]=s}delete e[r]}for(var u in t)e[u]=t[u];return e}function Ka(e,t,r,n){var i=(t=Ya(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Ka(e,t.fallthrough,r,n);for(var a=0;a<t.fallthrough.length;a++){var s=Ka(e,t.fallthrough[a],r,n);if(s)return s}}}function Va(e){var t="string"==typeof e?e:Ba[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function qa(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(S?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(S?t.ctrlKey:t.metaKey)&&"Mod"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function $a(e,t){if(d&&34==e.keyCode&&e.char)return!1;var r=Ba[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),qa(r,e,t))}function Ya(e){return"string"==typeof e?Ga[e]:e}function Xa(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var a=t(r[i]);n.length&&tt(a.from,$(n).to)<=0;){var s=n.pop();if(tt(s.from,a.from)<0){a.from=s.from;break}}n.push(a)}Jn(e,(function(){for(var t=n.length-1;t>=0;t--)pa(e.doc,"",n[t].from,n[t].to,"+delete");_n(e)}))}function Za(e,t,r){var n=ie(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Qa(e,t,r){var n=Za(e,t.ch,r);return null==n?null:new et(t.line,n,r<0?"after":"before")}function Ja(e,t,r,n,i){if(e){"rtl"==t.doc.direction&&(i=-i);var a=ue(r,t.doc.direction);if(a){var s,o=i<0?$(a):a[0],l=i<0==(1==o.level)?"after":"before";if(o.level>0||"rtl"==t.doc.direction){var u=_r(t,r);s=i<0?r.text.length-1:0;var c=Rr(t,u,s).top;s=ae((function(e){return Rr(t,u,e).top==c}),i<0==(1==o.level)?o.from:o.to-1,s),"before"==l&&(s=Za(r,s,1))}else s=i<0?o.to:o.from;return new et(n,s,l)}}return new et(n,i<0?r.text.length:0,i<0?"before":"after")}Ga.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ga.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ga.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ga.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ga.default=y?Ga.macDefault:Ga.pcDefault;var es={selectAll:oa,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),G)},killLine:function(e){return Xa(e,(function(t){if(t.empty()){var r=Ve(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,r)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Xa(e,(function(t){return{from:et(t.from().line,0),to:ot(e.doc,et(t.to().line+1,0))}}))},delLineLeft:function(e){return Xa(e,(function(e){return{from:et(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Xa(e,(function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return Xa(e,(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}}))},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return ts(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return rs(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return function(e,t){var r=Ve(e.doc,t),n=function(e){for(var t;t=Ft(e);)e=t.find(1,!0).line;return e}(r);return n!=r&&(t=Xe(n)),Ja(!0,e,r,t,-1)}(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")}),z)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")}),z)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?rs(e,t.head):n}),z)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var a=r[i].from(),s=B(e.getLine(a.line),a.ch,n);t.push(q(n-s%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Jn(e,(function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,a=Ve(e.doc,i.line).text;if(a)if(i.ch==a.length&&(i=new et(i.line,i.ch-1)),i.ch>0)i=new et(i.line,i.ch+1),e.replaceRange(a.charAt(i.ch-1)+a.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var s=Ve(e.doc,i.line-1).text;s&&(i=new et(i.line,1),e.replaceRange(a.charAt(0)+e.doc.lineSeparator()+s.charAt(s.length-1),et(i.line-1,s.length-1),i,"+transpose"))}r.push(new Ti(i,i))}e.setSelections(r)}))},newlineAndIndent:function(e){return Jn(e,(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);_n(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ts(e,t){var r=Ve(e.doc,t),n=Bt(r);return n!=r&&(t=Xe(n)),Ja(!0,e,n,t,1)}function rs(e,t){var r=ts(e,t.line),n=Ve(e.doc,r.line),i=ue(n,e.doc.direction);if(!i||0==i[0].level){var a=Math.max(r.ch,n.text.search(/\S/)),s=t.line==r.line&&t.ch<=a&&t.ch;return et(r.line,s?0:a,r.sticky)}return r}function ns(e,t,r){if("string"==typeof t&&!(t=es[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=H}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var is=new j;function as(e,t,r,n){var i=e.state.keySeq;if(i){if(Va(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:is.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),ss(e,i+" "+t,r,n))return!0}return ss(e,t,r,n)}function ss(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Ka(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Ka(t,e.options.extraKeys,r,e)||Ka(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&or(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(be(r),xn(e)),!!i}function os(e,t){var r=$a(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?as(e,"Shift-"+r,t,(function(t){return ns(e,t,!0)}))||as(e,r,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return ns(e,t)})):as(e,r,t,(function(t){return ns(e,t)})))}var ls=null;function us(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||(t.curOp.focus=R(),ge(t,e)))){s&&o<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var i=os(t,e);d&&(ls=i?n:null,i||88!=n||Ie||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),r&&!y&&!i&&46==n&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(C(t,"CodeMirror-crosshair"),he(document,"keyup",r),he(document,"mouseover",r))}I(t,"CodeMirror-crosshair"),de(document,"keyup",r),de(document,"mouseover",r)}(t)}}function cs(e){16==e.keyCode&&(this.doc.sel.shift=!1),ge(this,e)}function ds(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||xr(t.display,e)||ge(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(d&&r==ls)return ls=null,void be(e);if(!d||e.which&&!(e.which<10)||!os(t,e)){var i=String.fromCharCode(null==n?r:n);"\b"!=i&&(function(e,t,r){return as(e,"'"+r+"'",t,(function(t){return ns(e,t,!0)}))}(t,e,i)||t.display.input.onKeyPress(e))}}}var fs,hs,ps=function(e,t,r){this.time=e,this.pos=t,this.button=r};function gs(e){var t=this,r=t.display;if(!(ge(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,xr(r,e))l||(r.scroller.draggable=!1,setTimeout((function(){return r.scroller.draggable=!0}),100));else if(!ys(t,e)){var n=un(t,e),i=ke(e),a=n?function(e,t){var r=+new Date;return hs&&hs.compare(r,e,t)?(fs=hs=null,"triple"):fs&&fs.compare(r,e,t)?(hs=new ps(r,e,t),fs=null,"double"):(fs=new ps(r,e,t),hs=null,"single")}(n,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),n&&function(e,t,r,n,i){var a="Click";return"double"==n?a="Double"+a:"triple"==n&&(a="Triple"+a),as(e,qa(a=(1==t?"Left":2==t?"Middle":"Right")+a,i),i,(function(t){if("string"==typeof t&&(t=es[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=H}finally{e.state.suppressEdits=!1}return n}))}(t,i,n,a,e)||(1==i?n?function(e,t,r,n){s?setTimeout(P(Sn,e),0):e.curOp.focus=R();var i,a=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var a=b?r.shiftKey&&r.metaKey:r.altKey;i.unit=a?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),null==i.addNew&&(i.addNew=y?r.metaKey:r.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?r.altKey:r.ctrlKey)),i}(e,r,n),u=e.doc.sel;e.options.dragDrop&&Le&&!e.isReadOnly()&&"single"==r&&(i=u.contains(t))>-1&&(tt((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,r,n){var i=e.display,a=!1,u=ei(e,(function(t){l&&(i.scroller.draggable=!1),e.state.draggingText=!1,he(i.wrapper.ownerDocument,"mouseup",u),he(i.wrapper.ownerDocument,"mousemove",c),he(i.scroller,"dragstart",d),he(i.scroller,"drop",u),a||(be(t),n.addNew||$i(e.doc,r,null,null,n.extend),l&&!f||s&&9==o?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),c=function(e){a=a||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},d=function(){return a=!0};l&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),de(i.wrapper.ownerDocument,"mouseup",u),de(i.wrapper.ownerDocument,"mousemove",c),de(i.scroller,"dragstart",d),de(i.scroller,"drop",u),Tn(e),setTimeout((function(){return i.input.focus()}),20)}(e,n,t,a):function(e,t,r,n){var i=e.display,a=e.doc;be(t);var s,o,l=a.sel,u=l.ranges;if(n.addNew&&!n.extend?(o=a.sel.contains(r),s=o>-1?u[o]:new Ti(r,r)):(s=a.sel.primary(),o=a.sel.primIndex),"rectangle"==n.unit)n.addNew||(s=new Ti(r,r)),r=un(e,t,!0,!0),o=-1;else{var c=ms(e,r,n.unit);s=n.extend?qi(s,c.anchor,c.head,n.extend):c}n.addNew?-1==o?(o=u.length,Ji(a,ki(e,u.concat([s]),o),{scroll:!1,origin:"*mouse"})):u.length>1&&u[o].empty()&&"char"==n.unit&&!n.extend?(Ji(a,ki(e,u.slice(0,o).concat(u.slice(o+1)),0),{scroll:!1,origin:"*mouse"}),l=a.sel):Xi(a,o,s,W):(o=0,Ji(a,new Si([s],0),W),l=a.sel);var d=r;function f(t){if(0!=tt(d,t))if(d=t,"rectangle"==n.unit){for(var i=[],u=e.options.tabSize,c=B(Ve(a,r.line).text,r.ch,u),f=B(Ve(a,t.line).text,t.ch,u),h=Math.min(c,f),p=Math.max(c,f),g=Math.min(r.line,t.line),m=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=m;g++){var v=Ve(a,g).text,y=K(v,h,u);h==p?i.push(new Ti(et(g,y),et(g,y))):v.length>y&&i.push(new Ti(et(g,y),et(g,K(v,p,u))))}i.length||i.push(new Ti(r,r)),Ji(a,ki(e,l.ranges.slice(0,o).concat(i),o),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,E=s,x=ms(e,t,n.unit),S=E.anchor;tt(x.anchor,S)>0?(b=x.head,S=at(E.from(),x.anchor)):(b=x.anchor,S=it(E.to(),x.head));var T=l.ranges.slice(0);T[o]=function(e,t){var r=t.anchor,n=t.head,i=Ve(e.doc,r.line);if(0==tt(r,n)&&r.sticky==n.sticky)return t;var a=ue(i);if(!a)return t;var s=oe(a,r.ch,r.sticky),o=a[s];if(o.from!=r.ch&&o.to!=r.ch)return t;var l,u=s+(o.from==r.ch==(1!=o.level)?0:1);if(0==u||u==a.length)return t;if(n.line!=r.line)l=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=oe(a,n.ch,n.sticky),d=c-s||(n.ch-r.ch)*(1==o.level?-1:1);l=c==u-1||c==u?d<0:d>0}var f=a[u+(l?-1:0)],h=l==(1==f.level),p=h?f.from:f.to,g=h?"after":"before";return r.ch==p&&r.sticky==g?t:new Ti(new et(r.line,p,g),n)}(e,new Ti(ot(a,S),b)),Ji(a,ki(e,T,o),W)}}var h=i.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,t&&(be(t),i.input.focus()),he(i.wrapper.ownerDocument,"mousemove",m),he(i.wrapper.ownerDocument,"mouseup",v),a.history.lastSelOrigin=null}var m=ei(e,(function(t){0!==t.buttons&&ke(t)?function t(r){var s=++p,o=un(e,r,!0,"rectangle"==n.unit);if(o)if(0!=tt(o,d)){e.curOp.focus=R(),f(o);var l=An(i,a);(o.line>=l.to||o.line<l.from)&&setTimeout(ei(e,(function(){p==s&&t(r)})),150)}else{var u=r.clientY<h.top?-20:r.clientY>h.bottom?20:0;u&&setTimeout(ei(e,(function(){p==s&&(i.scroller.scrollTop+=u,t(r))})),50)}}(t):g(t)})),v=ei(e,g);e.state.selectingText=v,de(i.wrapper.ownerDocument,"mousemove",m),de(i.wrapper.ownerDocument,"mouseup",v)}(e,n,t,a)}(t,n,a,e):Te(e)==r.scroller&&be(e):2==i?(n&&$i(t.doc,n),setTimeout((function(){return r.input.focus()}),20)):3==i&&(T?t.display.input.onContextMenu(e):Tn(t)))}}function ms(e,t,r){if("char"==r)return new Ti(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new Ti(et(t.line,0),ot(e.doc,et(t.line+1,0)));var n=r(e,t);return new Ti(n.from,n.to)}function vs(e,t,r,n){var i,a;if(t.touches)i=t.touches[0].clientX,a=t.touches[0].clientY;else try{i=t.clientX,a=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&be(t);var s=e.display,o=s.lineDiv.getBoundingClientRect();if(a>o.bottom||!ve(e,r))return xe(t);a-=o.top-s.viewOffset;for(var l=0;l<e.display.gutterSpecs.length;++l){var u=s.gutters.childNodes[l];if(u&&u.getBoundingClientRect().right>=i)return pe(e,r,e,Ze(e.doc,a),e.display.gutterSpecs[l].className,t),xe(t)}}function ys(e,t){return vs(e,t,"gutterClick",!0)}function bs(e,t){xr(e.display,t)||function(e,t){return!!ve(e,"gutterContextMenu")&&vs(e,t,"gutterContextMenu",!1)}(e,t)||ge(e,t,"contextmenu")||T||e.display.input.onContextMenu(t)}function Es(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),jr(e)}ps.prototype.compare=function(e,t,r){return this.time+400>e&&0==tt(t,this.pos)&&r==this.button};var xs={toString:function(){return"CodeMirror.Init"}},Ss={},Ts={};function ks(e,t,r){if(!t!=!(r&&r!=xs)){var n=e.display.dragFunctions,i=t?de:he;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function ws(e){e.options.lineWrapping?(I(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(C(e.display.wrapper,"CodeMirror-wrap"),Kt(e)),ln(e),dn(e),jr(e),setTimeout((function(){return Hn(e)}),100)}function Cs(e,t){var r=this;if(!(this instanceof Cs))return new Cs(e,t);this.options=t=t?N(t):{},N(Ss,t,!1);var n=t.value;"string"==typeof n?n=new Oa(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Cs.inputStyles[t.inputStyle](this),a=this.display=new mi(e,n,i,t);for(var u in a.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),zn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new j,keySeq:null,specialChars:null},t.autofocus&&!v&&a.input.focus(),s&&o<11&&setTimeout((function(){return r.display.input.reset(!0)}),20),function(e){var t=e.display;de(t.scroller,"mousedown",ei(e,gs)),de(t.scroller,"dblclick",s&&o<11?ei(e,(function(t){if(!ge(e,t)){var r=un(e,t);if(r&&!ys(e,t)&&!xr(e.display,t)){be(t);var n=e.findWordAt(r);$i(e.doc,n.anchor,n.head)}}})):function(t){return ge(e,t)||be(t)}),de(t.scroller,"contextmenu",(function(t){return bs(e,t)})),de(t.input.getField(),"contextmenu",(function(r){t.scroller.contains(r.target)||bs(e,r)}));var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout((function(){return t.activeTouch=null}),1e3),(n=t.activeTouch).end=+new Date)}function a(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}de(t.scroller,"touchstart",(function(i){if(!ge(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!ys(e,i)){t.input.ensurePolled(),clearTimeout(r);var a=+new Date;t.activeTouch={start:a,moved:!1,prev:a-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),de(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),de(t.scroller,"touchend",(function(r){var n=t.activeTouch;if(n&&!xr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var s,o=e.coordsChar(t.activeTouch,"page");s=!n.prev||a(n,n.prev)?new Ti(o,o):!n.prev.prev||a(n,n.prev.prev)?e.findWordAt(o):new Ti(et(o.line,0),ot(e.doc,et(o.line+1,0))),e.setSelection(s.anchor,s.head),e.focus(),be(r)}i()})),de(t.scroller,"touchcancel",i),de(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Fn(e,t.scroller.scrollTop),Nn(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),de(t.scroller,"mousewheel",(function(t){return xi(e,t)})),de(t.scroller,"DOMMouseScroll",(function(t){return xi(e,t)})),de(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ge(e,t)||Se(t)},over:function(t){ge(e,t)||(function(e,t){var r=un(e,t);if(r){var n=document.createDocumentFragment();yn(e,r,n),e.display.dragCursor||(e.display.dragCursor=D("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,n)}}(e,t),Se(t))},start:function(t){return function(e,t){if(s&&(!e.state.draggingText||+new Date-_a<100))Se(t);else if(!ge(e,t)&&!xr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var r=D("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),d&&r.parentNode.removeChild(r)}}(e,t)},drop:ei(e,Ra),leave:function(t){ge(e,t)||Ia(e)}};var l=t.input.getField();de(l,"keyup",(function(t){return cs.call(e,t)})),de(l,"keydown",ei(e,us)),de(l,"keypress",ei(e,ds)),de(l,"focus",(function(t){return kn(e,t)})),de(l,"blur",(function(t){return wn(e,t)}))}(this),Pa(),Vn(this),this.curOp.forceUpdate=!0,Fi(this,n),t.autofocus&&!v||this.hasFocus()?setTimeout((function(){r.hasFocus()&&!r.state.focused&&kn(r)}),20):wn(this),Ts)Ts.hasOwnProperty(u)&&Ts[u](this,t[u],xs);fi(this),t.finishInit&&t.finishInit(this);for(var c=0;c<Ls.length;++c)Ls[c](this);qn(this),l&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}Cs.defaults=Ss,Cs.optionHandlers=Ts;var Ls=[];function As(e,t,r,n){var i,a=e.doc;null==r&&(r="add"),"smart"==r&&(a.mode.indent?i=ht(e,t).state:r="prev");var s=e.options.tabSize,o=Ve(a,t),l=B(o.text,null,s);o.stateAfter&&(o.stateAfter=null);var u,c=o.text.match(/^\s*/)[0];if(n||/\S/.test(o.text)){if("smart"==r&&((u=a.mode.indent(i,o.text.slice(c.length),o.text))==H||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>a.first?B(Ve(a,t-1).text,null,s):0:"add"==r?u=l+e.options.indentUnit:"subtract"==r?u=l-e.options.indentUnit:"number"==typeof r&&(u=l+r),u=Math.max(0,u);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/s);h;--h)f+=s,d+="\t";if(f<u&&(d+=q(u-f)),d!=c)return pa(a,d,et(t,0),et(t,c.length),"+input"),o.stateAfter=null,!0;for(var p=0;p<a.sel.ranges.length;p++){var g=a.sel.ranges[p];if(g.head.line==t&&g.head.ch<c.length){var m=et(t,c.length);Xi(a,p,new Ti(m,m));break}}}Cs.defineInitHook=function(e){return Ls.push(e)};var Ds=null;function Os(e){Ds=e}function _s(e,t,r,n,i){var a=e.doc;e.display.shift=!1,n||(n=a.sel);var s=+new Date-200,o="paste"==i||e.state.pasteIncoming>s,l=_e(t),u=null;if(o&&n.ranges.length>1)if(Ds&&Ds.text.join("\n")==t){if(n.ranges.length%Ds.text.length==0){u=[];for(var c=0;c<Ds.text.length;c++)u.push(a.splitLines(Ds.text[c]))}}else l.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(u=Y(l,(function(e){return[e]})));for(var d=e.curOp.updateInput,f=n.ranges.length-1;f>=0;f--){var h=n.ranges[f],p=h.from(),g=h.to();h.empty()&&(r&&r>0?p=et(p.line,p.ch-r):e.state.overwrite&&!o?g=et(g.line,Math.min(Ve(a,g.line).text.length,g.ch+$(l).length)):o&&Ds&&Ds.lineWise&&Ds.text.join("\n")==l.join("\n")&&(p=g=et(p.line,0)));var m={from:p,to:g,text:u?u[f%u.length]:l,origin:i||(o?"paste":e.state.cutIncoming>s?"cut":"+input")};ua(e.doc,m),or(e,"inputRead",e,m)}t&&!o&&Is(e,t),_n(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Rs(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Jn(t,(function(){return _s(t,r,0,null,"paste")})),!0}function Is(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var a=e.getModeAt(i.head),s=!1;if(a.electricChars){for(var o=0;o<a.electricChars.length;o++)if(t.indexOf(a.electricChars.charAt(o))>-1){s=As(e,i.head.line,"smart");break}}else a.electricInput&&a.electricInput.test(Ve(e.doc,i.head.line).text.slice(0,i.head.ch))&&(s=As(e,i.head.line,"smart"));s&&or(e,"electricInput",e,i.head.line)}}}function Ms(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,a={anchor:et(i,0),head:et(i+1,0)};r.push(a),t.push(e.getRange(a.anchor,a.head))}return{text:t,ranges:r}}function Fs(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Ps(){var e=D("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=D("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return l?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Fs(e),t}function Ns(e,t,r,n,i){var a=t,s=r,o=Ve(e,t.line),l=i&&"rtl"==e.direction?-r:r;function u(a){var s,u;if("codepoint"==n){var c=o.text.charCodeAt(t.ch+(n>0?0:-1));s=isNaN(c)?null:new et(t.line,Math.max(0,Math.min(o.text.length,t.ch+r*(c>=55296&&c<56320?2:1))),-r)}else s=i?function(e,t,r,n){var i=ue(t,e.doc.direction);if(!i)return Qa(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var a=oe(i,r.ch,r.sticky),s=i[a];if("ltr"==e.doc.direction&&s.level%2==0&&(n>0?s.to>r.ch:s.from<r.ch))return Qa(t,r,n);var o,l=function(e,r){return Za(t,e instanceof et?e.ch:e,r)},u=function(r){return e.options.lineWrapping?(o=o||_r(e,t),Zr(e,t,o,r)):{begin:0,end:t.text.length}},c=u("before"==r.sticky?l(r,-1):r.ch);if("rtl"==e.doc.direction||1==s.level){var d=1==s.level==n<0,f=l(r,d?1:-1);if(null!=f&&(d?f<=s.to&&f<=c.end:f>=s.from&&f>=c.begin)){var h=d?"before":"after";return new et(r.line,f,h)}}var p=function(e,t,n){for(var a=function(e,t){return t?new et(r.line,l(e,1),"before"):new et(r.line,e,"after")};e>=0&&e<i.length;e+=t){var s=i[e],o=t>0==(1!=s.level),u=o?n.begin:l(n.end,-1);if(s.from<=u&&u<s.to)return a(u,o);if(u=o?s.from:l(s.to,-1),n.begin<=u&&u<n.end)return a(u,o)}},g=p(a+n,n,c);if(g)return g;var m=n>0?c.end:l(c.begin,-1);return null==m||n>0&&m==t.text.length||!(g=p(n>0?0:i.length-1,n,u(m)))?null:g}(e.cm,o,t,r):Qa(o,t,r);if(null==s){if(a||(u=t.line+l)<e.first||u>=e.first+e.size||(t=new et(u,t.ch,t.sticky),!(o=Ve(e,u))))return!1;t=Ja(i,e.cm,o,t.line,l)}else t=s;return!0}if("char"==n||"codepoint"==n)u();else if("column"==n)u(!0);else if("word"==n||"group"==n)for(var c=null,d="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(r<0)||u(!h);h=!1){var p=o.text.charAt(t.ch)||"\n",g=ee(p,f)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";if(!d||h||g||(g="s"),c&&c!=g){r<0&&(r=1,u(),t.sticky="after");break}if(g&&(c=g),r>0&&!u(!h))break}var m=aa(e,t,a,s,!0);return rt(a,m)&&(m.hitSide=!0),m}function Bs(e,t,r,n){var i,a,s=e.doc,o=t.left;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(l-.5*rn(e.display),3);i=(r>0?t.bottom:t.top)+r*u}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;(a=Yr(e,o,i)).outside;){if(r<0?i<=0:i>=s.height){a.hitSide=!0;break}i+=5*r}return a}var js=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new j,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Us(e,t){var r=Or(e,t.line);if(!r||r.hidden)return null;var n=Ve(e.doc,t.line),i=Ar(r,n,t.line),a=ue(n,e.doc.direction),s="left";a&&(s=oe(a,t.ch)%2?"right":"left");var o=Fr(i.map,t.ch,s);return o.offset="right"==o.collapse?o.end:o.start,o}function Hs(e,t){return t&&(e.bad=!0),e}function Gs(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Hs(e.clipPos(et(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var a=e.display.view[i];if(a.node==n)return Ws(a,t,r)}}function Ws(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!_(n,t))return Hs(et(Xe(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var a=e.rest?$(e.rest):e.line;return Hs(et(Xe(a),a.text.length),i)}var s=3==t.nodeType?t:null,o=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));o.parentNode!=n;)o=o.parentNode;var l=e.measure,u=l.maps;function c(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var a=i<0?l.map:u[i],s=0;s<a.length;s+=3){var o=a[s+2];if(o==t||o==r){var c=Xe(i<0?e.line:e.rest[i]),d=a[s]+n;return(n<0||o!=t)&&(d=a[s+(n?1:0)]),et(c,d)}}}var d=c(s,o,r);if(d)return Hs(d,i);for(var f=o.nextSibling,h=s?s.nodeValue.length-r:0;f;f=f.nextSibling){if(d=c(f,f.firstChild,0))return Hs(et(d.line,d.ch-h),i);h+=f.textContent.length}for(var p=o.previousSibling,g=r;p;p=p.previousSibling){if(d=c(p,p.firstChild,-1))return Hs(et(d.line,d.ch+g),i);g+=p.textContent.length}}js.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;function a(e){for(var t=e.target;t;t=t.parentNode){if(t==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function s(e){if(a(e)&&!ge(n,e)){if(n.somethingSelected())Os({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=Ms(n);Os({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation((function(){n.setSelections(t.ranges,0,G),n.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData();var s=Ds.text.join("\n");if(e.clipboardData.setData("Text",s),e.clipboardData.getData("Text")==s)return void e.preventDefault()}var o=Ps(),l=o.firstChild;n.display.lineSpace.insertBefore(o,n.display.lineSpace.firstChild),l.value=Ds.text.join("\n");var u=document.activeElement;F(l),setTimeout((function(){n.display.lineSpace.removeChild(o),u.focus(),u==i&&r.showPrimarySelection()}),50)}}Fs(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize),de(i,"paste",(function(e){!a(e)||ge(n,e)||Rs(e,n)||o<=11&&setTimeout(ei(n,(function(){return t.updateFromDOM()})),20)})),de(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),de(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),de(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),de(i,"touchstart",(function(){return r.forceCompositionEnd()})),de(i,"input",(function(){t.composing||t.readFromDOMSoon()})),de(i,"copy",s),de(i,"cut",s)},js.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},js.prototype.prepareSelection=function(){var e=vn(this.cm,!1);return e.focus=document.activeElement==this.div,e},js.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},js.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},js.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),a=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||a.line<t.display.viewFrom)e.removeAllRanges();else{var s=Gs(t,e.anchorNode,e.anchorOffset),o=Gs(t,e.focusNode,e.focusOffset);if(!s||s.bad||!o||o.bad||0!=tt(at(s,o),i)||0!=tt(it(s,o),a)){var l=t.display.view,u=i.line>=t.display.viewFrom&&Us(t,i)||{node:l[0].measure.map[2],offset:0},c=a.line<t.display.viewTo&&Us(t,a);if(!c){var d=l[l.length-1].measure,f=d.maps?d.maps[d.maps.length-1]:d.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(u&&c){var h,p=e.rangeCount&&e.getRangeAt(0);try{h=w(u.node,u.offset,c.offset,c.node)}catch(e){}h&&(!r&&t.state.focused?(e.collapse(u.node,u.offset),h.collapsed||(e.removeAllRanges(),e.addRange(h))):(e.removeAllRanges(),e.addRange(h)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},js.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},js.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},js.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},js.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _(this.div,t)},js.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},js.prototype.blur=function(){this.div.blur()},js.prototype.getField=function(){return this.div},js.prototype.supportsTouch=function(){return!0},js.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Jn(this.cm,(function(){return e.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}))},js.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},js.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(m&&c&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=Gs(t,e.anchorNode,e.anchorOffset),n=Gs(t,e.focusNode,e.focusOffset);r&&n&&Jn(t,(function(){Ji(t.doc,wi(r,n),G),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)}))}}},js.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,r,n=this.cm,i=n.display,a=n.doc.sel.primary(),s=a.from(),o=a.to();if(0==s.ch&&s.line>n.firstLine()&&(s=et(s.line-1,Ve(n.doc,s.line-1).length)),o.ch==Ve(n.doc,o.line).text.length&&o.line<n.lastLine()&&(o=et(o.line+1,0)),s.line<i.viewFrom||o.line>i.viewTo-1)return!1;s.line==i.viewFrom||0==(e=cn(n,s.line))?(t=Xe(i.view[0].line),r=i.view[0].node):(t=Xe(i.view[e].line),r=i.view[e-1].node.nextSibling);var l,u,c=cn(n,o.line);if(c==i.view.length-1?(l=i.viewTo-1,u=i.lineDiv.lastChild):(l=Xe(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!r)return!1;for(var d=n.doc.splitLines(function(e,t,r,n,i){var a="",s=!1,o=e.doc.lineSeparator(),l=!1;function u(){s&&(a+=o,l&&(a+=o),s=l=!1)}function c(e){e&&(u(),a+=e)}function d(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)return void c(r);var a,f=t.getAttribute("cm-marker");if(f){var h=e.findMarks(et(n,0),et(i+1,0),(m=+f,function(e){return e.id==m}));return void(h.length&&(a=h[0].find(0))&&c(qe(e.doc,a.from,a.to).join(o)))}if("false"==t.getAttribute("contenteditable"))return;var p=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;p&&u();for(var g=0;g<t.childNodes.length;g++)d(t.childNodes[g]);/^(pre|p)$/i.test(t.nodeName)&&(l=!0),p&&(s=!0)}else 3==t.nodeType&&c(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var m}for(;d(t),t!=r;)t=t.nextSibling,l=!1;return a}(n,r,u,t,l)),f=qe(n.doc,et(t,0),et(l,Ve(n.doc,l).text.length));d.length>1&&f.length>1;)if($(d)==$(f))d.pop(),f.pop(),l--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),t++}for(var h=0,p=0,g=d[0],m=f[0],v=Math.min(g.length,m.length);h<v&&g.charCodeAt(h)==m.charCodeAt(h);)++h;for(var y=$(d),b=$(f),E=Math.min(y.length-(1==d.length?h:0),b.length-(1==f.length?h:0));p<E&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==d.length&&1==f.length&&t==s.line)for(;h&&h>s.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var x=et(t,h),S=et(l,f.length?$(f).length-p:0);return d.length>1||d[0]||tt(x,S)?(pa(n.doc,d,x,S,"+input"),!0):void 0},js.prototype.ensurePolled=function(){this.forceCompositionEnd()},js.prototype.reset=function(){this.forceCompositionEnd()},js.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},js.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},js.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Jn(this.cm,(function(){return dn(e.cm)}))},js.prototype.setUneditable=function(e){e.contentEditable="false"},js.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,_s)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},js.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},js.prototype.onContextMenu=function(){},js.prototype.resetPosition=function(){},js.prototype.needsContentAttribute=!0;var zs=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new j,this.hasSelection=!1,this.composing=null};zs.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;function a(e){if(!ge(n,e)){if(n.somethingSelected())Os({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Ms(n);Os({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,G):(r.prevInput="",i.value=t.text.join("\n"),F(i))}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),de(i,"input",(function(){s&&o>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()})),de(i,"paste",(function(e){ge(n,e)||Rs(e,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())})),de(i,"cut",a),de(i,"copy",a),de(e.scroller,"paste",(function(t){if(!xr(e,t)&&!ge(n,t)){if(!i.dispatchEvent)return n.state.pasteIncoming=+new Date,void r.focus();var a=new Event("paste");a.clipboardData=t.clipboardData,i.dispatchEvent(a)}})),de(e.lineSpace,"selectstart",(function(t){xr(e,t)||be(t)})),de(i,"compositionstart",(function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}})),de(i,"compositionend",(function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)}))},zs.prototype.createField=function(e){this.wrapper=Ps(),this.textarea=this.wrapper.firstChild},zs.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},zs.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=vn(e);if(e.options.moveInputWithCursor){var i=Vr(e,r.sel.primary().head,"div"),a=t.wrapper.getBoundingClientRect(),s=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+s.top-a.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+s.left-a.left))}return n},zs.prototype.showSelection=function(e){var t=this.cm.display;A(t.cursorDiv,e.cursors),A(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},zs.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&F(this.textarea),s&&o>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",s&&o>=9&&(this.hasSelection=null))}},zs.prototype.getField=function(){return this.textarea},zs.prototype.supportsTouch=function(){return!1},zs.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||R()!=this.textarea))try{this.textarea.focus()}catch(e){}},zs.prototype.blur=function(){this.textarea.blur()},zs.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},zs.prototype.receivedFocus=function(){this.slowPoll()},zs.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},zs.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}))},zs.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Re(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(s&&o>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var a=i.charCodeAt(0);if(8203!=a||n||(n=""),8666==a)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(n.length,i.length);l<u&&n.charCodeAt(l)==i.charCodeAt(l);)++l;return Jn(t,(function(){_s(t,i.slice(l),n.length-l,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},zs.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},zs.prototype.onKeyPress=function(){s&&o>=9&&(this.hasSelection=null),this.fastPoll()},zs.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var a=un(r,e),u=n.scroller.scrollTop;if(a&&!d){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(a)&&ei(r,Ji)(r.doc,wi(a),G);var c,f=i.style.cssText,h=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(s?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(c=window.scrollY),n.input.focus(),l&&window.scrollTo(null,c),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),s&&o>=9&&m(),T){Se(e);var g=function(){he(window,"mouseup",g),setTimeout(v,20)};de(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=i.selectionStart){var e=r.somethingSelected(),a=""+(e?i.value:"");i.value="⇚",i.value=a,t.prevInput=e?"":"",i.selectionStart=1,i.selectionEnd=a.length,n.selForContextMenu=r.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=f,s&&o<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=u),null!=i.selectionStart)){(!s||s&&o<9)&&m();var e=0,a=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?ei(r,oa)(r):e++<10?n.detectingSelectAll=setTimeout(a,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(a,200)}}},zs.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},zs.prototype.setUneditable=function(){},zs.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function r(r,n,i,a){e.defaults[r]=n,i&&(t[r]=a?function(e,t,r){r!=xs&&i(e,t,r)}:i)}e.defineOption=r,e.Init=xs,r("value","",(function(e,t){return e.setValue(t)}),!0),r("mode",null,(function(e,t){e.doc.modeOption=t,Oi(e)}),!0),r("indentUnit",2,Oi,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,(function(e){_i(e),jr(e),dn(e)}),!0),r("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var a=e.text.indexOf(t,i);if(-1==a)break;i=a+t.length,r.push(et(n,a))}n++}));for(var i=r.length-1;i>=0;i--)pa(e.doc,t,r[i],et(r[i].line,r[i].ch+t.length))}})),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=xs&&e.refresh()})),r("specialCharPlaceholder",Qt,(function(e){return e.refresh()}),!0),r("electricChars",!0),r("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),r("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),r("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),r("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),r("rtlMoveVisually",!E),r("wholeLineUpdateBefore",!0),r("theme","default",(function(e){Es(e),gi(e)}),!0),r("keyMap","default",(function(e,t,r){var n=Ya(t),i=r!=xs&&Ya(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,ws,!0),r("gutters",[],(function(e,t){e.display.gutterSpecs=hi(t,e.options.lineNumbers),gi(e)}),!0),r("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?sn(e.display)+"px":"0",e.refresh()}),!0),r("coverGutterNextToScrollbar",!1,(function(e){return Hn(e)}),!0),r("scrollbarStyle","native",(function(e){zn(e),Hn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),r("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=hi(e.options.gutters,t),gi(e)}),!0),r("firstLineNumber",1,gi,!0),r("lineNumberFormatter",(function(e){return e}),gi,!0),r("showCursorWhenSelecting",!1,mn,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,(function(e,t){"nocursor"==t&&(wn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),r("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),r("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),r("dragDrop",!0,ks),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,mn,!0),r("singleCursorHeightPerLine",!0,mn,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,_i,!0),r("addModeClass",!1,_i,!0),r("pollInterval",100),r("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),r("historyEventDelay",1250),r("viewportMargin",10,(function(e){return e.refresh()}),!0),r("maxHighlightLength",1e4,_i,!0),r("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),r("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),r("autofocus",null),r("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),r("phrases",null)}(Cs),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&ei(this,t[e])(this,r,i),pe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Ya(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:ti((function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},(function(e){return e.priority})),this.state.modeGen++,dn(this)})),removeOverlay:ti((function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void dn(this)}})),indentLine:ti((function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Qe(this.doc,e)&&As(this,e,t,r)})),indentSelection:ti((function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(As(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&_n(this));else{var a=i.from(),s=i.to(),o=Math.max(r,a.line);r=Math.min(this.lastLine(),s.line-(s.ch?0:1))+1;for(var l=o;l<r;++l)As(this,l,e);var u=this.doc.sel.ranges;0==a.ch&&t.length==u.length&&u[n].from().ch>0&&Xi(this.doc,n,new Ti(a,u[n].to()),G)}}})),getTokenAt:function(e,t){return yt(this,e,t)},getLineTokens:function(e,t){return yt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=ot(this.doc,e);var t,r=ft(this,Ve(this.doc,e.line)),n=0,i=(r.length-1)/2,a=e.ch;if(0==a)t=r[2];else for(;;){var s=n+i>>1;if((s?r[2*s-1]:0)>=a)i=s;else{if(!(r[2*s+1]<a)){t=r[2*s+2];break}n=s+1}}var o=t?t.indexOf("overlay "):-1;return o<0?t:0==o?null:t.slice(0,o-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!r.hasOwnProperty(t))return n;var i=r[t],a=this.getModeAt(e);if("string"==typeof a[t])i[a[t]]&&n.push(i[a[t]]);else if(a[t])for(var s=0;s<a[t].length;s++){var o=i[a[t][s]];o&&n.push(o)}else a.helperType&&i[a.helperType]?n.push(i[a.helperType]):i[a.name]&&n.push(i[a.name]);for(var l=0;l<i._global.length;l++){var u=i._global[l];u.pred(a,this)&&-1==U(n,u.val)&&n.push(u.val)}return n},getStateAfter:function(e,t){var r=this.doc;return ht(this,(e=st(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Vr(this,null==e?r.head:"object"==typeof e?ot(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return Kr(this,ot(this.doc,e),t||"page")},coordsChar:function(e,t){return Yr(this,(e=zr(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=zr(this,{top:e,left:0},t||"page").top,Ze(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var a=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>a&&(e=a,i=!0),n=Ve(this.doc,e)}else n=e;return Wr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Wt(n):0)},defaultTextHeight:function(){return rn(this.display)},defaultCharWidth:function(){return nn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var a,s,o,l=this.display,u=(e=Vr(this,ot(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==n)u=e.top;else if("above"==n||"near"==n){var d=Math.max(l.wrapper.clientHeight,this.doc.height),f=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>d)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=d&&(u=e.bottom),c+t.offsetWidth>f&&(c=f-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(a=this,s={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(o=Dn(a,s)).scrollTop&&Fn(a,o.scrollTop),null!=o.scrollLeft&&Nn(a,o.scrollLeft))},triggerOnKeyDown:ti(us),triggerOnKeyPress:ti(ds),triggerOnKeyUp:cs,triggerOnMouseDown:ti(gs),execCommand:function(e){if(es.hasOwnProperty(e))return es[e].call(null,this)},triggerElectric:ti((function(e){Is(this,e)})),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var a=ot(this.doc,e),s=0;s<t&&!(a=Ns(this.doc,a,i,r,n)).hitSide;++s);return a},moveH:ti((function(e,t){var r=this;this.extendSelectionsBy((function(n){return r.display.shift||r.doc.extend||n.empty()?Ns(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()}),z)})),deleteH:ti((function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Xa(this,(function(r){var i=Ns(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}}))})),findPosV:function(e,t,r,n){var i=1,a=n;t<0&&(i=-1,t=-t);for(var s=ot(this.doc,e),o=0;o<t;++o){var l=Vr(this,s,"div");if(null==a?a=l.left:l.left=a,(s=Bs(this,l,i,r)).hitSide)break}return s},moveV:ti((function(e,t){var r=this,n=this.doc,i=[],a=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy((function(s){if(a)return e<0?s.from():s.to();var o=Vr(r,s.head,"div");null!=s.goalColumn&&(o.left=s.goalColumn),i.push(o.left);var l=Bs(r,o,e,t);return"page"==t&&s==n.sel.primary()&&On(r,Kr(r,l,"div").top-o.top),l}),z),i.length)for(var s=0;s<n.sel.ranges.length;s++)n.sel.ranges[s].goalColumn=i[s]})),findWordAt:function(e){var t=Ve(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var a=t.charAt(r),s=ee(a,i)?function(e){return ee(e,i)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ee(e)};r>0&&s(t.charAt(r-1));)--r;for(;n<t.length&&s(t.charAt(n));)++n}return new Ti(et(e.line,r),et(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?I(this.display.cursorDiv,"CodeMirror-overwrite"):C(this.display.cursorDiv,"CodeMirror-overwrite"),pe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==R()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ti((function(e,t){Rn(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-wr(this)-this.display.barHeight,width:e.scrollWidth-wr(this)-this.display.barWidth,clientHeight:Lr(this),clientWidth:Cr(this)}},scrollIntoView:ti((function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:et(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?function(e,t){In(e),e.curOp.scrollToPos=t}(this,e):Mn(this,e.from,e.to,e.margin)})),setSize:ti((function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Br(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){fn(r,i,"widget");break}++i})),this.curOp.forceUpdate=!0,pe(this,"refresh",this)})),operation:function(e){return Jn(this,e)},startOperation:function(){return Vn(this)},endOperation:function(){return qn(this)},refresh:ti((function(){var e=this.display.cachedTextHeight;dn(this),this.curOp.forceUpdate=!0,jr(this),Rn(this,this.doc.scrollLeft,this.doc.scrollTop),ui(this.display),(null==e||Math.abs(e-rn(this.display))>.5||this.options.lineWrapping)&&ln(this),pe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Fi(this,e),jr(this),this.display.input.reset(),Rn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,or(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,a){e.registerHelper(t,n,a),r[t]._global.push({pred:i,val:a})}}(Cs);var Ks="iter insert remove copy getEditor constructor".split(" ");for(var Vs in Oa.prototype)Oa.prototype.hasOwnProperty(Vs)&&U(Ks,Vs)<0&&(Cs.prototype[Vs]=function(e){return function(){return e.apply(this.doc,arguments)}}(Oa.prototype[Vs]));return ye(Oa),Cs.inputStyles={textarea:zs,contenteditable:js},Cs.defineMode=function(e){Cs.defaults.mode||"null"==e||(Cs.defaults.mode=e),Ne.apply(this,arguments)},Cs.defineMIME=function(e,t){Pe[e]=t},Cs.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Cs.defineMIME("text/plain","null"),Cs.defineExtension=function(e,t){Cs.prototype[e]=t},Cs.defineDocExtension=function(e,t){Oa.prototype[e]=t},Cs.fromTextArea=function(e,t){if((t=t?N(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=R();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=o.getValue()}var i;if(e.form&&(de(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var a=e.form;i=a.submit;try{var s=a.submit=function(){n(),a.submit=i,a.submit(),a.submit=s}}catch(e){}}t.finishInit=function(r){r.save=n,r.getTextArea=function(){return e},r.toTextArea=function(){r.toTextArea=isNaN,n(),e.parentNode.removeChild(r.getWrapperElement()),e.style.display="",e.form&&(he(e.form,"submit",n),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var o=Cs((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return o},function(e){e.off=he,e.on=de,e.wheelEventPixels=Ei,e.Doc=Oa,e.splitLines=_e,e.countColumn=B,e.findColumn=K,e.isWordChar=J,e.Pass=H,e.signal=pe,e.Line=Vt,e.changeEnd=Ci,e.scrollbarModel=Wn,e.Pos=et,e.cmpPos=tt,e.modes=Fe,e.mimeModes=Pe,e.resolveMode=Be,e.getMode=je,e.modeExtensions=Ue,e.extendMode=He,e.copyState=Ge,e.startState=ze,e.innerMode=We,e.commands=es,e.keyMap=Ga,e.keyName=$a,e.isModifierKey=Va,e.lookupKey=Ka,e.normalizeKeyMap=za,e.StringStream=Ke,e.SharedTextMarker=Ca,e.TextMarker=ka,e.LineWidget=xa,e.e_preventDefault=be,e.e_stopPropagation=Ee,e.e_stop=Se,e.addClass=I,e.contains=_,e.rmClass=C,e.keyNames=Ba}(Cs),Cs.version="5.58.2",Cs}()},Y1PL:
|
|
|
/*!**********************************************************!*\
|
|
|
!*** ./node_modules/rc-textarea/es/index.js + 7 modules ***!
|
|
|
\**********************************************************/
|
|
|
/*! exports provided: ResizableTextArea, default */
|
|
|
/*! all exports used */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/findDOMNode.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/omit.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */function(e,t,r){"use strict";r.r(t),r.d(t,"ResizableTextArea",(function(){return I}));var n=r("wx14"),i=r("1OyB"),a=r("vuIU"),s=r("Ji7U"),o=r("LK+K"),l=r("q1tI"),u=r("VTBJ"),c=r("rePB"),d=r("Zm9Q"),f=(r("Kwbf"),r("c+Xe")),h=r("m+aA"),p=r("bdgK"),g=new Map;var m=new p.default((function(e){e.forEach((function(e){var t,r=e.target;null===(t=g.get(r))||void 0===t||t.forEach((function(e){return e(r)}))}))}));var v=function(e){Object(s.a)(r,e);var t=Object(o.a)(r);function r(){return Object(i.a)(this,r),t.apply(this,arguments)}return Object(a.a)(r,[{key:"render",value:function(){return this.props.children}}]),r}(l.Component),y=l.createContext(null);function b(e){var t=e.children,r=e.disabled,n=l.useRef(null),i=l.useRef(null),a=l.useContext(y),s=l.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),o=l.isValidElement(t)&&Object(f.c)(t),c=o?t.ref:null,d=l.useMemo((function(){return Object(f.a)(c,n)}),[c,n]),p=l.useRef(e);p.current=e;var b=l.useCallback((function(e){var t=p.current,r=t.onResize,n=t.data,i=e.getBoundingClientRect(),o=i.width,l=i.height,c=e.offsetWidth,d=e.offsetHeight,f=Math.floor(o),h=Math.floor(l);if(s.current.width!==f||s.current.height!==h||s.current.offsetWidth!==c||s.current.offsetHeight!==d){var g={width:f,height:h,offsetWidth:c,offsetHeight:d};s.current=g;var m=c===Math.round(o)?o:c,v=d===Math.round(l)?l:d,y=Object(u.a)(Object(u.a)({},g),{},{offsetWidth:m,offsetHeight:v});null==a||a(y,e,n),r&&Promise.resolve().then((function(){r(y,e)}))}}),[]);return l.useEffect((function(){var e,t,a=Object(h.a)(n.current)||Object(h.a)(i.current);return a&&!r&&(e=a,t=b,g.has(e)||(g.set(e,new Set),m.observe(e)),g.get(e).add(t)),function(){return function(e,t){g.has(e)&&(g.get(e).delete(t),g.get(e).size||(m.unobserve(e),g.delete(e)))}(a,b)}}),[n.current,r]),l.createElement(v,{ref:i},o?l.cloneElement(t,{ref:d}):t)}function E(e){var t=e.children;return Object(d.a)(t).map((function(t,r){var i=(null==t?void 0:t.key)||"".concat("rc-observer-key","-").concat(r);return l.createElement(b,Object(n.a)({},e,{key:i}),t)}))}E.Collection=function(e){var t=e.children,r=e.onBatchResize,n=l.useRef(0),i=l.useRef([]),a=l.useContext(y),s=l.useCallback((function(e,t,s){n.current+=1;var o=n.current;i.current.push({size:e,element:t,data:s}),Promise.resolve().then((function(){o===n.current&&(null==r||r(i.current),i.current=[])})),null==a||a(e,t,s)}),[r,a]);return l.createElement(y.Provider,{value:s},t)};var x,S=E,T=r("bT9E"),k=r("TSYQ"),w=r.n(k),C="\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n",L=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],A={};function D(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&A[r])return A[r];var n=window.getComputedStyle(e),i=n.getPropertyValue("box-sizing")||n.getPropertyValue("-moz-box-sizing")||n.getPropertyValue("-webkit-box-sizing"),a=parseFloat(n.getPropertyValue("padding-bottom"))+parseFloat(n.getPropertyValue("padding-top")),s=parseFloat(n.getPropertyValue("border-bottom-width"))+parseFloat(n.getPropertyValue("border-top-width")),o=L.map((function(e){return"".concat(e,":").concat(n.getPropertyValue(e))})).join(";"),l={sizingStyle:o,paddingSize:a,borderSize:s,boxSizing:i};return t&&r&&(A[r]=l),l}var O,_=r("Gytx"),R=r.n(_);!function(e){e[e.NONE=0]="NONE",e[e.RESIZING=1]="RESIZING",e[e.RESIZED=2]="RESIZED"}(O||(O={}));var I=function(e){Object(s.a)(r,e);var t=Object(o.a)(r);function r(e){var a;return Object(i.a)(this,r),(a=t.call(this,e)).nextFrameActionId=void 0,a.resizeFrameId=void 0,a.textArea=void 0,a.saveTextArea=function(e){a.textArea=e},a.handleResize=function(e){var t=a.state.resizeStatus,r=a.props,n=r.autoSize,i=r.onResize;t===O.NONE&&("function"==typeof i&&i(e),n&&a.resizeOnNextFrame())},a.resizeOnNextFrame=function(){cancelAnimationFrame(a.nextFrameActionId),a.nextFrameActionId=requestAnimationFrame(a.resizeTextarea)},a.resizeTextarea=function(){var e=a.props.autoSize;if(e&&a.textArea){var t=e.minRows,r=e.maxRows,n=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;x||((x=document.createElement("textarea")).setAttribute("tab-index","-1"),x.setAttribute("aria-hidden","true"),document.body.appendChild(x)),e.getAttribute("wrap")?x.setAttribute("wrap",e.getAttribute("wrap")):x.removeAttribute("wrap");var i=D(e,t),a=i.paddingSize,s=i.borderSize,o=i.boxSizing,l=i.sizingStyle;x.setAttribute("style","".concat(l,";").concat(C)),x.value=e.value||e.placeholder||"";var u,c=Number.MIN_SAFE_INTEGER,d=Number.MAX_SAFE_INTEGER,f=x.scrollHeight;if("border-box"===o?f+=s:"content-box"===o&&(f-=a),null!==r||null!==n){x.value=" ";var h=x.scrollHeight-a;null!==r&&(c=h*r,"border-box"===o&&(c=c+a+s),f=Math.max(c,f)),null!==n&&(d=h*n,"border-box"===o&&(d=d+a+s),u=f>d?"":"hidden",f=Math.min(d,f))}return{height:f,minHeight:c,maxHeight:d,overflowY:u,resize:"none"}}(a.textArea,!1,t,r);a.setState({textareaStyles:n,resizeStatus:O.RESIZING},(function(){cancelAnimationFrame(a.resizeFrameId),a.resizeFrameId=requestAnimationFrame((function(){a.setState({resizeStatus:O.RESIZED},(function(){a.resizeFrameId=requestAnimationFrame((function(){a.setState({resizeStatus:O.NONE}),a.fixFirefoxAutoScroll()}))}))}))}))}},a.renderTextArea=function(){var e=a.props,t=e.prefixCls,r=void 0===t?"rc-textarea":t,i=e.autoSize,s=e.onResize,o=e.className,d=e.disabled,f=a.state,h=f.textareaStyles,p=f.resizeStatus,g=Object(T.a)(a.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),m=w()(r,o,Object(c.a)({},"".concat(r,"-disabled"),d));"value"in g&&(g.value=g.value||"");var v=Object(u.a)(Object(u.a)(Object(u.a)({},a.props.style),h),p===O.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return l.createElement(S,{onResize:a.handleResize,disabled:!(i||s)},l.createElement("textarea",Object(n.a)({},g,{className:m,style:v,ref:a.saveTextArea})))},a.state={textareaStyles:{},resizeStatus:O.NONE},a}return Object(a.a)(r,[{key:"componentDidUpdate",value:function(e){e.value===this.props.value&&R()(e.autoSize,this.props.autoSize)||this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var e=this.textArea.selectionStart,t=this.textArea.selectionEnd;this.textArea.setSelectionRange(e,t)}}catch(e){}}},{key:"render",value:function(){return this.renderTextArea()}}]),r}(l.Component),M=function(e){Object(s.a)(r,e);var t=Object(o.a)(r);function r(e){var n;Object(i.a)(this,r),(n=t.call(this,e)).resizableTextArea=void 0,n.focus=function(){n.resizableTextArea.textArea.focus()},n.saveTextArea=function(e){n.resizableTextArea=e},n.handleChange=function(e){var t=n.props.onChange;n.setValue(e.target.value,(function(){n.resizableTextArea.resizeTextarea()})),t&&t(e)},n.handleKeyDown=function(e){var t=n.props,r=t.onPressEnter,i=t.onKeyDown;13===e.keyCode&&r&&r(e),i&&i(e)};var a=void 0===e.value||null===e.value?e.defaultValue:e.value;return n.state={value:a},n}return Object(a.a)(r,[{key:"setValue",value:function(e,t){"value"in this.props||this.setState({value:e},t)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return l.createElement(I,Object(n.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(e){return"value"in e?{value:e.value}:null}}]),r}(l.Component);t.default=M},ZW9T:
|
|
|
/*!************************************************************!*\
|
|
|
!*** ./src/components/monaco-editor/index.jsx + 1 modules ***!
|
|
|
\************************************************************/
|
|
|
/*! exports provided: getLanguageByMirrorName, default, DiffEditor */
|
|
|
/*! exports used: DiffEditor, default */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */function(e,t,r){"use strict";r.d(t,"a",(function(){return v}));var n=r("k1fw"),i=(r("miYZ"),r("tsqr")),a=r("rAM+"),s=r("tJVT"),o=r("PpiC"),l=r("q1tI"),u=r.n(l),c=r("bdgK");function d(e,t,r,i,a){var s=t.getWordUntilPosition(r),o={startLineNumber:r.lineNumber,endLineNumber:r.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},l=i.map((function(t){return{label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}}));return a.map((function(e){l.push(Object(n.a)(Object(n.a)({},e),{},{range:o}))})),l}r("LvDl");function f(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}function h(){}var p={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e;if(Array.isArray(e)){for(var r=0;r<e.length;r++){var n=p[e[r]];if(n)return n}return t[0]}return p[t]||t}var m=null;t.b=function(e){var t=e.width,p=void 0===t?"100%":t,v=e.height,y=void 0===v?"100%":v,b=e.value,E=e.language,x=void 0===E?"javascript":E,S=e.style,T=void 0===S?{}:S,k=e.options,w=void 0===k?{}:k,C=e.overrideServices,L=void 0===C?{}:C,A=e.theme,D=void 0===A?"vs-dark":A,O=e.onEditBlur,_=e.onSave,R=e.autoHeight,I=void 0!==R&&R,M=e.forbidCopy,F=void 0!==M&&M,P=e.onChange,N=void 0===P?h:P,B=e.editorDidMount,j=void 0===B?h:B,U=e.onFocus,H=void 0===U?h:U,G=e.filename,W=void 0===G?"educoder.txt":G,z=(Object(o.a)(e,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Object(l.useRef)()),K=Object(l.useRef)({}),V=Object(l.useRef)(),q=Object(l.useRef)(!1),$=Object(l.useRef)(),Y=Object(l.useState)(!1),X=Object(s.a)(Y,2),Z=X[0],Q=X[1];function J(){i.b.warn(decodeURIComponent("该任务关卡设置了禁止复制粘贴,请手动输入代码。"))}function ee(){var e=K.current.instance;if(e){var t=e.getSelection(),r=K.current.pastePos||{},n=new m.Range(r.startLineNumber||t.endLineNumber,r.startColumn||t.endColumn,r.endLineNumber||t.endLineNumber,r.endColumn||t.endColumn);setTimeout((function(){e.executeEdits("",[{range:n,text:""}])}),300)}}function te(e){(window.navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&83==e.keyCode&&(e.preventDefault(),_())}Object(l.useEffect)((function(){V.current&&clearTimeout(V.current),V.current=setTimeout((function(){!function(){var e=K.current.instance;if(null!=b&&e&&Z){var t=e.getModel();t&&b!==t.getValue()&&(!0,t.setValue(b),e.layout(),!1)}}()}),500)}),[b,Z,K.current]);var re=function(){if(I&&K.current.instance){var e=K.current.instance.getContentHeight();ce(e<y?y:e)}else ce(y)};function ne(e,t){var r,n,i=window.URL||window.webkitURL||window,a=new Blob([t]),s=document.createElementNS("http://www.w3.org/1999/xhtml","a");s.href=i.createObjectURL(a),s.download=e,r=s,(n=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r.dispatchEvent(n)}Object(l.useEffect)((function(){re()}),[re]),Object(l.useEffect)((function(){z.current&&!Z&&r.e(/*! import() | monaco-editor */27).then(r.t.bind(null,/*! monaco-editor/esm/vs/editor/editor.api.js */"M/lh",7)).then((function(e){try{m=e,K.current.instance=m.editor.create(z.current,{value:b,language:g(x),theme:D,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},L);var t=K.current.instance;if(j(t,m),setTimeout((function(){re(),K.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ne(W||"educoder.txt",t.getValue())}})}),500),K.current.subscription=t.onDidChangeModelContent((function(e){q.current?clearTimeout($.current):(re(),N(t.getValue(),e)),$.current=setTimeout((function(){q.current=!1}),500)})),window.Monaco||function(e){var t={label:"ifelse",kind:e.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {","\t$0","} else {","\t","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet},r=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];e.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(n,i){return{suggestions:d(e,n,i,r,[t])}}});var n=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];e.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(t,r){var i=[{label:"print",kind:e.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet}];return{suggestions:d(e,t,r,n,i)}}});var i=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];e.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(r,n){var a=[t,{label:"main",kind:e.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {","\t$0","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:e.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet}];return{suggestions:d(e,r,n,i,a)}}})}(m),F&&(t.addCommand(m.KeyMod.CtrlCmd|m.KeyMod.Shift|m.KeyCode.KEY_V,(function(){return J(),null})),t.addCommand(m.KeyMod.CtrlCmd|m.KeyCode.KEY_C,(function(){return J(),null}))),window.Monaco=m,O&&t.onDidBlurEditorWidget((function(){O(t.getValue())})),H&&t.onDidFocusEditorText((function(){H(t.getValue())})),F){t.addCommand(m.KeyMod.CtrlCmd|m.KeyCode.KEY_V,(function(){return J(),null})),t.onDidPaste((function(e){K.current.pastePos=e}));try{window.addEventListener("paste",ee)}catch(e){}}var r=function(){var e;return z.current&&(e=new c.default((function(e){var t,r=Object(a.a)(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;(n.target.offsetHeight>0||n.target.offsetWidth>0)&&K.current.instance.layout()}}catch(e){r.e(e)}finally{r.f()}}))).observe(z.current),e}();return Q(!0),function(){var e=K.current.instance;e.dispose();var t=e.getModel();t&&t.dispose(),K.current.subscription&&K.current.subscription.dispose(),F&&window.removeEventListener("paste",ee),r.unobserve(z.current)}}catch(e){}}))}),[]),Object(l.useEffect)((function(){if(K.current.instance&&Z)return document.addEventListener("keydown",te,!1),function(){document.removeEventListener("keydown",te)}}),[_,Z]),Object(l.useEffect)((function(){var e=K.current.instance;if(e&&Z){var t=g(x);m.editor.setModelLanguage(e.getModel(),t),console.log("language:",x,e.getModel(),t)}}),[x,Z]),Object(l.useEffect)((function(){K.current.instance&&Z&&m.editor.setTheme(D)}),[D,Z]),Object(l.useEffect)((function(){var e=K.current.instance;e&&Z&&(e.updateOptions(Object(n.a)({},w)),setTimeout((function(){e.getModel().updateOptions(Object(n.a)({},w))}),200))}),[JSON.stringify(w),Z]),Object(l.useEffect)((function(){var e=K.current.instance;e&&Z&&e.layout()}),[p,y,Z]);var ie=Object(l.useState)(f(p)),ae=Object(s.a)(ie,2),se=ae[0],oe=(ae[1],Object(l.useState)(f(y))),le=Object(s.a)(oe,2),ue=le[0],ce=le[1],de=Object(n.a)(Object(n.a)({},T),{},{width:se,height:ue});return u.a.createElement("div",{className:"my-monaco-editor",ref:z,style:de})};function v(e){var t=e.width,i=void 0===t?"100%":t,o=e.height,d=void 0===o?"100%":o,h=e.original,p=e.modified,g=e.language,v=e.options,y=void 0===v?{}:v,b=Object(l.useRef)(),E=Object(l.useState)(null),x=Object(s.a)(E,2),S=x[0],T=x[1];Object(l.useEffect)((function(){b.current&&r.e(/*! import() | monaco-editor */27).then(r.t.bind(null,/*! monaco-editor/esm/vs/editor/editor.api.js */"M/lh",7)).then((function(e){var t=(m=e).editor.createDiffEditor(b.current,Object(n.a)(Object(n.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},y),{},{wordWrap:!0}));T(t);var r=function(e){var t;return b.current&&(t=new c.default((function(t){var r,n=Object(a.a)(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;(i.target.offsetHeight>0||i.target.offsetWidth>0)&&e.layout()}}catch(e){n.e(e)}finally{n.f()}}))).observe(b.current),t}(t);return function(){t.dispose();var e=t.getModel();e&&e.dispose(),r.unobserve(b.current)}}))}),[]),Object(l.useEffect)((function(){S&&S.setModel({original:m.editor.createModel(h,g),modified:m.editor.createModel(p,g)})}),[h,p,g,S]);var k={width:f(i),height:f(d)};return u.a.createElement("div",{className:"my-diff-editor",ref:b,style:k})}},ZpRC:
|
|
|
/*!*************************************************************************!*\
|
|
|
!*** ./node_modules/scroll-into-view-if-needed/es/index.js + 1 modules ***!
|
|
|
\*************************************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,r){"use strict";function n(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function i(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function a(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var r=getComputedStyle(e,null);return i(r.overflowY,t)||i(r.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function s(e,t,r,n,i,a,s,o){return a<e&&s>t||a>e&&s<t?0:a<=e&&o<=r||s>=t&&o>=r?a-e-n:s>t&&o<r||a<e&&o>r?s-t+i:0}var o=function(e,t){var r=window,i=t.scrollMode,o=t.block,l=t.inline,u=t.boundary,c=t.skipOverflowHiddenElements,d="function"==typeof u?u:function(e){return e!==u};if(!n(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,h=[],p=e;n(p)&&d(p);){if((p=p.parentElement)===f){h.push(p);break}null!=p&&p===document.body&&a(p)&&!a(document.documentElement)||null!=p&&a(p,c)&&h.push(p)}for(var g=r.visualViewport?r.visualViewport.width:innerWidth,m=r.visualViewport?r.visualViewport.height:innerHeight,v=window.scrollX||pageXOffset,y=window.scrollY||pageYOffset,b=e.getBoundingClientRect(),E=b.height,x=b.width,S=b.top,T=b.right,k=b.bottom,w=b.left,C="start"===o||"nearest"===o?S:"end"===o?k:S+E/2,L="center"===l?w+x/2:"end"===l?T:w,A=[],D=0;D<h.length;D++){var O=h[D],_=O.getBoundingClientRect(),R=_.height,I=_.width,M=_.top,F=_.right,P=_.bottom,N=_.left;if("if-needed"===i&&S>=0&&w>=0&&k<=m&&T<=g&&S>=M&&k<=P&&w>=N&&T<=F)return A;var B=getComputedStyle(O),j=parseInt(B.borderLeftWidth,10),U=parseInt(B.borderTopWidth,10),H=parseInt(B.borderRightWidth,10),G=parseInt(B.borderBottomWidth,10),W=0,z=0,K="offsetWidth"in O?O.offsetWidth-O.clientWidth-j-H:0,V="offsetHeight"in O?O.offsetHeight-O.clientHeight-U-G:0;if(f===O)W="start"===o?C:"end"===o?C-m:"nearest"===o?s(y,y+m,m,U,G,y+C,y+C+E,E):C-m/2,z="start"===l?L:"center"===l?L-g/2:"end"===l?L-g:s(v,v+g,g,j,H,v+L,v+L+x,x),W=Math.max(0,W+y),z=Math.max(0,z+v);else{W="start"===o?C-M-U:"end"===o?C-P+G+V:"nearest"===o?s(M,P,R,U,G+V,C,C+E,E):C-(M+R/2)+V/2,z="start"===l?L-N-j:"center"===l?L-(N+I/2)+K/2:"end"===l?L-F+H+K:s(N,F,I,j,H+K,L,L+x,x);var q=O.scrollLeft,$=O.scrollTop;C+=$-(W=Math.max(0,Math.min($+W,O.scrollHeight-R+V))),L+=q-(z=Math.max(0,Math.min(q+z,O.scrollWidth-I+K)))}A.push({el:O,top:W,left:z})}return A};function l(e){return e===Object(e)&&0!==Object.keys(e).length}t.a=function(e,t){var r=!e.ownerDocument.documentElement.contains(e);if(l(t)&&"function"==typeof t.behavior)return t.behavior(r?[]:o(e,t));if(!r){var n=function(e){return!1===e?{block:"end",inline:"nearest"}:l(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var r="scrollBehavior"in document.body.style;e.forEach((function(e){var n=e.el,i=e.top,a=e.left;n.scroll&&r?n.scroll({top:i,left:a,behavior:t}):(n.scrollTop=i,n.scrollLeft=a)}))}(o(e,n),n.behavior)}}},Zss7:
|
|
|
/*!**********************************************!*\
|
|
|
!*** ./node_modules/tinycolor2/tinycolor.js ***!
|
|
|
\**********************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){var n;!function(i){var a=/^\s+/,s=/\s+$/,o=0,l=i.round,u=i.min,c=i.max,d=i.random;function f(e,t){if(t=t||{},(e=e||"")instanceof f)return e;if(!(this instanceof f))return new f(e,t);var r=function(e){var t={r:0,g:0,b:0},r=1,n=null,o=null,l=null,d=!1,f=!1;"string"==typeof e&&(e=function(e){e=e.replace(a,"").replace(s,"").toLowerCase();var t,r=!1;if(O[e])e=O[e],r=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(t=W.rgb.exec(e))return{r:t[1],g:t[2],b:t[3]};if(t=W.rgba.exec(e))return{r:t[1],g:t[2],b:t[3],a:t[4]};if(t=W.hsl.exec(e))return{h:t[1],s:t[2],l:t[3]};if(t=W.hsla.exec(e))return{h:t[1],s:t[2],l:t[3],a:t[4]};if(t=W.hsv.exec(e))return{h:t[1],s:t[2],v:t[3]};if(t=W.hsva.exec(e))return{h:t[1],s:t[2],v:t[3],a:t[4]};if(t=W.hex8.exec(e))return{r:F(t[1]),g:F(t[2]),b:F(t[3]),a:j(t[4]),format:r?"name":"hex8"};if(t=W.hex6.exec(e))return{r:F(t[1]),g:F(t[2]),b:F(t[3]),format:r?"name":"hex"};if(t=W.hex4.exec(e))return{r:F(t[1]+""+t[1]),g:F(t[2]+""+t[2]),b:F(t[3]+""+t[3]),a:j(t[4]+""+t[4]),format:r?"name":"hex8"};if(t=W.hex3.exec(e))return{r:F(t[1]+""+t[1]),g:F(t[2]+""+t[2]),b:F(t[3]+""+t[3]),format:r?"name":"hex"};return!1}(e));"object"==typeof e&&(z(e.r)&&z(e.g)&&z(e.b)?(h=e.r,p=e.g,g=e.b,t={r:255*I(h,255),g:255*I(p,255),b:255*I(g,255)},d=!0,f="%"===String(e.r).substr(-1)?"prgb":"rgb"):z(e.h)&&z(e.s)&&z(e.v)?(n=N(e.s),o=N(e.v),t=function(e,t,r){e=6*I(e,360),t=I(t,100),r=I(r,100);var n=i.floor(e),a=e-n,s=r*(1-t),o=r*(1-a*t),l=r*(1-(1-a)*t),u=n%6;return{r:255*[r,o,s,s,l,r][u],g:255*[l,r,r,o,s,s][u],b:255*[s,s,l,r,r,o][u]}}(e.h,n,o),d=!0,f="hsv"):z(e.h)&&z(e.s)&&z(e.l)&&(n=N(e.s),l=N(e.l),t=function(e,t,r){var n,i,a;function s(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=I(e,360),t=I(t,100),r=I(r,100),0===t)n=i=a=r;else{var o=r<.5?r*(1+t):r+t-r*t,l=2*r-o;n=s(l,o,e+1/3),i=s(l,o,e),a=s(l,o,e-1/3)}return{r:255*n,g:255*i,b:255*a}}(e.h,n,l),d=!0,f="hsl"),e.hasOwnProperty("a")&&(r=e.a));var h,p,g;return r=R(r),{ok:d,format:e.format||f,r:u(255,c(t.r,0)),g:u(255,c(t.g,0)),b:u(255,c(t.b,0)),a:r}}(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=l(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=l(this._r)),this._g<1&&(this._g=l(this._g)),this._b<1&&(this._b=l(this._b)),this._ok=r.ok,this._tc_id=o++}function h(e,t,r){e=I(e,255),t=I(t,255),r=I(r,255);var n,i,a=c(e,t,r),s=u(e,t,r),o=(a+s)/2;if(a==s)n=i=0;else{var l=a-s;switch(i=o>.5?l/(2-a-s):l/(a+s),a){case e:n=(t-r)/l+(t<r?6:0);break;case t:n=(r-e)/l+2;break;case r:n=(e-t)/l+4}n/=6}return{h:n,s:i,l:o}}function p(e,t,r){e=I(e,255),t=I(t,255),r=I(r,255);var n,i,a=c(e,t,r),s=u(e,t,r),o=a,l=a-s;if(i=0===a?0:l/a,a==s)n=0;else{switch(a){case e:n=(t-r)/l+(t<r?6:0);break;case t:n=(r-e)/l+2;break;case r:n=(e-t)/l+4}n/=6}return{h:n,s:i,v:o}}function g(e,t,r,n){var i=[P(l(e).toString(16)),P(l(t).toString(16)),P(l(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function m(e,t,r,n){return[P(B(n)),P(l(e).toString(16)),P(l(t).toString(16)),P(l(r).toString(16))].join("")}function v(e,t){t=0===t?0:t||10;var r=f(e).toHsl();return r.s-=t/100,r.s=M(r.s),f(r)}function y(e,t){t=0===t?0:t||10;var r=f(e).toHsl();return r.s+=t/100,r.s=M(r.s),f(r)}function b(e){return f(e).desaturate(100)}function E(e,t){t=0===t?0:t||10;var r=f(e).toHsl();return r.l+=t/100,r.l=M(r.l),f(r)}function x(e,t){t=0===t?0:t||10;var r=f(e).toRgb();return r.r=c(0,u(255,r.r-l(-t/100*255))),r.g=c(0,u(255,r.g-l(-t/100*255))),r.b=c(0,u(255,r.b-l(-t/100*255))),f(r)}function S(e,t){t=0===t?0:t||10;var r=f(e).toHsl();return r.l-=t/100,r.l=M(r.l),f(r)}function T(e,t){var r=f(e).toHsl(),n=(r.h+t)%360;return r.h=n<0?360+n:n,f(r)}function k(e){var t=f(e).toHsl();return t.h=(t.h+180)%360,f(t)}function w(e){var t=f(e).toHsl(),r=t.h;return[f(e),f({h:(r+120)%360,s:t.s,l:t.l}),f({h:(r+240)%360,s:t.s,l:t.l})]}function C(e){var t=f(e).toHsl(),r=t.h;return[f(e),f({h:(r+90)%360,s:t.s,l:t.l}),f({h:(r+180)%360,s:t.s,l:t.l}),f({h:(r+270)%360,s:t.s,l:t.l})]}function L(e){var t=f(e).toHsl(),r=t.h;return[f(e),f({h:(r+72)%360,s:t.s,l:t.l}),f({h:(r+216)%360,s:t.s,l:t.l})]}function A(e,t,r){t=t||6,r=r||30;var n=f(e).toHsl(),i=360/r,a=[f(e)];for(n.h=(n.h-(i*t>>1)+720)%360;--t;)n.h=(n.h+i)%360,a.push(f(n));return a}function D(e,t){t=t||6;for(var r=f(e).toHsv(),n=r.h,i=r.s,a=r.v,s=[],o=1/t;t--;)s.push(f({h:n,s:i,v:a})),a=(a+o)%1;return s}f.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,r,n=this.toRgb();return e=n.r/255,t=n.g/255,r=n.b/255,.2126*(e<=.03928?e/12.92:i.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:i.pow((t+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:i.pow((r+.055)/1.055,2.4))},setAlpha:function(e){return this._a=R(e),this._roundA=l(100*this._a)/100,this},toHsv:function(){var e=p(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=p(this._r,this._g,this._b),t=l(360*e.h),r=l(100*e.s),n=l(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=h(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=h(this._r,this._g,this._b),t=l(360*e.h),r=l(100*e.s),n=l(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return g(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,i){var a=[P(l(e).toString(16)),P(l(t).toString(16)),P(l(r).toString(16)),P(B(n))];if(i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:l(this._r),g:l(this._g),b:l(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+l(this._r)+", "+l(this._g)+", "+l(this._b)+")":"rgba("+l(this._r)+", "+l(this._g)+", "+l(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:l(100*I(this._r,255))+"%",g:l(100*I(this._g,255))+"%",b:l(100*I(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+l(100*I(this._r,255))+"%, "+l(100*I(this._g,255))+"%, "+l(100*I(this._b,255))+"%)":"rgba("+l(100*I(this._r,255))+"%, "+l(100*I(this._g,255))+"%, "+l(100*I(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(_[g(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+m(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var i=f(e);r="#"+m(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return f(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(E,arguments)},brighten:function(){return this._applyModification(x,arguments)},darken:function(){return this._applyModification(S,arguments)},desaturate:function(){return this._applyModification(v,arguments)},saturate:function(){return this._applyModification(y,arguments)},greyscale:function(){return this._applyModification(b,arguments)},spin:function(){return this._applyModification(T,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(A,arguments)},complement:function(){return this._applyCombination(k,arguments)},monochromatic:function(){return this._applyCombination(D,arguments)},splitcomplement:function(){return this._applyCombination(L,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(C,arguments)}},f.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:N(e[n]));e=r}return f(e,t)},f.equals=function(e,t){return!(!e||!t)&&f(e).toRgbString()==f(t).toRgbString()},f.random=function(){return f.fromRatio({r:d(),g:d(),b:d()})},f.mix=function(e,t,r){r=0===r?0:r||50;var n=f(e).toRgb(),i=f(t).toRgb(),a=r/100;return f({r:(i.r-n.r)*a+n.r,g:(i.g-n.g)*a+n.g,b:(i.b-n.b)*a+n.b,a:(i.a-n.a)*a+n.a})},f.readability=function(e,t){var r=f(e),n=f(t);return(i.max(r.getLuminance(),n.getLuminance())+.05)/(i.min(r.getLuminance(),n.getLuminance())+.05)},f.isReadable=function(e,t,r){var n,i,a=f.readability(e,t);switch(i=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":i=a>=4.5;break;case"AAlarge":i=a>=3;break;case"AAAsmall":i=a>=7}return i},f.mostReadable=function(e,t,r){var n,i,a,s,o=null,l=0;i=(r=r||{}).includeFallbackColors,a=r.level,s=r.size;for(var u=0;u<t.length;u++)(n=f.readability(e,t[u]))>l&&(l=n,o=f(t[u]));return f.isReadable(e,o,{level:a,size:s})||!i?o:(r.includeFallbackColors=!1,f.mostReadable(e,["#fff","#000"],r))};var O=f.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},_=f.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(O);function R(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function I(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var r=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=u(t,c(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),i.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function M(e){return u(1,c(0,e))}function F(e){return parseInt(e,16)}function P(e){return 1==e.length?"0"+e:""+e}function N(e){return e<=1&&(e=100*e+"%"),e}function B(e){return i.round(255*parseFloat(e)).toString(16)}function j(e){return F(e)/255}var U,H,G,W=(H="[\\s|\\(]+("+(U="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+U+")[,|\\s]+("+U+")\\s*\\)?",G="[\\s|\\(]+("+U+")[,|\\s]+("+U+")[,|\\s]+("+U+")[,|\\s]+("+U+")\\s*\\)?",{CSS_UNIT:new RegExp(U),rgb:new RegExp("rgb"+H),rgba:new RegExp("rgba"+G),hsl:new RegExp("hsl"+H),hsla:new RegExp("hsla"+G),hsv:new RegExp("hsv"+H),hsva:new RegExp("hsva"+G),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function z(e){return!!W.CSS_UNIT.exec(e)}e.exports?e.exports=f:void 0===(n=function(){return f}.call(t,r,t,e))||(e.exports=n)}(Math)},bT9E:
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./node_modules/rc-util/es/omit.js ***!
|
|
|
\*****************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ");function i(e,t){var r=Object(n.a)({},e);return Array.isArray(t)&&t.forEach((function(e){delete r[e]})),r}},c5Ni:
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./node_modules/codemirror/theme/blackboard.css ***!
|
|
|
\******************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){},dejd:
|
|
|
/*!***********************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/toolbar/index.less ***!
|
|
|
\***********************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){},dmUQ:
|
|
|
/*!**************************************************************!*\
|
|
|
!*** ./node_modules/rc-input-number/es/index.js + 1 modules ***!
|
|
|
\**************************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,r){"use strict";var n=r("Ff2n"),i=r("rePB"),a=r("1OyB"),s=r("vuIU"),o=r("Ji7U"),l=r("md7G"),u=r("foSv"),c=r("q1tI"),d=r.n(c),f=r("TSYQ"),h=r.n(f),p=r("4IlW");function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){Object(i.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Object(u.a)(e);if(t){var i=Object(u.a)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Object(l.a)(this,r)}}function y(){}function b(e){e.preventDefault()}var E=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,x=function(e){return null!=e},S=function(e,t){return t===e||"number"==typeof t&&"number"==typeof e&&isNaN(t)&&isNaN(e)},T=function(e){Object(o.a)(r,e);var t=v(r);function r(e){var n;Object(a.a)(this,r),(n=t.call(this,e)).onKeyDown=function(e){var t=n.props,r=t.onKeyDown,i=t.onPressEnter;if(e.keyCode===p.a.UP){var a=n.getRatio(e);n.up(e,a,null),n.stop()}else if(e.keyCode===p.a.DOWN){var s=n.getRatio(e);n.down(e,s,null),n.stop()}else e.keyCode===p.a.ENTER&&i&&i(e);if(n.recordCursorPosition(),n.lastKeyCode=e.keyCode,r){for(var o=arguments.length,l=new Array(o>1?o-1:0),u=1;u<o;u++)l[u-1]=arguments[u];r.apply(void 0,[e].concat(l))}},n.onKeyUp=function(e){var t=n.props.onKeyUp;if(n.stop(),n.recordCursorPosition(),t){for(var r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];t.apply(void 0,[e].concat(i))}},n.onChange=function(e){var t=n.props.onChange;n.state.focused&&(n.inputting=!0),n.rawInput=n.props.parser(n.getValueFromEvent(e)),n.setState({inputValue:n.rawInput}),t(n.toNumber(n.rawInput))},n.onMouseUp=function(){var e=n.props.onMouseUp;n.recordCursorPosition(),e&&e.apply(void 0,arguments)},n.onFocus=function(){var e;n.setState({focused:!0}),(e=n.props).onFocus.apply(e,arguments)},n.onBlur=function(){var e=n.props.onBlur;n.inputting=!1,n.setState({focused:!1});var t=n.getCurrentValidValue(n.state.inputValue),r=n.setValue(t,y);if(e){var i=n.input.value,a=n.getInputDisplayValue({focus:!1,value:r});n.input.value=a?Number(a):a,e.apply(void 0,arguments),n.input.value=i}},n.getRatio=function(e){var t=1;return e.metaKey||e.ctrlKey?t=.1:e.shiftKey&&(t=10),t},n.getFullNum=function(e){return isNaN(e)?e:/e/i.test(String(e))?Number(e).toFixed(18).replace(/\.?0+$/,""):e},n.getPrecision=function(e){if(x(n.props.precision))return n.props.precision;var t=String(e);if(t.indexOf("e-")>=0)return parseInt(t.slice(t.indexOf("e-")+2),10);var r=0;return t.indexOf(".")>=0&&(r=t.length-t.indexOf(".")-1),r},n.getInputDisplayValue=function(e){var t,r=e||n.state,i=r.focused,a=r.inputValue,s=r.value;null==(t=i?a:n.toPrecisionAsStep(s))&&(t="");var o=n.formatWrapper(t);return x(n.props.decimalSeparator)&&(o=o.toString().replace(".",n.props.decimalSeparator)),o},n.recordCursorPosition=function(){try{n.cursorStart=n.input.selectionStart,n.cursorEnd=n.input.selectionEnd,n.currentValue=n.input.value,n.cursorBefore=n.input.value.substring(0,n.cursorStart),n.cursorAfter=n.input.value.substring(n.cursorEnd)}catch(e){}},n.restoreByAfter=function(e){if(void 0===e)return!1;var t=n.input.value,r=t.lastIndexOf(e);if(-1===r)return!1;var i=n.cursorBefore.length;return n.lastKeyCode===p.a.DELETE&&n.cursorBefore.charAt(i-1)===e[0]?(n.fixCaret(i,i),!0):r+e.length===t.length&&(n.fixCaret(r,r),!0)},n.partRestoreByAfter=function(e){return void 0!==e&&Array.prototype.some.call(e,(function(t,r){var i=e.substring(r);return n.restoreByAfter(i)}))},n.isNotCompleteNumber=function(e){return isNaN(e)||""===e||null===e||e&&e.toString().indexOf(".")===e.toString().length-1},n.stop=function(){n.autoStepTimer&&clearTimeout(n.autoStepTimer)},n.down=function(e,t,r){n.pressingUpOrDown=!0,n.step("down",e,t,r)},n.up=function(e,t,r){n.pressingUpOrDown=!0,n.step("up",e,t,r)},n.saveInput=function(e){n.input=e};var i=e.value;void 0===i&&(i=e.defaultValue),n.state={focused:e.autoFocus};var s=n.getValidValue(n.toNumber(i));return n.state=m(m({},n.state),{},{inputValue:n.toPrecisionAsStep(s),value:s}),n}return Object(s.a)(r,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.value,n=t.onChange,i=t.max,a=t.min,s=this.state.focused;if(e){if(!S(e.value,r)||!S(e.max,i)||!S(e.min,a)){var o,l=s?r:this.getValidValue(r);o=this.pressingUpOrDown?l:this.inputting?this.rawInput:this.toPrecisionAsStep(l),this.setState({value:l,inputValue:o})}var u="value"in this.props?r:this.state.value;"max"in this.props&&e.max!==i&&"number"==typeof u&&u>i&&n&&n(i),"min"in this.props&&e.min!==a&&"number"==typeof u&&u<a&&n&&n(a)}try{if(void 0!==this.cursorStart&&this.state.focused)if(this.partRestoreByAfter(this.cursorAfter)||this.state.value===this.props.value){if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1)}}else{var c=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?c=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(c=this.cursorStart):c=this.input.value.length,this.fixCaret(c,c)}}catch(e){}this.lastKeyCode=null,this.pressingUpOrDown&&this.props.focusOnUpDown&&this.state.focused&&document.activeElement!==this.input&&this.focus()}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(e){var t=e;return t=""===t?"":this.isNotCompleteNumber(parseFloat(t))?this.state.value:this.getValidValue(t),this.toNumber(t)}},{key:"getValueFromEvent",value:function(e){var t=e.target.value.trim().replace(/。/g,".");return x(this.props.decimalSeparator)&&(t=t.replace(this.props.decimalSeparator,".")),t}},{key:"getValidValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props.min,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props.max,n=parseFloat(e);return isNaN(n)?e:(n<t&&(n=t),n>r&&(n=r),n)}},{key:"setValue",value:function(e,t){var r=this.props.precision,n=this.isNotCompleteNumber(parseFloat(e))?null:parseFloat(e),i=this.state.value,a=void 0===i?null:i,s=this.state.inputValue,o=void 0===s?null:s,l="number"==typeof n?n.toFixed(r):"".concat(n),u=n!==a||l!=="".concat(o);return"value"in this.props?(o=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:o},t)):this.setState({value:n,inputValue:this.toPrecisionAsStep(e)},t),u&&this.props.onChange(n),n}},{key:"getMaxPrecision",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=this.props,n=r.precision,i=r.step;if(x(n))return n;var a=this.getPrecision(t),s=this.getPrecision(i),o=this.getPrecision(e);return e?Math.max(o,a+s):a+s}},{key:"getPrecisionFactor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=this.getMaxPrecision(e,t);return Math.pow(10,r)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(e){return this.props.formatter?this.props.formatter(e):e}},{key:"toPrecisionAsStep",value:function(e){if(this.isNotCompleteNumber(e)||""===e)return e;var t=Math.abs(this.getMaxPrecision(e));return isNaN(t)?e.toString():Number(e).toFixed(t)}},{key:"toNumber",value:function(e){var t=this.props.precision,r=this.state.focused,n=e&&e.length>16&&r;return this.isNotCompleteNumber(e)||n?e:x(t)?Math.round(e*Math.pow(10,t))/Math.pow(10,t):Number(e)}},{key:"upStep",value:function(e,t){var r=this.props.step,n=this.getPrecisionFactor(e,t),i=Math.abs(this.getMaxPrecision(e,t)),a=((n*e+n*r*t)/n).toFixed(i);return this.toNumber(a)}},{key:"downStep",value:function(e,t){var r=this.props.step,n=this.getPrecisionFactor(e,t),i=Math.abs(this.getMaxPrecision(e,t)),a=((n*e-n*r*t)/n).toFixed(i);return this.toNumber(a)}},{key:"step",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3?arguments[3]:void 0;this.stop(),t&&(t.persist(),t.preventDefault());var a=this.props;if(!a.disabled){var s=this.getCurrentValidValue(this.state.inputValue)||0;if(!this.isNotCompleteNumber(s)){var o=this["".concat(e,"Step")](s,n),l=o>a.max||o<a.min;o>a.max?o=a.max:o<a.min&&(o=a.min),this.setValue(o,null),this.setState({focused:!0},(function(){r.pressingUpOrDown=!1})),l||(this.autoStepTimer=setTimeout((function(){r[e](t,n,!0)}),i?200:600))}}}},{key:"fixCaret",value:function(e,t){if(void 0!==e&&void 0!==t&&this.input&&this.input.value)try{var r=this.input.selectionStart,n=this.input.selectionEnd;e===r&&t===n||this.input.setSelectionRange(e,t)}catch(e){}}},{key:"render",value:function(){var e,t=this.props,r=t.prefixCls,a=t.disabled,s=t.readOnly,o=t.useTouch,l=t.autoComplete,u=t.upHandler,c=t.downHandler,f=t.className,p=t.max,g=t.min,m=t.style,v=t.title,E=t.onMouseEnter,x=t.onMouseLeave,S=t.onMouseOver,T=t.onMouseOut,k=t.required,w=t.onClick,C=t.tabIndex,L=t.type,A=t.placeholder,D=t.id,O=t.inputMode,_=t.pattern,R=t.step,I=t.maxLength,M=t.autoFocus,F=t.name,P=t.onPaste,N=t.onInput,B=Object(n.a)(t,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),j=this.state,U=j.value,H=j.focused,G=h()(r,(e={},Object(i.a)(e,f,!!f),Object(i.a)(e,"".concat(r,"-disabled"),a),Object(i.a)(e,"".concat(r,"-focused"),H),e)),W={};Object.keys(B).forEach((function(e){"data-"!==e.substr(0,5)&&"aria-"!==e.substr(0,5)&&"role"!==e||(W[e]=B[e])}));var z=!s&&!a,K=this.getInputDisplayValue(null),V=(U||0===U)&&(isNaN(U)||Number(U)>=p)||a||s,q=(U||0===U)&&(isNaN(U)||Number(U)<=g)||a||s,$=h()("".concat(r,"-handler"),"".concat(r,"-handler-up"),Object(i.a)({},"".concat(r,"-handler-up-disabled"),V)),Y=h()("".concat(r,"-handler"),"".concat(r,"-handler-down"),Object(i.a)({},"".concat(r,"-handler-down-disabled"),q)),X=o?{onTouchStart:V?y:this.up,onTouchEnd:this.stop}:{onMouseDown:V?y:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Z=o?{onTouchStart:q?y:this.down,onTouchEnd:this.stop}:{onMouseDown:q?y:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return d.a.createElement("div",{className:G,style:m,title:v,onMouseEnter:E,onMouseLeave:x,onMouseOver:S,onMouseOut:T,onFocus:function(){return null},onBlur:function(){return null}},d.a.createElement("div",{className:"".concat(r,"-handler-wrap")},d.a.createElement("span",Object.assign({unselectable:"on"},X,{role:"button","aria-label":"Increase Value","aria-disabled":V,className:$}),u||d.a.createElement("span",{unselectable:"on",className:"".concat(r,"-handler-up-inner"),onClick:b})),d.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Decrease Value","aria-disabled":q,className:Y}),c||d.a.createElement("span",{unselectable:"on",className:"".concat(r,"-handler-down-inner"),onClick:b}))),d.a.createElement("div",{className:"".concat(r,"-input-wrap")},d.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":g,"aria-valuemax":p,"aria-valuenow":U,required:k,type:L,placeholder:A,onPaste:P,onClick:w,onMouseUp:this.onMouseUp,className:"".concat(r,"-input"),tabIndex:C,autoComplete:l,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:z?this.onKeyDown:y,onKeyUp:z?this.onKeyUp:y,autoFocus:M,maxLength:I,readOnly:s,disabled:a,max:p,min:g,step:R,name:F,title:v,id:D,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(K),pattern:_,inputMode:O,onInput:N},W))))}}]),r}(d.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:E,min:-E,step:1,style:{},onChange:y,onKeyDown:y,onPressEnter:y,onFocus:y,onBlur:y,parser:function(e){return e.replace(/[^\w.-]+/g,"")},required:!1,autoComplete:"off"};var k=T;t.a=k},h78n:
|
|
|
/*!**********************************************************!*\
|
|
|
!*** ./node_modules/rc-progress/es/index.js + 3 modules ***!
|
|
|
\**********************************************************/
|
|
|
/*! exports provided: Line, Circle, default */
|
|
|
/*! exports used: Circle */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,r){"use strict";r.d(t,"a",(function(){return T}));var n=r("q1tI"),i=r.n(n),a=r("TSYQ"),s=r.n(a),o={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},l=function(e){var t=e.map((function(){return Object(n.useRef)()})),r=Object(n.useRef)();return Object(n.useEffect)((function(){var e=Date.now(),n=!1;Object.keys(t).forEach((function(i){var a=t[i].current;if(a){n=!0;var s=a.style;s.transitionDuration=".3s, .3s, .3s, .06s",r.current&&e-r.current<100&&(s.transitionDuration="0s, 0s")}})),n&&(r.current=Date.now())})),[t]};function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw a}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var h=function(e){var t=e.className,r=e.percent,n=e.prefixCls,a=e.strokeColor,o=e.strokeLinecap,d=e.strokeWidth,h=e.style,p=e.trailColor,g=e.trailWidth,m=e.transition,v=f(e,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete v.gapPosition;var y=Array.isArray(r)?r:[r],b=Array.isArray(a)?a:[a],E=c(l(y),1)[0],x=d/2,S=100-d/2,T="M ".concat("round"===o?x:0,",").concat(x,"\n L ").concat("round"===o?S:100,",").concat(x),k="0 0 100 ".concat(d),w=0;return i.a.createElement("svg",u({className:s()("".concat(n,"-line"),t),viewBox:k,preserveAspectRatio:"none",style:h},v),i.a.createElement("path",{className:"".concat(n,"-line-trail"),d:T,strokeLinecap:o,stroke:p,strokeWidth:g||d,fillOpacity:"0"}),y.map((function(e,t){var r={strokeDasharray:"".concat(e,"px, 100px"),strokeDashoffset:"-".concat(w,"px"),transition:m||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},a=b[t]||b[b.length-1];return w+=e,i.a.createElement("path",{key:t,className:"".concat(n,"-line-path"),d:T,strokeLinecap:o,stroke:a,strokeWidth:d,fillOpacity:"0",ref:E[t],style:r})})))};h.defaultProps=o;function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw a}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var y=0;function b(e){return+e.replace("%","")}function E(e){return Array.isArray(e)?e:[e]}function x(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0,s=50-n/2,o=0,l=-s,u=0,c=-2*s;switch(a){case"left":o=-s,l=0,u=2*s,c=0;break;case"right":o=s,l=0,u=-2*s,c=0;break;case"bottom":l=s,c=2*s}var d="M 50,50 m ".concat(o,",").concat(l,"\n a ").concat(s,",").concat(s," 0 1 1 ").concat(u,",").concat(-c,"\n a ").concat(s,",").concat(s," 0 1 1 ").concat(-u,",").concat(c),f=2*Math.PI*s,h={stroke:r,strokeDasharray:"".concat(t/100*(f-i),"px ").concat(f,"px"),strokeDashoffset:"-".concat(i/2+e/100*(f-i),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:d,pathStyle:h}}var S=function(e){var t,r=e.prefixCls,a=e.strokeWidth,o=e.trailWidth,u=e.gapDegree,c=e.gapPosition,d=e.trailColor,f=e.strokeLinecap,h=e.style,m=e.className,S=e.strokeColor,T=e.percent,k=v(e,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),w=Object(n.useMemo)((function(){return y+=1}),[]),C=x(0,100,d,a,u,c),L=C.pathString,A=C.pathStyle,D=E(T),O=E(S),_=O.find((function(e){return"[object Object]"===Object.prototype.toString.call(e)})),R=g(l(D),1)[0];return i.a.createElement("svg",p({className:s()("".concat(r,"-circle"),m),viewBox:"0 0 100 100",style:h},k),_&&i.a.createElement("defs",null,i.a.createElement("linearGradient",{id:"".concat(r,"-gradient-").concat(w),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(_).sort((function(e,t){return b(e)-b(t)})).map((function(e,t){return i.a.createElement("stop",{key:t,offset:e,stopColor:_[e]})})))),i.a.createElement("path",{className:"".concat(r,"-circle-trail"),d:L,stroke:d,strokeLinecap:f,strokeWidth:o||a,fillOpacity:"0",style:A}),(t=0,D.map((function(e,n){var s=O[n]||O[O.length-1],o="[object Object]"===Object.prototype.toString.call(s)?"url(#".concat(r,"-gradient-").concat(w,")"):"",l=x(t,e,s,a,u,c);return t+=e,i.a.createElement("path",{key:n,className:"".concat(r,"-circle-path"),d:l.pathString,stroke:o,strokeLinecap:f,strokeWidth:a,opacity:0===e?0:1,fillOpacity:"0",style:l.pathStyle,ref:R[n]})}))).reverse())};S.defaultProps=o;var T=S},kSUc:
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./src/components/markdown-editor/index.less ***!
|
|
|
\***************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){},lZu9:
|
|
|
/*!***********************************************************!*\
|
|
|
!*** ./node_modules/codemirror/mode/markdown/markdown.js ***!
|
|
|
\***********************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){!function(e){"use strict";e.defineMode("markdown",(function(t,r){var n=e.getMode(t,"text/html"),i="null"==n.name;void 0===r.highlightFormatting&&(r.highlightFormatting=!1),void 0===r.maxBlockquoteDepth&&(r.maxBlockquoteDepth=0),void 0===r.taskLists&&(r.taskLists=!1),void 0===r.strikethrough&&(r.strikethrough=!1),void 0===r.emoji&&(r.emoji=!1),void 0===r.fencedCodeBlockHighlighting&&(r.fencedCodeBlockHighlighting=!0),void 0===r.fencedCodeBlockDefaultMode&&(r.fencedCodeBlockDefaultMode="text/plain"),void 0===r.xml&&(r.xml=!0),void 0===r.tokenTypeOverrides&&(r.tokenTypeOverrides={});var a={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var s in a)a.hasOwnProperty(s)&&r.tokenTypeOverrides[s]&&(a[s]=r.tokenTypeOverrides[s]);var o=/^([*\-_])(?:\s*\1){2,}\s*$/,l=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,u=/^\[(x| )\](?=\s)/i,c=r.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,d=/^ {0,3}(?:\={1,}|-{2,})\s*$/,f=/^[^#!\[\]*_\\<>` "'(~:]+/,h=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,p=/^\s*\[[^\]]+?\]:.*$/,g=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/;function m(e,t,r){return t.f=t.inline=r,r(e,t)}function v(e,t,r){return t.f=t.block=r,r(e,t)}function y(t){if(t.linkTitle=!1,t.linkHref=!1,t.linkText=!1,t.em=!1,t.strong=!1,t.strikethrough=!1,t.quote=0,t.indentedCode=!1,t.f==E){var r=i;if(!r){var a=e.innerMode(n,t.htmlState);r="xml"==a.mode.name&&null===a.state.tagStart&&!a.state.context&&a.state.tokenize.isInText}r&&(t.f=k,t.block=b,t.htmlState=null)}return t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.prevLine=t.thisLine,t.thisLine={stream:null},null}function b(n,i){var s,f=n.column()===i.indentation,g=!(s=i.prevLine.stream)||!/\S/.test(s.string),v=i.indentedCode,y=i.prevLine.hr,b=!1!==i.list,E=(i.listStack[i.listStack.length-1]||0)+3;i.indentedCode=!1;var T=i.indentation;if(null===i.indentationDiff&&(i.indentationDiff=i.indentation,b)){for(i.list=null;T<i.listStack[i.listStack.length-1];)i.listStack.pop(),i.listStack.length?i.indentation=i.listStack[i.listStack.length-1]:i.list=!1;!1!==i.list&&(i.indentationDiff=T-i.listStack[i.listStack.length-1])}var k=!(g||y||i.prevLine.header||b&&v||i.prevLine.fencedCodeEnd),w=(!1===i.list||y||g)&&i.indentation<=E&&n.match(o),C=null;if(i.indentationDiff>=4&&(v||i.prevLine.fencedCodeEnd||i.prevLine.header||g))return n.skipToEnd(),i.indentedCode=!0,a.code;if(n.eatSpace())return null;if(f&&i.indentation<=E&&(C=n.match(c))&&C[1].length<=6)return i.quote=0,i.header=C[1].length,i.thisLine.header=!0,r.highlightFormatting&&(i.formatting="header"),i.f=i.inline,S(i);if(i.indentation<=E&&n.eat(">"))return i.quote=f?1:i.quote+1,r.highlightFormatting&&(i.formatting="quote"),n.eatSpace(),S(i);if(!w&&!i.setext&&f&&i.indentation<=E&&(C=n.match(l))){var L=C[1]?"ol":"ul";return i.indentation=T+n.current().length,i.list=!0,i.quote=0,i.listStack.push(i.indentation),i.em=!1,i.strong=!1,i.code=!1,i.strikethrough=!1,r.taskLists&&n.match(u,!1)&&(i.taskList=!0),i.f=i.inline,r.highlightFormatting&&(i.formatting=["list","list-"+L]),S(i)}return f&&i.indentation<=E&&(C=n.match(h,!0))?(i.quote=0,i.fencedEndRE=new RegExp(C[1]+"+ *$"),i.localMode=r.fencedCodeBlockHighlighting&&function(r){if(e.findModeByName){var n=e.findModeByName(r);n&&(r=n.mime||n.mimes[0])}var i=e.getMode(t,r);return"null"==i.name?null:i}(C[2]||r.fencedCodeBlockDefaultMode),i.localMode&&(i.localState=e.startState(i.localMode)),i.f=i.block=x,r.highlightFormatting&&(i.formatting="code-block"),i.code=-1,S(i)):i.setext||!(k&&b||i.quote||!1!==i.list||i.code||w||p.test(n.string))&&(C=n.lookAhead(1))&&(C=C.match(d))?(i.setext?(i.header=i.setext,i.setext=0,n.skipToEnd(),r.highlightFormatting&&(i.formatting="header")):(i.header="="==C[0].charAt(0)?1:2,i.setext=i.header),i.thisLine.header=!0,i.f=i.inline,S(i)):w?(n.skipToEnd(),i.hr=!0,i.thisLine.hr=!0,a.hr):"["===n.peek()?m(n,i,A):m(n,i,i.inline)}function E(t,r){var a=n.token(t,r.htmlState);if(!i){var s=e.innerMode(n,r.htmlState);("xml"==s.mode.name&&null===s.state.tagStart&&!s.state.context&&s.state.tokenize.isInText||r.md_inside&&t.current().indexOf(">")>-1)&&(r.f=k,r.block=b,r.htmlState=null)}return a}function x(e,t){var n,i=t.listStack[t.listStack.length-1]||0,s=t.indentation<i,o=i+3;return t.fencedEndRE&&t.indentation<=o&&(s||e.match(t.fencedEndRE))?(r.highlightFormatting&&(t.formatting="code-block"),s||(n=S(t)),t.localMode=t.localState=null,t.block=b,t.f=k,t.fencedEndRE=null,t.code=0,t.thisLine.fencedCodeEnd=!0,s?v(e,t,t.block):n):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),a.code)}function S(e){var t=[];if(e.formatting){t.push(a.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var n=0;n<e.formatting.length;n++)t.push(a.formatting+"-"+e.formatting[n]),"header"===e.formatting[n]&&t.push(a.formatting+"-"+e.formatting[n]+"-"+e.header),"quote"===e.formatting[n]&&(!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?t.push(a.formatting+"-"+e.formatting[n]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(a.linkHref,"url"):(e.strong&&t.push(a.strong),e.em&&t.push(a.em),e.strikethrough&&t.push(a.strikethrough),e.emoji&&t.push(a.emoji),e.linkText&&t.push(a.linkText),e.code&&t.push(a.code),e.image&&t.push(a.image),e.imageAltText&&t.push(a.imageAltText,"link"),e.imageMarker&&t.push(a.imageMarker)),e.header&&t.push(a.header,a.header+"-"+e.header),e.quote&&(t.push(a.quote),!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?t.push(a.quote+"-"+e.quote):t.push(a.quote+"-"+r.maxBlockquoteDepth)),!1!==e.list){var i=(e.listStack.length-1)%3;i?1===i?t.push(a.list2):t.push(a.list3):t.push(a.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function T(e,t){if(e.match(f,!0))return S(t)}function k(t,i){var s=i.text(t,i);if(void 0!==s)return s;if(i.list)return i.list=null,S(i);if(i.taskList)return" "===t.match(u,!0)[1]?i.taskOpen=!0:i.taskClosed=!0,r.highlightFormatting&&(i.formatting="task"),i.taskList=!1,S(i);if(i.taskOpen=!1,i.taskClosed=!1,i.header&&t.match(/^#+$/,!0))return r.highlightFormatting&&(i.formatting="header"),S(i);var o=t.next();if(i.linkTitle){i.linkTitle=!1;var l=o;"("===o&&(l=")");var c="^\\s*(?:[^"+(l=(l+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+l;if(t.match(new RegExp(c),!0))return a.linkHref}if("`"===o){var d=i.formatting;r.highlightFormatting&&(i.formatting="code"),t.eatWhile("`");var f=t.current().length;if(0!=i.code||i.quote&&1!=f){if(f==i.code){var h=S(i);return i.code=0,h}return i.formatting=d,S(i)}return i.code=f,S(i)}if(i.code)return S(i);if("\\"===o&&(t.next(),r.highlightFormatting)){var p=S(i),m=a.formatting+"-escape";return p?p+" "+m:m}if("!"===o&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return i.imageMarker=!0,i.image=!0,r.highlightFormatting&&(i.formatting="image"),S(i);if("["===o&&i.imageMarker&&t.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return i.imageMarker=!1,i.imageAltText=!0,r.highlightFormatting&&(i.formatting="image"),S(i);if("]"===o&&i.imageAltText){r.highlightFormatting&&(i.formatting="image");var p=S(i);return i.imageAltText=!1,i.image=!1,i.inline=i.f=C,p}if("["===o&&!i.image)return i.linkText&&t.match(/^.*?\]/)||(i.linkText=!0,r.highlightFormatting&&(i.formatting="link")),S(i);if("]"===o&&i.linkText){r.highlightFormatting&&(i.formatting="link");var p=S(i);return i.linkText=!1,i.inline=i.f=t.match(/\(.*?\)| ?\[.*?\]/,!1)?C:k,p}if("<"===o&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return i.f=i.inline=w,r.highlightFormatting&&(i.formatting="link"),(p=S(i))?p+=" ":p="",p+a.linkInline;if("<"===o&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return i.f=i.inline=w,r.highlightFormatting&&(i.formatting="link"),(p=S(i))?p+=" ":p="",p+a.linkEmail;if(r.xml&&"<"===o&&t.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var y=t.string.indexOf(">",t.pos);if(-1!=y){var b=t.string.substring(t.start,y);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(b)&&(i.md_inside=!0)}return t.backUp(1),i.htmlState=e.startState(n),v(t,i,E)}if(r.xml&&"<"===o&&t.match(/^\/\w*?>/))return i.md_inside=!1,"tag";if("*"===o||"_"===o){for(var x=1,T=1==t.pos?" ":t.string.charAt(t.pos-2);x<3&&t.eat(o);)x++;var L=t.peek()||" ",A=!/\s/.test(L)&&(!g.test(L)||/\s/.test(T)||g.test(T)),D=!/\s/.test(T)&&(!g.test(T)||/\s/.test(L)||g.test(L)),O=null,_=null;if(x%2&&(i.em||!A||"*"!==o&&D&&!g.test(T)?i.em!=o||!D||"*"!==o&&A&&!g.test(L)||(O=!1):O=!0),x>1&&(i.strong||!A||"*"!==o&&D&&!g.test(T)?i.strong!=o||!D||"*"!==o&&A&&!g.test(L)||(_=!1):_=!0),null!=_||null!=O)return r.highlightFormatting&&(i.formatting=null==O?"strong":null==_?"em":"strong em"),!0===O&&(i.em=o),!0===_&&(i.strong=o),h=S(i),!1===O&&(i.em=!1),!1===_&&(i.strong=!1),h}else if(" "===o&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return S(i);t.backUp(1)}if(r.strikethrough)if("~"===o&&t.eatWhile(o)){if(i.strikethrough)return r.highlightFormatting&&(i.formatting="strikethrough"),h=S(i),i.strikethrough=!1,h;if(t.match(/^[^\s]/,!1))return i.strikethrough=!0,r.highlightFormatting&&(i.formatting="strikethrough"),S(i)}else if(" "===o&&t.match(/^~~/,!0)){if(" "===t.peek())return S(i);t.backUp(2)}if(r.emoji&&":"===o&&t.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){i.emoji=!0,r.highlightFormatting&&(i.formatting="emoji");var R=S(i);return i.emoji=!1,R}return" "===o&&(t.match(/^ +$/,!1)?i.trailingSpace++:i.trailingSpace&&(i.trailingSpaceNewLine=!0)),S(i)}function w(e,t){if(">"===e.next()){t.f=t.inline=k,r.highlightFormatting&&(t.formatting="link");var n=S(t);return n?n+=" ":n="",n+a.linkInline}return e.match(/^[^>]+/,!0),a.linkInline}function C(e,t){if(e.eatSpace())return null;var n,i=e.next();return"("===i||"["===i?(t.f=t.inline=(n="("===i?")":"]",function(e,t){if(e.next()===n){t.f=t.inline=k,r.highlightFormatting&&(t.formatting="link-string");var i=S(t);return t.linkHref=!1,i}return e.match(L[n]),t.linkHref=!0,S(t)}),r.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,S(t)):"error"}var L={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function A(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=D,e.next(),r.highlightFormatting&&(t.formatting="link"),t.linkText=!0,S(t)):m(e,t,k)}function D(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=O,r.highlightFormatting&&(t.formatting="link");var n=S(t);return t.linkText=!1,n}return e.match(/^([^\]\\]|\\.)+/,!0),a.linkText}function O(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=k,a.linkHref+" url")}var _={startState:function(){return{f:b,prevLine:{stream:null},thisLine:{stream:null},block:b,htmlState:null,indentation:0,inline:k,text:T,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(n,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkText:t.linkText,linkTitle:t.linkTitle,linkHref:t.linkHref,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,emoji:t.emoji,header:t.header,setext:t.setext,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedEndRE:t.fencedEndRE}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine.stream){if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0))return y(t),null;if(t.prevLine=t.thisLine,t.thisLine={stream:e},t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,!t.localState&&(t.f=t.block,t.f!=E)){var r=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentation=r,t.indentationDiff=null,r>0)return null}}return t.f(e,t)},innerMode:function(e){return e.block==E?{state:e.htmlState,mode:n}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:_}},indent:function(t,r,i){return t.block==E&&n.indent?n.indent(t.htmlState,r,i):t.localState&&t.localMode.indent?t.localMode.indent(t.localState,r,i):e.Pass},blankLine:y,getType:S,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return _}),"xml"),e.defineMIME("text/markdown","markdown"),e.defineMIME("text/x-markdown","markdown")}(r(/*! ../../lib/codemirror */"VrN/"),r(/*! ../xml/xml */"1eCo"),r(/*! ../meta */"8EBN"))},osHv:
|
|
|
/*!********************************************************!*\
|
|
|
!*** ./node_modules/codemirror/addon/fold/xml-fold.js ***!
|
|
|
\********************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! all exports used */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){!function(e){"use strict";var t=e.Pos;function r(e,t){return e.line-t.line||e.ch-t.ch}var n="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i=new RegExp("<(/?)(["+n+"]["+n+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function a(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?Math.max(n.from,e.firstLine()):e.firstLine(),this.max=n?Math.min(n.to-1,e.lastLine()):e.lastLine()}function s(e,r){var n=e.cm.getTokenTypeAt(t(e.line,r));return n&&/\btag\b/.test(n)}function o(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function l(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function u(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(o(e))continue;return}if(s(e,t+1)){var r=e.text.lastIndexOf("/",t),n=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t+1}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(l(e))continue;return}if(s(e,t+1)){i.lastIndex=t,e.ch=t;var r=i.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function d(e){for(;;){i.lastIndex=e.ch;var t=i.exec(e.text);if(!t){if(o(e))continue;return}if(s(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function f(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(l(e))continue;return}if(s(e,t+1)){var r=e.text.lastIndexOf("/",t),n=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t}}function h(e,r){for(var n=[];;){var i,a=d(e),s=e.line,o=e.ch-(a?a[0].length:0);if(!a||!(i=u(e)))return;if("selfClose"!=i)if(a[1]){for(var l=n.length-1;l>=0;--l)if(n[l]==a[2]){n.length=l;break}if(l<0&&(!r||r==a[2]))return{tag:a[2],from:t(s,o),to:t(e.line,e.ch)}}else n.push(a[2])}}function p(e,r){for(var n=[];;){var i=f(e);if(!i)return;if("selfClose"!=i){var a=e.line,s=e.ch,o=c(e);if(!o)return;if(o[1])n.push(o[2]);else{for(var l=n.length-1;l>=0;--l)if(n[l]==o[2]){n.length=l;break}if(l<0&&(!r||r==o[2]))return{tag:o[2],from:t(e.line,e.ch),to:t(a,s)}}}else c(e)}}e.registerHelper("fold","xml",(function(e,n){for(var i=new a(e,n.line,0);;){var s=d(i);if(!s||i.line!=n.line)return;var o=u(i);if(!o)return;if(!s[1]&&"selfClose"!=o){var l=t(i.line,i.ch),c=h(i,s[2]);return c&&r(c.from,l)>0?{from:l,to:c.from}:null}}})),e.findMatchingTag=function(e,n,i){var s=new a(e,n.line,n.ch,i);if(-1!=s.text.indexOf(">")||-1!=s.text.indexOf("<")){var o=u(s),l=o&&t(s.line,s.ch),d=o&&c(s);if(o&&d&&!(r(s,n)>0)){var f={from:t(s.line,s.ch),to:l,tag:d[2]};return"selfClose"==o?{open:f,close:null,at:"open"}:d[1]?{open:p(s,d[2]),close:f,at:"close"}:{open:f,close:h(s=new a(e,l.line,l.ch,i),d[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,r,n){for(var i=new a(e,t.line,t.ch,r);;){var s=p(i,n);if(!s)break;var o=h(new a(e,t.line,t.ch,r),s.tag);if(o)return{open:s,close:o}}},e.scanForClosingTag=function(e,t,r,n){return h(new a(e,t.line,t.ch,n?{from:0,to:n}:null),r)}}(r(/*! ../../lib/codemirror */"VrN/"))},p0QG:
|
|
|
/*!********************************************!*\
|
|
|
!*** ./src/pages/Three/index.less?modules ***!
|
|
|
\********************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){e.exports={flex_box_center:"flex_box_center___2axlI",flex_space_between:"flex_space_between___F6m1U",flex_box_vertical_center:"flex_box_vertical_center___2GovZ",flex_box_center_end:"flex_box_center_end___2h9j0",flex_box_column:"flex_box_column___1kuIs",SubMentItem:"SubMentItem___34z-Y",MenuItem:"MenuItem___1bbPM",wrp:"wrp___3LRhb",classroomInfo:"classroomInfo___Ohxoq",title:"title___22ZLP",titleLeft:"titleLeft___1MP-h",titleRight:"titleRight___3zsz9",classroomUser:"classroomUser___1ePAN",headPic:"headPic___2lEg_",teacherInfo:"teacherInfo___3C0Dn",classroomDesc:"classroomDesc____QVZX",classroomDescBg:"classroomDescBg___1e7L7",joinCouses:"joinCouses___2G4vP",bg:"bg___2QojS",leftMenus:"leftMenus___34tjX",titleSelected:"titleSelected___K6QwW",menuText:"menuText___3qMqH",totalCount:"totalCount___R2q38",actions:"actions___26Ww0",task_count:"task_count___3UQ1V",container:"container___2EGM4",leftMenuActions:"leftMenuActions___3_J-1"}},p5ED:
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./src/components/PreviewAll/index.tsx ***!
|
|
|
\*********************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,r){"use strict";r(/*! antd/es/button/style */"+L6B");var n=r(/*! antd/es/button */"2/Rp"),i=(r(/*! antd/es/tooltip/style */"5Dmo"),r(/*! antd/es/tooltip */"3S7+")),a=r(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),s=r(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),o=r(/*! react */"q1tI"),l=r.n(o),u=r(/*! ./index.less?modules */"vHTk"),c=r.n(u),d=r(/*! @ant-design/icons */"yEEn"),f=r(/*! @/components/monaco-editor */"ZW9T"),h=r(/*! @/utils/util */"1vsH");t.a=function(e){var t=e.name,r=e.data,u=(e.theme,e.type),p=e.filename,g=e.monacoEditor,m=e.className,v=e.style,y=e.close,b=e.onClose,E=e.hasMask,x=Object(o.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),S=Object(s.a)(x,2),T=(S[0],S[1],Object(o.useState)("")),k=Object(s.a)(T,2),w=(k[0],k[1]),C=Object(o.useRef)();p&&(g.filename=p),Object(o.useEffect)((function(){var e,t,r=null===(e=document.cookie)||void 0===e||null===(t=e.replace(/\s/g,""))||void 0===t?void 0:t.split(";");null==r||r.map((function(e){var t=e.split("=");"_educoder_session"===t[0]&&w(t[1])}))}),[]);var L=function(){r.startsWith("http")||r.startsWith("/")?A():Object(h.x)(p||"educoder",r,p)},A=function(){Object(h.v)(p||t,r)};return console.log("data:",r,"fileanme:",p," name:",t),l.a.createElement("div",{style:Object(a.a)({},v||{}),className:"".concat(E&&c.a.bgBlack," ").concat(u?c.a.wrp:"hide")},y&&l.a.createElement("div",{className:c.a.close,ref:C},l.a.createElement(i.a,{title:"点击下载此文件",getPopupContainer:function(){return C.current}},l.a.createElement("span",{onClick:A},l.a.createElement("i",{className:"icon-quxiaozhiding"}))),l.a.createElement(i.a,{title:"关闭",getPopupContainer:function(){return C.current}},l.a.createElement("span",{className:"",onClick:b},l.a.createElement("i",{className:"icon-guanbi1"})))),l.a.createElement("div",{className:"".concat(c.a[m]," ").concat(m," ").concat(c.a.monaco," ").concat("txt"===u?"show":"hide")},"txt"===u&&l.a.createElement(f.b,g)),"audio"===u&&l.a.createElement("audio",{src:"".concat(null!=r&&r.startsWith("/")||(null==r?void 0:r.indexOf("https://"))>-1?r:"data:audio/mp3;base64,").concat(r),autoPlay:!0}),"video"===u&&l.a.createElement(l.a.Fragment,null,null!=r&&r.startsWith("/")?l.a.createElement("video",{controls:!0,src:"".concat(r),autoPlay:!0}):l.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(r),autoPlay:!0})),"pdf"===u&&l.a.createElement("embed",{className:c.a.embed,src:r}),"image"===u&&l.a.createElement(l.a.Fragment,null,l.a.createElement("img",{src:"".concat(null!=r&&r.startsWith("/")||(null==r?void 0:r.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(r)})),"other"===u&&l.a.createElement("div",null,l.a.createElement(n.a,{type:"primary",size:"large",onClick:L},l.a.createElement(d.a,null),"点击下载")),("download"===u||"office"===u)&&l.a.createElement(n.a,{type:"primary",size:"large",onClick:L},l.a.createElement(d.a,null),"点击下载"))}},"p77/":
|
|
|
/*!****************************************************!*\
|
|
|
!*** ./node_modules/codemirror/lib/codemirror.css ***!
|
|
|
\****************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){},"rAM+":
|
|
|
/*!*******************************************************************************************************************!*\
|
|
|
!*** ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js ***!
|
|
|
\*******************************************************************************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(/*! @babel/runtime/helpers/esm/unsupportedIterableToArray */"Qw5x");function i(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=Object(n.a)(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,l=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){l=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(l)throw s}}}}},rUJ1:
|
|
|
/*!********************************************!*\
|
|
|
!*** ./node_modules/marked/src/helpers.js ***!
|
|
|
\********************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: escape */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t){const r=/[&<>"']/,n=/[&<>"']/g,i=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g,s={"&":"&","<":"<",">":">",'"':""","'":"'"},o=e=>s[e];const l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function u(e){return e.replace(l,(e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")}const c=/(^|[^\[])\^/g;const d=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;const h={},p=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,m=/^([^:]+:\/*[^/]*)[\s\S]*$/;function v(e,t){h[" "+e]||(p.test(e)?h[" "+e]=e+"/":h[" "+e]=y(e,"/",!0));const r=-1===(e=h[" "+e]).indexOf(":");return"//"===t.substring(0,2)?r?t:e.replace(g,"$1")+t:"/"===t.charAt(0)?r?t:e.replace(m,"$1")+t:e+t}function y(e,t,r){const n=e.length;if(0===n)return"";let i=0;for(;i<n;){const a=e.charAt(n-i-1);if(a!==t||r){if(a===t||!r)break;i++}else i++}return e.substr(0,n-i)}e.exports={escape:function(e,t){if(t){if(r.test(e))return e.replace(n,o)}else if(i.test(e))return e.replace(a,o);return e},unescape:u,edit:function(e,t){e=e.source||e,t=t||"";const r={replace:(t,n)=>(n=(n=n.source||n).replace(c,"$1"),e=e.replace(t,n),r),getRegex:()=>new RegExp(e,t)};return r},cleanUrl:function(e,t,r){if(e){let e;try{e=decodeURIComponent(u(r)).replace(d,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!f.test(r)&&(r=v(t,r));try{r=encodeURI(r).replace(/%25/g,"%")}catch(e){return null}return r},resolveUrl:v,noopTest:{exec:function(){}},merge:function(e){let t,r,n=1;for(;n<arguments.length;n++)for(r in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},splitCells:function(e,t){const r=e.replace(/\|/g,(e,t,r)=>{let n=!1,i=t;for(;--i>=0&&"\\"===r[i];)n=!n;return n?"|":" |"}).split(/ \|/);let n=0;if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r},rtrim:y,findClosingBracket:function(e,t){if(-1===e.indexOf(t[1]))return-1;const r=e.length;let n=0,i=0;for(;i<r;i++)if("\\"===e[i])i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return-1},checkSanitizeDeprecation:function(e){e&&e.sanitize&&!e.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")}}},ulZh:
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./node_modules/hls.js/dist/hls.js ***!
|
|
|
\*****************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){var n;"undefined"!=typeof window&&(n=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/dist/",r(r.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./node_modules/eventemitter3/index.js ***!
|
|
|
\*********************************************/
|
|
|
/*! no static exports found */function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,i="~";function a(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,r,n,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new s(r,n||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function u(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(i=!1)),u.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)n.call(e,t)&&r.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},u.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,a=r.length,s=new Array(a);n<a;n++)s[n]=r[n].fn;return s},u.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},u.prototype.emit=function(e,t,r,n,a,s){var o=i?i+e:e;if(!this._events[o])return!1;var l,u,c=this._events[o],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,n),!0;case 5:return c.fn.call(c.context,t,r,n,a),!0;case 6:return c.fn.call(c.context,t,r,n,a,s),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var f,h=c.length;for(u=0;u<h;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,r);break;case 4:c[u].fn.call(c[u].context,t,r,n);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];c[u].fn.apply(c[u].context,l)}}return!0},u.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,r,n){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return l(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||l(this,a);else{for(var o=0,u=[],c=s.length;o<c;o++)(s[o].fn!==t||n&&!s[o].once||r&&s[o].context!==r)&&u.push(s[o]);u.length?this._events[a]=1===u.length?u[0]:u:l(this,a)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&l(this,t)):(this._events=new a,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=i,u.EventEmitter=u,e.exports=u},"./node_modules/url-toolkit/src/url-toolkit.js":
|
|
|
/*!*****************************************************!*\
|
|
|
!*** ./node_modules/url-toolkit/src/url-toolkit.js ***!
|
|
|
\*****************************************************/
|
|
|
/*! no static exports found */function(e,t,r){var n,i,a,s,o;n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,i=/^([^\/?#]*)([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var n=o.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=o.normalizePath(n.path),o.buildURLFromParts(n)}var a=o.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var s=o.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var l=i.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var u={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var c=s.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;u.path=o.normalizePath(d)}else u.path=s.path,a.params||(u.params=s.params,a.query||(u.query=s.query));return null===u.path&&(u.path=r.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(u)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(s,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o},"./node_modules/webworkify-webpack/index.js":
|
|
|
/*!**************************************************!*\
|
|
|
!*** ./node_modules/webworkify-webpack/index.js ***!
|
|
|
\**************************************************/
|
|
|
/*! no static exports found */function(e,t,r){function n(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r.oe=function(e){throw console.error(e),e};var n=r(r.s=ENTRY_MODULE);return n.default||n}function i(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,n){var a={};a[n]=[];var s=t.toString(),o=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return a;for(var l,u=o[1],c=new RegExp("(\\\\n|\\W)"+i(u)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");l=c.exec(s);)"dll-reference"!==l[3]&&a[n].push(l[3]);for(c=new RegExp("\\("+i(u)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");l=c.exec(s);)e[l[2]]||(a[n].push(l[1]),e[l[2]]=r(l[1]).m),a[l[2]]=a[l[2]]||[],a[l[2]].push(l[4]);for(var d,f=Object.keys(a),h=0;h<f.length;h++)for(var p=0;p<a[f[h]].length;p++)d=a[f[h]][p],isNaN(1*d)||(a[f[h]][p]=1*a[f[h]][p]);return a}function s(e){return Object.keys(e).reduce((function(t,r){return t||e[r].length>0}),!1)}e.exports=function(e,t){t=t||{};var i={main:r.m},o=t.all?{main:Object.keys(i.main)}:function(e,t){for(var r={main:[t]},n={main:[]},i={main:{}};s(r);)for(var o=Object.keys(r),l=0;l<o.length;l++){var u=o[l],c=r[u].pop();if(i[u]=i[u]||{},!i[u][c]&&e[u][c]){i[u][c]=!0,n[u]=n[u]||[],n[u].push(c);for(var d=a(e,e[u][c],u),f=Object.keys(d),h=0;h<f.length;h++)r[f[h]]=r[f[h]]||[],r[f[h]]=r[f[h]].concat(d[f[h]])}}return n}(i,e),l="";Object.keys(o).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;o[e][t];)t++;o[e].push(t),i[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+e+" = ("+n.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o[e].map((function(t){return JSON.stringify(t)+": "+i[e][t].toString()})).join(",")+"});\n"})),l=l+"new (("+n.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o.main.map((function(e){return JSON.stringify(e)+": "+i.main[e].toString()})).join(",")+"}))(self);";var u=new window.Blob([l],{type:"text/javascript"});if(t.bare)return u;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),d=new window.Worker(c);return d.objectURL=c,d}},"./src/config.ts":
|
|
|
/*!***********************!*\
|
|
|
!*** ./src/config.ts ***!
|
|
|
\***********************/
|
|
|
/*! exports provided: hlsDefaultConfig, mergeConfig, enableStreamingMode */function(e,t,r){"use strict";r.r(t),r.d(t,"hlsDefaultConfig",(function(){return T})),r.d(t,"mergeConfig",(function(){return k})),r.d(t,"enableStreamingMode",(function(){return w}));var n=r(/*! ./controller/abr-controller */"./src/controller/abr-controller.ts"),i=r(/*! ./controller/audio-stream-controller */"./src/controller/audio-stream-controller.ts"),a=r(/*! ./controller/audio-track-controller */"./src/controller/audio-track-controller.ts"),s=r(/*! ./controller/subtitle-stream-controller */"./src/controller/subtitle-stream-controller.ts"),o=r(/*! ./controller/subtitle-track-controller */"./src/controller/subtitle-track-controller.ts"),l=r(/*! ./controller/buffer-controller */"./src/controller/buffer-controller.ts"),u=r(/*! ./controller/timeline-controller */"./src/controller/timeline-controller.ts"),c=r(/*! ./controller/cap-level-controller */"./src/controller/cap-level-controller.ts"),d=r(/*! ./controller/fps-controller */"./src/controller/fps-controller.ts"),f=r(/*! ./controller/eme-controller */"./src/controller/eme-controller.ts"),h=r(/*! ./controller/cmcd-controller */"./src/controller/cmcd-controller.ts"),p=r(/*! ./utils/xhr-loader */"./src/utils/xhr-loader.ts"),g=r(/*! ./utils/fetch-loader */"./src/utils/fetch-loader.ts"),m=r(/*! ./utils/cues */"./src/utils/cues.ts"),v=r(/*! ./utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts"),y=r(/*! ./utils/logger */"./src/utils/logger.ts");function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=x(x({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:p.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:n.default,bufferController:l.default,capLevelController:c.default,fpsController:d.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:v.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},{cueHandler:m.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:s.SubtitleStreamController,subtitleTrackController:o.default,timelineController:u.TimelineController,audioStreamController:i.default,audioTrackController:a.default,emeController:f.default,cmcdController:h.default});function k(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return b({},e,t)}function w(e){var t=e.loader;t!==g.default&&t!==p.default?(y.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):Object(g.fetchSupported)()&&(e.loader=g.default,e.progressive=!0,e.enableSoftwareAES=!0,y.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}},"./src/controller/abr-controller.ts":
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/controller/abr-controller.ts ***!
|
|
|
\******************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/ewma-bandwidth-estimator */"./src/utils/ewma-bandwidth-estimator.ts"),a=r(/*! ../events */"./src/events.ts"),s=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=r(/*! ../errors */"./src/errors.ts"),l=r(/*! ../types/loader */"./src/types/loader.ts"),u=r(/*! ../utils/logger */"./src/utils/logger.ts");function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var d=function(){function e(e){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;var t=e.config;this.bwEstimator=new i.default(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var t,r,d,f=e.prototype;return f.registerListeners=function(){var e=this.hls;e.on(a.Events.FRAG_LOADING,this.onFragLoading,this),e.on(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var e=this.hls;e.off(a.Events.FRAG_LOADING,this.onFragLoading,this),e.off(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.ERROR,this.onError,this)},f.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},f.onFragLoading=function(e,t){var r,n=t.frag;n.type===l.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=n,this.partCurrent=null!=(r=t.part)?r:null,this.timer=self.setInterval(this.onCheck,100)))},f.onLevelLoaded=function(e,t){var r=this.hls.config;t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)},f._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,r=this.hls,i=r.autoLevelEnabled,o=r.config,l=r.media;if(e&&l){var c=t?t.stats:e.stats,d=t?t.duration:e.duration;if(c.aborted)return u.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);if(i&&!l.paused&&l.playbackRate&&l.readyState){var f=performance.now()-c.loading.start,h=Math.abs(l.playbackRate);if(!(f<=500*d/h)){var p=r.levels,g=r.minAutoLevel,m=p[e.level],v=c.total||Math.max(c.loaded,Math.round(d*m.maxBitrate/8)),y=Math.max(1,c.bwEstimate?c.bwEstimate/8:1e3*c.loaded/f),b=(v-c.loaded)/y,E=l.currentTime,x=(s.BufferHelper.bufferInfo(l,E,o.maxBufferHole).end-E)/h;if(!(x>=2*d/h||b<=x)){var S,T=Number.POSITIVE_INFINITY;for(S=e.level-1;S>g&&!((T=d*p[S].maxBitrate/(6.4*y))<x);S--);if(!(T>=b)){var k=this.bwEstimator.getEstimate();u.logger.warn("Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+S+"\n Current BW estimate: "+(Object(n.isFiniteNumber)(k)?(k/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+b.toFixed(3)+" s\n Estimated load time for the next fragment: "+T.toFixed(3)+" s\n Time to underbuffer: "+x.toFixed(3)+" s"),r.nextLoadLevel=S,this.bwEstimator.sample(f,c.loaded),this.clearTimer(),e.loader&&(this.fragCurrent=this.partCurrent=null,e.loader.abort()),r.trigger(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:c})}}}}}},f.onFragLoaded=function(e,t){var r=t.frag,i=t.part;if(r.type===l.PlaylistLevelType.MAIN&&Object(n.isFiniteNumber)(r.sn)){var s=i?i.stats:r.stats,o=i?i.duration:r.duration;if(this.clearTimer(),this.lastLoadedFragLevel=r.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var u=this.hls.levels[r.level],c=(u.loaded?u.loaded.bytes:0)+s.loaded,d=(u.loaded?u.loaded.duration:0)+o;u.loaded={bytes:c,duration:d},u.realBitrate=Math.round(8*c/d)}if(r.bitrateTest){var f={stats:s,frag:r,part:i,id:r.type};this.onFragBuffered(a.Events.FRAG_BUFFERED,f),r.bitrateTest=!1}}},f.onFragBuffered=function(e,t){var r=t.frag,n=t.part,i=n?n.stats:r.stats;if(!i.aborted&&r.type===l.PlaylistLevelType.MAIN&&"initSegment"!==r.sn){var a=i.parsing.end-i.loading.start;this.bwEstimator.sample(a,i.loaded),i.bwEstimate=this.bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}},f.onError=function(e,t){switch(t.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},f.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},f.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,r=this.hls,n=r.maxAutoLevel,i=r.config,a=r.minAutoLevel,o=r.media,l=t?t.duration:e?e.duration:0,c=o?o.currentTime:0,d=o&&0!==o.playbackRate?Math.abs(o.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,h=(s.BufferHelper.bufferInfo(o,c,i.maxBufferHole).end-c)/d,p=this.findBestLevel(f,a,n,h,i.abrBandWidthFactor,i.abrBandWidthUpFactor);if(p>=0)return p;u.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=l?Math.min(l,i.maxStarvationDelay):i.maxStarvationDelay,m=i.abrBandWidthFactor,v=i.abrBandWidthUpFactor;if(!h){var y=this.bitrateTestDelay;y&&(g=(l?Math.min(l,i.maxLoadingDelay):i.maxLoadingDelay)-y,u.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),m=v=1)}return p=this.findBestLevel(f,a,n,h+g,m,v),Math.max(p,0)},f.findBestLevel=function(e,t,r,n,i,a){for(var s,o=this.fragCurrent,l=this.partCurrent,c=this.lastLoadedFragLevel,d=this.hls.levels,f=d[c],h=!(null==f||null===(s=f.details)||void 0===s||!s.live),p=null==f?void 0:f.codecSet,g=l?l.duration:o?o.duration:0,m=r;m>=t;m--){var v=d[m];if(v&&(!p||v.codecSet===p)){var y=v.details,b=(l?null==y?void 0:y.partTarget:null==y?void 0:y.averagetargetduration)||g,E=void 0;E=m<=c?i*e:a*e;var x=d[m].maxBitrate,S=x*b/E;if(u.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(E)+"/"+x+"/"+b+"/"+n+"/"+S),E>x&&(!S||h&&!this.bitrateTestDelay||S<n))return m}}return-1},t=e,(r=[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var r=this.getNextABRAutoLevel();return-1!==e&&(r=Math.min(e,r)),r},set:function(e){this._nextAutoLevel=e}}])&&c(t.prototype,r),d&&c(t,d),e}();t.default=d},"./src/controller/audio-stream-controller.ts":
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./src/controller/audio-stream-controller.ts ***!
|
|
|
\***************************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),a=r(/*! ../events */"./src/events.ts"),s=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),l=r(/*! ../types/level */"./src/types/level.ts"),u=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),d=r(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts"),f=r(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),h=r(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),p=r(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),g=r(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),m=r(/*! ../errors */"./src/errors.ts"),v=r(/*! ../utils/logger */"./src/utils/logger.ts");function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var E=function(e){var t,r;function E(t,r){var n;return(n=e.call(this,t,r,"[audio-stream-controller]")||this).videoBuffer=null,n.videoTrackCC=-1,n.waitingVideoCC=-1,n.audioSwitch=!1,n.trackId=-1,n.waitingData=null,n.mainDetails=null,n.bufferFlushed=!1,n._registerListeners(),n}r=e,(t=E).prototype=Object.create(r.prototype),t.prototype.constructor=t,b(t,r);var x=E.prototype;return x.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},x._registerListeners=function(){var e=this.hls;e.on(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(a.Events.ERROR,this.onError,this),e.on(a.Events.BUFFER_RESET,this.onBufferReset,this),e.on(a.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var e=this.hls;e.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(a.Events.ERROR,this.onError,this),e.off(a.Events.BUFFER_RESET,this.onBufferReset,this),e.off(a.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onInitPtsFound=function(e,t){var r=t.frag,n=t.id,a=t.initPTS;if("main"===n){var s=r.cc;this.initPTS[r.cc]=a,this.log("InitPTS for cc: "+s+" found from main: "+a),this.videoTrackCC=s,this.state===i.State.WAITING_INIT_PTS&&this.tick()}},x.startLoad=function(e){if(!this.levels)return this.startPosition=e,void(this.state=i.State.STOPPED);var t=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,t>0&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=i.State.IDLE):(this.loadedmetadata=!1,this.state=i.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},x.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_TRACK:var t,r=this.levels,n=this.trackId,a=null==r||null===(t=r[n])||void 0===t?void 0:t.details;if(a){if(this.waitForCdnTuneIn(a))break;this.state=i.State.WAITING_INIT_PTS}break;case i.State.FRAG_LOADING_WAITING_RETRY:var o,l=performance.now(),u=this.retryDate;(!u||l>=u||null!==(o=this.media)&&void 0!==o&&o.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=i.State.IDLE);break;case i.State.WAITING_INIT_PTS:var c=this.waitingData;if(c){var d=c.frag,f=c.part,h=c.cache,g=c.complete;if(void 0!==this.initPTS[d.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=i.State.FRAG_LOADING;var m={frag:d,part:f,payload:h.flush(),networkDetails:null};this._handleFragmentLoadProgress(m),g&&e.prototype._handleFragmentLoadComplete.call(this,m)}else if(this.videoTrackCC!==this.waitingVideoCC)v.logger.log("Waiting fragment cc ("+d.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var y=this.getLoadPosition(),b=s.BufferHelper.bufferInfo(this.mediaBuffer,y,this.config.maxBufferHole);Object(p.fragmentWithinToleranceTest)(b.end,this.config.maxFragLookUpTolerance,d)<0&&(v.logger.log("Waiting fragment cc ("+d.cc+") @ "+d.start+" cancelled because another fragment at "+b.end+" is needed"),this.clearWaitingFragment())}}else this.state=i.State.IDLE}this.onTickEnd()},x.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=i.State.IDLE)},x.onTickEnd=function(){var e=this.media;if(e&&e.readyState){var t=(this.mediaBuffer?this.mediaBuffer:e).buffered;!this.loadedmetadata&&t.length&&(this.loadedmetadata=!0),this.lastCurrentTime=e.currentTime}},x.doTickIdle=function(){var e,t,r=this.hls,n=this.levels,s=this.media,o=this.trackId,l=r.config;if(n&&n[o]&&(s||!this.startFragRequested&&l.startFragPrefetch)){var d=n[o].details;if(!d||d.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(d))this.state=i.State.WAITING_TRACK;else{this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,c.ElementaryStreamTypes.AUDIO,u.PlaylistLevelType.AUDIO));var f=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,u.PlaylistLevelType.AUDIO);if(null!==f){var h=f.len,p=this.getMaxBufferLength(),g=this.audioSwitch;if(!(h>=p)||g){if(!g&&this._streamEnded(f,d))return r.trigger(a.Events.BUFFER_EOS,{type:"audio"}),void(this.state=i.State.ENDED);var m=d.fragments[0].start,v=f.end;if(g){var y=this.getLoadPosition();v=y,d.PTSKnown&&y<m&&(f.end>m||f.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=m+.05)}var b=this.getNextFragment(v,d);b?"identity"!==(null===(e=b.decryptdata)||void 0===e?void 0:e.keyFormat)||null!==(t=b.decryptdata)&&void 0!==t&&t.key?this.loadFragment(b,d,v):this.loadKey(b,d):this.bufferFlushed=!0}}}}},x.getMaxBufferLength=function(){var t=e.prototype.getMaxBufferLength.call(this),r=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,u.PlaylistLevelType.MAIN);return null===r?t:Math.max(t,r.len)},x.onMediaDetaching=function(){this.videoBuffer=null,e.prototype.onMediaDetaching.call(this)},x.onAudioTracksUpdated=function(e,t){var r=t.audioTracks;this.resetTransmuxer(),this.levels=r.map((function(e){return new l.Level(e)}))},x.onAudioTrackSwitching=function(e,t){var r=!!t.url;this.trackId=t.id;var n=this.fragCurrent;null!=n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.audioSwitch=!0,this.state=i.State.IDLE):this.state=i.State.STOPPED,this.tick()},x.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},x.onLevelLoaded=function(e,t){this.mainDetails=t.details},x.onAudioTrackLoaded=function(e,t){var r,n=this.levels,a=t.details,s=t.id;if(n){this.log("Track "+s+" loaded ["+a.startSN+","+a.endSN+"],duration:"+a.totalduration);var o=n[s],l=0;if(a.live||null!==(r=o.details)&&void 0!==r&&r.live){var u=this.mainDetails;if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed||!u)return;!o.details&&a.hasProgramDateTime&&u.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(a,u),l=a.fragments[0].start):l=this.alignPlaylists(a,o.details)}o.details=a,this.levelLastLoaded=s,this.startFragRequested||!this.mainDetails&&a.live||this.setStartPosition(o.details,l),this.state!==i.State.WAITING_TRACK||this.waitForCdnTuneIn(a)||(this.state=i.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+s)},x._handleFragmentLoadProgress=function(e){var t,r=e.frag,n=e.part,a=e.payload,s=this.config,o=this.trackId,l=this.levels;if(l){var c=l[o];console.assert(c,"Audio track is defined on fragment load progress");var p=c.details;console.assert(p,"Audio track details are defined on fragment load progress");var g=s.defaultAudioCodec||c.audioCodec||"mp4a.40.2",m=this.transmuxer;m||(m=this.transmuxer=new f.default(this.hls,u.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var y=this.initPTS[r.cc],b=null===(t=r.initSegment)||void 0===t?void 0:t.data;if(void 0!==y){var E=n?n.index:-1,x=-1!==E,S=new h.ChunkMetadata(r.level,r.sn,r.stats.chunkCount,a.byteLength,E,x);m.push(a,b,g,"",r,n,p.totalduration,!1,S,y)}else v.logger.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+p.startSN+" ,"+p.endSN+"],track "+o),(this.waitingData=this.waitingData||{frag:r,part:n,cache:new d.default,complete:!1}).cache.push(new Uint8Array(a)),this.waitingVideoCC=this.videoTrackCC,this.state=i.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},x._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:e.prototype._handleFragmentLoadComplete.call(this,t)},x.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},x.onBufferCreated=function(e,t){var r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},x.onFragBuffered=function(e,t){var r=t.frag,n=t.part;r.type===u.PlaylistLevelType.AUDIO&&(this.fragContextChanged(r)?this.warn("Fragment "+r.sn+(n?" p: "+n.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==r.sn&&(this.fragPrevious=r,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(r,n)))},x.onError=function(t,r){switch(r.details){case m.ErrorDetails.FRAG_LOAD_ERROR:case m.ErrorDetails.FRAG_LOAD_TIMEOUT:case m.ErrorDetails.KEY_LOAD_ERROR:case m.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(u.PlaylistLevelType.AUDIO,r);break;case m.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case m.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==i.State.ERROR&&this.state!==i.State.STOPPED&&(this.state=r.fatal?i.State.ERROR:i.State.IDLE,this.warn(r.details+" while loading frag, switching to "+this.state+" state"));break;case m.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===r.parent&&(this.state===i.State.PARSING||this.state===i.State.PARSED)){var n=!0,a=this.getFwdBufferInfo(this.mediaBuffer,u.PlaylistLevelType.AUDIO);a&&a.len>.5&&(n=!this.reduceMaxBufferLength(a.len)),n&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}},x.onBufferFlushed=function(e,t){t.type===c.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},x._handleTransmuxComplete=function(e){var t,r="audio",n=this.hls,s=e.remuxResult,o=e.chunkMeta,l=this.getCurrentContext(o);if(!l)return this.warn("The loading context changed while buffering fragment "+o.sn+" of level "+o.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(o.level);var u=l.frag,d=l.part,f=s.audio,h=s.text,p=s.id3,g=s.initSegment;if(!this.fragContextChanged(u)){if(this.state=i.State.PARSING,this.audioSwitch&&f&&this.completeAudioSwitch(),null!=g&&g.tracks&&(this._bufferInitSegment(g.tracks,u,o),n.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:u,id:r,tracks:g.tracks})),f){var m=f.startPTS,v=f.endPTS,b=f.startDTS,E=f.endDTS;d&&(d.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:m,endPTS:v,startDTS:b,endDTS:E}),u.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,m,v,b,E),this.bufferFragmentData(f,u,d,o)}if(null!=p&&null!==(t=p.samples)&&void 0!==t&&t.length){var x=y({frag:u,id:r},p);n.trigger(a.Events.FRAG_PARSING_METADATA,x)}if(h){var S=y({frag:u,id:r},h);n.trigger(a.Events.FRAG_PARSING_USERDATA,S)}}},x._bufferInitSegment=function(e,t,r){if(this.state===i.State.PARSING){e.video&&delete e.video;var n=e.audio;if(n){n.levelCodec=n.codec,n.id="audio",this.log("Init audio buffer, container:"+n.container+", codecs[parsed]=["+n.codec+"]"),this.hls.trigger(a.Events.BUFFER_CODECS,e);var s=n.initSegment;if(null!=s&&s.byteLength){var o={type:"audio",frag:t,part:null,chunkMeta:r,parent:t.type,data:s};this.hls.trigger(a.Events.BUFFER_APPENDING,o)}this.tick()}}},x.loadFragment=function(t,r,a){var s=this.fragmentTracker.getState(t);this.fragCurrent=t,(this.audioSwitch||s===o.FragmentState.NOT_LOADED||s===o.FragmentState.PARTIAL)&&("initSegment"===t.sn?this._loadInitSegment(t):r.live&&!Object(n.isFiniteNumber)(this.initPTS[t.cc])?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=i.State.WAITING_INIT_PTS):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,r,a)))},x.completeAudioSwitch=function(){var t=this.hls,r=this.media,n=this.trackId;r&&(this.log("Switching audio track : flushing all audio"),e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,t.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:n})},E}(i.default);t.default=E},"./src/controller/audio-track-controller.ts":
|
|
|
/*!**************************************************!*\
|
|
|
!*** ./src/controller/audio-track-controller.ts ***!
|
|
|
\**************************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),s=r(/*! ../types/loader */"./src/types/loader.ts");function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=function(e){var t,r;function a(t){var r;return(r=e.call(this,t,"[audio-track-controller]")||this).tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.trackName="",r.selectDefaultTrack=!0,r.registerListeners(),r}r=e,(t=a).prototype=Object.create(r.prototype),t.prototype.constructor=t,l(t,r);var u,c,d,f=a.prototype;return f.registerListeners=function(){var e=this.hls;e.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(n.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(n.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var e=this.hls;e.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(n.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(n.Events.ERROR,this.onError,this)},f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,e.prototype.destroy.call(this)},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},f.onManifestParsed=function(e,t){this.tracks=t.audioTracks||[]},f.onAudioTrackLoaded=function(e,t){var r=t.id,n=t.details,i=this.tracksInGroup[r];if(i){var a=i.details;i.details=t.details,this.log("audioTrack "+r+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,a))}else this.warn("Invalid audio track id "+r)},f.onLevelLoading=function(e,t){this.switchLevel(t.level)},f.onLevelSwitching=function(e,t){this.switchLevel(t.level)},f.switchLevel=function(e){var t=this.hls.levels[e];if(null!=t&&t.audioGroupIds){var r=t.audioGroupIds[t.urlId];if(this.groupId!==r){this.groupId=r;var i=this.tracks.filter((function(e){return!r||e.groupId===r}));this.selectDefaultTrack&&!i.some((function(e){return e.default}))&&(this.selectDefaultTrack=!1),this.tracksInGroup=i;var a={audioTracks:i};this.log("Updating audio tracks, "+i.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(n.Events.AUDIO_TRACKS_UPDATED,a),this.selectInitialTrack()}}},f.onError=function(t,r){e.prototype.onError.call(this,t,r),!r.fatal&&r.context&&r.context.type===s.PlaylistContextType.AUDIO_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},f.setAudioTrack=function(e){var t=this.tracksInGroup;if(e<0||e>=t.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var r=t[this.trackId];this.log("Now switching to audio-track index "+e);var i=t[e],a=i.id,s=i.groupId,o=void 0===s?"":s,l=i.name,u=i.type,c=i.url;if(this.trackId=e,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(n.Events.AUDIO_TRACK_SWITCHING,{id:a,groupId:o,name:l,type:u,url:c}),!i.details||i.details.live){var d=this.switchParams(i.url,null==r?void 0:r.details);this.loadPlaylist(d)}}},f.selectInitialTrack=function(){var e=this.tracksInGroup;console.assert(e.length,"Initial audio track should be selected when tracks are known");var t=this.trackName,r=this.findTrackId(t)||this.findTrackId();-1!==r?this.setAudioTrack(r):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},f.findTrackId=function(e){for(var t=this.tracksInGroup,r=0;r<t.length;r++){var n=t[r];if((!this.selectDefaultTrack||n.default)&&(!e||e===n.name))return n.id}return-1},f.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var r=t.id,i=t.groupId,a=t.url;if(e)try{a=e.addDirectives(a)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("loading audio-track playlist for id: "+r),this.clearTimer(),this.hls.trigger(n.Events.AUDIO_TRACK_LOADING,{url:a,id:r,groupId:i,deliveryDirectives:e||null})}},u=a,(c=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}}])&&o(u.prototype,c),d&&o(u,d),a}(a.default);t.default=u},"./src/controller/base-playlist-controller.ts":
|
|
|
/*!****************************************************!*\
|
|
|
!*** ./src/controller/base-playlist-controller.ts ***!
|
|
|
\****************************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return l}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../types/level */"./src/types/level.ts"),a=r(/*! ./level-helper */"./src/controller/level-helper.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../errors */"./src/errors.ts"),l=function(){function e(e,t){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=s.logger.log.bind(s.logger,t+":"),this.warn=s.logger.warn.bind(s.logger,t+":"),this.hls=e}var t=e.prototype;return t.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},t.onError=function(e,t){t.fatal&&t.type===o.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},t.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},t.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},t.stopLoad=function(){this.canLoad=!1,this.clearTimer()},t.switchParams=function(e,t){var r=null==t?void 0:t.renditionReports;if(r)for(var a=0;a<r.length;a++){var s=r[a],o=""+s.URI;if(o===e.substr(-o.length)){var l=parseInt(s["LAST-MSN"]),u=parseInt(s["LAST-PART"]);if(t&&this.hls.config.lowLatencyMode){var c=Math.min(t.age-t.partTarget,t.targetduration);void 0!==u&&c>t.partTarget&&(u+=1)}if(Object(n.isFiniteNumber)(l))return new i.HlsUrlParameters(l,Object(n.isFiniteNumber)(u)?u:void 0,i.HlsSkip.No)}}},t.loadPlaylist=function(e){},t.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},t.playlistLoaded=function(e,t,r){var n=this,i=t.details,s=t.stats,o=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(i.advancedDateTime=Date.now()-o,i.live||null!=r&&r.live){if(i.reloaded(r),r&&this.log("live playlist "+e+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED")),r&&i.fragments.length>0&&Object(a.mergeDetails)(r,i),!this.canLoad||!i.live)return;var l,u=void 0,c=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var d=this.hls.config.lowLatencyMode,f=i.lastPartSn,h=i.endSN,p=i.lastPartIndex,g=f===h;-1!==p?(u=g?h+1:f,c=g?d?0:p:p+1):u=h+1;var m=i.age,v=m+i.ageHeader,y=Math.min(v-i.partTarget,1.5*i.targetduration);if(y>0){if(r&&y>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+y+" with playlist age: "+i.age),y=0;else{var b=Math.floor(y/i.targetduration);u+=b,void 0!==c&&(c+=Math.round(y%i.targetduration/i.partTarget)),this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+m.toFixed(2)+"s goal: "+y+" skip sn "+b+" to part "+c)}i.tuneInGoal=y}if(l=this.getDeliveryDirectives(i,t.deliveryDirectives,u,c),d||!g)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(i,t.deliveryDirectives,u,c);var E=Object(a.computeReloadInterval)(i,s);void 0!==u&&i.canBlockReload&&(E-=i.partTarget||1),this.log("reload live playlist "+e+" in "+Math.round(E)+" ms"),this.timer=self.setTimeout((function(){return n.loadPlaylist(l)}),E)}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,r,n){var a=Object(i.getSkipValue)(e,r);return null!=t&&t.skip&&e.deltaUpdateFailed&&(r=t.msn,n=t.part,a=i.HlsSkip.No),new i.HlsUrlParameters(r,n,a)},t.retryLoadingOrFail=function(e){var t,r=this,n=this.hls.config,i=this.retryCount<n.levelLoadingMaxRetry;if(i)if(this.retryCount++,e.details.indexOf("LoadTimeOut")>-1&&null!==(t=e.context)&&void 0!==t&&t.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+e.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout((function(){return r.loadPlaylist()}),a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+e.details+'"')}else this.warn('cannot recover from error "'+e.details+'"'),this.clearTimer(),e.fatal=!0;return i},e}()},"./src/controller/base-stream-controller.ts":
|
|
|
/*!**************************************************!*\
|
|
|
!*** ./src/controller/base-stream-controller.ts ***!
|
|
|
\**************************************************/
|
|
|
/*! exports provided: State, default */function(e,t,r){"use strict";r.r(t),r.d(t,"State",(function(){return x})),r.d(t,"default",(function(){return S}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../task-loop */"./src/task-loop.ts"),a=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),s=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=r(/*! ../utils/logger */"./src/utils/logger.ts"),l=r(/*! ../events */"./src/events.ts"),u=r(/*! ../errors */"./src/errors.ts"),c=r(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),d=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),f=r(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),h=r(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),p=r(/*! ./level-helper */"./src/controller/level-helper.ts"),g=r(/*! ../loader/fragment-loader */"./src/loader/fragment-loader.ts"),m=r(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),v=r(/*! ../utils/time-ranges */"./src/utils/time-ranges.ts"),y=r(/*! ../types/loader */"./src/types/loader.ts");function b(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var x={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},S=function(e){var t,r;function i(t,r,n){var i;return(i=e.call(this)||this).hls=void 0,i.fragPrevious=null,i.fragCurrent=null,i.fragmentTracker=void 0,i.transmuxer=null,i._state=x.STOPPED,i.media=void 0,i.mediaBuffer=void 0,i.config=void 0,i.bitrateTest=!1,i.lastCurrentTime=0,i.nextLoadPosition=0,i.startPosition=0,i.loadedmetadata=!1,i.fragLoadError=0,i.retryDate=0,i.levels=null,i.fragmentLoader=void 0,i.levelLastLoaded=null,i.startFragRequested=!1,i.decrypter=void 0,i.initPTS=[],i.onvseeking=null,i.onvended=null,i.logPrefix="",i.log=void 0,i.warn=void 0,i.logPrefix=n,i.log=o.logger.log.bind(o.logger,n+":"),i.warn=o.logger.warn.bind(o.logger,n+":"),i.hls=t,i.fragmentLoader=new g.default(t.config),i.fragmentTracker=r,i.config=t.config,i.decrypter=new m.default(t,t.config),t.on(l.Events.KEY_LOADED,i.onKeyLoaded,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i)),i}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,E(t,r);var S,T,k,w=i.prototype;return w.doTick=function(){this.onTickEnd()},w.onTickEnd=function(){},w.startLoad=function(e){},w.stopLoad=function(){this.fragmentLoader.abort();var e=this.fragCurrent;e&&this.fragmentTracker.removeFragment(e),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},w._streamEnded=function(e,t){var r=this.fragCurrent,n=this.fragmentTracker;if(!t.live&&r&&r.sn===t.endSN&&!e.nextStart){var i=n.getState(r);return i===a.FragmentState.PARTIAL||i===a.FragmentState.OK}return!1},w.onMediaAttached=function(e,t){var r=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);var n=this.config;this.levels&&n.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(n.startPosition)},w.onMediaDetaching=function(){var e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},w.onMediaSeeking=function(){var e=this.config,t=this.fragCurrent,r=this.media,i=this.mediaBuffer,a=this.state,o=r?r.currentTime:0,l=s.BufferHelper.bufferInfo(i||r,o,e.maxBufferHole);if(this.log("media seeking to "+(Object(n.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+a),a===x.ENDED)this.resetLoadingState();else if(t&&!l.len){var u=e.maxFragLookUpTolerance,c=t.start-u,d=o>t.start+t.duration+u;(o<c||d)&&(d&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.loader.abort()),this.resetLoadingState())}r&&(this.lastCurrentTime=o),this.loadedmetadata||l.len||(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()},w.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},w.onKeyLoaded=function(e,t){if(this.state===x.KEY_LOADING&&t.frag===this.fragCurrent&&this.levels){this.state=x.IDLE;var r=this.levels[t.frag.level].details;r&&this.loadFragment(t.frag,r,t.frag.start)}},w.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},w.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(l.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,e.prototype.onHandlerDestroyed.call(this)},w.loadKey=function(e,t){this.log("Loading key for "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level),this.state=x.KEY_LOADING,this.fragCurrent=e,this.hls.trigger(l.Events.KEY_LOADING,{frag:e})},w.loadFragment=function(e,t,r){this._loadFragForPlayback(e,t,r)},w._loadFragForPlayback=function(e,t,r){var n=this;this._doFragLoad(e,t,r,(function(t){if(n.fragContextChanged(e))return n.warn("Fragment "+e.sn+(t.part?" p: "+t.part.index:"")+" of level "+e.level+" was dropped during download."),void n.fragmentTracker.removeFragment(e);e.stats.chunkCount++,n._handleFragmentLoadProgress(t)})).then((function(t){if(t){n.fragLoadError=0;var r=n.state;if(!n.fragContextChanged(e))return"payload"in t&&(n.log("Loaded fragment "+e.sn+" of level "+e.level),n.hls.trigger(l.Events.FRAG_LOADED,t),n.state===x.BACKTRACKING)?(n.fragmentTracker.backtrack(e,t),void n.resetFragmentLoading(e)):void n._handleFragmentLoadComplete(t);(r===x.FRAG_LOADING||r===x.BACKTRACKING||!n.fragCurrent&&r===x.PARSING)&&(n.fragmentTracker.removeFragment(e),n.state=x.IDLE)}})).catch((function(t){n.warn(t),n.resetFragmentLoading(e)}))},w.flushMainBuffer=function(e,t,r){if(void 0===r&&(r=null),e-t){var n={startOffset:e,endOffset:t,type:r};this.fragLoadError=0,this.hls.trigger(l.Events.BUFFER_FLUSHING,n)}},w._loadInitSegment=function(e){var t=this;this._doFragLoad(e).then((function(r){if(!r||t.fragContextChanged(e)||!t.levels)throw new Error("init load aborted");return r})).then((function(r){var n=t.hls,i=r.payload,a=e.decryptdata;if(i&&i.byteLength>0&&a&&a.key&&a.iv&&"AES-128"===a.method){var s=self.performance.now();return t.decrypter.webCryptoDecrypt(new Uint8Array(i),a.key.buffer,a.iv.buffer).then((function(t){var i=self.performance.now();return n.trigger(l.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:s,tdecrypt:i}}),r.payload=t,r}))}return r})).then((function(r){var n=t.fragCurrent,i=t.hls,a=t.levels;if(!a)throw new Error("init load aborted, missing levels");var s=a[e.level].details;console.assert(s,"Level details are defined when init segment is loaded");var o=e.stats;t.state=x.IDLE,t.fragLoadError=0,e.data=new Uint8Array(r.payload),o.parsing.start=o.buffering.start=self.performance.now(),o.parsing.end=o.buffering.end=self.performance.now(),r.frag===n&&i.trigger(l.Events.FRAG_BUFFERED,{stats:o,frag:n,part:null,id:e.type}),t.tick()})).catch((function(r){t.warn(r),t.resetFragmentLoading(e)}))},w.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId},w.fragBufferedComplete=function(e,t){var r=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level+" "+v.default.toString(s.BufferHelper.getBuffered(r))),this.state=x.IDLE,this.tick()},w._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var r=e.frag,n=e.part,i=e.partsLoaded,a=!i||0===i.length||i.some((function(e){return!e})),s=new c.ChunkMetadata(r.level,r.sn,r.stats.chunkCount+1,0,n?n.index:-1,!a);t.flush(s)}},w._handleFragmentLoadProgress=function(e){},w._doFragLoad=function(e,t,r,i){var a=this;if(void 0===r&&(r=null),!this.levels)throw new Error("frag load aborted, missing levels");if(r=Math.max(e.start,r||0),this.config.lowLatencyMode&&t){var s=t.partList;if(s&&i){r>e.end&&t.fragmentHint&&(e=t.fragmentHint);var o=this.getNextPart(s,e,r);if(o>-1){var u=s[o];return this.log("Loading part sn: "+e.sn+" p: "+u.index+" cc: "+e.cc+" of playlist ["+t.startSN+"-"+t.endSN+"] parts [0-"+o+"-"+(s.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(r.toFixed(3))),this.nextLoadPosition=u.start+u.duration,this.state=x.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:e,part:s[o],targetBufferTime:r}),this.doFragPartsLoad(e,s,o,i).catch((function(e){return a.handleFragLoadError(e)}))}if(!e.url||this.loadedEndOfParts(s,r))return Promise.resolve(null)}}return this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(t?"of ["+t.startSN+"-"+t.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(r.toFixed(3))),Object(n.isFiniteNumber)(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=x.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:e,targetBufferTime:r}),this.fragmentLoader.load(e,i).catch((function(e){return a.handleFragLoadError(e)}))},w.doFragPartsLoad=function(e,t,r,n){var i=this;return new Promise((function(a,s){var o=[];!function r(u){var c=t[u];i.fragmentLoader.loadPart(e,c,n).then((function(n){o[c.index]=n;var s=n.part;i.hls.trigger(l.Events.FRAG_LOADED,n);var d=t[u+1];if(!d||d.fragment!==e)return a({frag:e,part:s,partsLoaded:o});r(u+1)})).catch(s)}(r)}))},w.handleFragLoadError=function(e){var t=e.data;return t&&t.details===u.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(l.Events.ERROR,t),null},w._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(t&&this.state===x.PARSING){var r=t.frag,n=t.part,i=t.level,a=self.performance.now();r.stats.parsing.end=a,n&&(n.stats.parsing.end=a),this.updateLevelTiming(r,n,i,e.partial)}else this.fragCurrent||(this.state=x.IDLE)},w.getCurrentContext=function(e){var t=this.levels,r=e.level,n=e.sn,i=e.part;if(!t||!t[r])return this.warn("Levels object was unset while buffering fragment "+n+" of level "+r+". The current chunk will not be buffered."),null;var a=t[r],s=i>-1?Object(p.getPartWith)(a,n,i):null,o=s?s.fragment:Object(p.getFragmentWithSN)(a,n,this.fragCurrent);return o?{frag:o,part:s,level:a}:null},w.bufferFragmentData=function(e,t,r,n){if(e&&this.state===x.PARSING){var i=e.data1,a=e.data2,s=i;if(i&&a&&(s=Object(d.appendUint8Array)(i,a)),s&&s.length){var o={type:e.type,frag:t,part:r,chunkMeta:n,parent:t.type,data:s};this.hls.trigger(l.Events.BUFFER_APPENDING,o),e.dropped&&e.independent&&!r&&this.flushBufferGap(t)}}},w.flushBufferGap=function(e){var t=this.media;if(t)if(s.BufferHelper.isBuffered(t,t.currentTime)){var r=t.currentTime,n=s.BufferHelper.bufferInfo(t,r,0),i=e.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),o=Math.max(Math.min(e.start-a,n.end-a),r+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}else this.flushMainBuffer(0,e.start)},w.getFwdBufferInfo=function(e,t){var r=this.config,i=this.getLoadPosition();if(!Object(n.isFiniteNumber)(i))return null;var a=s.BufferHelper.bufferInfo(e,i,r.maxBufferHole);if(0===a.len&&void 0!==a.nextStart){var o=this.fragmentTracker.getBufferedFrag(i,t);if(o&&a.nextStart<o.end)return s.BufferHelper.bufferInfo(e,i,Math.max(a.nextStart,r.maxBufferHole))}return a},w.getMaxBufferLength=function(e){var t,r=this.config;return t=e?Math.max(8*r.maxBufferSize/e,r.maxBufferLength):r.maxBufferLength,Math.min(t,r.maxMaxBufferLength)},w.reduceMaxBufferLength=function(e){var t=this.config,r=e||t.maxBufferLength;return t.maxMaxBufferLength>=r&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},w.getNextFragment=function(e,t){var r,n,i=t.fragments,a=i.length;if(!a)return null;var s,o=this.config,l=i[0].start;if(t.live){var u=o.initialLiveManifestSize;if(a<u)return this.warn("Not enough fragments to start playback (have: "+a+", need: "+u+")"),null;t.PTSKnown||this.startFragRequested||-1!==this.startPosition||(s=this.getInitialLiveFragment(t,i),this.startPosition=s?this.hls.liveSyncPosition||s.start:e)}else e<=l&&(s=i[0]);if(!s){var c=o.lowLatencyMode?t.partEnd:t.fragmentEnd;s=this.getFragmentAtPosition(e,c,t)}return null===(r=s)||void 0===r||!r.initSegment||null!==(n=s)&&void 0!==n&&n.initSegment.data||this.bitrateTest||(s=s.initSegment),s},w.getNextPart=function(e,t,r){for(var n=-1,i=!1,a=!0,s=0,o=e.length;s<o;s++){var l=e[s];if(a=a&&!l.independent,n>-1&&r<l.start)break;var u=l.loaded;!u&&(i||l.independent||a)&&l.fragment===t&&(n=s),i=u}return n},w.loadedEndOfParts=function(e,t){var r=e[e.length-1];return r&&t>r.start&&r.loaded},w.getInitialLiveFragment=function(e,t){var r=this.fragPrevious,n=null;if(r){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),n=Object(h.findFragmentByPDT)(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){var i=r.sn+1;if(i>=e.startSN&&i<=e.endSN){var a=t[i-e.startSN];r.cc===a.cc&&(n=a,this.log("Live playlist, switching playlist, load frag with next SN: "+n.sn))}n||(n=Object(h.findFragWithCC)(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+n.sn)}}else{var s=this.hls.liveSyncPosition;null!==s&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n},w.getFragmentAtPosition=function(e,t,r){var n,i=this.config,s=this.fragPrevious,o=r.fragments,l=r.endSN,u=r.fragmentHint,c=i.maxFragLookUpTolerance,d=!!(i.lowLatencyMode&&r.partList&&u);if(d&&u&&!this.bitrateTest&&(o=o.concat(u),l=u.sn),e<t){var f=e>t-c?0:c;n=Object(h.findFragmentByPTS)(s,o,e,f)}else n=o[o.length-1];if(n){var p=n.sn-r.startSN,g=s&&n.level===s.level,m=o[p+1];if(this.fragmentTracker.getState(n)===a.FragmentState.BACKTRACKED){n=null;for(var v=p;o[v]&&this.fragmentTracker.getState(o[v])===a.FragmentState.BACKTRACKED;)n=s?o[v--]:o[--v];n||(n=m)}else s&&n.sn===s.sn&&!d&&g&&(n.sn<l&&this.fragmentTracker.getState(m)!==a.FragmentState.OK?(this.log("SN "+n.sn+" just loaded, load next one: "+m.sn),n=m):n=null)}return n},w.synchronizeToLiveEdge=function(e){var t=this.config,r=this.media;if(r){var n=this.hls.liveSyncPosition,i=r.currentTime,a=e.fragments[0].start,s=e.edge,o=i>=a-t.maxFragLookUpTolerance&&i<=s;if(null!==n&&r.duration>n&&(i<n||!o)){var l=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&r.readyState<4||i<s-l)&&(this.loadedmetadata||(this.nextLoadPosition=n),r.readyState&&(this.warn("Playback: "+i.toFixed(3)+" is located too far from the end of live sliding playlist: "+s+", reset currentTime to : "+n.toFixed(3)),r.currentTime=n))}}},w.alignPlaylists=function(e,t){var r=this.levels,i=this.levelLastLoaded,a=this.fragPrevious,s=null!==i?r[i]:null,o=e.fragments.length;if(!o)return this.warn("No fragments in live playlist"),0;var l=e.fragments[0].start,u=!t,c=e.alignedSliding&&Object(n.isFiniteNumber)(l);if(u||!c&&!l){Object(f.alignStream)(a,s,e);var d=e.fragments[0].start;return this.log("Live playlist sliding: "+d.toFixed(2)+" start-sn: "+(t?t.startSN:"na")+"->"+e.startSN+" prev-sn: "+(a?a.sn:"na")+" fragments: "+o),d}return l},w.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},w.setStartPosition=function(e,t){var r=this.startPosition;if(r<t&&(r=-1),-1===r||-1===this.lastCurrentTime){var i=e.startTimeOffset;Object(n.isFiniteNumber)(i)?(r=t+i,i<0&&(r+=e.totalduration),r=Math.min(Math.max(t,r),t+e.totalduration),this.log("Start time offset "+i+" found in playlist, adjust startPosition to "+r),this.startPosition=r):e.live?r=this.hls.liveSyncPosition||t:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r},w.getLoadPosition=function(){var e=this.media,t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t},w.handleFragLoadAborted=function(e,t){this.transmuxer&&"initSegment"!==e.sn&&e.stats.aborted&&(this.warn("Fragment "+e.sn+(t?" part"+t.index:"")+" of level "+e.level+" was aborted"),this.resetFragmentLoading(e))},w.resetFragmentLoading=function(e){this.fragCurrent&&this.fragContextChanged(e)||(this.state=x.IDLE)},w.onFragmentOrKeyLoadError=function(e,t){if(!t.fatal){var r=t.frag;if(r&&r.type===e){var n=this.fragCurrent;console.assert(n&&r.sn===n.sn&&r.level===n.level&&r.urlId===n.urlId,"Frag load error must match current frag to retry");var i=this.config;if(this.fragLoadError+1<=i.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(r.level))return;var a=Math.min(Math.pow(2,this.fragLoadError)*i.fragLoadingRetryDelay,i.fragLoadingMaxRetryTimeout);this.warn("Fragment "+r.sn+" of "+e+" "+r.level+" failed to load, retrying in "+a+"ms"),this.retryDate=self.performance.now()+a,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else t.levelRetry?(e===y.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(o.logger.error(t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)}}},w.afterBufferFlushed=function(e,t,r){if(e){var n=s.BufferHelper.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,r),this.state===x.ENDED&&this.resetLoadingState()}},w.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},w.resetLiveStartWhenNotLoaded=function(e){if(!this.loadedmetadata){this.startFragRequested=!1;var t=this.levels?this.levels[e].details:null;if(null!=t&&t.live)return this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},w.updateLevelTiming=function(e,t,r,n){var i=this,a=r.details;console.assert(!!a,"level.details must be defined"),Object.keys(e.elementaryStreams).reduce((function(t,s){var o=e.elementaryStreams[s];if(o){var u=o.endPTS-o.startPTS;if(u<=0)return i.warn("Could not parse fragment "+e.sn+" "+s+" duration reliably ("+u+") resetting transmuxer to fallback to playlist timing"),i.resetTransmuxer(),t||!1;var c=n?0:Object(p.updateFragPTSDTS)(a,e,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return i.hls.trigger(l.Events.LEVEL_PTS_UPDATED,{details:a,level:r,drift:c,type:s,frag:e,start:o.startPTS,end:o.endPTS}),!0}return t}),!1)?(this.state=x.PARSED,this.hls.trigger(l.Events.FRAG_PARSED,{frag:e,part:t})):this.resetLoadingState()},w.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S=i,(T=[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}])&&b(S.prototype,T),k&&b(S,k),i}(i.default)},"./src/controller/buffer-controller.ts":
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./src/controller/buffer-controller.ts ***!
|
|
|
\*********************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return h}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ../errors */"./src/errors.ts"),o=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=r(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),u=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),c=r(/*! ./buffer-operation-queue */"./src/controller/buffer-operation-queue.ts"),d=Object(l.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function e(e){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var e=t.hls,r=t.media,n=t.mediaSource;a.logger.log("[buffer-controller]: Media source opened"),r&&(t.updateMediaElementDuration(),e.trigger(i.Events.MEDIA_ATTACHED,{media:r})),n&&n.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){a.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){a.logger.log("[buffer-controller]: Media source ended")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var t=e.prototype;return t.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},t.destroy=function(){this.unregisterListeners(),this.details=null},t.registerListeners=function(){var e=this.hls;e.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(i.Events.BUFFER_RESET,this.onBufferReset,this),e.on(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(i.Events.BUFFER_EOS,this.onBufferEos,this),e.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(i.Events.FRAG_PARSED,this.onFragParsed,this),e.on(i.Events.FRAG_CHANGED,this.onFragChanged,this)},t.unregisterListeners=function(){var e=this.hls;e.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(i.Events.BUFFER_RESET,this.onBufferReset,this),e.off(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(i.Events.BUFFER_EOS,this.onBufferEos,this),e.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(i.Events.FRAG_PARSED,this.onFragParsed,this),e.off(i.Events.FRAG_CHANGED,this.onFragChanged,this)},t._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},t.onManifestParsed=function(e,t){var r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.details=null,a.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},t.onMediaAttaching=function(e,t){var r=this.media=t.media;if(r&&d){var n=this.mediaSource=new d;n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),r.src=self.URL.createObjectURL(n),this._objectUrl=r.src}},t.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,r=this._objectUrl;if(t){if(a.logger.log("[buffer-controller]: media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){a.logger.warn("[buffer-controller]: onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(r&&self.URL.revokeObjectURL(r),e.src===r?(e.removeAttribute("src"),e.load()):a.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(i.Events.MEDIA_DETACHED,void 0)},t.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach((function(t){var r=e.sourceBuffer[t];try{r&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(r),e.sourceBuffer[t]=void 0)}catch(e){a.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",e)}})),this._initSourceBuffer()},t.onBufferCodecs=function(e,t){var r=this,n=this.getSourceBufferTypes().length;Object.keys(t).forEach((function(e){if(n){var i=r.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var a=t[e],s=a.codec,o=a.levelCodec,l=a.container;if((i.levelCodec||i.codec).replace(f,"$1")!==(o||s).replace(f,"$1")){var u=l+";codecs="+(o||s);r.appendChangeType(e,u)}}}else r.pendingTracks[e]=t[e]})),n||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},t.appendChangeType=function(e,t){var r=this,n=this.operationQueue,i={execute:function(){var i=r.sourceBuffer[e];i&&(a.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),i.changeType(t)),n.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){a.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",t)}};n.append(i,e)},t.onBufferAppending=function(e,t){var r=this,n=this.hls,l=this.operationQueue,u=this.tracks,c=t.data,d=t.type,f=t.frag,h=t.part,p=t.chunkMeta,g=p.buffering[d],m=self.performance.now();g.start=m;var v=f.stats.buffering,y=h?h.stats.buffering:null;0===v.start&&(v.start=m),y&&0===y.start&&(y.start=m);var b=u.audio,E="audio"===d&&1===p.id&&"audio/mpeg"===(null==b?void 0:b.container),x={execute:function(){if(g.executeStart=self.performance.now(),E){var e=r.sourceBuffer[d];if(e){var t=f.start-e.timestampOffset;Math.abs(t)>=.1&&(a.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+t+") sn: "+f.sn+")"),e.timestampOffset=f.start)}}r.appendExecutor(c,d)},onStart:function(){},onComplete:function(){var e=self.performance.now();g.executeEnd=g.end=e,0===v.first&&(v.first=e),y&&0===y.first&&(y.first=e);var t=r.sourceBuffer,n={};for(var a in t)n[a]=o.BufferHelper.getBuffered(t[a]);r.appendError=0,r.hls.trigger(i.Events.BUFFER_APPENDED,{type:d,frag:f,part:h,chunkMeta:p,parent:f.type,timeRanges:n})},onError:function(e){a.logger.error("[buffer-controller]: Error encountered while trying to append to the "+d+" SourceBuffer",e);var t={type:s.ErrorTypes.MEDIA_ERROR,parent:f.type,details:s.ErrorDetails.BUFFER_APPEND_ERROR,err:e,fatal:!1};e.code===DOMException.QUOTA_EXCEEDED_ERR?t.details=s.ErrorDetails.BUFFER_FULL_ERROR:(r.appendError++,t.details=s.ErrorDetails.BUFFER_APPEND_ERROR,r.appendError>n.config.appendErrorMaxRetry&&(a.logger.error("[buffer-controller]: Failed "+n.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),n.trigger(i.Events.ERROR,t)}};l.append(x,d)},t.onBufferFlushing=function(e,t){var r=this,n=this.operationQueue,s=function(e){return{execute:r.removeExecutor.bind(r,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(i.Events.BUFFER_FLUSHED,{type:e})},onError:function(t){a.logger.warn("[buffer-controller]: Failed to remove from "+e+" SourceBuffer",t)}}};t.type?n.append(s(t.type),t.type):this.getSourceBufferTypes().forEach((function(e){n.append(s(e),e)}))},t.onFragParsed=function(e,t){var r=this,n=t.frag,s=t.part,o=[],l=s?s.elementaryStreams:n.elementaryStreams;l[u.ElementaryStreamTypes.AUDIOVIDEO]?o.push("audiovideo"):(l[u.ElementaryStreamTypes.AUDIO]&&o.push("audio"),l[u.ElementaryStreamTypes.VIDEO]&&o.push("video")),0===o.length&&a.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+n.type+" level: "+n.level+" sn: "+n.sn),this.blockBuffers((function(){var e=self.performance.now();n.stats.buffering.end=e,s&&(s.stats.buffering.end=e);var t=s?s.stats:n.stats;r.hls.trigger(i.Events.FRAG_BUFFERED,{frag:n,part:s,stats:t,id:n.type})}),o)},t.onFragChanged=function(e,t){this.flushBackBuffer()},t.onBufferEos=function(e,t){var r=this;this.getSourceBufferTypes().reduce((function(e,n){var i=r.sourceBuffer[n];return t.type&&t.type!==n||i&&!i.ended&&(i.ended=!0,a.logger.log("[buffer-controller]: "+n+" sourceBuffer now EOS")),e&&!(i&&!i.ended)}),!0)&&this.blockBuffers((function(){var e=r.mediaSource;e&&"open"===e.readyState&&e.endOfStream()}))},t.onLevelUpdated=function(e,t){var r=t.details;r.fragments.length&&(this.details=r,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},t.flushBackBuffer=function(){var e=this.hls,t=this.details,r=this.media,a=this.sourceBuffer;if(r&&null!==t){var s=this.getSourceBufferTypes();if(s.length){var l=t.live&&null!==e.config.liveBackBufferLength?e.config.liveBackBufferLength:e.config.backBufferLength;if(Object(n.isFiniteNumber)(l)&&!(l<0)){var u=r.currentTime,c=t.levelTargetDuration,d=Math.max(l,c),f=Math.floor(u/c)*c-d;s.forEach((function(r){var n=a[r];if(n){var s=o.BufferHelper.getBuffered(n);s.length>0&&f>s.start(0)&&(e.trigger(i.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),t.live&&e.trigger(i.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),e.trigger(i.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:r}))}}))}}}},t.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var e=this.details,t=this.hls,r=this.media,i=this.mediaSource,s=e.fragments[0].start+e.totalduration,o=r.duration,l=Object(n.isFiniteNumber)(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(a.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(e)):(s>l&&s>o||!Object(n.isFiniteNumber)(o))&&(a.logger.log("[buffer-controller]: Updating Media Source duration to "+s.toFixed(3)),i.duration=s)}},t.updateSeekableRange=function(e){var t=this.mediaSource,r=e.fragments;if(r.length&&e.live&&null!=t&&t.setLiveSeekableRange){var n=Math.max(0,r[0].start),i=Math.max(n,n+e.totalduration);t.setLiveSeekableRange(n,i)}},t.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,r=this.pendingTracks,n=Object.keys(r).length;if(n&&!e||2===n){this.createSourceBuffers(r),this.pendingTracks={};var a=this.getSourceBufferTypes();if(0===a.length)return void this.hls.trigger(i.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});a.forEach((function(e){t.executeNext(e)}))}},t.createSourceBuffers=function(e){var t=this.sourceBuffer,r=this.mediaSource;if(!r)throw Error("createSourceBuffers called when mediaSource was null");var n=0;for(var o in e)if(!t[o]){var l=e[o];if(!l)throw Error("source buffer exists for track "+o+", however track does not");var u=l.levelCodec||l.codec,c=l.container+";codecs="+u;a.logger.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var d=t[o]=r.addSourceBuffer(c),f=o;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[o]={buffer:d,codec:u,container:l.container,levelCodec:l.levelCodec,id:l.id},n++}catch(e){a.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(i.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:c})}}n&&this.hls.trigger(i.Events.BUFFER_CREATED,{tracks:this.tracks})},t._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},t._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},t._onSBUpdateError=function(e,t){a.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(i.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var r=this.operationQueue.current(e);r&&r.onError(t)},t.removeExecutor=function(e,t,r){var i=this.media,s=this.mediaSource,o=this.operationQueue,l=this.sourceBuffer[e];if(!i||!s||!l)return a.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void o.shiftAndExecuteNext(e);var u=Object(n.isFiniteNumber)(i.duration)?i.duration:1/0,c=Object(n.isFiniteNumber)(s.duration)?s.duration:1/0,d=Math.max(0,t),f=Math.min(r,u,c);f>d?(a.logger.log("[buffer-controller]: Removing ["+d+","+f+"] from the "+e+" SourceBuffer"),console.assert(!l.updating,e+" sourceBuffer must not be updating"),l.remove(d,f)):o.shiftAndExecuteNext(e)},t.appendExecutor=function(e,t){var r=this.operationQueue,n=this.sourceBuffer[t];if(!n)return a.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void r.shiftAndExecuteNext(t);n.ended=!1,console.assert(!n.updating,t+" sourceBuffer must not be updating"),n.appendBuffer(e)},t.blockBuffers=function(e,t){var r=this;if(void 0===t&&(t=this.getSourceBufferTypes()),!t.length)return a.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve(e);var n=this.operationQueue,i=t.map((function(e){return n.appendBlocker(e)}));Promise.all(i).then((function(){e(),t.forEach((function(e){var t=r.sourceBuffer[e];t&&t.updating||n.shiftAndExecuteNext(e)}))}))},t.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},t.addBufferListener=function(e,t,r){var n=this.sourceBuffer[e];if(n){var i=r.bind(this,e);this.listeners[e].push({event:t,listener:i}),n.addEventListener(t,i)}},t.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach((function(e){t.removeEventListener(e.event,e.listener)}))},e}()},"./src/controller/buffer-operation-queue.ts":
|
|
|
/*!**************************************************!*\
|
|
|
!*** ./src/controller/buffer-operation-queue.ts ***!
|
|
|
\**************************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=function(){function e(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var t=e.prototype;return t.append=function(e,t){var r=this.queues[t];r.push(e),1===r.length&&this.buffers[t]&&this.executeNext(t)},t.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},t.appendBlocker=function(e){var t,r=new Promise((function(e){t=e})),n={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(n,e),r},t.executeNext=function(e){var t=this.buffers,r=this.queues,i=t[e],a=r[e];if(a.length){var s=a[0];try{s.execute()}catch(t){n.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),s.onError(t),i&&i.updating||(a.shift(),this.executeNext(e))}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},e}()},"./src/controller/cap-level-controller.ts":
|
|
|
/*!************************************************!*\
|
|
|
!*** ./src/controller/cap-level-controller.ts ***!
|
|
|
\************************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../events */"./src/events.ts");function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=function(){function e(e){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var t,r,a,s=e.prototype;return s.setStreamController=function(e){this.streamController=e},s.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},s.registerListeners=function(){var e=this.hls;e.on(n.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var e=this.hls;e.off(n.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},s.onFpsDropLevelCapping=function(t,r){e.isLevelAllowed(r.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(r.droppedLevel)},s.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null},s.onManifestParsed=function(e,t){var r=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,r.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var e=this.hls.levels;if(e.length){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},s.getMaxLevel=function(t){var r=this,n=this.hls.levels;if(!n.length)return-1;var i=n.filter((function(n,i){return e.isLevelAllowed(i,r.restrictedLevels)&&i<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},s.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},s.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.width||t.height||(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t},e.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},e.getMaxLevelByMediaSize=function(e,t,r){if(!e||!e.length)return-1;for(var n,i,a=e.length-1,s=0;s<e.length;s+=1){var o=e[s];if((o.width>=t||o.height>=r)&&(n=o,!(i=e[s+1])||n.width!==i.width||n.height!==i.height)){a=s;break}}return a},t=e,a=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],(r=[{key:"mediaWidth",get:function(){return this.getDimensions().width*e.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*e.contentScaleFactor}}])&&i(t.prototype,r),a&&i(t,a),e}();t.default=a},"./src/controller/cmcd-controller.ts":
|
|
|
/*!*******************************************!*\
|
|
|
!*** ./src/controller/cmcd-controller.ts ***!
|
|
|
\*******************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return f}));var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../types/cmcd */"./src/types/cmcd.ts"),a=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts");function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e}function u(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var f=function(){function e(t){var r=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(e){try{r.apply(e,{ot:i.CMCDObjectType.MANIFEST,su:!r.initialized})}catch(e){s.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var t=e.frag,n=r.hls.levels[t.level],a=r.getObjectType(t),o={d:1e3*t.duration,ot:a};a!==i.CMCDObjectType.VIDEO&&a!==i.CMCDObjectType.AUDIO&&a!=i.CMCDObjectType.MUXED||(o.br=n.bitrate/1e3,o.tb=r.getTopBandwidth(a),o.bl=r.getBufferLength(a)),r.apply(e,o)}catch(e){s.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=t;var n=this.config=t.config,a=n.cmcd;null!=a&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||e.uuid(),this.cid=a.contentId,this.useHeaders=!0===a.useHeaders,this.registerListeners())}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(n.Events.BUFFER_CREATED,this.onBufferCreated,this)},t.unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(n.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},t.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},t.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},t.onBufferCreated=function(e,t){var r,n;this.audioBuffer=null===(r=t.tracks.audio)||void 0===r?void 0:r.buffer,this.videoBuffer=null===(n=t.tracks.video)||void 0===n?void 0:n.buffer},t.createData=function(){var e;return{v:i.CMCDVersion,sf:i.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:null===(e=this.media)||void 0===e?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},t.apply=function(t,r){void 0===r&&(r={}),d(r,this.createData());var n=r.ot===i.CMCDObjectType.INIT||r.ot===i.CMCDObjectType.VIDEO||r.ot===i.CMCDObjectType.MUXED;if(this.starved&&n&&(r.bs=!0,r.su=!0,this.starved=!1),null==r.su&&(r.su=this.buffering),this.useHeaders){var a=e.toHeaders(r);if(!Object.keys(a).length)return;t.headers||(t.headers={}),d(t.headers,a)}else{var s=e.toQuery(r);if(!s)return;t.url=e.appendQueryToUri(t.url,s)}},t.getObjectType=function(e){var t=e.type;return"subtitle"===t?i.CMCDObjectType.TIMED_TEXT:"initSegment"===e.sn?i.CMCDObjectType.INIT:"audio"===t?i.CMCDObjectType.AUDIO:"main"===t?this.hls.audioTracks.length?i.CMCDObjectType.VIDEO:i.CMCDObjectType.MUXED:void 0},t.getTopBandwidth=function(e){for(var t,r=0,n=u(e===i.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels);!(t=n()).done;){var a=t.value;a.bitrate>r&&(r=a.bitrate)}return r>0?r:NaN},t.getBufferLength=function(e){var t=this.hls.media,r=e===i.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return r&&t?1e3*a.BufferHelper.bufferInfo(r,t.currentTime,this.config.maxBufferHole).len:NaN},t.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,r=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new r(e)}var n=e.prototype;return n.destroy=function(){this.loader.destroy()},n.abort=function(){this.loader.abort()},n.load=function(e,r,n){t(e),this.loader.load(e,r,n)},l(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e}()},t.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,r=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new r(e)}var n=e.prototype;return n.destroy=function(){this.loader.destroy()},n.abort=function(){this.loader.abort()},n.load=function(e,r,n){t(e),this.loader.load(e,r,n)},l(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e}()},e.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},e.serialize=function(e){for(var t,r=[],n=function(e){return!Number.isNaN(e)&&null!=e&&""!==e&&!1!==e},i=function(e){return Math.round(e)},a=function(e){return 100*i(e/100)},s={br:i,d:i,bl:a,dl:a,mtp:a,nor:function(e){return encodeURIComponent(e)},rtp:a,tb:i},o=u(Object.keys(e||{}).sort());!(t=o()).done;){var l=t.value,c=e[l];if(n(c)&&!("v"===l&&1===c||"pr"==l&&1===c)){var d=s[l];d&&(c=d(c));var f=typeof c,h=void 0;h="ot"===l||"sf"===l||"st"===l?l+"="+c:"boolean"===f?l:"number"===f?l+"="+c:l+"="+JSON.stringify(c),r.push(h)}}return r.join(",")},e.toHeaders=function(t){for(var r={},n=["Object","Request","Session","Status"],i=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},s=0,o=Object.keys(t);s<o.length;s++){var l=o[s];i[null!=a[l]?a[l]:1][l]=t[l]}for(var u=0;u<i.length;u++){var c=e.serialize(i[u]);c&&(r["CMCD-"+n[u]]=c)}return r},e.toQuery=function(t){return"CMCD="+encodeURIComponent(e.serialize(t))},e.appendQueryToUri=function(e,t){if(!t)return e;var r=e.includes("?")?"&":"?";return""+e+r+t},e}()},"./src/controller/eme-controller.ts":
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/controller/eme-controller.ts ***!
|
|
|
\******************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ../utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts");function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l=function(){function e(e){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=e,this._config=e.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var t,r,l,u=e.prototype;return u.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},u._registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this)},u._unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this)},u.getLicenseServerUrl=function(e){switch(e){case s.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+e+'"')},u._attemptKeySystemAccess=function(e,t,r){var n=this,i=function(e,t,r,n){switch(e){case s.KeySystems.WIDEVINE:return function(e,t,r){var n={audioCapabilities:[],videoCapabilities:[]};return e.forEach((function(e){n.audioCapabilities.push({contentType:'audio/mp4; codecs="'+e+'"',robustness:r.audioRobustness||""})})),t.forEach((function(e){n.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"',robustness:r.videoRobustness||""})})),[n]}(t,r,n);default:throw new Error("Unknown key-system: "+e)}}(e,t,r,this._drmSystemOptions);a.logger.log("Requesting encrypted media key-system access");var o=this.requestMediaKeySystemAccess(e,i);this.mediaKeysPromise=o.then((function(t){return n._onMediaKeySystemAccessObtained(e,t)})),o.catch((function(t){a.logger.error('Failed to obtain key-system "'+e+'" access:',t)}))},u._onMediaKeySystemAccessObtained=function(e,t){var r=this;a.logger.log('Access for key-system "'+e+'" obtained');var n={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(n);var i=Promise.resolve().then((function(){return t.createMediaKeys()})).then((function(t){return n.mediaKeys=t,a.logger.log('Media-keys created for key-system "'+e+'"'),r._onMediaKeysCreated(),t}));return i.catch((function(e){a.logger.error("Failed to create media-keys:",e)})),i},u._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach((function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))}))},u._onNewMediaKeySession=function(e){var t=this;a.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",(function(r){t._onKeySessionMessage(e,r.message)}),!1)},u._onKeySessionMessage=function(e,t){a.logger.log("Got EME message event, creating license request"),this._requestLicense(t,(function(t){a.logger.log("Received license data (length: "+(t?t.byteLength:t)+"), updating key-session"),e.update(t)}))},u.onMediaEncrypted=function(e){var t=this;if(a.logger.log('Media is encrypted using "'+e.initDataType+'" init data type'),!this.mediaKeysPromise)return a.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var r=function(r){t._media&&(t._attemptSetMediaKeys(r),t._generateRequestWithPreferredKeySession(e.initDataType,e.initData))};this.mediaKeysPromise.then(r).catch(r)},u._attemptSetMediaKeys=function(e){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys)return a.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});a.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},u._generateRequestWithPreferredKeySession=function(e,t){var r=this,s=this._mediaKeysList[0];if(!s)return a.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(s.mediaKeysSessionInitialized)a.logger.warn("Key-Session already initialized but requested again");else{var o=s.mediaKeysSession;if(!o)return a.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!t)return a.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});a.logger.log('Generating key-session request for "'+e+'" init data type'),s.mediaKeysSessionInitialized=!0,o.generateRequest(e,t).then((function(){a.logger.debug("Key-session generation succeeded")})).catch((function(e){a.logger.error("Error generating key-session request:",e),r.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},u._createLicenseXhr=function(e,t,r){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,n,e,t,r);var i=this._licenseXhrSetup;if(i)try{i.call(this.hls,n,e),i=void 0}catch(e){a.logger.error(e)}try{n.readyState||n.open("POST",e,!0),i&&i.call(this.hls,n,e)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return n},u._onLicenseRequestReadyStageChange=function(e,t,r,s){switch(e.readyState){case 4:if(200===e.status){this._requestLicenseFailureCount=0,a.logger.log("License request succeeded");var o=e.response,l=this._licenseResponseCallback;if(l)try{o=l.call(this.hls,e,t)}catch(e){a.logger.error(e)}s(o)}else{if(a.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var u=3-this._requestLicenseFailureCount+1;a.logger.warn("Retrying license request, "+u+" attempts left"),this._requestLicense(r,s)}}},u._generateLicenseRequestChallenge=function(e,t){switch(e.mediaKeySystemDomain){case s.KeySystems.WIDEVINE:return t}throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},u._requestLicense=function(e,t){a.logger.log("Requesting content license for key-system");var r=this._mediaKeysList[0];if(!r)return a.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var s=this.getLicenseServerUrl(r.mediaKeySystemDomain),o=this._createLicenseXhr(s,e,t);a.logger.log("Sending license request to URL: "+s);var l=this._generateLicenseRequestChallenge(r,e);o.send(l)}catch(e){a.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},u.onMediaAttached=function(e,t){if(this._emeEnabled){var r=t.media;this._media=r,r.addEventListener("encrypted",this._onMediaEncrypted)}},u.onMediaDetached=function(){var e=this._media,t=this._mediaKeysList;e&&(e.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map((function(e){if(e.mediaKeysSession)return e.mediaKeysSession.close().catch((function(){}))}))).then((function(){return e.setMediaKeys(null)})).catch((function(){})))},u.onManifestParsed=function(e,t){if(this._emeEnabled){var r=t.levels.map((function(e){return e.audioCodec})).filter((function(e){return!!e})),n=t.levels.map((function(e){return e.videoCodec})).filter((function(e){return!!e}));this._attemptKeySystemAccess(s.KeySystems.WIDEVINE,r,n)}},t=e,(r=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&o(t.prototype,r),l&&o(t,l),e}();t.default=l},"./src/controller/fps-controller.ts":
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/controller/fps-controller.ts ***!
|
|
|
\******************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/logger */"./src/utils/logger.ts"),a=function(){function e(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching)},t.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},t.onMediaAttaching=function(e,t){var r=this.hls.config;if(r.capLevelOnFPSDrop){var n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&"function"==typeof n.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}},t.checkFPS=function(e,t,r){var a=performance.now();if(t){if(this.lastTime){var s=a-this.lastTime,o=r-this.lastDroppedFrames,l=t-this.lastDecodedFrames,u=1e3*o/s,c=this.hls;if(c.trigger(n.Events.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:r}),u>0&&o>c.config.fpsDroppedMonitoringThreshold*l){var d=c.currentLevel;i.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(-1===c.autoLevelCapping||c.autoLevelCapping>=d)&&(d-=1,c.trigger(n.Events.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:c.currentLevel}),c.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=r,this.lastDecodedFrames=t}},t.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},e}();t.default=a},"./src/controller/fragment-finders.ts":
|
|
|
/*!********************************************!*\
|
|
|
!*** ./src/controller/fragment-finders.ts ***!
|
|
|
\********************************************/
|
|
|
/*! exports provided: findFragmentByPDT, findFragmentByPTS, fragmentWithinToleranceTest, pdtWithinToleranceTest, findFragWithCC */function(e,t,r){"use strict";r.r(t),r.d(t,"findFragmentByPDT",(function(){return a})),r.d(t,"findFragmentByPTS",(function(){return s})),r.d(t,"fragmentWithinToleranceTest",(function(){return o})),r.d(t,"pdtWithinToleranceTest",(function(){return l})),r.d(t,"findFragWithCC",(function(){return u}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/binary-search */"./src/utils/binary-search.ts");function a(e,t,r){if(null===t||!Array.isArray(e)||!e.length||!Object(n.isFiniteNumber)(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;r=r||0;for(var i=0;i<e.length;++i){var a=e[i];if(l(t,r,a))return a}return null}function s(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var a=null;if(e?a=t[e.sn-t[0].sn+1]||null:0===r&&0===t[0].start&&(a=t[0]),a&&0===o(r,n,a))return a;var s=i.default.search(t,o.bind(null,r,n));return s||a}function o(e,t,r){void 0===e&&(e=0),void 0===t&&(t=0);var n=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-n<=e?1:r.start-n>e&&r.start?-1:0}function l(e,t,r){var n=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-n>e}function u(e,t){return i.default.search(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}},"./src/controller/fragment-tracker.ts":
|
|
|
/*!********************************************!*\
|
|
|
!*** ./src/controller/fragment-tracker.ts ***!
|
|
|
\********************************************/
|
|
|
/*! exports provided: FragmentState, FragmentTracker */function(e,t,r){"use strict";r.r(t),r.d(t,"FragmentState",(function(){return n})),r.d(t,"FragmentTracker",(function(){return s}));var n,i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../types/loader */"./src/types/loader.ts");!function(e){e.NOT_LOADED="NOT_LOADED",e.BACKTRACKED="BACKTRACKED",e.APPENDING="APPENDING",e.PARTIAL="PARTIAL",e.OK="OK"}(n||(n={}));var s=function(){function e(e){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){var e=this.hls;e.on(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(i.Events.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(i.Events.FRAG_LOADED,this.onFragLoaded,this)},t.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},t.getAppendedFrag=function(e,t){if(t===a.PlaylistLevelType.MAIN){var r=this.activeFragment,n=this.activeParts;if(!r)return null;if(n)for(var i=n.length;i--;){var s=n[i],o=s?s.end:r.appendedPTS;if(s.start<=e&&void 0!==o&&e<=o)return i>9&&(this.activeParts=n.slice(i-9)),s}else if(r.start<=e&&void 0!==r.appendedPTS&&e<=r.appendedPTS)return r}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){for(var r=this.fragments,n=Object.keys(r),i=n.length;i--;){var a=r[n[i]];if((null==a?void 0:a.body.type)===t&&a.buffered){var s=a.body;if(s.start<=e&&e<=s.end)return s}}return null},t.detectEvictedFragments=function(e,t,r){var n=this;Object.keys(this.fragments).forEach((function(i){var a=n.fragments[i];if(a)if(a.buffered){var s=a.range[e];s&&s.time.some((function(e){var r=!n.isTimeBuffered(e.startPTS,e.endPTS,t);return r&&n.removeFragment(a.body),r}))}else a.body.type===r&&n.removeFragment(a.body)}))},t.detectPartialFragments=function(e){var t=this,r=this.timeRanges,n=e.frag,i=e.part;if(r&&"initSegment"!==n.sn){var a=l(n),s=this.fragments[a];s&&(Object.keys(r).forEach((function(e){var a=n.elementaryStreams[e];if(a){var o=r[e],l=null!==i||!0===a.partial;s.range[e]=t.getBufferedTimes(n,i,l,o)}})),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body))}},t.fragBuffered=function(e){var t=l(e),r=this.fragments[t];r&&(r.backtrack=r.loaded=null,r.buffered=!0)},t.getBufferedTimes=function(e,t,r,n){for(var i={time:[],partial:r},a=t?t.start:e.start,s=t?t.end:e.end,o=e.minEndPTS||s,l=e.maxStartPTS||a,u=0;u<n.length;u++){var c=n.start(u)-this.bufferPadding,d=n.end(u)+this.bufferPadding;if(l>=c&&o<=d){i.time.push({startPTS:Math.max(a,n.start(u)),endPTS:Math.min(s,n.end(u))});break}if(a<d&&s>c)i.partial=!0,i.time.push({startPTS:Math.max(a,n.start(u)),endPTS:Math.min(s,n.end(u))});else if(s<=c)break}return i},t.getPartialFragment=function(e){var t,r,n,i=null,a=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach((function(u){var c=l[u];c&&o(c)&&(r=c.body.start-s,n=c.body.end+s,e>=r&&e<=n&&(t=Math.min(e-r,n-e),a<=t&&(i=c.body,a=t)))})),i},t.getState=function(e){var t=l(e),r=this.fragments[t];return r?r.buffered?o(r)?n.PARTIAL:n.OK:r.backtrack?n.BACKTRACKED:n.APPENDING:n.NOT_LOADED},t.backtrack=function(e,t){var r=l(e),n=this.fragments[r];if(!n||n.backtrack)return null;var i=n.backtrack=t||n.loaded;return n.loaded=null,i},t.getBacktrackData=function(e){var t=l(e),r=this.fragments[t];if(r){var n,i=r.backtrack;if(null!=i&&null!==(n=i.payload)&&void 0!==n&&n.byteLength)return i;this.removeFragment(e)}return null},t.isTimeBuffered=function(e,t,r){for(var n,i,a=0;a<r.length;a++){if(n=r.start(a)-this.bufferPadding,i=r.end(a)+this.bufferPadding,e>=n&&t<=i)return!0;if(t<=n)return!1}return!1},t.onFragLoaded=function(e,t){var r=t.frag,n=t.part;if("initSegment"!==r.sn&&!r.bitrateTest&&!n){var i=l(r);this.fragments[i]={body:r,loaded:t,backtrack:null,buffered:!1,range:Object.create(null)}}},t.onBufferAppended=function(e,t){var r=this,n=t.frag,i=t.part,s=t.timeRanges;if(n.type===a.PlaylistLevelType.MAIN)if(this.activeFragment=n,i){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(i)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach((function(e){var t=s[e];if(r.detectEvictedFragments(e,t),!i)for(var a=0;a<t.length;a++)n.appendedPTS=Math.max(t.end(a),n.appendedPTS||0)}))},t.onFragBuffered=function(e,t){this.detectPartialFragments(t)},t.hasFragment=function(e){var t=l(e);return!!this.fragments[t]},t.removeFragmentsInRange=function(e,t,r){var n=this;Object.keys(this.fragments).forEach((function(i){var a=n.fragments[i];if(a&&a.buffered){var s=a.body;s.type===r&&s.start<t&&s.end>e&&n.removeFragment(s)}}))},t.removeFragment=function(e){var t=l(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),delete this.fragments[t]},t.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},e}();function o(e){var t,r;return e.buffered&&((null===(t=e.range.video)||void 0===t?void 0:t.partial)||(null===(r=e.range.audio)||void 0===r?void 0:r.partial))}function l(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn}},"./src/controller/gap-controller.ts":
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/controller/gap-controller.ts ***!
|
|
|
\******************************************/
|
|
|
/*! exports provided: STALL_MINIMUM_DURATION_MS, MAX_START_GAP_JUMP, SKIP_BUFFER_HOLE_STEP_SECONDS, SKIP_BUFFER_RANGE_START, default */function(e,t,r){"use strict";r.r(t),r.d(t,"STALL_MINIMUM_DURATION_MS",(function(){return o})),r.d(t,"MAX_START_GAP_JUMP",(function(){return l})),r.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return u})),r.d(t,"SKIP_BUFFER_RANGE_START",(function(){return c})),r.d(t,"default",(function(){return d}));var n=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../events */"./src/events.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=250,l=2,u=.1,c=.05,d=function(){function e(e,t,r,n){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=r,this.hls=n}var t=e.prototype;return t.destroy=function(){this.hls=this.fragmentTracker=this.media=null},t.poll=function(e){var t=this.config,r=this.media,i=this.stalled,a=r.currentTime,u=r.seeking,c=this.seeking&&!u,d=!this.seeking&&u;if(this.seeking=u,a===e){if((d||c)&&(this.stalled=null),!r.paused&&!r.ended&&0!==r.playbackRate&&n.BufferHelper.getBuffered(r).length){var f=n.BufferHelper.bufferInfo(r,a,0),h=f.len>0,p=f.nextStart||0;if(h||p){if(u){var g=f.len>l,m=!p||p-a>l&&!this.fragmentTracker.getPartialFragment(a);if(g||m)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var v,y=Math.max(p,f.start||0)-a,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,E=(null==b||null===(v=b.details)||void 0===v?void 0:v.live)?2*b.details.targetduration:l;if(y>0&&y<=E)return void this._trySkipBufferHole(null)}var x=self.performance.now();if(null!==i){var S=x-i;!u&&S>=o&&this._reportStall(f.len);var T=n.BufferHelper.bufferInfo(r,a,t.maxBufferHole);this._tryFixBufferStall(T,S)}else this.stalled=x}}}else if(this.moved=!0,null!==i){if(this.stallReported){var k=self.performance.now()-i;s.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var r=this.config,n=this.fragmentTracker,i=this.media.currentTime,a=n.getPartialFragment(i);a&&this._trySkipBufferHole(a)||e.len>r.maxBufferHole&&t>1e3*r.highBufferWatchdogPeriod&&(s.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,s.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,r=this.hls,o=this.media,l=o.currentTime,d=0,f=n.BufferHelper.getBuffered(o),h=0;h<f.length;h++){var p=f.start(h);if(l+t.maxBufferHole>=d&&l<p){var g=Math.max(p+c,o.currentTime+u);return s.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+g),this.moved=!0,this.stalled=null,o.currentTime=g,e&&r.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+g,frag:e}),g}d=f.end(h)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,r=this.media,n=r.currentTime,o=(this.nudgeRetry||0)+1;if(this.nudgeRetry=o,o<e.nudgeMaxRetry){var l=n+o*e.nudgeOffset;s.logger.warn("Nudging 'currentTime' from "+n+" to "+l),r.currentTime=l,t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else s.logger.error("Playhead still not moving while enough data buffered @"+n+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},e}()},"./src/controller/id3-track-controller.ts":
|
|
|
/*!************************************************!*\
|
|
|
!*** ./src/controller/id3-track-controller.ts ***!
|
|
|
\************************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),a=r(/*! ../demux/id3 */"./src/demux/id3.ts"),s=function(){function e(e){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=e,this._registerListeners()}var t=e.prototype;return t.destroy=function(){this._unregisterListeners()},t._registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},t._unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},t.onMediaAttached=function(e,t){this.media=t.media},t.onMediaDetaching=function(){this.id3Track&&(Object(i.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},t.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var r=e[t];if("metadata"===r.kind&&"id3"===r.label)return Object(i.sendAddTrackEvent)(r,this.media),r}return this.media.addTextTrack("metadata","id3")}},t.onFragParsingMetadata=function(e,t){if(this.media){var r=t.frag,n=t.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<n.length;s++){var o=a.getID3Frames(n[s].data);if(o){var l=n[s].pts,u=s<n.length-1?n[s+1].pts:r.end;u-l<=0&&(u=l+.25);for(var c=0;c<o.length;c++){var d=o[c];if(!a.isTimeStampFrame(d)){var f=new i(l,u,"");f.value=d,this.id3Track.addCue(f)}}}}}},t.onBufferFlushing=function(e,t){var r=t.startOffset,n=t.endOffset,a=t.type;if(!a||"audio"===a){var s=this.id3Track;s&&Object(i.removeCuesInRange)(s,r,n)}},e}();t.default=s},"./src/controller/latency-controller.ts":
|
|
|
/*!**********************************************!*\
|
|
|
!*** ./src/controller/latency-controller.ts ***!
|
|
|
\**********************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(/*! ../errors */"./src/errors.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts");function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=function(){function e(e){var t=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return t.timeupdate()},this.hls=e,this.config=e.config,this.registerListeners()}var t,r,o,l=e.prototype;return l.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},l.registerListeners=function(){this.hls.on(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(i.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){this.hls.off(i.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(i.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(i.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(i.Events.ERROR,this.onError)},l.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},l.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},l.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},l.onLevelUpdated=function(e,t){var r=t.details;this.levelDetails=r,r.advanced&&this.timeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},l.onError=function(e,t){t.details===n.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,a.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},l.timeupdate=function(){var e=this.media,t=this.levelDetails;if(e&&t){this.currentTime=e.currentTime;var r=this.computeLatency();if(null!==r){this._latency=r;var n=this.config,i=n.lowLatencyMode,a=n.maxLiveSyncPlaybackRate;if(i&&1!==a){var s=this.targetLatency;if(null!==s){var o=r-s,l=o<Math.min(this.maxLatency,s+t.targetduration);if(t.live&&l&&o>.05&&this.forwardBufferLength>1){var u=Math.min(2,Math.max(1,a)),c=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(u,Math.max(1,c))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}}}}},l.estimateLiveEdge=function(){var e=this.levelDetails;return null===e?null:e.edge+e.age},l.computeLatency=function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime},t=e,(r=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(null===e)return null;var t=e.holdBack,r=e.partHoldBack,n=e.targetduration,i=this.config,a=i.liveSyncDuration,s=i.liveSyncDurationCount,o=i.lowLatencyMode,l=this.hls.userConfig,u=o&&r||t;(l.liveSyncDuration||l.liveSyncDurationCount||0===u)&&(u=void 0!==a?a:s*n);var c=n;return u+Math.min(1*this.stallCount,c)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,r=this.levelDetails;if(null===e||null===t||null===r)return null;var n=r.edge,i=e-t-this.edgeStalled,a=n-r.totalduration,s=n-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(a,i),s)}},{key:"drift",get:function(){var e=this.levelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(null===e)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var r=e.buffered.length;return r?e.buffered.end(r-1):t.edge-this.currentTime}}])&&s(t.prototype,r),o&&s(t,o),e}()},"./src/controller/level-controller.ts":
|
|
|
/*!********************************************!*\
|
|
|
!*** ./src/controller/level-controller.ts ***!
|
|
|
\********************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return p}));var n=r(/*! ../types/level */"./src/types/level.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../errors */"./src/errors.ts"),s=r(/*! ../utils/codecs */"./src/utils/codecs.ts"),o=r(/*! ./level-helper */"./src/controller/level-helper.ts"),l=r(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),u=r(/*! ../types/loader */"./src/types/loader.ts");function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=function(e){var t,r;function l(t){var r;return(r=e.call(this,t,"[level-controller]")||this)._levels=[],r._firstLevel=-1,r._startLevel=void 0,r.currentLevelIndex=-1,r.manualLevelIndex=-1,r.onParsedComplete=void 0,r._registerListeners(),r}r=e,(t=l).prototype=Object.create(r.prototype),t.prototype.constructor=t,f(t,r);var p,g,m,v=l.prototype;return v._registerListeners=function(){var e=this.hls;e.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(i.Events.ERROR,this.onError,this)},v._unregisterListeners=function(){var e=this.hls;e.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(i.Events.ERROR,this.onError,this)},v.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,e.prototype.destroy.call(this)},v.startLoad=function(){this._levels.forEach((function(e){e.loadError=0})),e.prototype.startLoad.call(this)},v.onManifestLoaded=function(e,t){var r,l,u=[],c=[],d=[],f={},p=!1,g=!1,m=!1;if(t.levels.forEach((function(e){var t=e.attrs;p=p||!(!e.width||!e.height),g=g||!!e.videoCodec,m=m||!!e.audioCodec,h&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0);var r=e.bitrate+"-"+e.attrs.RESOLUTION+"-"+e.attrs.CODECS;(l=f[r])?l.url.push(e.url):(l=new n.Level(e),f[r]=l,u.push(l)),t&&(t.AUDIO&&Object(o.addGroupId)(l,"audio",t.AUDIO),t.SUBTITLES&&Object(o.addGroupId)(l,"text",t.SUBTITLES))})),(p||g)&&m&&(u=u.filter((function(e){var t=e.videoCodec,r=e.width,n=e.height;return!!t||!(!r||!n)}))),u=u.filter((function(e){var t=e.audioCodec,r=e.videoCodec;return(!t||Object(s.isCodecSupportedInMp4)(t,"audio"))&&(!r||Object(s.isCodecSupportedInMp4)(r,"video"))})),t.audioTracks&&(c=t.audioTracks.filter((function(e){return!e.audioCodec||Object(s.isCodecSupportedInMp4)(e.audioCodec,"audio")})),Object(o.assignTrackIdsByGroup)(c)),t.subtitles&&(d=t.subtitles,Object(o.assignTrackIdsByGroup)(d)),u.length>0){r=u[0].bitrate,u.sort((function(e,t){return e.bitrate-t.bitrate})),this._levels=u;for(var v=0;v<u.length;v++)if(u[v].bitrate===r){this._firstLevel=v,this.log("manifest loaded, "+u.length+" level(s) found, first bitrate: "+r);break}var y=m&&!g,b={levels:u,audioTracks:c,subtitleTracks:d,firstLevel:this._firstLevel,stats:t.stats,audio:m,video:g,altAudio:!y&&c.some((function(e){return!!e.url}))};this.hls.trigger(i.Events.MANIFEST_PARSED,b),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,reason:"no level with compatible codecs found in manifest"})},v.onError=function(t,r){if(e.prototype.onError.call(this,t,r),!r.fatal){var n=r.context,i=this._levels[this.currentLevelIndex];if(n&&(n.type===u.PlaylistContextType.AUDIO_TRACK&&i.audioGroupIds&&n.groupId===i.audioGroupIds[i.urlId]||n.type===u.PlaylistContextType.SUBTITLE_TRACK&&i.textGroupIds&&n.groupId===i.textGroupIds[i.urlId]))this.redundantFailover(this.currentLevelIndex);else{var s,o=!1,l=!0;switch(r.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:if(r.frag){var c=this._levels[r.frag.level];c?(c.fragmentError++,c.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=r.frag.level)):s=r.frag.level}break;case a.ErrorDetails.LEVEL_LOAD_ERROR:case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:n&&(n.deliveryDirectives&&(l=!1),s=n.level),o=!0;break;case a.ErrorDetails.REMUX_ALLOC_ERROR:s=r.level,o=!0}void 0!==s&&this.recoverLevel(r,s,o,l)}}},v.recoverLevel=function(e,t,r,n){var i=e.details,a=this._levels[t];if(a.loadError++,r){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}if(n){var s=a.url.length;if(s>1&&a.loadError<s)e.levelRetry=!0,this.redundantFailover(t);else if(-1===this.manualLevelIndex){var o=0===t?this._levels.length-1:t-1;this.currentLevelIndex!==o&&0===this._levels[o].loadError&&(this.warn(i+": switch to "+o),e.levelRetry=!0,this.hls.nextAutoLevel=o)}}},v.redundantFailover=function(e){var t=this._levels[e],r=t.url.length;if(r>1){var n=(t.urlId+1)%r;this.warn("Switching to redundant URL-id "+n),this._levels.forEach((function(e){e.urlId=n})),this.level=e}},v.onFragLoaded=function(e,t){var r=t.frag;if(void 0!==r&&r.type===u.PlaylistLevelType.MAIN){var n=this._levels[r.level];void 0!==n&&(n.fragmentError=0,n.loadError=0)}},v.onLevelLoaded=function(e,t){var r,n,i=t.level,a=t.details,s=this._levels[i];if(!s)return this.warn("Invalid level index "+i),void(null!==(n=t.deliveryDirectives)&&void 0!==n&&n.skip&&(a.deltaUpdateFailed=!0));i===this.currentLevelIndex?(0===s.fragmentError&&(s.loadError=0,this.retryCount=0),this.playlistLoaded(i,t,s.details)):null!==(r=t.deliveryDirectives)&&void 0!==r&&r.skip&&(a.deltaUpdateFailed=!0)},v.onAudioTrackSwitched=function(e,t){var r=this.hls.levels[this.currentLevelIndex];if(r&&r.audioGroupIds){for(var n=-1,i=this.hls.audioTracks[t.id].groupId,a=0;a<r.audioGroupIds.length;a++)if(r.audioGroupIds[a]===i){n=a;break}n!==r.urlId&&(r.urlId=n,this.startLoad())}},v.loadPlaylist=function(e){var t=this.currentLevelIndex,r=this._levels[t];if(this.canLoad&&r&&r.url.length>0){var n=r.urlId,a=r.url[n];if(e)try{a=e.addDirectives(a)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Attempt loading level index "+t+(e?" at sn "+e.msn+" part "+e.part:"")+" with URL-id "+n+" "+a),this.clearTimer(),this.hls.trigger(i.Events.LEVEL_LOADING,{url:a,level:t,id:n,deliveryDirectives:e||null})}},v.removeLevel=function(e,t){var r=function(e,r){return r!==t},n=this._levels.filter((function(n,i){return i!==e||n.url.length>1&&void 0!==t&&(n.url=n.url.filter(r),n.audioGroupIds&&(n.audioGroupIds=n.audioGroupIds.filter(r)),n.textGroupIds&&(n.textGroupIds=n.textGroupIds.filter(r)),n.urlId=0,!0)})).map((function(e,t){var r=e.details;return null!=r&&r.fragments&&r.fragments.forEach((function(e){e.level=t})),e}));this._levels=n,this.hls.trigger(i.Events.LEVELS_UPDATED,{levels:n})},p=l,(g=[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t,r=this._levels;if(0!==r.length&&(this.currentLevelIndex!==e||null===(t=r[e])||void 0===t||!t.details)){if(e<0||e>=r.length){var n=e<0;if(this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:n,reason:"invalid level idx"}),n)return;e=Math.min(e,r.length-1)}this.clearTimer();var s=this.currentLevelIndex,o=r[s],l=r[e];this.log("switching to level "+e+" from "+s),this.currentLevelIndex=e;var u=c({},l,{level:e,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete u._urlId,this.hls.trigger(i.Events.LEVEL_SWITCHING,u);var d=l.details;if(!d||d.live){var f=this.switchParams(l.uri,null==o?void 0:o.details);this.loadPlaylist(f)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}])&&d(p.prototype,g),m&&d(p,m),l}(l.default)},"./src/controller/level-helper.ts":
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/controller/level-helper.ts ***!
|
|
|
\****************************************/
|
|
|
/*! exports provided: addGroupId, assignTrackIdsByGroup, updatePTS, updateFragPTSDTS, mergeDetails, mapPartIntersection, mapFragmentIntersection, adjustSliding, addSliding, computeReloadInterval, getFragmentWithSN, getPartWith */function(e,t,r){"use strict";r.r(t),r.d(t,"addGroupId",(function(){return a})),r.d(t,"assignTrackIdsByGroup",(function(){return s})),r.d(t,"updatePTS",(function(){return o})),r.d(t,"updateFragPTSDTS",(function(){return u})),r.d(t,"mergeDetails",(function(){return c})),r.d(t,"mapPartIntersection",(function(){return d})),r.d(t,"mapFragmentIntersection",(function(){return f})),r.d(t,"adjustSliding",(function(){return h})),r.d(t,"addSliding",(function(){return p})),r.d(t,"computeReloadInterval",(function(){return g})),r.d(t,"getFragmentWithSN",(function(){return m})),r.d(t,"getPartWith",(function(){return v}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/logger */"./src/utils/logger.ts");function a(e,t,r){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(r);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(r)}}function s(e){var t={};e.forEach((function(e){var r=e.groupId||"";e.id=t[r]=t[r]||0,t[r]++}))}function o(e,t,r){l(e[t],e[r])}function l(e,t){var r=t.startPTS;if(Object(n.isFiniteNumber)(r)){var i,a=0;t.sn>e.sn?(a=r-e.start,i=e):(a=e.start-r,i=t),i.duration!==a&&(i.duration=a)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function u(e,t,r,a,s,o){a-r<=0&&(i.logger.warn("Fragment should have a positive duration",t),a=r+t.duration,o=s+t.duration);var u=r,c=a,d=t.startPTS,f=t.endPTS;if(Object(n.isFiniteNumber)(d)){var h=Math.abs(d-r);Object(n.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(h,t.deltaPTS):t.deltaPTS=h,u=Math.max(r,d),r=Math.min(r,d),s=Math.min(s,t.startDTS),c=Math.min(a,f),a=Math.max(a,f),o=Math.max(o,t.endDTS)}t.duration=a-r;var p=r-t.start;t.appendedPTS=a,t.start=t.startPTS=r,t.maxStartPTS=u,t.startDTS=s,t.endPTS=a,t.minEndPTS=c,t.endDTS=o;var g,m=t.sn;if(!e||m<e.startSN||m>e.endSN)return 0;var v=m-e.startSN,y=e.fragments;for(y[v]=t,g=v;g>0;g--)l(y[g],y[g-1]);for(g=v;g<y.length-1;g++)l(y[g],y[g+1]);return e.fragmentHint&&l(y[y.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,p}function c(e,t){for(var r=null,a=e.fragments,s=a.length-1;s>=0;s--){var o=a[s].initSegment;if(o){r=o;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var l,c=0;if(f(e,t,(function(e,i){e.relurl&&(c=e.cc-i.cc),Object(n.isFiniteNumber)(e.startPTS)&&Object(n.isFiniteNumber)(e.endPTS)&&(i.start=i.startPTS=e.startPTS,i.startDTS=e.startDTS,i.appendedPTS=e.appendedPTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.duration=e.endPTS-e.startPTS,i.duration&&(l=i),t.PTSKnown=t.alignedSliding=!0),i.elementaryStreams=e.elementaryStreams,i.loader=e.loader,i.stats=e.stats,i.urlId=e.urlId,e.initSegment&&(i.initSegment=e.initSegment,r=e.initSegment)})),r&&(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((function(e){var t;e.initSegment&&e.initSegment.relurl!==(null===(t=r)||void 0===t?void 0:t.relurl)||(e.initSegment=r)})),t.skippedSegments&&(t.deltaUpdateFailed=t.fragments.some((function(e){return!e})),t.deltaUpdateFailed)){i.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var p=t.skippedSegments;p--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}var g=t.fragments;if(c){i.logger.warn("discontinuity sliding from playlist, take drift into account");for(var m=0;m<g.length;m++)g[m].cc+=c}t.skippedSegments&&(t.startCC=t.fragments[0].cc),d(e.partList,t.partList,(function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),l?u(t,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS):h(e,t),g.length&&(t.totalduration=t.edge-g[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;var v=t.advancedDateTime;if(t.advanced&&v){var y=t.edge;t.driftStart||(t.driftStartTime=v,t.driftStart=y),t.driftEndTime=v,t.driftEnd=y}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function d(e,t,r){if(e&&t)for(var n=0,i=0,a=e.length;i<=a;i++){var s=e[i],o=t[i+n];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?r(s,o):n--}}function f(e,t,r){for(var n=t.skippedSegments,i=Math.max(e.startSN,t.startSN)-t.startSN,a=(e.fragmentHint?1:0)+(n?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,s=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,u=i;u<=a;u++){var c=l[s+u],d=o[u];n&&!d&&u<n&&(d=t.fragments[u]=c),c&&d&&r(c,d)}}function h(e,t){var r=t.startSN+t.skippedSegments-e.startSN,n=e.fragments;r<0||r>=n.length||p(t,n[r].start)}function p(e,t){if(t){for(var r=e.fragments,n=e.skippedSegments;n<r.length;n++)r[n].start+=t;e.fragmentHint&&(e.fragmentHint.start+=t)}}function g(e,t){var r,n=1e3*e.levelTargetDuration,i=n/2,a=e.age,s=a>0&&a<3*n,o=t.loading.end-t.loading.start,l=e.availabilityDelay;if(!1===e.updated)if(s){var u=333*e.misses;r=Math.max(Math.min(i,2*o),u),e.availabilityDelay=(e.availabilityDelay||0)+r}else r=i;else s?(l=Math.min(l||n/2,a),e.availabilityDelay=l,r=l+n-a):r=n-o;return Math.round(r)}function m(e,t,r){if(!e||!e.details)return null;var n=e.details,i=n.fragments[t-n.startSN];return i||((i=n.fragmentHint)&&i.sn===t?i:t<n.startSN&&r&&r.sn===t?r:null)}function v(e,t,r){if(!e||!e.details)return null;var n=e.details.partList;if(n)for(var i=n.length;i--;){var a=n[i];if(a.index===r&&a.fragment.sn===t)return a}return null}},"./src/controller/stream-controller.ts":
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./src/controller/stream-controller.ts ***!
|
|
|
\*********************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return y}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),a=r(/*! ../is-supported */"./src/is-supported.ts"),s=r(/*! ../events */"./src/events.ts"),o=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),u=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),d=r(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),f=r(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),h=r(/*! ./gap-controller */"./src/controller/gap-controller.ts"),p=r(/*! ../errors */"./src/errors.ts"),g=r(/*! ../utils/logger */"./src/utils/logger.ts");function m(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e){var t,r;function y(t,r){var n;return(n=e.call(this,t,r,"[stream-controller]")||this).audioCodecSwap=!1,n.gapController=null,n.level=-1,n._forceStartLoad=!1,n.altAudio=!1,n.audioOnly=!1,n.fragPlaying=null,n.onvplaying=null,n.onvseeked=null,n.fragLastKbps=0,n.stalled=!1,n.couldBacktrack=!1,n.audioCodecSwitch=!1,n.videoBuffer=null,n._registerListeners(),n}r=e,(t=y).prototype=Object.create(r.prototype),t.prototype.constructor=t,v(t,r);var b,E,x,S=y.prototype;return S._registerListeners=function(){var e=this.hls;e.on(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(s.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(s.Events.ERROR,this.onError,this),e.on(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(s.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S._unregisterListeners=function(){var e=this.hls;e.off(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(s.Events.ERROR,this.onError,this),e.off(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(s.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},S.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var n=r.startLevel;-1===n&&(r.config.testBandwidth?(n=0,this.bitrateTest=!0):n=r.nextAutoLevel),this.level=r.nextLoadLevel=n,this.loadedmetadata=!1}t>0&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=i.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=i.State.STOPPED},S.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.call(this)},S.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_LEVEL:var e,t=this.levels,r=this.level,n=null==t||null===(e=t[r])||void 0===e?void 0:e.details;if(n&&(!n.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(n))break;this.state=i.State.IDLE;break}break;case i.State.FRAG_LOADING_WAITING_RETRY:var a,s=self.performance.now(),o=this.retryDate;(!o||s>=o||null!==(a=this.media)&&void 0!==a&&a.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=i.State.IDLE)}this.onTickEnd()},S.onTickEnd=function(){e.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},S.doTickIdle=function(){var e,t,r=this.hls,n=this.levelLastLoaded,a=this.levels,o=this.media,d=r.config,f=r.nextLoadLevel;if(null!==n&&(o||!this.startFragRequested&&d.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&a&&a[f]){var h=a[f];this.level=r.nextLoadLevel=f;var p=h.details;if(!p||this.state===i.State.WAITING_LEVEL||p.live&&this.levelLastLoaded!==f)this.state=i.State.WAITING_LEVEL;else{var g=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:o,u.PlaylistLevelType.MAIN);if(null!==g&&!(g.len>=this.getMaxBufferLength(h.maxBitrate))){if(this._streamEnded(g,p)){var m={};return this.altAudio&&(m.type="video"),this.hls.trigger(s.Events.BUFFER_EOS,m),void(this.state=i.State.ENDED)}var v=g.end,y=this.getNextFragment(v,p);if(this.couldBacktrack&&!this.fragPrevious&&y&&"initSegment"!==y.sn){var b=y.sn-p.startSN;b>1&&(y=p.fragments[b-1],this.fragmentTracker.removeFragment(y))}if(y&&this.fragmentTracker.getState(y)===l.FragmentState.OK&&this.nextLoadPosition>v){var E=this.audioOnly&&!this.altAudio?c.ElementaryStreamTypes.AUDIO:c.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(o,E,u.PlaylistLevelType.MAIN),y=this.getNextFragment(this.nextLoadPosition,p)}y&&(!y.initSegment||y.initSegment.data||this.bitrateTest||(y=y.initSegment),"identity"!==(null===(e=y.decryptdata)||void 0===e?void 0:e.keyFormat)||null!==(t=y.decryptdata)&&void 0!==t&&t.key?this.loadFragment(y,p,v):this.loadKey(y,p))}}}},S.loadFragment=function(t,r,n){var i,a=this.fragmentTracker.getState(t);if(this.fragCurrent=t,a===l.FragmentState.BACKTRACKED){var s=this.fragmentTracker.getBacktrackData(t);if(s)return this._handleFragmentLoadProgress(s),void this._handleFragmentLoadComplete(s);a=l.FragmentState.NOT_LOADED}a===l.FragmentState.NOT_LOADED||a===l.FragmentState.PARTIAL?"initSegment"===t.sn?this._loadInitSegment(t):this.bitrateTest?(t.bitrateTest=!0,this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t)):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,r,n)):a===l.FragmentState.APPENDING?this.reduceMaxBufferLength(t.duration)&&this.fragmentTracker.removeFragment(t):0===(null===(i=this.media)||void 0===i?void 0:i.buffered.length)&&this.fragmentTracker.removeAllFragments()},S.getAppendedFrag=function(e){var t=this.fragmentTracker.getAppendedFrag(e,u.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},S.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,u.PlaylistLevelType.MAIN)},S.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},S.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},S.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var r,n=this.getAppendedFrag(t.currentTime);if(n&&n.start>1&&this.flushMainBuffer(0,n.start-1),!t.paused&&e){var i=e[this.hls.nextLoadLevel],a=this.fragLastKbps;r=a&&this.fragCurrent?this.fragCurrent.duration*i.maxBitrate/(1e3*a)+1:0}else r=0;var s=this.getBufferedFrag(t.currentTime+r);if(s){var o=this.followingBufferedFrag(s);if(o){this.abortCurrentFrag();var l=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,c=Math.max(s.end,l+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,.5*u),.75*u));this.flushMainBuffer(c,Number.POSITIVE_INFINITY)}}}},S.abortCurrentFrag=function(){var e=this.fragCurrent;this.fragCurrent=null,null!=e&&e.loader&&e.loader.abort(),this.state===i.State.KEY_LOADING&&(this.state=i.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},S.flushMainBuffer=function(t,r){e.prototype.flushMainBuffer.call(this,t,r,this.altAudio?"video":null)},S.onMediaAttached=function(t,r){e.prototype.onMediaAttached.call(this,t,r);var n=r.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,n,this.fragmentTracker,this.hls)},S.onMediaDetaching=function(){var t=this.media;t&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),e.prototype.onMediaDetaching.call(this)},S.onMediaPlaying=function(){this.tick()},S.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:null;Object(n.isFiniteNumber)(t)&&this.log("Media seeked to "+t.toFixed(3)),this.tick()},S.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(s.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},S.onManifestParsed=function(e,t){var r,n=!1,i=!1;t.levels.forEach((function(e){(r=e.audioCodec)&&(-1!==r.indexOf("mp4a.40.2")&&(n=!0),-1!==r.indexOf("mp4a.40.5")&&(i=!0))})),this.audioCodecSwitch=n&&i&&!Object(a.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},S.onLevelLoading=function(e,t){var r=this.levels;if(r&&this.state===i.State.IDLE){var n=r[t.level];(!n.details||n.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(n.details))&&(this.state=i.State.WAITING_LEVEL)}},S.onLevelLoaded=function(e,t){var r,n=this.levels,a=t.level,o=t.details,l=o.totalduration;if(n){this.log("Level "+a+" loaded ["+o.startSN+","+o.endSN+"], cc ["+o.startCC+", "+o.endCC+"] duration:"+l);var u=this.fragCurrent;!u||this.state!==i.State.FRAG_LOADING&&this.state!==i.State.FRAG_LOADING_WAITING_RETRY||u.level!==t.level&&u.loader&&(this.state=i.State.IDLE,u.loader.abort());var c=n[a],d=0;if(o.live||null!==(r=c.details)&&void 0!==r&&r.live){if(o.fragments[0]||(o.deltaUpdateFailed=!0),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,c.details)}if(c.details=o,this.levelLastLoaded=a,this.hls.trigger(s.Events.LEVEL_UPDATED,{details:o,level:a}),this.state===i.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=i.State.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,d),this.tick()}else this.warn("Levels were reset while loading level "+a)},S._handleFragmentLoadProgress=function(e){var t,r=e.frag,n=e.part,i=e.payload,a=this.levels;if(a){var s=a[r.level],o=s.details;if(o){var l=s.videoCodec,c=o.PTSKnown||!o.live,h=null===(t=r.initSegment)||void 0===t?void 0:t.data,p=this._getAudioCodec(s),g=this.transmuxer=this.transmuxer||new d.default(this.hls,u.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=n?n.index:-1,v=-1!==m,y=new f.ChunkMetadata(r.level,r.sn,r.stats.chunkCount,i.byteLength,m,v),b=this.initPTS[r.cc];g.push(i,h,p,l,r,n,o.totalduration,c,y,b)}else this.warn("Dropping fragment "+r.sn+" of level "+r.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},S.onAudioTrackSwitching=function(e,t){var r=this.altAudio,n=!!t.url,i=t.id;if(!n){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;null!=a&&a.loader&&(this.log("Switching to main audio track, cancel main fragment load"),a.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var o=this.hls;r&&o.trigger(s.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),o.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:i})}},S.onAudioTrackSwitched=function(e,t){var r=t.id,n=!!this.hls.audioTracks[r].url;if(n){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n,this.tick()},S.onBufferCreated=function(e,t){var r,n,i=t.tracks,a=!1;for(var s in i){var o=i[s];if("main"===o.id){if(n=s,r=o,"video"===s){var l=i[s];l&&(this.videoBuffer=l.buffer)}}else a=!0}a&&r?(this.log("Alternate track found, use "+n+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},S.onFragBuffered=function(e,t){var r=t.frag,n=t.part;if(!r||r.type===u.PlaylistLevelType.MAIN){if(this.fragContextChanged(r))return this.warn("Fragment "+r.sn+(n?" p: "+n.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===i.State.PARSED&&(this.state=i.State.IDLE));var a=n?n.stats:r.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,n)}},S.onError=function(e,t){switch(t.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(u.PlaylistLevelType.MAIN,t);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==i.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=i.State.ERROR):t.levelRetry||this.state!==i.State.WAITING_LEVEL||(this.state=i.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if("main"===t.parent&&(this.state===i.State.PARSING||this.state===i.State.PARSED)){var r=!0,n=this.getFwdBufferInfo(this.media,u.PlaylistLevelType.MAIN);n&&n.len>.5&&(r=!this.reduceMaxBufferLength(n.len)),r&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}},S.checkBuffer=function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){var r=o.BufferHelper.getBuffered(e);!this.loadedmetadata&&r.length?(this.loadedmetadata=!0,this.seekToStartPos()):t.poll(this.lastCurrentTime),this.lastCurrentTime=e.currentTime}},S.onFragLoadEmergencyAborted=function(){this.state=i.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},S.onBufferFlushed=function(e,t){var r=t.type;if(r!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var n=(r===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,r,u.PlaylistLevelType.MAIN)}},S.onLevelsUpdated=function(e,t){this.levels=t.levels},S.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},S.seekToStartPos=function(){var e=this.media,t=e.currentTime,r=this.startPosition;if(r>=0&&t<r){if(e.seeking)return void g.logger.log("could not seek to "+r+", already seeking at "+t);var n=o.BufferHelper.getBuffered(e),i=(n.length?n.start(0):0)-r;i>0&&(i<this.config.maxBufferHole||i<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+i+" to match buffer start"),r+=i,this.startPosition=r),this.log("seek to target start position "+r+" from current time "+t),e.currentTime=r}},S._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t},S._loadBitrateTestFrag=function(e){var t=this;this._doFragLoad(e).then((function(r){var n=t.hls;if(r&&!n.nextLoadLevel&&!t.fragContextChanged(e)){t.fragLoadError=0,t.state=i.State.IDLE,t.startFragRequested=!1,t.bitrateTest=!1;var a=e.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),n.trigger(s.Events.FRAG_LOADED,r)}}))},S._handleTransmuxComplete=function(e){var t,r="main",a=this.hls,o=e.remuxResult,l=e.chunkMeta,u=this.getCurrentContext(l);if(!u)return this.warn("The loading context changed while buffering fragment "+l.sn+" of level "+l.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(l.level);var d=u.frag,f=u.part,h=u.level,p=o.video,g=o.text,m=o.id3,v=o.initSegment,y=this.altAudio?void 0:o.audio;if(!this.fragContextChanged(d)){if(this.state=i.State.PARSING,v){v.tracks&&(this._bufferInitSegment(h,v.tracks,d,l),a.trigger(s.Events.FRAG_PARSING_INIT_SEGMENT,{frag:d,id:r,tracks:v.tracks}));var b=v.initPTS,E=v.timescale;Object(n.isFiniteNumber)(b)&&(this.initPTS[d.cc]=b,a.trigger(s.Events.INIT_PTS_FOUND,{frag:d,id:r,initPTS:b,timescale:E}))}if(p&&!1!==o.independent){if(h.details){var x=p.startPTS,S=p.endPTS,T=p.startDTS,k=p.endDTS;if(f)f.elementaryStreams[p.type]={startPTS:x,endPTS:S,startDTS:T,endDTS:k};else if(p.firstKeyFrame&&p.independent&&(this.couldBacktrack=!0),p.dropped&&p.independent){if(this.getLoadPosition()+this.config.maxBufferHole<x)return void this.backtrack(d);d.setElementaryStreamInfo(p.type,d.start,S,d.start,k,!0)}d.setElementaryStreamInfo(p.type,x,S,T,k),this.bufferFragmentData(p,d,f,l)}}else if(!1===o.independent)return void this.backtrack(d);if(y){var w=y.startPTS,C=y.endPTS,L=y.startDTS,A=y.endDTS;f&&(f.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:w,endPTS:C,startDTS:L,endDTS:A}),d.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,w,C,L,A),this.bufferFragmentData(y,d,f,l)}if(null!=m&&null!==(t=m.samples)&&void 0!==t&&t.length){var D={frag:d,id:r,samples:m.samples};a.trigger(s.Events.FRAG_PARSING_METADATA,D)}if(g){var O={frag:d,id:r,samples:g.samples};a.trigger(s.Events.FRAG_PARSING_USERDATA,O)}}},S._bufferInitSegment=function(e,t,r,n){var a=this;if(this.state===i.State.PARSING){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var o=t.audio,l=t.video,u=t.audiovideo;if(o){var c=e.audioCodec,d=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(c&&(c=-1!==c.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==o.metadata.channelCount&&-1===d.indexOf("firefox")&&(c="mp4a.40.5")),-1!==d.indexOf("android")&&"audio/mpeg"!==o.container&&(c="mp4a.40.2",this.log("Android: force audio codec to "+c)),e.audioCodec&&e.audioCodec!==c&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+c+'"'),o.levelCodec=c,o.id="main",this.log("Init audio buffer, container:"+o.container+", codecs[selected/level/parsed]=["+(c||"")+"/"+(e.audioCodec||"")+"/"+o.codec+"]")}l&&(l.levelCodec=e.videoCodec,l.id="main",this.log("Init video buffer, container:"+l.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+l.codec+"]")),u&&this.log("Init audiovideo buffer, container:"+u.container+", codecs[level/parsed]=["+(e.attrs.CODECS||"")+"/"+u.codec+"]"),this.hls.trigger(s.Events.BUFFER_CODECS,t),Object.keys(t).forEach((function(e){var i=t[e].initSegment;null!=i&&i.byteLength&&a.hls.trigger(s.Events.BUFFER_APPENDING,{type:e,data:i,frag:r,part:null,chunkMeta:n,parent:r.type})})),this.tick()}},S.backtrack=function(e){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(e);var t=this.fragmentTracker.backtrack(e);this.fragPrevious=null,this.nextLoadPosition=e.start,t?this.resetFragmentLoading(e):this.state=i.State.BACKTRACKING},S.checkFragmentChanged=function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var r=e.currentTime;if(o.BufferHelper.isBuffered(e,r)?t=this.getAppendedFrag(r):o.BufferHelper.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){var n=this.fragPlaying,i=t.level;n&&t.sn===n.sn&&n.level===i&&t.urlId===n.urlId||(this.hls.trigger(s.Events.FRAG_CHANGED,{frag:t}),n&&n.level===i||this.hls.trigger(s.Events.LEVEL_SWITCHED,{level:i}),this.fragPlaying=t)}}},b=y,(E=[{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getAppendedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;if(e){var t=this.getAppendedFrag(e.currentTime);return this.followingBufferedFrag(t)}return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&m(b.prototype,E),x&&m(b,x),y}(i.default)},"./src/controller/subtitle-stream-controller.ts":
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./src/controller/subtitle-stream-controller.ts ***!
|
|
|
\******************************************************/
|
|
|
/*! exports provided: SubtitleStreamController */function(e,t,r){"use strict";r.r(t),r.d(t,"SubtitleStreamController",(function(){return g}));var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/logger */"./src/utils/logger.ts"),a=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),s=r(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),o=r(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),l=r(/*! ./level-helper */"./src/controller/level-helper.ts"),u=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),c=r(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),d=r(/*! ../types/loader */"./src/types/loader.ts"),f=r(/*! ../types/level */"./src/types/level.ts");function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var g=function(e){var t,r;function g(t,r){var n;return(n=e.call(this,t,r,"[subtitle-stream-controller]")||this).levels=[],n.currentTrackId=-1,n.tracksBuffered=[],n.mainDetails=null,n._registerListeners(),n}r=e,(t=g).prototype=Object.create(r.prototype),t.prototype.constructor=t,p(t,r);var m,v,y,b=g.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(n.Events.ERROR,this.onError,this),e.on(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(n.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(n.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b._unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(n.Events.ERROR,this.onError,this),e.off(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(n.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(n.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b.startLoad=function(){this.stopLoad(),this.state=c.State.IDLE,this.setInterval(500),this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},b.onLevelLoaded=function(e,t){this.mainDetails=t.details},b.onSubtitleFragProcessed=function(e,t){var r=t.frag,n=t.success;if(this.fragPrevious=r,this.state=c.State.IDLE,n){var i=this.tracksBuffered[this.currentTrackId];if(i){for(var a,s=r.start,o=0;o<i.length;o++)if(s>=i[o].start&&s<=i[o].end){a=i[o];break}var l=r.start+r.duration;a?a.end=l:(a={start:s,end:l},i.push(a)),this.fragmentTracker.fragBuffered(r)}}},b.onBufferFlushing=function(e,t){var r=t.startOffset,n=t.endOffset;if(0===r&&n!==Number.POSITIVE_INFINITY){var i=this.currentTrackId,a=this.levels;if(!a.length||!a[i]||!a[i].details)return;var s=n-a[i].details.targetduration;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach((function(e){for(var t=0;t<e.length;)if(e[t].end<=s)e.shift();else{if(!(e[t].start<s))break;e[t].start=s,t++}})),this.fragmentTracker.removeFragmentsInRange(r,s,d.PlaylistLevelType.SUBTITLE)}},b.onError=function(e,t){var r,n=t.frag;n&&n.type===d.PlaylistLevelType.SUBTITLE&&(null!==(r=this.fragCurrent)&&void 0!==r&&r.loader&&this.fragCurrent.loader.abort(),this.state=c.State.IDLE)},b.onSubtitleTracksUpdated=function(e,t){var r=this,n=t.subtitleTracks;this.tracksBuffered=[],this.levels=n.map((function(e){return new f.Level(e)})),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach((function(e){r.tracksBuffered[e.id]=[]})),this.mediaBuffer=null},b.onSubtitleTrackSwitch=function(e,t){if(this.currentTrackId=t.id,this.levels.length&&-1!==this.currentTrackId){var r=this.levels[this.currentTrackId];null!=r&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(500)}else this.clearInterval()},b.onSubtitleTrackLoaded=function(e,t){var r,n=t.details,i=t.id,a=this.currentTrackId,u=this.levels;if(u.length){var d=u[a];if(!(i>=u.length||i!==a)&&d){if(this.mediaBuffer=this.mediaBufferTimeRanges,n.live||null!==(r=d.details)&&void 0!==r&&r.live){var f=this.mainDetails;if(n.deltaUpdateFailed||!f)return;var h=f.fragments[0];d.details?0===this.alignPlaylists(n,d.details)&&h&&Object(l.addSliding)(n,h.start):n.hasProgramDateTime&&f.hasProgramDateTime?Object(o.alignMediaPlaylistByPDT)(n,f):h&&Object(l.addSliding)(n,h.start)}d.details=n,this.levelLastLoaded=i,this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===c.State.IDLE&&(Object(s.findFragmentByPTS)(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),d.details=void 0))}}},b._handleFragmentLoadComplete=function(e){var t=e.frag,r=e.payload,i=t.decryptdata,a=this.hls;if(!this.fragContextChanged(t)&&r&&r.byteLength>0&&i&&i.key&&i.iv&&"AES-128"===i.method){var s=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(r),i.key.buffer,i.iv.buffer).then((function(e){var r=performance.now();a.trigger(n.Events.FRAG_DECRYPTED,{frag:t,payload:e,stats:{tstart:s,tdecrypt:r}})}))}},b.doTick=function(){if(this.media){if(this.state===c.State.IDLE){var e,t=this.currentTrackId,r=this.levels;if(!r.length||!r[t]||!r[t].details)return;var o=r[t].details,l=o.targetduration,d=this.config,f=this.media,h=a.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,f.currentTime-l,d.maxBufferHole),p=h.end;if(h.len>this.getMaxBufferLength()+l)return;console.assert(o,"Subtitle track details are defined on idle subtitle stream controller tick");var g,m=o.fragments,v=m.length,y=o.edge,b=this.fragPrevious;if(p<y){var E=d.maxFragLookUpTolerance;b&&o.hasProgramDateTime&&(g=Object(s.findFragmentByPDT)(m,b.endProgramDateTime,E)),g||!(g=Object(s.findFragmentByPTS)(b,m,p,E))&&b&&b.start<m[0].start&&(g=m[0])}else g=m[v-1];null!==(e=g)&&void 0!==e&&e.encrypted?(i.logger.log("Loading key for "+g.sn),this.state=c.State.KEY_LOADING,this.hls.trigger(n.Events.KEY_LOADING,{frag:g})):g&&this.fragmentTracker.getState(g)===u.FragmentState.NOT_LOADED&&this.loadFragment(g,o,p)}}else this.state=c.State.IDLE},b.loadFragment=function(t,r,n){this.fragCurrent=t,e.prototype.loadFragment.call(this,t,r,n)},m=g,(v=[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}])&&h(m.prototype,v),y&&h(m,y),g}(c.default)},"./src/controller/subtitle-track-controller.ts":
|
|
|
/*!*****************************************************!*\
|
|
|
!*** ./src/controller/subtitle-track-controller.ts ***!
|
|
|
\*****************************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),a=r(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),s=r(/*! ../types/loader */"./src/types/loader.ts");function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=function(e){var t,r;function a(t){var r;return(r=e.call(this,t,"[subtitle-track-controller]")||this).media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r.subtitleDisplay=!0,r.registerListeners(),r}r=e,(t=a).prototype=Object.create(r.prototype),t.prototype.constructor=t,l(t,r);var u,d,f,h=a.prototype;return h.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,e.prototype.destroy.call(this)},h.registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(n.Events.ERROR,this.onError,this)},h.unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(n.Events.ERROR,this.onError,this)},h.onMediaAttached=function(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},h.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},h.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),c(this.media.textTracks).forEach((function(e){Object(i.clearCurrentCues)(e)})),this.subtitleTrack=-1,this.media=null)},h.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},h.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},h.onSubtitleTrackLoaded=function(e,t){var r=t.id,n=t.details,i=this.trackId,a=this.tracksInGroup[i];if(a){var s=a.details;a.details=t.details,this.log("subtitle track "+r+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,s))}else this.warn("Invalid subtitle track id "+r)},h.onLevelLoading=function(e,t){this.switchLevel(t.level)},h.onLevelSwitching=function(e,t){this.switchLevel(t.level)},h.switchLevel=function(e){var t=this.hls.levels[e];if(null!=t&&t.textGroupIds){var r=t.textGroupIds[t.urlId];if(this.groupId!==r){var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,a=this.tracks.filter((function(e){return!r||e.groupId===r}));this.tracksInGroup=a;var s=this.findTrackId(null==i?void 0:i.name)||this.findTrackId();this.groupId=r;var o={subtitleTracks:a};this.log("Updating subtitle tracks, "+a.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(n.Events.SUBTITLE_TRACKS_UPDATED,o),-1!==s&&this.setSubtitleTrack(s,i)}}},h.findTrackId=function(e){for(var t=this.tracksInGroup,r=0;r<t.length;r++){var n=t[r];if((!this.selectDefaultTrack||n.default)&&(!e||e===n.name))return n.id}return-1},h.onError=function(t,r){e.prototype.onError.call(this,t,r),!r.fatal&&r.context&&r.context.type===s.PlaylistContextType.SUBTITLE_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},h.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var r=t.id,i=t.groupId,a=t.url;if(e)try{a=e.addDirectives(a)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADING,{url:a,id:r,groupId:i,deliveryDirectives:e||null})}},h.toggleTrackModes=function(e){var t=this,r=this.media,n=this.subtitleDisplay,i=this.trackId;if(r){var a=c(r.textTracks),s=a.filter((function(e){return e.groupId===t.groupId}));if(-1===e)[].slice.call(a).forEach((function(e){e.mode="disabled"}));else{var o=s[i];o&&(o.mode="disabled")}var l=s[e];l&&(l.mode=n?"showing":"hidden")}},h.setSubtitleTrack=function(e,t){var r,i=this.tracksInGroup;if(this.media){if(this.trackId!==e&&this.toggleTrackModes(e),!(this.trackId===e&&(-1===e||null!==(r=i[e])&&void 0!==r&&r.details)||e<-1||e>=i.length)){this.clearTimer();var a=i[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,a){var s=a.id,o=a.groupId,l=void 0===o?"":o,u=a.name,c=a.type,d=a.url;this.hls.trigger(n.Events.SUBTITLE_TRACK_SWITCH,{id:s,groupId:l,name:u,type:c,url:d});var f=this.switchParams(a.url,null==t?void 0:t.details);this.loadPlaylist(f)}else this.hls.trigger(n.Events.SUBTITLE_TRACK_SWITCH,{id:e})}}else this.queuedDefaultTrack=e},h.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=c(this.media.textTracks),r=0;r<t.length;r++)if("hidden"===t[r].mode)e=r;else if("showing"===t[r].mode){e=r;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)}},u=a,(d=[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}}])&&o(u.prototype,d),f&&o(u,f),a}(a.default);function c(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];"subtitles"===n.kind&&n.label&&t.push(e[r])}return t}t.default=u},"./src/controller/timeline-controller.ts":
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./src/controller/timeline-controller.ts ***!
|
|
|
\***********************************************/
|
|
|
/*! exports provided: TimelineController */function(e,t,r){"use strict";r.r(t),r.d(t,"TimelineController",(function(){return f}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/cea-608-parser */"./src/utils/cea-608-parser.ts"),s=r(/*! ../utils/output-filter */"./src/utils/output-filter.ts"),o=r(/*! ../utils/webvtt-parser */"./src/utils/webvtt-parser.ts"),l=r(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),u=r(/*! ../utils/imsc1-ttml-parser */"./src/utils/imsc1-ttml-parser.ts"),c=r(/*! ../types/loader */"./src/types/loader.ts"),d=r(/*! ../utils/logger */"./src/utils/logger.ts"),f=function(){function e(e){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var t=new s.default(this,"textTrack1"),r=new s.default(this,"textTrack2"),n=new s.default(this,"textTrack3"),o=new s.default(this,"textTrack4");this.cea608Parser1=new a.default(1,t,r),this.cea608Parser2=new a.default(3,n,o)}e.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(i.Events.FRAG_LOADING,this.onFragLoading,this),e.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=e.prototype;return t.destroy=function(){var e=this.hls;e.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(i.Events.FRAG_LOADING,this.onFragLoading,this),e.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},t.addCues=function(e,t,r,n,a){for(var s,o,l,u,c=!1,d=a.length;d--;){var f=a[d],h=(s=f[0],o=f[1],l=t,u=r,Math.min(o,u)-Math.max(s,l));if(h>=0&&(f[0]=Math.min(f[0],t),f[1]=Math.max(f[1],r),c=!0,h/(r-t)>.5))return}if(c||a.push([t,r]),this.config.renderTextTracksNatively){var p=this.captionsTracks[e];this.Cues.newCue(p,t,r,n)}else{var g=this.Cues.newCue(null,t,r,n);this.hls.trigger(i.Events.CUES_PARSED,{type:"captions",cues:g,track:e})}},t.onInitPtsFound=function(e,t){var r=this,n=t.frag,a=t.id,s=t.initPTS,o=t.timescale,l=this.unparsedVttFrags;"main"===a&&(this.initPTS[n.cc]=s,this.timescale[n.cc]=o),l.length&&(this.unparsedVttFrags=[],l.forEach((function(e){r.onFragLoaded(i.Events.FRAG_LOADED,e)})))},t.getExistingTrack=function(e){var t=this.media;if(t)for(var r=0;r<t.textTracks.length;r++){var n=t.textTracks[r];if(n[e])return n}return null},t.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},t.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,r=this.captionsTracks,n=this.media,i=t[e],a=i.label,s=i.languageCode,o=this.getExistingTrack(e);if(o)r[e]=o,Object(l.clearCurrentCues)(r[e]),Object(l.sendAddTrackEvent)(r[e],n);else{var u=this.createTextTrack("captions",a,s);u&&(u[e]=!0,r[e]=u)}}},t.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var r={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}}},t.createTextTrack=function(e,t,r){var n=this.media;if(n)return n.addTextTrack(e,t,r)},t.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},t.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach((function(t){Object(l.clearCurrentCues)(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}},t.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},t._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var r=0;r<t.length;r++)Object(l.clearCurrentCues)(t[r])}},t.onSubtitleTracksUpdated=function(e,t){var r=this;this.textTracks=[];var n=t.subtitleTracks||[],a=n.some((function(e){return e.textCodec===u.IMSC1_CODEC}));if(this.config.enableWebVTT||a&&this.config.enableIMSC1){var s=this.tracks&&n&&this.tracks.length===n.length;if(this.tracks=n||[],this.config.renderTextTracksNatively){var o=this.media?this.media.textTracks:[];this.tracks.forEach((function(e,t){var n;if(t<o.length){for(var i=null,a=0;a<o.length;a++)if(h(o[a],e)){i=o[a];break}i&&(n=i)}n?Object(l.clearCurrentCues)(n):(n=r.createTextTrack("subtitles",e.name,e.lang))&&(n.mode="disabled"),n&&(n.groupId=e.groupId,r.textTracks.push(n))}))}else if(!s&&this.tracks&&this.tracks.length){var c=this.tracks.map((function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}));this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},t.onManifestLoaded=function(e,t){var r=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(t){var n="textTrack"+t[1],i=r.captionsProperties[n];i&&(i.label=e.name,e.lang&&(i.languageCode=e.lang),i.media=e)}}))},t.onFragLoading=function(e,t){var r=this.cea608Parser1,n=this.cea608Parser2,i=this.lastSn,a=this.lastPartIndex;if(this.enabled&&r&&n&&t.frag.type===c.PlaylistLevelType.MAIN){var s,o,l=t.frag.sn,u=null!=(s=null==t||null===(o=t.part)||void 0===o?void 0:o.index)?s:-1;l===i+1||l===i&&u===a+1||(r.reset(),n.reset()),this.lastSn=l,this.lastPartIndex=u}},t.onFragLoaded=function(e,t){var r=t.frag,a=t.payload,s=this.initPTS,o=this.unparsedVttFrags;if(r.type===c.PlaylistLevelType.SUBTITLE)if(a.byteLength){if(!Object(n.isFiniteNumber)(s[r.cc]))return o.push(t),void(s.length&&this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Missing initial subtitle PTS")}));var l=r.decryptdata;if(null==l||null==l.key||"AES-128"!==l.method){var d=this.tracks[r.level],f=this.vttCCs;f[r.cc]||(f[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),d&&d.textCodec===u.IMSC1_CODEC?this._parseIMSC1(r,a):this._parseVTTs(r,a,f)}}else this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})},t._parseIMSC1=function(e,t){var r=this,n=this.hls;Object(u.parseIMSC1)(t,this.initPTS[e.cc],this.timescale[e.cc],(function(t){r._appendCues(t,e.level),n.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){d.logger.log("Failed to parse IMSC1: "+t),n.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))},t._parseVTTs=function(e,t,r){var n=this,a=this.hls;Object(o.parseWebVTT)(t,this.initPTS[e.cc],this.timescale[e.cc],r,e.cc,e.start,(function(t){n._appendCues(t,e.level),a.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(r){n._fallbackToIMSC1(e,t),d.logger.log("Failed to parse VTT cue: "+r),a.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})}))},t._fallbackToIMSC1=function(e,t){var r=this,n=this.tracks[e.level];n.textCodec||Object(u.parseIMSC1)(t,this.initPTS[e.cc],this.timescale[e.cc],(function(){n.textCodec=u.IMSC1_CODEC,r._parseIMSC1(e,t)}),(function(){n.textCodec="wvtt"}))},t._appendCues=function(e,t){var r=this.hls;if(this.config.renderTextTracksNatively){var n=this.textTracks[t];if("disabled"===n.mode)return;e.forEach((function(e){return Object(l.addCueToTrack)(n,e)}))}else{var a=this.tracks[t].default?"default":"subtitles"+t;r.trigger(i.Events.CUES_PARSED,{type:"subtitles",cues:e,track:a})}},t.onFragDecrypted=function(e,t){var r=t.frag;if(r.type===c.PlaylistLevelType.SUBTITLE){if(!Object(n.isFiniteNumber)(this.initPTS[r.cc]))return void this.unparsedVttFrags.push(t);this.onFragLoaded(i.Events.FRAG_LOADED,t)}},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){var r=this.cea608Parser1,n=this.cea608Parser2;if(this.enabled&&r&&n)for(var i=0;i<t.samples.length;i++){var a=t.samples[i].bytes;if(a){var s=this.extractCea608Data(a);r.addData(t.samples[i].pts,s[0]),n.addData(t.samples[i].pts,s[1])}}},t.onBufferFlushing=function(e,t){var r=t.startOffset,n=t.endOffset,i=t.endOffsetSubtitles,a=t.type,s=this.media;if(s&&!(s.currentTime<n)){if(!a||"video"===a){var o=this.captionsTracks;Object.keys(o).forEach((function(e){return Object(l.removeCuesInRange)(o[e],r,n)}))}if(this.config.renderTextTracksNatively&&0===r&&void 0!==i){var u=this.textTracks;Object.keys(u).forEach((function(e){return Object(l.removeCuesInRange)(u[e],r,i)}))}}},t.extractCea608Data=function(e){for(var t=31&e[0],r=2,n=[[],[]],i=0;i<t;i++){var a=e[r++],s=127&e[r++],o=127&e[r++],l=3&a;0===s&&0===o||0!=(4&a)&&(0!==l&&1!==l||(n[l].push(s),n[l].push(o)))}return n},e}();function h(e,t){return e&&e.label===t.name&&!(e.textTrack1||e.textTrack2)}},"./src/crypt/aes-crypto.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/crypt/aes-crypto.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}return e.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)},e}()},"./src/crypt/aes-decryptor.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/crypt/aes-decryptor.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: removePadding, default */function(e,t,r){"use strict";r.r(t),r.d(t,"removePadding",(function(){return i})),r.d(t,"default",(function(){return a}));var n=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts");function i(e){var t=e.byteLength,r=t&&new DataView(e.buffer).getUint8(t-1);return r?Object(n.sliceUint8)(e,0,t-r):e}var a=function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),r=new Uint32Array(4),n=0;n<4;n++)r[n]=t.getUint32(4*n);return r},t.initTable=function(){var e=this.sBox,t=this.invSBox,r=this.subMix,n=r[0],i=r[1],a=r[2],s=r[3],o=this.invSubMix,l=o[0],u=o[1],c=o[2],d=o[3],f=new Uint32Array(256),h=0,p=0,g=0;for(g=0;g<256;g++)f[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var m=p^p<<1^p<<2^p<<3^p<<4;m=m>>>8^255&m^99,e[h]=m,t[m]=h;var v=f[h],y=f[v],b=f[y],E=257*f[m]^16843008*m;n[h]=E<<24|E>>>8,i[h]=E<<16|E>>>16,a[h]=E<<8|E>>>24,s[h]=E,E=16843009*b^65537*y^257*v^16843008*h,l[m]=E<<24|E>>>8,u[m]=E<<16|E>>>16,c[m]=E<<8|E>>>24,d[m]=E,h?(h=v^f[f[f[b^v]]],p^=f[f[p]]):h=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,n=0;n<t.length&&r;)r=t[n]===this.key[n],n++;if(!r){this.key=t;var i=this.keySize=t.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);var a,s,o,l,u=this.ksRows=4*(i+6+1),c=this.keySchedule=new Uint32Array(u),d=this.invKeySchedule=new Uint32Array(u),f=this.sBox,h=this.rcon,p=this.invSubMix,g=p[0],m=p[1],v=p[2],y=p[3];for(a=0;a<u;a++)a<i?o=c[a]=t[a]:(l=o,a%i==0?(l=f[(l=l<<8|l>>>24)>>>24]<<24|f[l>>>16&255]<<16|f[l>>>8&255]<<8|f[255&l],l^=h[a/i|0]<<24):i>6&&a%i==4&&(l=f[l>>>24]<<24|f[l>>>16&255]<<16|f[l>>>8&255]<<8|f[255&l]),c[a]=o=(c[a-i]^l)>>>0);for(s=0;s<u;s++)a=u-s,l=3&s?c[a]:c[a-4],d[s]=s<4||a<=4?l:g[f[l>>>24]]^m[f[l>>>16&255]]^v[f[l>>>8&255]]^y[f[255&l]],d[s]=d[s]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,r){for(var n,i,a,s,o,l,u,c,d,f,h,p,g,m,v=this.keySize+6,y=this.invKeySchedule,b=this.invSBox,E=this.invSubMix,x=E[0],S=E[1],T=E[2],k=E[3],w=this.uint8ArrayToUint32Array_(r),C=w[0],L=w[1],A=w[2],D=w[3],O=new Int32Array(e),_=new Int32Array(O.length),R=this.networkToHostOrderSwap;t<O.length;){for(d=R(O[t]),f=R(O[t+1]),h=R(O[t+2]),p=R(O[t+3]),o=d^y[0],l=p^y[1],u=h^y[2],c=f^y[3],g=4,m=1;m<v;m++)n=x[o>>>24]^S[l>>16&255]^T[u>>8&255]^k[255&c]^y[g],i=x[l>>>24]^S[u>>16&255]^T[c>>8&255]^k[255&o]^y[g+1],a=x[u>>>24]^S[c>>16&255]^T[o>>8&255]^k[255&l]^y[g+2],s=x[c>>>24]^S[o>>16&255]^T[l>>8&255]^k[255&u]^y[g+3],o=n,l=i,u=a,c=s,g+=4;n=b[o>>>24]<<24^b[l>>16&255]<<16^b[u>>8&255]<<8^b[255&c]^y[g],i=b[l>>>24]<<24^b[u>>16&255]<<16^b[c>>8&255]<<8^b[255&o]^y[g+1],a=b[u>>>24]<<24^b[c>>16&255]<<16^b[o>>8&255]<<8^b[255&l]^y[g+2],s=b[c>>>24]<<24^b[o>>16&255]<<16^b[l>>8&255]<<8^b[255&u]^y[g+3],_[t]=R(n^C),_[t+1]=R(s^L),_[t+2]=R(a^A),_[t+3]=R(i^D),C=d,L=f,A=h,D=p,t+=4}return _.buffer},e}()},"./src/crypt/decrypter.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/crypt/decrypter.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return u}));var n=r(/*! ./aes-crypto */"./src/crypt/aes-crypto.ts"),i=r(/*! ./fast-aes-key */"./src/crypt/fast-aes-key.ts"),a=r(/*! ./aes-decryptor */"./src/crypt/aes-decryptor.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),u=function(){function e(e,t,r){var n=(void 0===r?{}:r).removePKCS7Padding,i=void 0===n||n;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=e,this.config=t,this.removePKCS7Padding=i,i)try{var a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(e){}null===this.subtle&&(this.config.enableSoftwareAES=!0)}var t=e.prototype;return t.destroy=function(){this.observer=null},t.isSync=function(){return this.config.enableSoftwareAES},t.flush=function(){var e=this.currentResult;if(e){var t=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Object(a.removePadding)(t):t}this.reset()},t.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},t.decrypt=function(e,t,r,n){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(e),t,r);var i=this.flush();i&&n(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(e),t,r).then(n)},t.softwareDecrypt=function(e,t,r){var n=this.currentIV,i=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(e=Object(o.appendUint8Array)(s,e),this.remainderData=null);var u=this.getValidChunk(e);if(!u.length)return null;n&&(r=n);var c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new a.default),c.expandKey(t);var d=i;return this.currentResult=c.decrypt(u.buffer,0,r),this.currentIV=Object(l.sliceUint8)(u,-16).buffer,d||null},t.webCryptoDecrypt=function(e,t,r){var a=this,s=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new i.default(s,t)),this.fastAesKey.expandKey().then((function(t){return s?new n.default(s,r).decrypt(e.buffer,t):Promise.reject(new Error("web crypto not initialized"))})).catch((function(n){return a.onWebCryptoError(n,e,t,r)}))},t.onWebCryptoError=function(e,t,r,n){return s.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",e),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(t,r,n)},t.getValidChunk=function(e){var t=e,r=e.length-e.length%16;return r!==e.length&&(t=Object(l.sliceUint8)(e,0,r),this.remainderData=Object(l.sliceUint8)(e,r)),t},t.logOnce=function(e){this.logEnabled&&(s.logger.log("[decrypter.ts]: "+e),this.logEnabled=!1)},e}()},"./src/crypt/fast-aes-key.ts":
|
|
|
/*!***********************************!*\
|
|
|
!*** ./src/crypt/fast-aes-key.ts ***!
|
|
|
\***********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}return e.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},e}()},"./src/demux/aacdemuxer.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/aacdemuxer.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),i=r(/*! ./adts */"./src/demux/adts.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ../demux/id3 */"./src/demux/id3.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=function(e){var t,r;function n(t,r){var n;return(n=e.call(this)||this).observer=void 0,n.config=void 0,n.observer=t,n.config=r,n}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,o(t,r);var l=n.prototype;return l.resetInitSegment=function(t,r,n){e.prototype.resetInitSegment.call(this,t,r,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}},n.probe=function(e){if(!e)return!1;for(var t=(s.getID3Data(e,0)||[]).length,r=e.length;t<r;t++)if(i.probe(e,t))return a.logger.log("ADTS sync word found !"),!0;return!1},l.canParse=function(e,t){return i.canParse(e,t)},l.appendFrame=function(e,t,r){i.initTrackConfig(e,this.observer,t,r,e.manifestCodec);var n=i.appendFrame(e,t,r,this.initPTS,this.frameIndex);if(n&&0===n.missing)return n},n}(n.default);l.minProbeByteLength=9,t.default=l},"./src/demux/adts.ts":
|
|
|
/*!***************************!*\
|
|
|
!*** ./src/demux/adts.ts ***!
|
|
|
\***************************/
|
|
|
/*! exports provided: getAudioConfig, isHeaderPattern, getHeaderLength, getFullFrameLength, canGetFrameLength, isHeader, canParse, probe, initTrackConfig, getFrameDuration, parseFrameHeader, appendFrame */function(e,t,r){"use strict";r.r(t),r.d(t,"getAudioConfig",(function(){return s})),r.d(t,"isHeaderPattern",(function(){return o})),r.d(t,"getHeaderLength",(function(){return l})),r.d(t,"getFullFrameLength",(function(){return u})),r.d(t,"canGetFrameLength",(function(){return c})),r.d(t,"isHeader",(function(){return d})),r.d(t,"canParse",(function(){return f})),r.d(t,"probe",(function(){return h})),r.d(t,"initTrackConfig",(function(){return p})),r.d(t,"getFrameDuration",(function(){return g})),r.d(t,"parseFrameHeader",(function(){return m})),r.d(t,"appendFrame",(function(){return v}));var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../events */"./src/events.ts");function s(e,t,r,s){var o,l,u,c,d=navigator.userAgent.toLowerCase(),f=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=1+((192&t[r+2])>>>6);var p=(60&t[r+2])>>>2;if(!(p>h.length-1))return u=(1&t[r+2])<<2,u|=(192&t[r+3])>>>6,n.logger.log("manifest codec:"+s+", ADTS type:"+o+", samplingIndex:"+p),/firefox/i.test(d)?p>=6?(o=5,c=new Array(4),l=p-3):(o=2,c=new Array(2),l=p):-1!==d.indexOf("android")?(o=2,c=new Array(2),l=p):(o=5,c=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&p>=6?l=p-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(p>=6&&1===u||/vivaldi/i.test(d))||!s&&1===u)&&(o=2,c=new Array(2)),l=p)),c[0]=o<<3,c[0]|=(14&p)>>1,c[1]|=(1&p)<<7,c[1]|=u<<3,5===o&&(c[1]|=(14&l)>>1,c[2]=(1&l)<<7,c[2]|=8,c[3]=0),{config:c,samplerate:h[p],channelCount:u,codec:"mp4a.40."+o,manifestCodec:f};e.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+p})}function o(e,t){return 255===e[t]&&240==(246&e[t+1])}function l(e,t){return 1&e[t+1]?7:9}function u(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function c(e,t){return t+5<e.length}function d(e,t){return t+1<e.length&&o(e,t)}function f(e,t){return c(e,t)&&o(e,t)&&u(e,t)<=e.length-t}function h(e,t){if(d(e,t)){var r=l(e,t);if(t+r>=e.length)return!1;var n=u(e,t);if(n<=r)return!1;var i=t+n;return i===e.length||d(e,i)}return!1}function p(e,t,r,i,a){if(!e.samplerate){var o=s(t,r,i,a);if(!o)return;e.config=o.config,e.samplerate=o.samplerate,e.channelCount=o.channelCount,e.codec=o.codec,e.manifestCodec=o.manifestCodec,n.logger.log("parsed codec:"+e.codec+", rate:"+o.samplerate+", channels:"+o.channelCount)}}function g(e){return 9216e4/e}function m(e,t,r,n,i){var a=l(e,t),s=u(e,t);if((s-=a)>0)return{headerLength:a,frameLength:s,stamp:r+n*i}}function v(e,t,r,n,i){var a=m(t,r,n,i,g(e.samplerate));if(a){var s,o=a.frameLength,l=a.headerLength,u=a.stamp,c=l+o,d=Math.max(0,r+c-t.length);d?(s=new Uint8Array(c-l)).set(t.subarray(r+l,t.length),0):s=t.subarray(r+l,r+c);var f={unit:s,pts:u};return d||e.samples.push(f),{sample:f,length:c,missing:d}}}},"./src/demux/base-audio-demuxer.ts":
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./src/demux/base-audio-demuxer.ts ***!
|
|
|
\*****************************************/
|
|
|
/*! exports provided: initPTSFn, default */function(e,t,r){"use strict";r.r(t),r.d(t,"initPTSFn",(function(){return u}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../demux/id3 */"./src/demux/id3.ts"),a=r(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),s=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),o=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),l=function(){function e(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var t=e.prototype;return t.resetInitSegment=function(e,t,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},t.resetTimeStamp=function(){},t.resetContiguity=function(){},t.canParse=function(e,t){return!1},t.appendFrame=function(e,t,r){},t.demux=function(e,t){this.cachedData&&(e=Object(s.appendUint8Array)(this.cachedData,e),this.cachedData=null);var r,n,l=i.getID3Data(e,0),c=l?l.length:0,d=this._audioTrack,f=this._id3Track,h=l?i.getTimeStamp(l):void 0,p=e.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=u(h,t)),l&&l.length>0&&f.samples.push({pts:this.initPTS,dts:this.initPTS,data:l}),n=this.initPTS;c<p;){if(this.canParse(e,c)){var g=this.appendFrame(d,e,c);g?(this.frameIndex++,n=g.sample.pts,r=c+=g.length):c=p}else i.canParse(e,c)?(l=i.getID3Data(e,c),f.samples.push({pts:n,dts:n,data:l}),r=c+=l.length):c++;if(c===p&&r!==p){var m=Object(o.sliceUint8)(e,r);this.cachedData?this.cachedData=Object(s.appendUint8Array)(this.cachedData,m):this.cachedData=m}}return{audioTrack:d,avcTrack:Object(a.dummyTrack)(),id3Track:f,textTrack:Object(a.dummyTrack)()}},t.demuxSampleAes=function(e,t,r){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},t.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(a.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(a.dummyTrack)()}},t.destroy=function(){},e}(),u=function(e,t){return Object(n.isFiniteNumber)(e)?90*e:9e4*t};t.default=l},"./src/demux/chunk-cache.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/demux/chunk-cache.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(){this.chunks=[],this.dataLength=0}var t=e.prototype;return t.push=function(e){this.chunks.push(e),this.dataLength+=e.length},t.flush=function(){var e,t=this.chunks,r=this.dataLength;return t.length?(e=1===t.length?t[0]:function(e,t){for(var r=new Uint8Array(t),n=0,i=0;i<e.length;i++){var a=e[i];r.set(a,n),n+=a.length}return r}(t,r),this.reset(),e):new Uint8Array(0)},t.reset=function(){this.chunks.length=0,this.dataLength=0},e}()},"./src/demux/dummy-demuxed-track.ts":
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/demux/dummy-demuxed-track.ts ***!
|
|
|
\******************************************/
|
|
|
/*! exports provided: dummyTrack */function(e,t,r){"use strict";function n(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}r.r(t),r.d(t,"dummyTrack",(function(){return n}))},"./src/demux/exp-golomb.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/exp-golomb.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=function(){function e(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,n=new Uint8Array(4),i=Math.min(4,t);if(0===i)throw new Error("no bytes available");n.set(e.subarray(r,r+i)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},t.skipBits=function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=e-t)>0&&this.bitsAvailable?r<<t|this.readBits(t):r},t.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r},t.readSPS=function(){var e,t,r,n=0,i=0,a=0,s=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),u=this.readUEG.bind(this),c=this.readBoolean.bind(this),d=this.skipBits.bind(this),f=this.skipEG.bind(this),h=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();var g=o();if(l(5),d(3),o(),h(),100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g){var m=u();if(3===m&&d(1),h(),h(),d(1),c())for(t=3!==m?8:12,r=0;r<t;r++)c()&&p(r<6?16:64)}h();var v=u();if(0===v)u();else if(1===v)for(d(1),f(),f(),e=u(),r=0;r<e;r++)f();h(),d(1);var y=u(),b=u(),E=l(1);0===E&&d(1),d(1),c()&&(n=u(),i=u(),a=u(),s=u());var x=[1,1];if(c()&&c())switch(o()){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:x=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(y+1)-2*n-2*i),height:(2-E)*(b+1)*16-(E?2:4)*(a+s),pixelRatio:x}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}();t.default=i},"./src/demux/id3.ts":
|
|
|
/*!**************************!*\
|
|
|
!*** ./src/demux/id3.ts ***!
|
|
|
\**************************/
|
|
|
/*! exports provided: isHeader, isFooter, getID3Data, canParse, getTimeStamp, isTimeStampFrame, getID3Frames, decodeFrame, utf8ArrayToStr, testables */function(e,t,r){"use strict";r.r(t),r.d(t,"isHeader",(function(){return i})),r.d(t,"isFooter",(function(){return a})),r.d(t,"getID3Data",(function(){return s})),r.d(t,"canParse",(function(){return l})),r.d(t,"getTimeStamp",(function(){return u})),r.d(t,"isTimeStampFrame",(function(){return c})),r.d(t,"getID3Frames",(function(){return f})),r.d(t,"decodeFrame",(function(){return h})),r.d(t,"utf8ArrayToStr",(function(){return y})),r.d(t,"testables",(function(){return b}));var n,i=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},a=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},s=function(e,t){for(var r=t,n=0;i(e,t);)n+=10,n+=o(e,t+6),a(e,t+10)&&(n+=10),t+=n;if(n>0)return e.subarray(r,r+n)},o=function(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3]},l=function(e,t){return i(e,t)&&o(e,t+6)+10<=e.length-t},u=function(e){for(var t=f(e),r=0;r<t.length;r++){var n=t[r];if(c(n))return v(n)}},c=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},d=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=o(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}},f=function(e){for(var t=0,r=[];i(e,t);){for(var n=o(e,t+6),s=(t+=10)+n;t+8<s;){var l=d(e.subarray(t)),u=h(l);u&&r.push(u),t+=l.size+10}a(e,t)&&(t+=10)}return r},h=function(e){return"PRIV"===e.type?p(e):"W"===e.type[0]?m(e):g(e)},p=function(e){if(!(e.size<2)){var t=y(e.data,!0),r=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:r.buffer}}},g=function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,r=y(e.data.subarray(t),!0);t+=r.length+1;var n=y(e.data.subarray(t));return{key:e.type,info:r,data:n}}var i=y(e.data.subarray(1));return{key:e.type,data:i}}},m=function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,r=y(e.data.subarray(t),!0);t+=r.length+1;var n=y(e.data.subarray(t));return{key:e.type,info:r,data:n}}var i=y(e.data);return{key:e.type,data:i}},v=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],n=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return n/=45,r&&(n+=47721858.84),Math.round(n)}},y=function(e,t){void 0===t&&(t=!1);var r=E();if(r){var n=r.decode(e);if(t){var i=n.indexOf("\0");return-1!==i?n.substring(0,i):n}return n.replace(/\0/g,"")}for(var a,s,o,l=e.length,u="",c=0;c<l;){if(0===(a=e[c++])&&t)return u;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(a);break;case 12:case 13:s=e[c++],u+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=e[c++],o=e[c++],u+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&o)<<0)}}return u},b={decodeTextFrame:g};function E(){return n||void 0===self.TextDecoder||(n=new self.TextDecoder("utf-8")),n}},"./src/demux/mp3demuxer.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/mp3demuxer.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),i=r(/*! ../demux/id3 */"./src/demux/id3.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ./mpegaudio */"./src/demux/mpegaudio.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=function(e){var t,r;function n(){return e.apply(this,arguments)||this}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,o(t,r);var l=n.prototype;return l.resetInitSegment=function(t,r,n){e.prototype.resetInitSegment.call(this,t,r,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}},n.probe=function(e){if(!e)return!1;for(var t=(i.getID3Data(e,0)||[]).length,r=e.length;t<r;t++)if(s.probe(e,t))return a.logger.log("MPEG Audio sync word found !"),!0;return!1},l.canParse=function(e,t){return s.canParse(e,t)},l.appendFrame=function(e,t,r){if(null!==this.initPTS)return s.appendFrame(e,t,r,this.initPTS,this.frameIndex)},n}(n.default);l.minProbeByteLength=4,t.default=l},"./src/demux/mp4demuxer.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/mp4demuxer.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),i=r(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),a=function(){function e(e,t){this.remainderData=null,this.config=void 0,this.config=t}var t=e.prototype;return t.resetTimeStamp=function(){},t.resetInitSegment=function(){},t.resetContiguity=function(){},e.probe=function(e){return Object(n.findBox)({data:e,start:0,end:Math.min(e.length,16384)},["moof"]).length>0},t.demux=function(e){var t=e,r=Object(i.dummyTrack)();if(this.config.progressive){this.remainderData&&(t=Object(n.appendUint8Array)(this.remainderData,e));var a=Object(n.segmentValidRange)(t);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=t;return{audioTrack:Object(i.dummyTrack)(),avcTrack:r,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},t.flush=function(){var e=Object(i.dummyTrack)();return e.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(i.dummyTrack)(),avcTrack:e,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},t.demuxSampleAes=function(e,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},t.destroy=function(){},e}();a.minProbeByteLength=1024,t.default=a},"./src/demux/mpegaudio.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/demux/mpegaudio.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: appendFrame, parseHeader, isHeaderPattern, isHeader, canParse, probe */function(e,t,r){"use strict";r.r(t),r.d(t,"appendFrame",(function(){return l})),r.d(t,"parseHeader",(function(){return u})),r.d(t,"isHeaderPattern",(function(){return c})),r.d(t,"isHeader",(function(){return d})),r.d(t,"canParse",(function(){return f})),r.d(t,"probe",(function(){return h}));var n=null,i=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],a=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],s=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],o=[0,1,1,4];function l(e,t,r,n,i){if(!(r+24>t.length)){var a=u(t,r);if(a&&r+a.frameLength<=t.length){var s=n+i*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:t.subarray(r,r+a.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(o),{sample:o,length:a.frameLength,missing:0}}}}function u(e,t){var r=e[t+1]>>3&3,l=e[t+1]>>1&3,u=e[t+2]>>4&15,c=e[t+2]>>2&3;if(1!==r&&0!==u&&15!==u&&3!==c){var d=e[t+2]>>1&1,f=e[t+3]>>6,h=1e3*i[14*(3===r?3-l:3===l?3:4)+u-1],p=a[3*(3===r?0:2===r?1:2)+c],g=3===f?1:2,m=s[r][l],v=o[l],y=8*m*v,b=Math.floor(m*h/p+d)*v;if(null===n){var E=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);n=E?parseInt(E[1]):0}return!!n&&n<=87&&2===l&&h>=224e3&&0===f&&(e[t+3]=128|e[t+3]),{sampleRate:p,channelCount:g,frameLength:b,samplesPerFrame:y}}}function c(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function d(e,t){return t+1<e.length&&c(e,t)}function f(e,t){return c(e,t)&&4<=e.length-t}function h(e,t){if(t+1<e.length&&c(e,t)){var r=u(e,t),n=4;null!=r&&r.frameLength&&(n=r.frameLength);var i=t+n;return i===e.length||d(e,i)}return!1}},"./src/demux/sample-aes.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/sample-aes.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),i=r(/*! ./tsdemuxer */"./src/demux/tsdemuxer.ts"),a=function(){function e(e,t,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new n.default(e,t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,t)},t.decryptAacSample=function(e,t,r,n){var i=e[t].unit,a=i.subarray(16,i.length-i.length%16),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),o=this;this.decryptBuffer(s,(function(a){var s=new Uint8Array(a);i.set(s,16),n||o.decryptAacSamples(e,t+1,r)}))},t.decryptAacSamples=function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32)){var n=this.decrypter.isSync();if(this.decryptAacSample(e,t,r,n),!n)return}}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),n=0,i=32;i<=e.length-16;i+=160,n+=16)r.set(e.subarray(i,i+16),n);return r},t.getAvcDecryptedUnit=function(e,t){for(var r=new Uint8Array(t),n=0,i=32;i<=e.length-16;i+=160,n+=16)e.set(r.subarray(n,n+16),i);return e},t.decryptAvcSample=function(e,t,r,n,a,s){var o=Object(i.discardEPB)(a.data),l=this.getAvcEncryptedData(o),u=this;this.decryptBuffer(l.buffer,(function(i){a.data=u.getAvcDecryptedUnit(o,i),s||u.decryptAvcSamples(e,t,r+1,n)}))},t.decryptAvcSamples=function(e,t,r,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length)return void n();for(var i=e[t].units;!(r>=i.length);r++){var a=i[r];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(e,t,r,n,a,s),!s)return}}}},e}();t.default=a},"./src/demux/transmuxer-interface.ts":
|
|
|
/*!*******************************************!*\
|
|
|
!*** ./src/demux/transmuxer-interface.ts ***!
|
|
|
\*******************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return d}));var n=r(/*! webworkify-webpack */"./node_modules/webworkify-webpack/index.js"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../errors */"./src/errors.ts"),l=r(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),u=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),c=Object(l.getMediaSource)()||{isTypeSupported:function(){return!1}},d=function(){function e(e,t,r,l){var d=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=e,this.id=t,this.onTransmuxComplete=r,this.onFlush=l;var f=e.config,h=function(t,r){(r=r||{}).frag=d.frag,r.id=d.id,e.trigger(t,r)};this.observer=new u.EventEmitter,this.observer.on(i.Events.FRAG_DECRYPTED,h),this.observer.on(i.Events.ERROR,h);var p={mp4:c.isTypeSupported("video/mp4"),mpeg:c.isTypeSupported("audio/mpeg"),mp3:c.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(f.enableWorker&&"undefined"!=typeof Worker){var m;s.logger.log("demuxing in webworker");try{m=this.worker=n(/*! ../demux/transmuxer-worker.ts */"./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(t){e.trigger(i.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(t.message+" ("+t.filename+":"+t.lineno+")")})},m.postMessage({cmd:"init",typeSupported:p,vendor:g,id:t,config:JSON.stringify(f)})}catch(e){s.logger.warn("Error in worker:",e),s.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new a.default(this.observer,p,f,g,t),this.worker=null}}else this.transmuxer=new a.default(this.observer,p,f,g,t)}var t=e.prototype;return t.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var r=this.observer;r&&r.removeAllListeners(),this.observer=null},t.push=function(e,t,r,n,i,o,l,u,c,d){var f=this;c.transmuxing.start=self.performance.now();var h=this.transmuxer,p=this.worker,g=o?o.start:i.start,m=i.decryptdata,v=this.frag,y=!(v&&i.cc===v.cc),b=!(v&&c.level===v.level),E=v?c.sn-v.sn:-1,x=this.part?c.part-this.part.index:1,S=!b&&(1===E||0===E&&1===x),T=self.performance.now();(b||E||0===i.stats.parsing.start)&&(i.stats.parsing.start=T),!o||!x&&S||(o.stats.parsing.start=T);var k=new a.TransmuxState(y,S,u,b,g);if(!S||y){s.logger.log("[transmuxer-interface, "+i.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+"\n discontinuity: "+y+"\n trackSwitch: "+b+"\n contiguous: "+S+"\n accurateTimeOffset: "+u+"\n timeOffset: "+g);var w=new a.TransmuxConfig(r,n,t,l,d);this.configureTransmuxer(w)}if(this.frag=i,this.part=o,p)p.postMessage({cmd:"demux",data:e,decryptdata:m,chunkMeta:c,state:k},e instanceof ArrayBuffer?[e]:[]);else if(h){var C=h.push(e,m,c,k);Object(a.isPromise)(C)?C.then((function(e){f.handleTransmuxComplete(e)})):this.handleTransmuxComplete(C)}},t.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var r=this.transmuxer,n=this.worker;if(n)n.postMessage({cmd:"flush",chunkMeta:e});else if(r){var i=r.flush(e);Object(a.isPromise)(i)?i.then((function(r){t.handleFlushResult(r,e)})):this.handleFlushResult(i,e)}},t.handleFlushResult=function(e,t){var r=this;e.forEach((function(e){r.handleTransmuxComplete(e)})),this.onFlush(t)},t.onWorkerMessage=function(e){var t=e.data,r=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data)}},t.configureTransmuxer=function(e){var t=this.worker,r=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):r&&r.configure(e)},t.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},e}()},"./src/demux/transmuxer-worker.ts":
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/demux/transmuxer-worker.ts ***!
|
|
|
\****************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");function o(e){var t=new s.EventEmitter,r=function(t,r){e.postMessage({event:t,data:r})};t.on(i.Events.FRAG_DECRYPTED,r),t.on(i.Events.ERROR,r),e.addEventListener("message",(function(i){var s=i.data;switch(s.cmd){case"init":var o=JSON.parse(s.config);e.transmuxer=new n.default(t,s.typeSupported,o,s.vendor,s.id),Object(a.enableLogs)(o.debug),r("init",null);break;case"configure":e.transmuxer.configure(s.config);break;case"demux":var u=e.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(n.isPromise)(u)?u.then((function(t){l(e,t)})):l(e,u);break;case"flush":var d=s.chunkMeta,f=e.transmuxer.flush(d);Object(n.isPromise)(f)?f.then((function(t){c(e,t,d)})):c(e,f,d)}}))}function l(e,t){if((r=t.remuxResult).audio||r.video||r.text||r.id3||r.initSegment){var r,n=[],i=t.remuxResult,a=i.audio,s=i.video;a&&u(n,a),s&&u(n,s),e.postMessage({event:"transmuxComplete",data:t},n)}}function u(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function c(e,t,r){t.forEach((function(t){l(e,t)})),e.postMessage({event:"flush",data:r})}},"./src/demux/transmuxer.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/transmuxer.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default, isPromise, TransmuxConfig, TransmuxState */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return y})),r.d(t,"isPromise",(function(){return E})),r.d(t,"TransmuxConfig",(function(){return x})),r.d(t,"TransmuxState",(function(){return S}));var n,i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../errors */"./src/errors.ts"),s=r(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),o=r(/*! ../demux/aacdemuxer */"./src/demux/aacdemuxer.ts"),l=r(/*! ../demux/mp4demuxer */"./src/demux/mp4demuxer.ts"),u=r(/*! ../demux/tsdemuxer */"./src/demux/tsdemuxer.ts"),c=r(/*! ../demux/mp3demuxer */"./src/demux/mp3demuxer.ts"),d=r(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),f=r(/*! ../remux/passthrough-remuxer */"./src/remux/passthrough-remuxer.ts"),h=r(/*! ./chunk-cache */"./src/demux/chunk-cache.ts"),p=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),g=r(/*! ../utils/logger */"./src/utils/logger.ts");try{n=self.performance.now.bind(self.performance)}catch(e){g.logger.debug("Unable to use Performance API on this environment"),n=self.Date.now}var m=[{demux:u.default,remux:d.default},{demux:l.default,remux:f.default},{demux:o.default,remux:d.default},{demux:c.default,remux:d.default}],v=1024;m.forEach((function(e){var t=e.demux;v=Math.max(v,t.minProbeByteLength)}));var y=function(){function e(e,t,r,n,i){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new h.default,this.observer=e,this.typeSupported=t,this.config=r,this.vendor=n,this.id=i}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,r,i){var a=this,s=r.transmuxing;s.executeStart=n();var o=new Uint8Array(e),l=this.cache,u=this.config,c=this.currentTransmuxState,d=this.transmuxConfig;i&&(this.currentTransmuxState=i);var f=function(e,t){var r=null;return e.byteLength>0&&null!=t&&null!=t.key&&null!==t.iv&&null!=t.method&&(r=t),r}(o,t);if(f&&"AES-128"===f.method){var h=this.getDecrypter();if(!u.enableSoftwareAES)return this.decryptionPromise=h.webCryptoDecrypt(o,f.key.buffer,f.iv.buffer).then((function(e){var t=a.push(e,null,r);return a.decryptionPromise=null,t})),this.decryptionPromise;var g=h.softwareDecrypt(o,f.key.buffer,f.iv.buffer);if(!g)return s.executeEnd=n(),b(r);o=new Uint8Array(g)}var m=i||c,v=m.contiguous,y=m.discontinuity,E=m.trackSwitch,x=m.accurateTimeOffset,S=m.timeOffset,T=d.audioCodec,k=d.videoCodec,w=d.defaultInitPts,C=d.duration,L=d.initSegmentData;if((y||E)&&this.resetInitSegment(L,T,k,C),y&&this.resetInitialTimestamp(w),v||this.resetContiguity(),this.needsProbing(o,y,E)){if(l.dataLength){var A=l.flush();o=Object(p.appendUint8Array)(A,o)}this.configureTransmuxer(o,d)}var D=this.transmux(o,f,S,x,r),O=this.currentTransmuxState;return O.contiguous=!0,O.discontinuity=!1,O.trackSwitch=!1,s.executeEnd=n(),D},t.flush=function(e){var t=this,r=e.transmuxing;r.executeStart=n();var s=this.decrypter,o=this.cache,l=this.currentTransmuxState,u=this.decryptionPromise;if(u)return u.then((function(){return t.flush(e)}));var c=[],d=l.timeOffset;if(s){var f=s.flush();f&&c.push(this.push(f,null,e))}var h=o.dataLength;o.reset();var p=this.demuxer,g=this.remuxer;if(!p||!g)return h>=v&&this.observer.emit(i.Events.ERROR,i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),r.executeEnd=n(),[b(e)];var m=p.flush(d);return E(m)?m.then((function(r){return t.flushRemux(c,r,e),c})):(this.flushRemux(c,m,e),c)},t.flushRemux=function(e,t,r){var i=t.audioTrack,a=t.avcTrack,s=t.id3Track,o=t.textTrack,l=this.currentTransmuxState,u=l.accurateTimeOffset,c=l.timeOffset;g.logger.log("[transmuxer.ts]: Flushed fragment "+r.sn+(r.part>-1?" p: "+r.part:"")+" of level "+r.level);var d=this.remuxer.remux(i,a,s,o,c,u,!0,this.id);e.push({remuxResult:d,chunkMeta:r}),r.transmuxing.executeEnd=n()},t.resetInitialTimestamp=function(e){var t=this.demuxer,r=this.remuxer;t&&r&&(t.resetTimeStamp(e),r.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,r,n){var i=this.demuxer,a=this.remuxer;i&&a&&(i.resetInitSegment(t,r,n),a.resetInitSegment(e,t,r))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},t.transmux=function(e,t,r,n,i){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,r,n,i):this.transmuxUnencrypted(e,r,n,i)},t.transmuxUnencrypted=function(e,t,r,n){var i=this.demuxer.demux(e,t,!1,!this.config.progressive),a=i.audioTrack,s=i.avcTrack,o=i.id3Track,l=i.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,l,t,r,!1,this.id),chunkMeta:n}},t.transmuxSampleAes=function(e,t,r,n,i){var a=this;return this.demuxer.demuxSampleAes(e,t,r).then((function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.avcTrack,e.id3Track,e.textTrack,r,n,!1,a.id),chunkMeta:i}}))},t.configureTransmuxer=function(e,t){for(var r,n=this.config,i=this.observer,a=this.typeSupported,s=this.vendor,o=t.audioCodec,u=t.defaultInitPts,c=t.duration,d=t.initSegmentData,h=t.videoCodec,p=0,v=m.length;p<v;p++)if(m[p].demux.probe(e)){r=m[p];break}r||(g.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),r={demux:l.default,remux:f.default});var y=this.demuxer,b=this.remuxer,E=r.remux,x=r.demux;b&&b instanceof E||(this.remuxer=new E(i,n,a,s)),y&&y instanceof x||(this.demuxer=new x(i,n,a),this.probe=x.probe),this.resetInitSegment(d,o,h,c),this.resetInitialTimestamp(u)},t.needsProbing=function(e,t,r){return!this.demuxer||!this.remuxer||t||r},t.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new s.default(this.observer,this.config)),e},e}(),b=function(e){return{remuxResult:{},chunkMeta:e}};function E(e){return"then"in e&&e.then instanceof Function}var x=function(e,t,r,n,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=r,this.duration=n,this.defaultInitPts=i},S=function(e,t,r,n,i){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=r,this.trackSwitch=n,this.timeOffset=i}},"./src/demux/tsdemuxer.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/demux/tsdemuxer.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: discardEPB, default */function(e,t,r){"use strict";r.r(t),r.d(t,"discardEPB",(function(){return E}));var n=r(/*! ./adts */"./src/demux/adts.ts"),i=r(/*! ./mpegaudio */"./src/demux/mpegaudio.ts"),a=r(/*! ./exp-golomb */"./src/demux/exp-golomb.ts"),s=r(/*! ./id3 */"./src/demux/id3.ts"),o=r(/*! ./sample-aes */"./src/demux/sample-aes.ts"),l=r(/*! ../events */"./src/events.ts"),u=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),c=r(/*! ../utils/logger */"./src/utils/logger.ts"),d=r(/*! ../errors */"./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},h=function(){function e(e,t,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=r}e.probe=function(t){var r=e.syncOffset(t);return!(r<0||(r&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),0))},e.syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),r=0;r<t;){if(71===e[r]&&71===e[r+188]&&71===e[r+376])return r;r++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:f[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,r,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=e.createTrack("video",n),this._audioTrack=e.createTrack("audio",n),this._id3Track=e.createTrack("id3",n),this._txtTrack=e.createTrack("text",n),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=t,this.videoCodec=r,this._duration=n},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,r=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},t.demux=function(t,r,n,i){var a;void 0===n&&(n=!1),void 0===i&&(i=!1),n||(this.sampleAes=null);var s=this._avcTrack,o=this._audioTrack,f=this._id3Track,h=s.pid,p=s.pesData,y=o.pid,b=f.pid,E=o.pesData,x=f.pesData,S=!1,T=this.pmtParsed,k=this._pmtId,w=t.length;if(this.remainderData&&(w=(t=Object(u.appendUint8Array)(this.remainderData,t)).length,this.remainderData=null),w<188&&!i)return this.remainderData=t,{audioTrack:o,avcTrack:s,id3Track:f,textTrack:this._txtTrack};var C=Math.max(0,e.syncOffset(t));(w-=(w+C)%188)<t.byteLength&&!i&&(this.remainderData=new Uint8Array(t.buffer,w,t.buffer.byteLength-w));for(var L=C;L<w;L+=188)if(71===t[L]){var A=!!(64&t[L+1]),D=((31&t[L+1])<<8)+t[L+2],O=void 0;if((48&t[L+3])>>4>1){if((O=L+5+t[L+4])===L+188)continue}else O=L+4;switch(D){case h:A&&(p&&(a=v(p))&&this.parseAVCPES(a,!1),p={data:[],size:0}),p&&(p.data.push(t.subarray(O,L+188)),p.size+=L+188-O);break;case y:A&&(E&&(a=v(E))&&(o.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),E={data:[],size:0}),E&&(E.data.push(t.subarray(O,L+188)),E.size+=L+188-O);break;case b:A&&(x&&(a=v(x))&&this.parseID3PES(a),x={data:[],size:0}),x&&(x.data.push(t.subarray(O,L+188)),x.size+=L+188-O);break;case 0:A&&(O+=t[O]+1),k=this._pmtId=g(t,O);break;case k:A&&(O+=t[O]+1);var _=m(t,O,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,n);(h=_.avc)>0&&(s.pid=h),(y=_.audio)>0&&(o.pid=y,o.isAAC=_.isAAC),(b=_.id3)>0&&(f.pid=b),S&&!T&&(c.logger.log("reparse from beginning"),S=!1,L=C-188),T=this.pmtParsed=!0;break;case 17:case 8191:break;default:S=!0}}else this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s.pesData=p,o.pesData=E,f.pesData=x;var R={audioTrack:o,avcTrack:s,id3Track:f,textTrack:this._txtTrack};return i&&this.extractRemainingSamples(R),R},t.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},t.extractRemainingSamples=function(e){var t,r=e.audioTrack,n=e.avcTrack,i=e.id3Track,a=n.pesData,s=r.pesData,o=i.pesData;a&&(t=v(a))?(this.parseAVCPES(t,!0),n.pesData=null):n.pesData=a,s&&(t=v(s))?(r.isAAC?this.parseAACPES(t):this.parseMPEGPES(t),r.pesData=null):(null!=s&&s.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=s),o&&(t=v(o))?(this.parseID3PES(t),i.pesData=null):i.pesData=o},t.demuxSampleAes=function(e,t,r){var n=this.demux(e,r,!0,!this.config.progressive),i=this.sampleAes=new o.default(this.observer,this.config,t);return this.decrypt(n,i)},t.decrypt=function(e,t){return new Promise((function(r){var n=e.audioTrack,i=e.avcTrack;n.samples&&n.isAAC?t.decryptAacSamples(n.samples,0,(function(){i.samples?t.decryptAvcSamples(i.samples,0,0,(function(){r(e)})):r(e)})):i.samples&&t.decryptAvcSamples(i.samples,0,0,(function(){r(e)}))}))},t.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},t.parseAVCPES=function(e,t){var r,n=this,i=this._avcTrack,o=this.parseAVCNALu(e.data),l=this.avcSample,u=!1;e.data=null,l&&o.length&&!i.audFound&&(y(l,i),l=this.avcSample=p(!1,e.pts,e.dts,"")),o.forEach((function(t){switch(t.type){case 1:r=!0,l||(l=n.avcSample=p(!0,e.pts,e.dts,"")),l.frame=!0;var o=t.data;if(u&&o.length>4){var c=new a.default(o).readSliceType();2!==c&&4!==c&&7!==c&&9!==c||(l.key=!0)}break;case 5:r=!0,l||(l=n.avcSample=p(!0,e.pts,e.dts,"")),l.key=!0,l.frame=!0;break;case 6:r=!0;var d=new a.default(E(t.data));d.readUByte();for(var f=0,h=0,g=!1,m=0;!g&&d.bytesAvailable>1;){f=0;do{f+=m=d.readUByte()}while(255===m);h=0;do{h+=m=d.readUByte()}while(255===m);if(4===f&&0!==d.bytesAvailable){if(g=!0,181===d.readUByte()&&49===d.readUShort()&&1195456820===d.readUInt()&&3===d.readUByte()){for(var v=d.readUByte(),x=31&v,S=[v,d.readUByte()],T=0;T<x;T++)S.push(d.readUByte()),S.push(d.readUByte()),S.push(d.readUByte());b(n._txtTrack.samples,{type:3,pts:e.pts,bytes:S})}}else if(5===f&&0!==d.bytesAvailable){if(g=!0,h>16){for(var k=[],w=0;w<16;w++)k.push(d.readUByte().toString(16)),3!==w&&5!==w&&7!==w&&9!==w||k.push("-");for(var C=h-16,L=new Uint8Array(C),A=0;A<C;A++)L[A]=d.readUByte();b(n._txtTrack.samples,{pts:e.pts,payloadType:f,uuid:k.join(""),userData:Object(s.utf8ArrayToStr)(L),userDataBytes:L})}}else if(h<d.bytesAvailable)for(var D=0;D<h;D++)d.readUByte()}break;case 7:if(r=!0,u=!0,!i.sps){var O=new a.default(t.data).readSPS();i.width=O.width,i.height=O.height,i.pixelRatio=O.pixelRatio,i.sps=[t.data],i.duration=n._duration;for(var _=t.data.subarray(1,4),R="avc1.",I=0;I<3;I++){var M=_[I].toString(16);M.length<2&&(M="0"+M),R+=M}i.codec=R}break;case 8:r=!0,i.pps||(i.pps=[t.data]);break;case 9:r=!1,i.audFound=!0,l&&y(l,i),l=n.avcSample=p(!1,e.pts,e.dts,"");break;case 12:r=!1;break;default:r=!1,l&&(l.debug+="unknown NAL "+t.type+" ")}l&&r&&l.units.push(t)})),t&&l&&(y(l,i),this.avcSample=null)},t.getLastNalUnit=function(){var e,t,r=this.avcSample;if(!r||0===r.units.length){var n=this._avcTrack.samples;r=n[n.length-1]}if(null!==(e=r)&&void 0!==e&&e.units){var i=r.units;t=i[i.length-1]}return t},t.parseAVCNALu=function(e){var t,r,n=e.byteLength,i=this._avcTrack,a=i.naluState||0,s=a,o=[],l=0,u=-1,c=0;for(-1===a&&(u=0,c=31&e[0],a=0,l=1);l<n;)if(t=e[l++],a)if(1!==a)if(t)if(1===t){if(u>=0){var d={data:e.subarray(u,l-a-1),type:c};o.push(d)}else{var f=this.getLastNalUnit();if(f&&(s&&l<=4-s&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-s)),(r=l-a-1)>0)){var h=new Uint8Array(f.data.byteLength+r);h.set(f.data,0),h.set(e.subarray(0,r),f.data.byteLength),f.data=h,f.state=0}}l<n?(u=l,c=31&e[l],a=0):a=-1}else a=0;else a=3;else a=t?0:2;else a=t?0:1;if(u>=0&&a>=0){var p={data:e.subarray(u,n),type:c,state:a};o.push(p)}if(0===o.length){var g=this.getLastNalUnit();if(g){var m=new Uint8Array(g.data.byteLength+e.byteLength);m.set(g.data,0),m.set(e,g.data.byteLength),g.data=m}}return i.naluState=a,o},t.parseAACPES=function(e){var t,r,i,a,s,o=0,u=this._audioTrack,f=this.aacOverFlow,h=e.data;if(f){this.aacOverFlow=null;var p=f.sample.unit.byteLength,g=Math.min(f.missing,p),m=p-g;f.sample.unit.set(h.subarray(0,g),m),u.samples.push(f.sample),o=f.missing}for(t=o,r=h.length;t<r-1&&!n.isHeader(h,t);t++);if(t===o||(t<r-1?(i="AAC PES did not start with ADTS header,offset:"+t,a=!1):(i="no ADTS header found in AAC PES",a=!0),c.logger.warn("parsing error:"+i),this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:a,reason:i}),!a)){if(n.initTrackConfig(u,this.observer,h,t,this.audioCodec),void 0!==e.pts)s=e.pts;else{if(!f)return void c.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var v=n.getFrameDuration(u.samplerate);s=f.sample.pts+v}for(var y=0;t<r;){if(n.isHeader(h,t)){if(t+5<r){var b=n.appendFrame(u,h,t,s,y);if(b){if(!b.missing){t+=b.length,y++;continue}this.aacOverFlow=b}}break}t++}}},t.parseMPEGPES=function(e){var t=e.data,r=t.length,n=0,a=0,s=e.pts;if(void 0!==s)for(;a<r;)if(i.isHeader(t,a)){var o=i.appendFrame(this._audioTrack,t,a,s,n);if(!o)break;a+=o.length,n++}else a++;else c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},t.parseID3PES=function(e){void 0!==e.pts?this._id3Track.samples.push(e):c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},e}();function p(e,t,r,n){return{key:e,frame:!1,pts:t,dts:r,units:[],debug:n,length:0}}function g(e,t){return(31&e[t+10])<<8|e[t+11]}function m(e,t,r,n){var i={audio:-1,avc:-1,id3:-1,isAAC:!0},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<a;){var s=(31&e[t+1])<<8|e[t+2];switch(e[t]){case 207:if(!n){c.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===i.audio&&(i.audio=s);break;case 21:-1===i.id3&&(i.id3=s);break;case 219:if(!n){c.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===i.avc&&(i.avc=s);break;case 3:case 4:r?-1===i.audio&&(i.audio=s,i.isAAC=!1):c.logger.log("MPEG audio found, not supported in this browser");break;case 36:c.logger.warn("Unsupported HEVC stream type found")}t+=5+((15&e[t+3])<<8|e[t+4])}return i}function v(e){var t,r,n,i,a,s=0,o=e.data;if(!e||0===e.size)return null;for(;o[0].length<19&&o.length>1;){var l=new Uint8Array(o[0].length+o[1].length);l.set(o[0]),l.set(o[1],o[0].length),o[0]=l,o.splice(1,1)}if(1===((t=o[0])[0]<<16)+(t[1]<<8)+t[2]){if((r=(t[4]<<8)+t[5])&&r>e.size-6)return null;var u=t[7];192&u&&(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&u?i-(a=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(c.logger.warn(Math.round((i-a)/9e4)+"s delta between PTS and DTS, align them"),i=a):a=i);var d=(n=t[8])+9;if(e.size<=d)return null;e.size-=d;for(var f=new Uint8Array(e.size),h=0,p=o.length;h<p;h++){var g=(t=o[h]).byteLength;if(d){if(d>g){d-=g;continue}t=t.subarray(d),g-=d,d=0}f.set(t,s),s+=g}return r&&(r-=n+3),{data:f,pts:i,dts:a,len:r}}return null}function y(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var r=t.samples,n=r.length;if(!n)return void t.dropped++;var i=r[n-1];e.pts=i.pts,e.dts=i.dts}t.samples.push(e)}e.debug.length&&c.logger.log(e.pts+"/"+e.dts+":"+e.debug)}function b(e,t){var r=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);else for(var n=r-1;n>=0;n--)if(t.pts<e[n].pts){e.splice(n,0,t);break}}else e.push(t)}function E(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return e;var i=t-r.length,a=new Uint8Array(i),s=0;for(n=0;n<i;s++,n++)s===r[0]&&(s++,r.shift()),a[n]=e[s];return a}h.minProbeByteLength=188,t.default=h},"./src/errors.ts":
|
|
|
/*!***********************!*\
|
|
|
!*** ./src/errors.ts ***!
|
|
|
\***********************/
|
|
|
/*! exports provided: ErrorTypes, ErrorDetails */function(e,t,r){"use strict";var n,i;r.r(t),r.d(t,"ErrorTypes",(function(){return n})),r.d(t,"ErrorDetails",(function(){return i})),function(e){e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError"}(n||(n={})),function(e){e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.UNKNOWN="unknown"}(i||(i={}))},"./src/events.ts":
|
|
|
/*!***********************!*\
|
|
|
!*** ./src/events.ts ***!
|
|
|
\***********************/
|
|
|
/*! exports provided: Events */function(e,t,r){"use strict";var n;r.r(t),r.d(t,"Events",(function(){return n})),function(e){e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached"}(n||(n={}))},"./src/hls.ts":
|
|
|
/*!********************!*\
|
|
|
!*** ./src/hls.ts ***!
|
|
|
\********************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return y}));var n=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),i=r(/*! ./loader/playlist-loader */"./src/loader/playlist-loader.ts"),a=r(/*! ./loader/key-loader */"./src/loader/key-loader.ts"),s=r(/*! ./controller/id3-track-controller */"./src/controller/id3-track-controller.ts"),o=r(/*! ./controller/latency-controller */"./src/controller/latency-controller.ts"),l=r(/*! ./controller/level-controller */"./src/controller/level-controller.ts"),u=r(/*! ./controller/fragment-tracker */"./src/controller/fragment-tracker.ts"),c=r(/*! ./controller/stream-controller */"./src/controller/stream-controller.ts"),d=r(/*! ./is-supported */"./src/is-supported.ts"),f=r(/*! ./utils/logger */"./src/utils/logger.ts"),h=r(/*! ./config */"./src/config.ts"),p=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),g=r(/*! ./events */"./src/events.ts"),m=r(/*! ./errors */"./src/errors.ts");function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var y=function(){function e(t){void 0===t&&(t={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var r=this.config=Object(h.mergeConfig)(e.DefaultConfig,t);this.userConfig=t,Object(f.enableLogs)(r.debug),this._autoLevelCapping=-1,r.progressive&&Object(h.enableStreamingMode)(r);var n=r.abrController,d=r.bufferController,g=r.capLevelController,m=r.fpsController,v=this.abrController=new n(this),y=this.bufferController=new d(this),b=this.capLevelController=new g(this),E=new m(this),x=new i.default(this),S=new a.default(this),T=new s.default(this),k=this.levelController=new l.default(this),w=new u.FragmentTracker(this),C=this.streamController=new c.default(this,w);b.setStreamController(C),E.setStreamController(C);var L=[k,C];this.networkControllers=L;var A=[x,S,v,y,b,E,T,w];this.audioTrackController=this.createController(r.audioTrackController,null,L),this.createController(r.audioStreamController,w,L),this.subtitleTrackController=this.createController(r.subtitleTrackController,null,L),this.createController(r.subtitleStreamController,w,L),this.createController(r.timelineController,null,A),this.emeController=this.createController(r.emeController,null,A),this.cmcdController=this.createController(r.cmcdController,null,A),this.latencyController=this.createController(o.default,null,A),this.coreComponents=A}e.isSupported=function(){return Object(d.isSupported)()};var t,r,y,b=e.prototype;return b.createController=function(e,t,r){if(e){var n=t?new e(this,t):new e(this);return r&&r.push(n),n}return null},b.on=function(e,t,r){void 0===r&&(r=this),this._emitter.on(e,t,r)},b.once=function(e,t,r){void 0===r&&(r=this),this._emitter.once(e,t,r)},b.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},b.off=function(e,t,r,n){void 0===r&&(r=this),this._emitter.off(e,t,r,n)},b.listeners=function(e){return this._emitter.listeners(e)},b.emit=function(e,t,r){return this._emitter.emit(e,t,r)},b.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){f.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(g.Events.ERROR,{type:m.ErrorTypes.OTHER_ERROR,details:m.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,error:t})}return!1},b.listenerCount=function(e){return this._emitter.listenerCount(e)},b.destroy=function(){f.logger.log("destroy"),this.trigger(g.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((function(e){return e.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(e){return e.destroy()})),this.coreComponents.length=0},b.attachMedia=function(e){f.logger.log("attachMedia"),this._media=e,this.trigger(g.Events.MEDIA_ATTACHING,{media:e})},b.detachMedia=function(){f.logger.log("detachMedia"),this.trigger(g.Events.MEDIA_DETACHING,void 0),this._media=null},b.loadSource=function(e){this.stopLoad();var t=this.media,r=this.url,i=this.url=n.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});f.logger.log("loadSource:"+i),t&&r&&r!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(t)),this.trigger(g.Events.MANIFEST_LOADING,{url:e})},b.startLoad=function(e){void 0===e&&(e=-1),f.logger.log("startLoad("+e+")"),this.networkControllers.forEach((function(t){t.startLoad(e)}))},b.stopLoad=function(){f.logger.log("stopLoad"),this.networkControllers.forEach((function(e){e.stopLoad()}))},b.swapAudioCodec=function(){f.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},b.recoverMediaError=function(){f.logger.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},b.removeLevel=function(e,t){void 0===t&&(t=0),this.levelController.removeLevel(e,t)},t=e,y=[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return g.Events}},{key:"ErrorTypes",get:function(){return m.ErrorTypes}},{key:"ErrorDetails",get:function(){return m.ErrorDetails}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:h.hlsDefaultConfig},set:function(t){e.defaultConfig=t}}],(r=[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){f.logger.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){f.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){f.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){f.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){f.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(f.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e)}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var r=e.length,n=0;n<r;n++)if(e[n].maxBitrate>t)return n;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&v(t.prototype,r),y&&v(t,y),e}();y.defaultConfig=void 0},"./src/is-supported.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/is-supported.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: isSupported, changeTypeSupported */function(e,t,r){"use strict";r.r(t),r.d(t,"isSupported",(function(){return a})),r.d(t,"changeTypeSupported",(function(){return s}));var n=r(/*! ./utils/mediasource-helper */"./src/utils/mediasource-helper.ts");function i(){return self.SourceBuffer||self.WebKitSourceBuffer}function a(){var e=Object(n.getMediaSource)();if(!e)return!1;var t=i(),r=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!r&&!!a}function s(){var e,t=i();return"function"==typeof(null==t||null===(e=t.prototype)||void 0===e?void 0:e.changeType)}},"./src/loader/fragment-loader.ts":
|
|
|
/*!***************************************!*\
|
|
|
!*** ./src/loader/fragment-loader.ts ***!
|
|
|
\***************************************/
|
|
|
/*! exports provided: default, LoadError */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return d})),r.d(t,"LoadError",(function(){return h}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../errors */"./src/errors.ts");function a(e){var t="function"==typeof Map?new Map:void 0;return(a=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return s(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,e)})(e)}function s(e,t,r){return(s=o()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&l(i,r.prototype),i}).apply(null,arguments)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=Math.pow(2,17),d=function(){function e(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var t=e.prototype;return t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(e,t){var r=this,n=e.url;if(!n)return Promise.reject(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(n?"part list":"url")));this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(n,l){r.loader&&r.loader.destroy();var u=r.loader=e.loader=s?new s(a):new o(a),d=f(e),p={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};e.stats=u.stats,u.load(d,p,{onSuccess:function(t,i,a,s){r.resetLoader(e,u),n({frag:e,part:null,payload:t.data,networkDetails:s})},onError:function(t,n,a){r.resetLoader(e,u),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t,networkDetails:a}))},onAbort:function(t,n,a){r.resetLoader(e,u),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:a}))},onTimeout:function(t,n,a){r.resetLoader(e,u),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:a}))},onProgress:function(r,n,i,a){t&&t({frag:e,part:null,payload:i,networkDetails:a})}})}))},t.loadPart=function(e,t,r){var n=this;this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(l,u){n.loader&&n.loader.destroy();var d=n.loader=e.loader=s?new s(a):new o(a),p=f(e,t),g={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};t.stats=d.stats,d.load(p,g,{onSuccess:function(i,a,s,o){n.resetLoader(e,d),n.updateStatsFromPart(e,t);var u={frag:e,part:t,payload:i.data,networkDetails:o};r(u),l(u)},onError:function(r,a,s){n.resetLoader(e,d),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:r,networkDetails:s}))},onAbort:function(r,a,s){e.stats.aborted=t.stats.aborted,n.resetLoader(e,d),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:s}))},onTimeout:function(r,a,s){n.resetLoader(e,d),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:s}))}})}))},t.updateStatsFromPart=function(e,t){var r=e.stats,n=t.stats,i=n.total;if(r.loaded+=n.loaded,i){var a=Math.round(e.duration/t.duration),s=Math.min(Math.round(r.loaded/i),a),o=(a-s)*Math.round(r.loaded/s);r.total=r.loaded+o}else r.total=Math.max(r.loaded,r.total);var l=r.loading,u=n.loading;l.start?l.first+=u.first-u.start:(l.start=u.start,l.first=u.first),l.end=u.end},t.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},e}();function f(e,t){void 0===t&&(t=null);var r=t||e,i={frag:e,part:t,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},a=r.byteRangeStartOffset,s=r.byteRangeEndOffset;return Object(n.isFiniteNumber)(a)&&Object(n.isFiniteNumber)(s)&&(i.rangeStart=a,i.rangeEnd=s),i}var h=function(e){var t,r;function n(t){for(var r,n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return(r=e.call.apply(e,[this].concat(i))||this).data=void 0,r.data=t,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,l(t,r),n}(a(Error))},"./src/loader/fragment.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/loader/fragment.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: ElementaryStreamTypes, BaseSegment, Fragment, Part */function(e,t,r){"use strict";r.r(t),r.d(t,"ElementaryStreamTypes",(function(){return n})),r.d(t,"BaseSegment",(function(){return h})),r.d(t,"Fragment",(function(){return p})),r.d(t,"Part",(function(){return g}));var n,i=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),a=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ./level-key */"./src/loader/level-key.ts"),l=r(/*! ./load-stats */"./src/loader/load-stats.ts");function u(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,c(e,t)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t,r){return t&&d(e.prototype,t),r&&d(e,r),e}!function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"}(n||(n={}));var h=function(){function e(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[n.AUDIO]=null,t[n.VIDEO]=null,t[n.AUDIOVIDEO]=null,t),this.baseurl=e}return e.prototype.setByteRange=function(e,t){var r=e.split("@",2),n=[];1===r.length?n[0]=t?t.byteRangeEndOffset:0:n[0]=parseInt(r[1]),n[1]=parseInt(r[0])+n[0],this._byteRange=n},f(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(a.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}]),e}(),p=function(e){function t(t,r){var n;return(n=e.call(this,r)||this)._decryptdata=null,n.rawProgramDateTime=null,n.programDateTime=null,n.tagList=[],n.duration=0,n.sn=0,n.levelkey=void 0,n.type=void 0,n.loader=null,n.level=-1,n.cc=0,n.startPTS=void 0,n.endPTS=void 0,n.appendedPTS=void 0,n.startDTS=void 0,n.endDTS=void 0,n.start=0,n.deltaPTS=void 0,n.maxStartPTS=void 0,n.minEndPTS=void 0,n.stats=new l.LoadStats,n.urlId=0,n.data=void 0,n.bitrateTest=!1,n.title=null,n.initSegment=null,n.type=t,n}u(t,e);var r=t.prototype;return r.createInitializationVector=function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t},r.setDecryptDataFromLevelKey=function(e,t){var r=e;return"AES-128"===(null==e?void 0:e.method)&&e.uri&&!e.iv&&((r=o.LevelKey.fromURI(e.uri)).method=e.method,r.iv=this.createInitializationVector(t),r.keyFormat="identity"),r},r.setElementaryStreamInfo=function(e,t,r,n,i,a){void 0===a&&(a=!1);var s=this.elementaryStreams,o=s[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,i)):s[e]={startPTS:t,endPTS:r,startDTS:n,endDTS:i,partial:a}},r.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[n.AUDIO]=null,e[n.VIDEO]=null,e[n.AUDIOVIDEO]=null},f(t,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var e=this.sn;"number"!=typeof e&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&s.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(i.isFiniteNumber)(this.programDateTime))return null;var e=Object(i.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;return!(null===(e=this.decryptdata)||void 0===e||!e.keyFormat||!this.decryptdata.uri)}}]),t}(h),g=function(e){function t(t,r,n,i,a){var s;(s=e.call(this,n)||this).fragOffset=0,s.duration=0,s.gap=!1,s.independent=!1,s.relurl=void 0,s.fragment=void 0,s.index=void 0,s.stats=new l.LoadStats,s.duration=t.decimalFloatingPoint("DURATION"),s.gap=t.bool("GAP"),s.independent=t.bool("INDEPENDENT"),s.relurl=t.enumeratedString("URI"),s.fragment=r,s.index=i;var o=t.enumeratedString("BYTERANGE");return o&&s.setByteRange(o,a),a&&(s.fragOffset=a.fragOffset+a.duration),s}return u(t,e),f(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),t}(h)},"./src/loader/key-loader.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/loader/key-loader.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return s}));var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=function(){function e(e){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){this.hls.on(n.Events.KEY_LOADING,this.onKeyLoading,this)},t._unregisterListeners=function(){this.hls.off(n.Events.KEY_LOADING,this.onKeyLoading)},t.destroy=function(){for(var e in this._unregisterListeners(),this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={}},t.onKeyLoading=function(e,t){var r=t.frag,i=r.type,s=this.loaders[i];if(r.decryptdata){var o=r.decryptdata.uri;if(o!==this.decrypturl||null===this.decryptkey){var l=this.hls.config;if(s&&(a.logger.warn("abort previous key loader for type:"+i),s.abort()),!o)return void a.logger.warn("key uri is falsy");var u=l.loader,c=r.loader=this.loaders[i]=new u(l);this.decrypturl=o,this.decryptkey=null;var d={url:o,frag:r,responseType:"arraybuffer"},f={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},h={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(d,f,h)}else this.decryptkey&&(r.decryptdata.key=this.decryptkey,this.hls.trigger(n.Events.KEY_LOADED,{frag:r}))}else a.logger.warn("Missing decryption data on fragment in onKeyLoading")},t.loadsuccess=function(e,t,r){var i=r.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=null,delete this.loaders[i.type],this.hls.trigger(n.Events.KEY_LOADED,{frag:i})):a.logger.error("after key load, decryptdata unset")},t.loaderror=function(e,t){var r=t.frag,a=r.loader;a&&a.abort(),delete this.loaders[r.type],this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:e})},t.loadtimeout=function(e,t){var r=t.frag,a=r.loader;a&&a.abort(),delete this.loaders[r.type],this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},e}()},"./src/loader/level-details.ts":
|
|
|
/*!*************************************!*\
|
|
|
!*** ./src/loader/level-details.ts ***!
|
|
|
\*************************************/
|
|
|
/*! exports provided: LevelDetails */function(e,t,r){"use strict";r.r(t),r.d(t,"LevelDetails",(function(){return a}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts");function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=function(){function e(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=e}var t,r,a;return e.prototype.reloaded=function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t,this.advanced=this.endSN>e.endSN||t>0||0===t&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay},t=e,(r=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(n.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!==(e=this.partList)&&void 0!==e&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!==(e=this.fragments)&&void 0!==e&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!==(e=this.partList)&&void 0!==e&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!==(e=this.partList)&&void 0!==e&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&i(t.prototype,r),a&&i(t,a),e}()},"./src/loader/level-key.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/loader/level-key.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: LevelKey */function(e,t,r){"use strict";r.r(t),r.d(t,"LevelKey",(function(){return a}));var n=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js");function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=function(){function e(e,t){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,this._uri=t?Object(n.buildAbsoluteURL)(e,t,{alwaysNormalize:!0}):e}var t,r,a;return e.fromURL=function(t,r){return new e(t,r)},e.fromURI=function(t){return new e(t)},t=e,(r=[{key:"uri",get:function(){return this._uri}}])&&i(t.prototype,r),a&&i(t,a),e}()},"./src/loader/load-stats.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/loader/load-stats.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: LoadStats */function(e,t,r){"use strict";r.r(t),r.d(t,"LoadStats",(function(){return n}));var n=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":
|
|
|
/*!***********************************!*\
|
|
|
!*** ./src/loader/m3u8-parser.ts ***!
|
|
|
\***********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return m}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),a=r(/*! ./fragment */"./src/loader/fragment.ts"),s=r(/*! ./level-details */"./src/loader/level-details.ts"),o=r(/*! ./level-key */"./src/loader/level-key.ts"),l=r(/*! ../utils/attr-list */"./src/utils/attr-list.ts"),u=r(/*! ../utils/logger */"./src/utils/logger.ts"),c=r(/*! ../utils/codecs */"./src/utils/codecs.ts"),d=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,f=/#EXT-X-MEDIA:(.*)/g,h=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),g=/\.(mp4|m4s|m4v|m4a)$/i,m=function(){function e(){}return e.findGroup=function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(n.id===t)return n}},e.convertAVC1ToAVCOTI=function(e){var t=e.split(".");if(t.length>2){var r=t.shift()+".";return r+=parseInt(t.shift()).toString(16),r+=("000"+parseInt(t.shift()).toString(16)).substr(-4)}return e},e.resolve=function(e,t){return i.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,r){var n,i=[],a={},s=!1;for(d.lastIndex=0;null!=(n=d.exec(t));)if(n[1]){var o=new l.AttrList(n[1]),u={attrs:o,bitrate:o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),name:o.NAME,url:e.resolve(n[2],r)},c=o.decimalResolution("RESOLUTION");c&&(u.width=c.width,u.height=c.height),v((o.CODECS||"").split(/[ ,]+/).filter((function(e){return e})),u),u.videoCodec&&-1!==u.videoCodec.indexOf("avc1")&&(u.videoCodec=e.convertAVC1ToAVCOTI(u.videoCodec)),i.push(u)}else if(n[3]){var f=new l.AttrList(n[3]);f["DATA-ID"]&&(s=!0,a[f["DATA-ID"]]=f)}return{levels:i,sessionData:s?a:null}},e.parseMasterPlaylistMedia=function(t,r,n,i){var a;void 0===i&&(i=[]);var s=[],o=0;for(f.lastIndex=0;null!==(a=f.exec(t));){var u=new l.AttrList(a[1]);if(u.TYPE===n){var c={attrs:u,bitrate:0,id:o++,groupId:u["GROUP-ID"],instreamId:u["INSTREAM-ID"],name:u.NAME||u.LANGUAGE||"",type:n,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:u.LANGUAGE,url:u.URI?e.resolve(u.URI,r):""};if(i.length){var d=e.findGroup(i,c.groupId)||i[0];y(c,d,"audioCodec"),y(c,d,"textCodec")}s.push(c)}}return s},e.parseLevelPlaylist=function(e,t,r,c,d){var f,m,v,y=new s.LevelDetails(t),E=y.fragments,x=null,S=0,T=0,k=0,w=0,C=null,L=new a.Fragment(c,t),A=-1,D=!1;for(h.lastIndex=0,y.m3u8=e;null!==(f=h.exec(e));){D&&(D=!1,(L=new a.Fragment(c,t)).start=k,L.sn=S,L.cc=w,L.level=r,x&&(L.initSegment=x,L.rawProgramDateTime=x.rawProgramDateTime));var O=f[1];if(O){L.duration=parseFloat(O);var _=(" "+f[2]).slice(1);L.title=_||null,L.tagList.push(_?["INF",O,_]:["INF",O])}else if(f[3])Object(n.isFiniteNumber)(L.duration)&&(L.start=k,v&&(L.levelkey=v),L.sn=S,L.level=r,L.cc=w,L.urlId=d,E.push(L),L.relurl=(" "+f[3]).slice(1),b(L,C),C=L,k+=L.duration,S++,T=0,D=!0);else if(f[4]){var R=(" "+f[4]).slice(1);C?L.setByteRange(R,C):L.setByteRange(R)}else if(f[5])L.rawProgramDateTime=(" "+f[5]).slice(1),L.tagList.push(["PROGRAM-DATE-TIME",L.rawProgramDateTime]),-1===A&&(A=E.length);else{if(!(f=f[0].match(p))){u.logger.warn("No matches on slow regex match for level playlist!");continue}for(m=1;m<f.length&&void 0===f[m];m++);var I=(" "+f[m]).slice(1),M=(" "+f[m+1]).slice(1),F=f[m+2]?(" "+f[m+2]).slice(1):"";switch(I){case"PLAYLIST-TYPE":y.type=M.toUpperCase();break;case"MEDIA-SEQUENCE":S=y.startSN=parseInt(M);break;case"SKIP":var P=new l.AttrList(M),N=P.decimalInteger("SKIPPED-SEGMENTS");if(Object(n.isFiniteNumber)(N)){y.skippedSegments=N;for(var B=N;B--;)E.unshift(null);S+=N}var j=P.enumeratedString("RECENTLY-REMOVED-DATERANGES");j&&(y.recentlyRemovedDateranges=j.split("\t"));break;case"TARGETDURATION":y.targetduration=parseFloat(M);break;case"VERSION":y.version=parseInt(M);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(M||F)&&L.tagList.push(F?[M,F]:[M]);break;case"DIS":w++;case"GAP":L.tagList.push([I]);break;case"BITRATE":L.tagList.push([I,M]);break;case"DISCONTINUITY-SEQ":w=parseInt(M);break;case"KEY":var U,H=new l.AttrList(M),G=H.enumeratedString("METHOD"),W=H.URI,z=H.hexadecimalInteger("IV"),K=H.enumeratedString("KEYFORMATVERSIONS"),V=H.enumeratedString("KEYID"),q=null!=(U=H.enumeratedString("KEYFORMAT"))?U:"identity";if(["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(q)>-1){u.logger.warn("Keyformat "+q+" is not supported from the manifest");continue}if("identity"!==q)continue;G&&(v=o.LevelKey.fromURL(t,W),W&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(G)>=0&&(v.method=G,v.keyFormat=q,V&&(v.keyID=V),K&&(v.keyFormatVersions=K),v.iv=z));break;case"START":var $=new l.AttrList(M).decimalFloatingPoint("TIME-OFFSET");Object(n.isFiniteNumber)($)&&(y.startTimeOffset=$);break;case"MAP":var Y=new l.AttrList(M);L.relurl=Y.URI,Y.BYTERANGE&&L.setByteRange(Y.BYTERANGE),L.level=r,L.sn="initSegment",v&&(L.levelkey=v),L.initSegment=null,x=L,D=!0;break;case"SERVER-CONTROL":var X=new l.AttrList(M);y.canBlockReload=X.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=X.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&X.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=X.optionalFloat("PART-HOLD-BACK",0),y.holdBack=X.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Z=new l.AttrList(M);y.partTarget=Z.decimalFloatingPoint("PART-TARGET");break;case"PART":var Q=y.partList;Q||(Q=y.partList=[]);var J=T>0?Q[Q.length-1]:void 0,ee=T++,te=new a.Part(new l.AttrList(M),L,t,ee,J);Q.push(te),L.duration+=te.duration;break;case"PRELOAD-HINT":var re=new l.AttrList(M);y.preloadHint=re;break;case"RENDITION-REPORT":var ne=new l.AttrList(M);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ne);break;default:u.logger.warn("line parsed but not handled: "+f)}}}C&&!C.relurl?(E.pop(),k-=C.duration,y.partList&&(y.fragmentHint=C)):y.partList&&(b(L,C),L.cc=w,y.fragmentHint=L);var ie=E.length,ae=E[0],se=E[ie-1];if((k+=y.skippedSegments*y.targetduration)>0&&ie&&se){y.averagetargetduration=k/ie;var oe=se.sn;y.endSN="initSegment"!==oe?oe:0,ae&&(y.startCC=ae.cc,ae.initSegment||y.fragments.every((function(e){return e.relurl&&(t=e.relurl,g.test(null!=(r=null===(n=i.parseURL(t))||void 0===n?void 0:n.path)?r:""));var t,r,n}))&&(u.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(L=new a.Fragment(c,t)).relurl=se.relurl,L.level=r,L.sn="initSegment",ae.initSegment=L,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(k+=y.fragmentHint.duration),y.totalduration=k,y.endCC=w,A>0&&function(e,t){for(var r=e[t],n=t;n--;){var i=e[n];if(!i)return;i.programDateTime=r.programDateTime-1e3*i.duration,r=i}}(E,A),y},e}();function v(e,t){["video","audio","text"].forEach((function(r){var n=e.filter((function(e){return Object(c.isCodecType)(e,r)}));if(n.length){var i=n.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}));t[r+"Codec"]=i.length>0?i[0]:n[0],e=e.filter((function(e){return-1===n.indexOf(e)}))}})),t.unknownCodecs=e}function y(e,t,r){var n=t[r];n&&(e[r]=n)}function b(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Object(n.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":
|
|
|
/*!***************************************!*\
|
|
|
!*** ./src/loader/playlist-loader.ts ***!
|
|
|
\***************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../errors */"./src/errors.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=r(/*! ./m3u8-parser */"./src/loader/m3u8-parser.ts"),u=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../utils/attr-list */"./src/utils/attr-list.ts");function d(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r}var f=function(){function e(e){this.hls=void 0,this.loaders=Object.create(null),this.hls=e,this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(i.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(i.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,n=t.loader,i=new(r||n)(t);return e.loader=i,this.loaders[e.type]=i,i},t.getInternalLoader=function(e){return this.loaders[e.type]},t.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},t.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},t.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},t.onManifestLoading=function(e,t){var r=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:u.PlaylistContextType.MANIFEST,url:r,deliveryDirectives:null})},t.onLevelLoading=function(e,t){var r=t.id,n=t.level,i=t.url,a=t.deliveryDirectives;this.load({id:r,groupId:null,level:n,responseType:"text",type:u.PlaylistContextType.LEVEL,url:i,deliveryDirectives:a})},t.onAudioTrackLoading=function(e,t){var r=t.id,n=t.groupId,i=t.url,a=t.deliveryDirectives;this.load({id:r,groupId:n,level:null,responseType:"text",type:u.PlaylistContextType.AUDIO_TRACK,url:i,deliveryDirectives:a})},t.onSubtitleTrackLoading=function(e,t){var r=t.id,n=t.groupId,i=t.url,a=t.deliveryDirectives;this.load({id:r,groupId:n,level:null,responseType:"text",type:u.PlaylistContextType.SUBTITLE_TRACK,url:i,deliveryDirectives:a})},t.load=function(e){var t,r,n,i,a,o,l=this.hls.config,c=this.getInternalLoader(e);if(c){var d=c.context;if(d&&d.url===e.url)return void s.logger.trace("[playlist-loader]: playlist request ongoing");s.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}switch(e.type){case u.PlaylistContextType.MANIFEST:r=l.manifestLoadingMaxRetry,n=l.manifestLoadingTimeOut,i=l.manifestLoadingRetryDelay,a=l.manifestLoadingMaxRetryTimeout;break;case u.PlaylistContextType.LEVEL:case u.PlaylistContextType.AUDIO_TRACK:case u.PlaylistContextType.SUBTITLE_TRACK:r=0,n=l.levelLoadingTimeOut;break;default:r=l.levelLoadingMaxRetry,n=l.levelLoadingTimeOut,i=l.levelLoadingRetryDelay,a=l.levelLoadingMaxRetryTimeout}if(c=this.createInternalLoader(e),null!==(t=e.deliveryDirectives)&&void 0!==t&&t.part&&(e.type===u.PlaylistContextType.LEVEL&&null!==e.level?o=this.hls.levels[e.level].details:e.type===u.PlaylistContextType.AUDIO_TRACK&&null!==e.id?o=this.hls.audioTracks[e.id].details:e.type===u.PlaylistContextType.SUBTITLE_TRACK&&null!==e.id&&(o=this.hls.subtitleTracks[e.id].details),o)){var f=o.partTarget,h=o.targetduration;f&&h&&(n=Math.min(1e3*Math.max(3*f,.8*h),n))}var p={timeout:n,maxRetry:r,retryDelay:i,maxRetryDelay:a,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(e,p,g)},t.loadsuccess=function(e,t,r,n){if(void 0===n&&(n=null),r.isSidxRequest)return this.handleSidxRequest(e,r),void this.handlePlaylistLoaded(e,t,r,n);this.resetInternalLoader(r.type);var i=e.data;0===i.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),i.indexOf("#EXTINF:")>0||i.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,r,n):this.handleMasterPlaylist(e,t,r,n)):this.handleManifestParsingError(e,r,"no EXTM3U delimiter",n)},t.loaderror=function(e,t,r){void 0===r&&(r=null),this.handleNetworkError(t,r,!1,e)},t.loadtimeout=function(e,t,r){void 0===r&&(r=null),this.handleNetworkError(t,r,!0)},t.handleMasterPlaylist=function(e,t,r,n){var a=this.hls,o=e.data,u=d(e,r),f=l.default.parseMasterPlaylist(o,u),h=f.levels,p=f.sessionData;if(h.length){var g=h.map((function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),m=h.map((function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),v=l.default.parseMasterPlaylistMedia(o,u,"AUDIO",g),y=l.default.parseMasterPlaylistMedia(o,u,"SUBTITLES",m),b=l.default.parseMasterPlaylistMedia(o,u,"CLOSED-CAPTIONS");v.length&&(v.some((function(e){return!e.url}))||!h[0].audioCodec||h[0].attrs.AUDIO||(s.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))),a.trigger(i.Events.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:y,captions:b,url:u,stats:t,networkDetails:n,sessionData:p})}else this.handleManifestParsingError(e,r,"no level found in manifest",n)},t.handleTrackOrLevelPlaylist=function(e,t,r,s){var o=this.hls,f=r.id,h=r.level,p=r.type,g=d(e,r),m=Object(n.isFiniteNumber)(f)?f:0,v=Object(n.isFiniteNumber)(h)?h:m,y=function(e){switch(e.type){case u.PlaylistContextType.AUDIO_TRACK:return u.PlaylistLevelType.AUDIO;case u.PlaylistContextType.SUBTITLE_TRACK:return u.PlaylistLevelType.SUBTITLE;default:return u.PlaylistLevelType.MAIN}}(r),b=l.default.parseLevelPlaylist(e.data,g,v,y,m);if(b.fragments.length){if(p===u.PlaylistContextType.MANIFEST){var E={attrs:new c.AttrList({}),bitrate:0,details:b,name:"",url:g};o.trigger(i.Events.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:g,stats:t,networkDetails:s,sessionData:null})}if(t.parsing.end=performance.now(),b.needSidxRanges){var x,S=null===(x=b.fragments[0].initSegment)||void 0===x?void 0:x.url;this.load({url:S,isSidxRequest:!0,type:p,level:h,levelDetails:b,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})}else r.levelDetails=b,this.handlePlaylistLoaded(e,t,r,s)}else o.trigger(i.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:"number"==typeof r.level?r.level:void 0})},t.handleSidxRequest=function(e,t){var r=Object(o.parseSegmentIndex)(new Uint8Array(e.data));if(r){var n=r.references,i=t.levelDetails;n.forEach((function(e,t){var n=e.info,a=i.fragments[t];0===a.byteRange.length&&a.setByteRange(String(1+n.end-n.start)+"@"+String(n.start)),a.initSegment&&a.initSegment.setByteRange(String(r.moovEndOffset)+"@0")}))}},t.handleManifestParsingError=function(e,t,r,n){this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===u.PlaylistContextType.MANIFEST,url:e.url,reason:r,response:e,context:t,networkDetails:n})},t.handleNetworkError=function(e,t,r,n){void 0===r&&(r=!1),s.logger.warn("[playlist-loader]: A network "+(r?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var o=a.ErrorDetails.UNKNOWN,l=!1,c=this.getInternalLoader(e);switch(e.type){case u.PlaylistContextType.MANIFEST:o=r?a.ErrorDetails.MANIFEST_LOAD_TIMEOUT:a.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case u.PlaylistContextType.LEVEL:o=r?a.ErrorDetails.LEVEL_LOAD_TIMEOUT:a.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case u.PlaylistContextType.AUDIO_TRACK:o=r?a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case u.PlaylistContextType.SUBTITLE_TRACK:o=r?a.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:a.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1}c&&this.resetInternalLoader(e.type);var d={type:a.ErrorTypes.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:c,context:e,networkDetails:t};n&&(d.response=n),this.hls.trigger(i.Events.ERROR,d)},t.handlePlaylistLoaded=function(e,t,r,n){var a=r.type,s=r.level,o=r.id,l=r.groupId,c=r.loader,d=r.levelDetails,f=r.deliveryDirectives;if(null!=d&&d.targetduration){if(c)switch(d.live&&(c.getCacheAge&&(d.ageHeader=c.getCacheAge()||0),c.getCacheAge&&!isNaN(d.ageHeader)||(d.ageHeader=0)),a){case u.PlaylistContextType.MANIFEST:case u.PlaylistContextType.LEVEL:this.hls.trigger(i.Events.LEVEL_LOADED,{details:d,level:s||0,id:o||0,stats:t,networkDetails:n,deliveryDirectives:f});break;case u.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(i.Events.AUDIO_TRACK_LOADED,{details:d,id:o||0,groupId:l||"",stats:t,networkDetails:n,deliveryDirectives:f});break;case u.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(i.Events.SUBTITLE_TRACK_LOADED,{details:d,id:o||0,groupId:l||"",stats:t,networkDetails:n,deliveryDirectives:f})}}else this.handleManifestParsingError(e,r,"invalid target duration",n)},e}();t.default=f},"./src/polyfills/number.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/polyfills/number.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */function(e,t,r){"use strict";r.r(t),r.d(t,"isFiniteNumber",(function(){return n})),r.d(t,"MAX_SAFE_INTEGER",(function(){return i}));var n=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},i=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/remux/aac-helper.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=function(){function e(){}return e.getSilentFrame=function(e,t){switch(e){case"mp4a.40.2":if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}},e}();t.default=n},"./src/remux/mp4-generator.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/remux/mp4-generator.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=Math.pow(2,32)-1,i=function(){function e(){}return e.init=function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:n};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,l,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,i))},e.box=function(e){for(var t=8,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=n.length,s=a;a--;)t+=n[a].byteLength;var o=new Uint8Array(t);for(o[0]=t>>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),a=0,t=8;a<s;a++)o.set(n[a],t),t+=n[a].byteLength;return o},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,r){r*=t;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,r,n){return e.box(e.types.moof,e.mfhd(t),e.traf(n,r))},e.moov=function(t){for(var r=t.length,n=[];r--;)n[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(n).concat(e.mvex(t)))},e.mvex=function(t){for(var r=t.length,n=[];r--;)n[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(n))},e.mvhd=function(t,r){r*=t;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,s)},e.sdtp=function(t){var r,n,i=t.samples||[],a=new Uint8Array(4+i.length);for(r=0;r<i.length;r++)n=i[r].flags,a[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return e.box(e.types.sdtp,a)},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))},e.avc1=function(t){var r,n,i,a=[],s=[];for(r=0;r<t.sps.length;r++)i=(n=t.sps[r]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(n));for(r=0;r<t.pps.length;r++)i=(n=t.pps[r]).byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(n));var o=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(s))),l=t.width,u=t.height,c=t.pixelRatio[0],d=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,d>>24,d>>16&255,d>>8&255,255&d])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.mp4a=function(t){var r=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var r=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},e.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var r=t.id,i=t.duration*t.timescale,a=t.width,s=t.height,o=Math.floor(i/(n+1)),l=Math.floor(i%(n+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,l>>24,l>>16&255,l>>8&255,255&l,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,s>>8&255,255&s,0,0]))},e.traf=function(t,r){var i=e.sdtp(t),a=t.id,s=Math.floor(r/(n+1)),o=Math.floor(r%(n+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,i.length+16+20+8+16+8+8),i)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,r){var n,i,a,s,o,l,u=t.samples||[],c=u.length,d=12+16*c,f=new Uint8Array(d);for(r+=8+d,f.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),n=0;n<c;n++)a=(i=u[n]).duration,s=i.size,o=i.flags,l=i.cts,f.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*n);return e.box(e.types.trun,f)},e.initSegment=function(t){e.types||e.init();var r=e.moov(t),n=new Uint8Array(e.FTYP.byteLength+r.byteLength);return n.set(e.FTYP),n.set(r,e.FTYP.byteLength),n},e}();i.types=void 0,i.HDLR_TYPES=void 0,i.STTS=void 0,i.STSC=void 0,i.STCO=void 0,i.STSZ=void 0,i.VMHD=void 0,i.SMHD=void 0,i.STSD=void 0,i.FTYP=void 0,i.DINF=void 0,t.default=i},"./src/remux/mp4-remuxer.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/remux/mp4-remuxer.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: default, normalizePts */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return g})),r.d(t,"normalizePts",(function(){return m}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./aac-helper */"./src/remux/aac-helper.ts"),a=r(/*! ./mp4-generator */"./src/remux/mp4-generator.ts"),s=r(/*! ../events */"./src/events.ts"),o=r(/*! ../errors */"./src/errors.ts"),l=r(/*! ../utils/logger */"./src/utils/logger.ts"),u=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../utils/timescale-conversion */"./src/utils/timescale-conversion.ts");function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var f=null,h=null,p=!1,g=function(){function e(e,t,r,n){if(void 0===n&&(n=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=r,this.ISGenerated=!1,null===f){var i=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);f=i?parseInt(i[1]):0}if(null===h){var a=navigator.userAgent.match(/Safari\/(\d+)/i);h=a?parseInt(a[1]):0}p=!!f&&f<75||!!h&&h<600}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){l.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){l.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){l.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},t.getVideoStartPts=function(e){var t=!1,r=e.reduce((function(e,r){var n=r.pts-e;return n<-4294967296?(t=!0,m(e,r.pts)):n>0?e:r.pts}),e[0].pts);return t&&l.logger.debug("PTS rollover detected"),r},t.remux=function(e,t,r,n,i,a,s,o){var c,d,f,h,p,g,v=i,y=i,b=e.pid>-1,E=t.pid>-1,x=t.samples.length,S=e.samples.length>0,T=x>1;if((!b||S)&&(!E||T)||this.ISGenerated||s){this.ISGenerated||(f=this.generateIS(e,t,i));var k=this.isVideoContiguous,w=-1;if(T&&(w=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!k&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,w>0){l.logger.warn("[mp4-remuxer]: Dropped "+w+" out of "+x+" video samples due to a missing keyframe");var C=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(w),t.dropped+=w,y+=(t.samples[0].pts-C)/(t.timescale||9e4)}else-1===w&&(l.logger.warn("[mp4-remuxer]: No keyframe found out of "+x+" video samples"),g=!1);if(this.ISGenerated){if(S&&T){var L=this.getVideoStartPts(t.samples),A=(m(e.samples[0].pts,L)-L)/t.inputTimeScale;v+=Math.max(0,A),y+=Math.max(0,-A)}if(S){if(e.samplerate||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),f=this.generateIS(e,t,i)),d=this.remuxAudio(e,v,this.isAudioContiguous,a,E||T||o===u.PlaylistLevelType.AUDIO?y:void 0),T){var D=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),f=this.generateIS(e,t,i)),c=this.remuxVideo(t,y,k,D)}}else T&&(c=this.remuxVideo(t,y,k,0));c&&(c.firstKeyFrame=w,c.independent=-1!==w)}}return this.ISGenerated&&(r.samples.length&&(p=this.remuxID3(r,i)),n.samples.length&&(h=this.remuxText(n,i))),{audio:d,video:c,initSegment:f,independent:g,text:h,id3:p}},t.generateIS=function(e,t,r){var i,s,o,l=e.samples,u=t.samples,c=this.typeSupported,d={},f=!Object(n.isFiniteNumber)(this._initPTS),h="audio/mp4";if(f&&(i=s=1/0),e.config&&l.length&&(e.timescale=e.samplerate,e.isAAC||(c.mpeg?(h="audio/mpeg",e.codec=""):c.mp3&&(e.codec="mp3")),d.audio={id:"audio",container:h,codec:e.codec,initSegment:!e.isAAC&&c.mpeg?new Uint8Array(0):a.default.initSegment([e]),metadata:{channelCount:e.channelCount}},f&&(o=e.inputTimeScale,i=s=l[0].pts-Math.round(o*r))),t.sps&&t.pps&&u.length&&(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:a.default.initSegment([t]),metadata:{width:t.width,height:t.height}},f)){o=t.inputTimeScale;var p=this.getVideoStartPts(u),g=Math.round(o*r);s=Math.min(s,m(u[0].dts,p)-g),i=Math.min(i,p-g)}if(Object.keys(d).length)return this.ISGenerated=!0,f&&(this._initPTS=i,this._initDTS=s),{tracks:d,initPTS:i,timescale:o}},t.remuxVideo=function(e,t,r,n){var i,u,h,g=e.inputTimeScale,y=e.samples,b=[],E=y.length,x=this._initPTS,S=this.nextAvcDts,T=8,k=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY,C=0,L=!1;r&&null!==S||(S=t*g-(y[0].pts-m(y[0].dts,y[0].pts)));for(var A=0;A<E;A++){var D=y[A];D.pts=m(D.pts-x,S),D.dts=m(D.dts-x,S),D.dts>D.pts&&(C=Math.max(Math.min(C,D.pts-D.dts),-18e3)),D.dts<y[A>0?A-1:A].dts&&(L=!0)}L&&y.sort((function(e,t){var r=e.dts-t.dts,n=e.pts-t.pts;return r||n})),u=y[0].dts,h=y[y.length-1].dts;var O=Math.round((h-u)/(E-1));if(C<0){if(C<-2*O){l.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(c.toMsFromMpegTsClock)(-O,!0)+" ms");for(var _=C,R=0;R<E;R++)y[R].dts=_=Math.max(_,y[R].pts-O),y[R].pts=Math.max(_,y[R].pts)}else{l.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(c.toMsFromMpegTsClock)(C,!0)+" ms to overcome this issue");for(var I=0;I<E;I++)y[I].dts=y[I].dts+C}u=y[0].dts}if(r){var M=u-S,F=M>O;if(F||M<-1){F?l.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(M,!0)+" ms ("+M+"dts) hole between fragments detected, filling it"):l.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(-M,!0)+" ms ("+M+"dts) overlapping between fragments detected"),u=S;var P=y[0].pts-M;y[0].dts=u,y[0].pts=P,l.logger.log("Video: First PTS/DTS adjusted: "+Object(c.toMsFromMpegTsClock)(P,!0)+"/"+Object(c.toMsFromMpegTsClock)(u,!0)+", delta: "+Object(c.toMsFromMpegTsClock)(M,!0)+" ms")}}p&&(u=Math.max(0,u));for(var N=0,B=0,j=0;j<E;j++){for(var U=y[j],H=U.units,G=H.length,W=0,z=0;z<G;z++)W+=H[z].data.length;B+=W,N+=G,U.length=W,U.dts=Math.max(U.dts,u),U.pts=Math.max(U.pts,U.dts,0),k=Math.min(U.pts,k),w=Math.max(U.pts,w)}h=y[E-1].dts;var K,V=B+4*N+8;try{K=new Uint8Array(V)}catch(e){return void this.observer.emit(s.Events.ERROR,s.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:V,reason:"fail allocating video mdat "+V})}var q=new DataView(K.buffer);q.setUint32(0,V),K.set(a.default.types.mdat,4);for(var $=0;$<E;$++){for(var Y=y[$],X=Y.units,Z=0,Q=0,J=X.length;Q<J;Q++){var ee=X[Q],te=ee.data,re=ee.data.byteLength;q.setUint32(T,re),T+=4,K.set(te,T),T+=re,Z+=4+re}if($<E-1)i=y[$+1].dts-Y.dts;else{var ne=this.config,ie=Y.dts-y[$>0?$-1:$].dts;if(ne.stretchShortVideoTrack&&null!==this.nextAudioPts){var ae=Math.floor(ne.maxBufferHole*g),se=(n?k+n*g:this.nextAudioPts)-Y.pts;se>ae?((i=se-ie)<0&&(i=ie),l.logger.log("[mp4-remuxer]: It is approximately "+se/90+" ms to the next segment; using duration "+i/90+" ms for the last video frame.")):i=ie}else i=ie}var oe=Math.round(Y.pts-Y.dts);b.push(new v(Y.key,i,Z,oe))}if(b.length&&f&&f<70){var le=b[0].flags;le.dependsOn=2,le.isNonSync=0}console.assert(void 0!==i,"mp4SampleDuration must be computed"),this.nextAvcDts=S=h+i,this.isVideoContiguous=!0;var ue={data1:a.default.moof(e.sequenceNumber++,u,d({},e,{samples:b})),data2:K,startPTS:k/g,endPTS:(w+i)/g,startDTS:u/g,endDTS:S/g,type:"video",hasAudio:!1,hasVideo:!0,nb:b.length,dropped:e.dropped};return e.samples=[],e.dropped=0,console.assert(K.length,"MDAT length must not be zero"),ue},t.remuxAudio=function(e,t,r,n,u){var c=e.inputTimeScale,f=c/(e.samplerate?e.samplerate:c),h=e.isAAC?1024:1152,p=h*f,g=this._initPTS,y=!e.isAAC&&this.typeSupported.mpeg,b=[],E=e.samples,x=y?0:8,S=this.nextAudioPts||-1,T=t*c;if(this.isAudioContiguous=r=r||E.length&&S>0&&(n&&Math.abs(T-S)<9e3||Math.abs(m(E[0].pts-g,T)-S)<20*p),E.forEach((function(e){e.pts=m(e.pts-g,T)})),!r||S<0){if(!(E=E.filter((function(e){return e.pts>=0}))).length)return;S=0===u?0:n?Math.max(0,T):E[0].pts}if(e.isAAC)for(var k=void 0!==u,w=this.config.maxAudioFramesDrift,C=0,L=S;C<E.length;C++){var A=E[C],D=A.pts,O=D-L,_=Math.abs(1e3*O/c);if(O<=-w*p&&k)0===C&&(l.logger.warn("Audio frame @ "+(D/c).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*O/c)+" ms."),this.nextAudioPts=S=L=D);else if(O>=w*p&&_<1e4&&k){var R=Math.round(O/p);(L=D-R*p)<0&&(R--,L+=p),0===C&&(this.nextAudioPts=S=L),l.logger.warn("[mp4-remuxer]: Injecting "+R+" audio frame @ "+(L/c).toFixed(3)+"s due to "+Math.round(1e3*O/c)+" ms gap.");for(var I=0;I<R;I++){var M=Math.max(L,0),F=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);F||(l.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),F=A.unit.subarray()),E.splice(C,0,{unit:F,pts:M}),L+=p,C++}}A.pts=L,L+=p}for(var P,N=null,B=null,j=0,U=E.length;U--;)j+=E[U].unit.byteLength;for(var H=0,G=E.length;H<G;H++){var W=E[H],z=W.unit,K=W.pts;if(null!==B)b[H-1].duration=Math.round((K-B)/f);else{if(r&&e.isAAC&&(K=S),N=K,!(j>0))return;j+=x;try{P=new Uint8Array(j)}catch(e){return void this.observer.emit(s.Events.ERROR,s.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:j,reason:"fail allocating audio mdat "+j})}y||(new DataView(P.buffer).setUint32(0,j),P.set(a.default.types.mdat,4))}P.set(z,x);var V=z.byteLength;x+=V,b.push(new v(!0,h,V,0)),B=K}var q=b.length;if(q){var $=b[b.length-1];this.nextAudioPts=S=B+f*$.duration;var Y=y?new Uint8Array(0):a.default.moof(e.sequenceNumber++,N/f,d({},e,{samples:b}));e.samples=[];var X=N/c,Z=S/c,Q={data1:Y,data2:P,startPTS:X,endPTS:Z,startDTS:X,endDTS:Z,type:"audio",hasAudio:!0,hasVideo:!1,nb:q};return this.isAudioContiguous=!0,console.assert(P.length,"MDAT length must not be zero"),Q}},t.remuxEmptyAudio=function(e,t,r,n){var a=e.inputTimeScale,s=a/(e.samplerate?e.samplerate:a),o=this.nextAudioPts,u=(null!==o?o:n.startDTS*a)+this._initDTS,c=n.endDTS*a+this._initDTS,d=1024*s,f=Math.ceil((c-u)/d),h=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(l.logger.warn("[mp4-remuxer]: remux empty Audio"),h){for(var p=[],g=0;g<f;g++){var m=u+g*d;p.push({unit:h,pts:m,dts:m})}return e.samples=p,this.remuxAudio(e,t,r,!1)}l.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},t.remuxID3=function(e,t){var r=e.samples.length;if(r){for(var n=e.inputTimeScale,i=this._initPTS,a=this._initDTS,s=0;s<r;s++){var o=e.samples[s];o.pts=m(o.pts-i,t*n)/n,o.dts=m(o.dts-a,t*n)/n}var l=e.samples;return e.samples=[],{samples:l}}},t.remuxText=function(e,t){var r=e.samples.length;if(r){for(var n=e.inputTimeScale,i=this._initPTS,a=0;a<r;a++){var s=e.samples[a];s.pts=m(s.pts-i,t*n)/n}e.samples.sort((function(e,t){return e.pts-t.pts}));var o=e.samples;return e.samples=[],{samples:o}}},e}();function m(e,t){var r;if(null===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}var v=function(e,t,r,n){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=r,this.cts=n,this.flags=new y(e)},y=function(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}},"./src/remux/passthrough-remuxer.ts":
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/remux/passthrough-remuxer.ts ***!
|
|
|
\******************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),a=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=function(){function e(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this.initPTS=e,this.lastEndDTS=null},t.resetNextTimestamp=function(){this.lastEndDTS=null},t.resetInitSegment=function(e,t,r){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(e),this.emitInitSegment=!0},t.generateInitSegment=function(e){var t=this.audioCodec,r=this.videoCodec;if(!e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var n=this.initData=Object(i.parseInitSegment)(e);t||(t=u(n.audio,a.ElementaryStreamTypes.AUDIO)),r||(r=u(n.video,a.ElementaryStreamTypes.VIDEO));var o={};n.audio&&n.video?o.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:e,id:"main"}:n.audio?o.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?o.video={container:"video/mp4",codec:r,initSegment:e,id:"main"}:s.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},t.remux=function(e,t,r,a,o){var u=this.initPTS,c=this.lastEndDTS,d={audio:void 0,video:void 0,text:a,id3:r,initSegment:void 0};Object(n.isFiniteNumber)(c)||(c=this.lastEndDTS=o||0);var f=t.samples;if(!f||!f.length)return d;var h={initPTS:void 0,timescale:1},p=this.initData;if(p&&p.length||(this.generateInitSegment(f),p=this.initData),!p||!p.length)return s.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),d;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(n.isFiniteNumber)(u)||(this.initPTS=h.initPTS=u=l(p,f,c));var g=Object(i.getDuration)(f,p),m=c,v=g+m;Object(i.offsetStartDTS)(p,f,u),g>0?this.lastEndDTS=v:(s.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!p.audio,b=!!p.video,E="";y&&(E+="audio"),b&&(E+="video");var x={data1:f,startPTS:m,startDTS:m,endPTS:v,endDTS:v,type:E,hasAudio:y,hasVideo:b,nb:1,dropped:0};return d.audio="audio"===x.type?x:void 0,d.video="audio"!==x.type?x:void 0,d.text=a,d.id3=r,d.initSegment=h,d},e}(),l=function(e,t,r){return Object(i.getStartDTS)(e,t)-r};function u(e,t){var r=null==e?void 0:e.codec;return r&&r.length>4?r:"hvc1"===r?"hvc1.1.c.L120.90":"av01"===r?"av01.0.04M.08":"avc1"===r||t===a.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}t.default=o},"./src/task-loop.ts":
|
|
|
/*!**************************!*\
|
|
|
!*** ./src/task-loop.ts ***!
|
|
|
\**************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},t.onHandlerDestroyed=function(){},t.hasInterval=function(){return!!this._tickInterval},t.hasNextTick=function(){return!!this._tickTimer},t.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},t.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},t.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},t.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},t.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},t.doTick=function(){},e}()},"./src/types/cmcd.ts":
|
|
|
/*!***************************!*\
|
|
|
!*** ./src/types/cmcd.ts ***!
|
|
|
\***************************/
|
|
|
/*! exports provided: CMCDVersion, CMCDObjectType, CMCDStreamingFormat, CMCDStreamType */function(e,t,r){"use strict";r.r(t),r.d(t,"CMCDVersion",(function(){return s})),r.d(t,"CMCDObjectType",(function(){return n})),r.d(t,"CMCDStreamingFormat",(function(){return i})),r.d(t,"CMCDStreamType",(function(){return a}));var n,i,a,s=1;!function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(n||(n={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(i||(i={})),function(e){e.VOD="v",e.LIVE="l"}(a||(a={}))},"./src/types/level.ts":
|
|
|
/*!****************************!*\
|
|
|
!*** ./src/types/level.ts ***!
|
|
|
\****************************/
|
|
|
/*! exports provided: HlsSkip, getSkipValue, HlsUrlParameters, Level */function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i;function a(e,t){var r=e.canSkipUntil,n=e.canSkipDateRanges,a=e.endSN;return r&&(void 0!==t?t-a:0)<r?n?i.v2:i.Yes:i.No}r.r(t),r.d(t,"HlsSkip",(function(){return i})),r.d(t,"getSkipValue",(function(){return a})),r.d(t,"HlsUrlParameters",(function(){return s})),r.d(t,"Level",(function(){return o})),function(e){e.No="",e.Yes="YES",e.v2="v2"}(i||(i={}));var s=function(){function e(e,t,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=r}return e.prototype.addDirectives=function(e){var t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.toString()},e}(),o=function(){function e(e){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[e.url],this.attrs=e.attrs,this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter((function(e){return e})).join(",").replace(/\.[^.,]+/g,"")}var t,r,i;return t=e,(r=[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(e){var t=e%this.url.length;this._urlId!==t&&(this.details=void 0,this._urlId=t)}}])&&n(t.prototype,r),i&&n(t,i),e}()},"./src/types/loader.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/types/loader.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: PlaylistContextType, PlaylistLevelType */function(e,t,r){"use strict";var n,i;r.r(t),r.d(t,"PlaylistContextType",(function(){return n})),r.d(t,"PlaylistLevelType",(function(){return i})),function(e){e.MANIFEST="manifest",e.LEVEL="level",e.AUDIO_TRACK="audioTrack",e.SUBTITLE_TRACK="subtitleTrack"}(n||(n={})),function(e){e.MAIN="main",e.AUDIO="audio",e.SUBTITLE="subtitle"}(i||(i={}))},"./src/types/transmuxer.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/types/transmuxer.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: ChunkMetadata */function(e,t,r){"use strict";r.r(t),r.d(t,"ChunkMetadata",(function(){return n}));var n=function(e,t,r,n,i,a){void 0===n&&(n=0),void 0===i&&(i=-1),void 0===a&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=r,this.size=n,this.part=i,this.partial=a}},"./src/utils/attr-list.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/utils/attr-list.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: AttrList */function(e,t,r){"use strict";r.r(t),r.d(t,"AttrList",(function(){return a}));var n=/^(\d+)x(\d+)$/,i=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,a=function(){function e(t){for(var r in"string"==typeof t&&(t=e.parseAttrList(t)),t)t.hasOwnProperty(r)&&(this[r]=t[r])}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),n=0;n<t.length/2;n++)r[n]=parseInt(t.slice(2*n,2*n+2),16);return r}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var r=this[e];return r?parseFloat(r):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=n.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,r={};for(i.lastIndex=0;null!==(t=i.exec(e));){var n=t[2];0===n.indexOf('"')&&n.lastIndexOf('"')===n.length-1&&(n=n.slice(1,-1)),r[t[1]]=n}return r},e}()},"./src/utils/binary-search.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/utils/binary-search.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),t.default={search:function(e,t){for(var r=0,n=e.length-1,i=null,a=null;r<=n;){var s=t(a=e[i=(r+n)/2|0]);if(s>0)r=i+1;else{if(!(s<0))return a;n=i-1}}return null}}},"./src/utils/buffer-helper.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/utils/buffer-helper.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: BufferHelper */function(e,t,r){"use strict";r.r(t),r.d(t,"BufferHelper",(function(){return a}));var n=r(/*! ./logger */"./src/utils/logger.ts"),i={length:0,start:function(){return 0},end:function(){return 0}},a=function(){function e(){}return e.isBuffered=function(t,r){try{if(t)for(var n=e.getBuffered(t),i=0;i<n.length;i++)if(r>=n.start(i)&&r<=n.end(i))return!0}catch(e){}return!1},e.bufferInfo=function(t,r,n){try{if(t){var i,a=e.getBuffered(t),s=[];for(i=0;i<a.length;i++)s.push({start:a.start(i),end:a.end(i)});return this.bufferedInfo(s,r,n)}}catch(e){}return{len:0,start:r,end:r,nextStart:void 0}},e.bufferedInfo=function(e,t,r){t=Math.max(0,t),e.sort((function(e,t){var r=e.start-t.start;return r||t.end-e.end}));var n=[];if(r)for(var i=0;i<e.length;i++){var a=n.length;if(a){var s=n[a-1].end;e[i].start-s<r?e[i].end>s&&(n[a-1].end=e[i].end):n.push(e[i])}else n.push(e[i])}else n=e;for(var o,l=0,u=t,c=t,d=0;d<n.length;d++){var f=n[d].start,h=n[d].end;if(t+r>=f&&t<h)u=f,l=(c=h)-t;else if(t+r<f){o=f;break}}return{len:l,start:u||0,end:c||0,nextStart:o}},e.getBuffered=function(e){try{return e.buffered}catch(e){return n.logger.log("failed to get media.buffered",e),i}},e}()},"./src/utils/cea-608-parser.ts":
|
|
|
/*!*************************************!*\
|
|
|
!*** ./src/utils/cea-608-parser.ts ***!
|
|
|
\*************************************/
|
|
|
/*! exports provided: Row, CaptionScreen, default */function(e,t,r){"use strict";r.r(t),r.d(t,"Row",(function(){return m})),r.d(t,"CaptionScreen",(function(){return v}));var n,i=r(/*! ../utils/logger */"./src/utils/logger.ts"),a={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},s=function(e){var t=e;return a.hasOwnProperty(e)&&(t=a[e]),String.fromCharCode(t)},o={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},l={17:2,18:4,21:6,22:8,23:10,19:13,20:15},u={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},c={25:2,26:4,29:6,30:8,31:10,27:13,28:15},d=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];!function(e){e[e.ERROR=0]="ERROR",e[e.TEXT=1]="TEXT",e[e.WARNING=2]="WARNING",e[e.INFO=2]="INFO",e[e.DEBUG=3]="DEBUG",e[e.DATA=3]="DATA"}(n||(n={}));var f=function(){function e(){this.time=null,this.verboseLevel=n.ERROR}return e.prototype.log=function(e,t){this.verboseLevel>=e&&i.logger.log(this.time+" ["+e+"] "+t)},e}(),h=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},p=function(){function e(e,t,r,n,i){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=r||!1,this.background=n||"black",this.flash=i||!1}var t=e.prototype;return t.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},t.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],r=0;r<t.length;r++){var n=t[r];e.hasOwnProperty(n)&&(this[n]=e[n])}},t.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},t.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},t.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},t.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},e}(),g=function(){function e(e,t,r,n,i,a){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new p(t,r,n,i,a)}var t=e.prototype;return t.reset=function(){this.uchar=" ",this.penState.reset()},t.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},t.setPenState=function(e){this.penState.copy(e)},t.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},t.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},t.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},e}(),m=function(){function e(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var t=0;t<100;t++)this.chars.push(new g);this.logger=e,this.pos=0,this.currPenState=new p}var t=e.prototype;return t.equals=function(e){for(var t=!0,r=0;r<100;r++)if(!this.chars[r].equals(e.chars[r])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<100;t++)this.chars[t].copy(e.chars[t])},t.isEmpty=function(){for(var e=!0,t=0;t<100;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},t.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(n.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(this.logger.log(n.DEBUG,"Too large cursor position "+this.pos),this.pos=100)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var r=this.pos+1;r<t+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)},t.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},t.insertChar=function(e){e>=144&&this.backSpace();var t=s(e);this.pos>=100?this.logger.log(n.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<100;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,r=0;r<100;r++){var n=this.chars[r].uchar;" "!==n&&(t=!1),e.push(n)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),v=function(){function e(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var t=0;t<15;t++)this.rows.push(new m(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var t=e.prototype;return t.reset=function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},t.equals=function(e){for(var t=!0,r=0;r<15;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},t.isEmpty=function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},t.backSpace=function(){this.rows[this.currRow].backSpace()},t.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},t.insertChar=function(e){this.rows[this.currRow].insertChar(e)},t.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},t.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},t.setCursor=function(e){this.logger.log(n.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){this.logger.log(n.INFO,"pacData = "+JSON.stringify(e));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var r=0;r<15;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var s=a.rows[i].cueStartTime,o=this.logger.time;if(s&&null!==o&&s<o)for(var l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(a.rows[i+l])}}this.currRow=t;var u=this.rows[this.currRow];if(null!==e.indent){var c=e.indent,d=Math.max(c-1,0);u.setCursor(e.indent),e.color=u.chars[d].penState.foreground}var f={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(f)},t.setBkgData=function(e){this.logger.log(n.INFO,"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},t.setRollUpRows=function(e){this.nrRollUpRows=e},t.rollUp=function(){if(null!==this.nrRollUpRows){this.logger.log(n.TEXT,this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(n.INFO,"Rolling up")}else this.logger.log(n.DEBUG,"roll_up but nrRollUpRows not set yet")},t.getDisplayText=function(e){e=e||!1;for(var t=[],r="",n=-1,i=0;i<15;i++){var a=this.rows[i].getTextString();a&&(n=i+1,e?t.push("Row "+n+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r},t.getTextAndFormat=function(){return this.rows},e}(),y=function(){function e(e,t,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new v(r),this.nonDisplayedMemory=new v(r),this.lastOutputScreen=new v(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(n.INFO,"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(n.INFO,r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(n.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},t.ccRCL=function(){this.logger.log(n.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.ccBS=function(){this.logger.log(n.INFO,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},t.ccAOF=function(){},t.ccAON=function(){},t.ccDER=function(){this.logger.log(n.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.ccRU=function(e){this.logger.log(n.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},t.ccFON=function(){this.logger.log(n.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.ccRDC=function(){this.logger.log(n.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.ccTR=function(){this.logger.log(n.INFO,"TR"),this.setMode("MODE_TEXT")},t.ccRTD=function(){this.logger.log(n.INFO,"RTD"),this.setMode("MODE_TEXT")},t.ccEDM=function(){this.logger.log(n.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.ccCR=function(){this.logger.log(n.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.ccENM=function(){this.logger.log(n.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.ccEOC=function(){if(this.logger.log(n.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(n.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},t.ccTO=function(e){this.logger.log(n.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},t.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][r]}this.logger.log(n.INFO,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e}(),b=function(){function e(e,t,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var n=new f;this.channels=[null,new y(e,t,n),new y(e+1,r,n)],this.cmdHistory={a:null,b:null},this.logger=n}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var r,i,a,s=!1;this.logger.time=e;for(var o=0;o<t.length;o+=2)if(i=127&t[o],a=127&t[o+1],0!==i||0!==a){if(this.logger.log(n.DATA,"["+h([t[o],t[o+1]])+"] -> ("+h([i,a])+")"),(r=this.parseCmd(i,a))||(r=this.parseMidrow(i,a)),r||(r=this.parsePAC(i,a)),r||(r=this.parseBackgroundAttributes(i,a)),!r&&(s=this.parseChars(i,a))){var l=this.currentChannel;l&&l>0?this.channels[l].insertChars(s):this.logger.log(n.WARNING,"No channel found yet. TEXT-MODE?")}r||s||this.logger.log(n.WARNING,"Couldn't parse cleaned data "+h([i,a])+" orig: "+h([t[o],t[o+1]]))}},t.parseCmd=function(e,t){var r=this.cmdHistory;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(x(e,t,r))return E(null,null,r),this.logger.log(n.DEBUG,"Repeated command ("+h([e,t])+") is dropped"),!0;var i=20===e||21===e||23===e?1:2,a=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?a.ccRCL():33===t?a.ccBS():34===t?a.ccAOF():35===t?a.ccAON():36===t?a.ccDER():37===t?a.ccRU(2):38===t?a.ccRU(3):39===t?a.ccRU(4):40===t?a.ccFON():41===t?a.ccRDC():42===t?a.ccTR():43===t?a.ccRTD():44===t?a.ccEDM():45===t?a.ccCR():46===t?a.ccENM():47===t&&a.ccEOC():a.ccTO(t-32),E(e,t,r),this.currentChannel=i,!0},t.parseMidrow=function(e,t){var r=0;if((17===e||25===e)&&t>=32&&t<=47){if((r=17===e?1:2)!==this.currentChannel)return this.logger.log(n.ERROR,"Mismatch channel in midrow parsing"),!1;var i=this.channels[r];return!!i&&(i.ccMIDROW(t),this.logger.log(n.DEBUG,"MIDROW ("+h([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var r,n=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(x(e,t,n))return E(null,null,n),!0;var i=e<=23?1:2;r=t>=64&&t<=95?1===i?o[e]:u[e]:1===i?l[e]:c[e];var a=this.channels[i];return!!a&&(a.setPAC(this.interpretPAC(r,t)),E(e,t,n),this.currentChannel=i,!0)},t.interpretPAC=function(e,t){var r,n={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,n.underline=1==(1&r),r<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((r-16)/2),n},t.parseChars=function(e,t){var r,i,a=null,o=null;if(e>=25?(r=2,o=e-8):(r=1,o=e),o>=17&&o<=19?(i=17===o?t+80:18===o?t+112:t+144,this.logger.log(n.INFO,"Special char '"+s(i)+"' in channel "+r),a=[i]):e>=32&&e<=127&&(a=0===t?[e]:[e,t]),a){var l=h(a);this.logger.log(n.DEBUG,"Char codes = "+l.join(",")),E(e,t,this.cmdHistory)}return a},t.parseBackgroundAttributes=function(e,t){var r;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var n={};16===e||24===e?(r=Math.floor((t-32)/2),n.background=d[r],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0));var i=e<=23?1:2;return this.channels[i].setBkgData(n),E(e,t,this.cmdHistory),!0},t.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},t.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var r=this.channels[t];r&&r.cueSplitAtTime(e)}},e}();function E(e,t,r){r.a=e,r.b=t}function x(e,t,r){return r.a===e&&r.b===t}t.default=b},"./src/utils/codecs.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/utils/codecs.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: isCodecType, isCodecSupportedInMp4 */function(e,t,r){"use strict";r.r(t),r.d(t,"isCodecType",(function(){return i})),r.d(t,"isCodecSupportedInMp4",(function(){return a}));var n={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function i(e,t){var r=n[t];return!!r&&!0===r[e.slice(0,4)]}function a(e,t){return MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}},"./src/utils/cues.ts":
|
|
|
/*!***************************!*\
|
|
|
!*** ./src/utils/cues.ts ***!
|
|
|
\***************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ./vttparser */"./src/utils/vttparser.ts"),i=r(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts"),a=r(/*! ./texttrack-utils */"./src/utils/texttrack-utils.ts"),s=/\s/,o={newCue:function(e,t,r,o){for(var l,u,c,d,f,h=[],p=self.VTTCue||self.TextTrackCue,g=0;g<o.rows.length;g++)if(c=!0,d=0,f="",!(l=o.rows[g]).isEmpty()){for(var m=0;m<l.chars.length;m++)s.test(l.chars[m].uchar)&&c?d++:(f+=l.chars[m].uchar,c=!1);l.cueStartTime=t,t===r&&(r+=1e-4),d>=16?d--:d++;var v=Object(n.fixLineBreaks)(f.trim()),y=Object(i.generateCueId)(t,r,v);e&&e.cues&&e.cues.getCueById(y)||((u=new p(t,r,v)).id=y,u.line=g+1,u.align="left",u.position=10+Math.min(80,10*Math.floor(8*d/32)),h.push(u))}return e&&h.length&&(h.sort((function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line})),h.forEach((function(t){return Object(a.addCueToTrack)(e,t)}))),h}};t.default=o},"./src/utils/discontinuities.ts":
|
|
|
/*!**************************************!*\
|
|
|
!*** ./src/utils/discontinuities.ts ***!
|
|
|
\**************************************/
|
|
|
/*! exports provided: findFirstFragWithCC, shouldAlignOnDiscontinuities, findDiscontinuousReferenceFrag, adjustSlidingStart, alignStream, alignPDT, alignFragmentByPDTDelta, alignMediaPlaylistByPDT */function(e,t,r){"use strict";r.r(t),r.d(t,"findFirstFragWithCC",(function(){return s})),r.d(t,"shouldAlignOnDiscontinuities",(function(){return o})),r.d(t,"findDiscontinuousReferenceFrag",(function(){return l})),r.d(t,"adjustSlidingStart",(function(){return c})),r.d(t,"alignStream",(function(){return d})),r.d(t,"alignPDT",(function(){return f})),r.d(t,"alignFragmentByPDTDelta",(function(){return h})),r.d(t,"alignMediaPlaylistByPDT",(function(){return p}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./logger */"./src/utils/logger.ts"),a=r(/*! ../controller/level-helper */"./src/controller/level-helper.ts");function s(e,t){for(var r=null,n=0,i=e.length;n<i;n++){var a=e[n];if(a&&a.cc===t){r=a;break}}return r}function o(e,t,r){return!(!t.details||!(r.endCC>r.startCC||e&&e.cc<r.startCC))}function l(e,t){var r=e.fragments,n=t.fragments;if(n.length&&r.length){var a=s(r,n[0].cc);if(a&&(!a||a.startPTS))return a;i.logger.log("No frag in previous level to align on")}else i.logger.log("No fragments to align")}function u(e,t){if(e){var r=e.start+t;e.start=e.startPTS=r,e.endPTS=r+e.duration}}function c(e,t){for(var r=t.fragments,n=0,i=r.length;n<i;n++)u(r[n],e);t.fragmentHint&&u(t.fragmentHint,e),t.alignedSliding=!0}function d(e,t,r){t&&(function(e,t,r){if(o(e,r,t)){var a=l(r.details,t);a&&Object(n.isFiniteNumber)(a.start)&&(i.logger.log("Adjusting PTS using last level due to CC increase within current level "+t.url),c(a.start,t))}}(e,r,t),!r.alignedSliding&&t.details&&f(r,t.details),r.alignedSliding||!t.details||r.skippedSegments||Object(a.adjustSliding)(t.details,r))}function f(e,t){if(t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime){var r=t.fragments[0].programDateTime,a=e.fragments[0].programDateTime,s=(a-r)/1e3+t.fragments[0].start;s&&Object(n.isFiniteNumber)(s)&&(i.logger.log("Adjusting PTS using programDateTime delta "+(a-r)+"ms, sliding:"+s.toFixed(3)+" "+e.url+" "),c(s,e))}}function h(e,t){var r=e.programDateTime;if(r){var n=(r-t)/1e3;e.start=e.startPTS=n,e.endPTS=n+e.duration}}function p(e,t){if(t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime){var r=t.fragments[0].programDateTime-1e3*t.fragments[0].start;e.fragments.forEach((function(e){h(e,r)})),e.fragmentHint&&h(e.fragmentHint,r),e.alignedSliding=!0}}},"./src/utils/ewma-bandwidth-estimator.ts":
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./src/utils/ewma-bandwidth-estimator.ts ***!
|
|
|
\***********************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../utils/ewma */"./src/utils/ewma.ts"),i=function(){function e(e,t,r){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new n.default(e),this.fast_=new n.default(t)}var t=e.prototype;return t.update=function(e,t){var r=this.slow_,i=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new n.default(e,r.getEstimate(),r.getTotalWeight())),this.fast_.halfLife!==t&&(this.fast_=new n.default(t,i.getEstimate(),i.getTotalWeight()))},t.sample=function(e,t){var r=(e=Math.max(e,this.minDelayMs_))/1e3,n=8*t/r;this.fast_.sample(r,n),this.slow_.sample(r,n)},t.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.destroy=function(){},e}();t.default=i},"./src/utils/ewma.ts":
|
|
|
/*!***************************!*\
|
|
|
!*** ./src/utils/ewma.ts ***!
|
|
|
\***************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=r}var t=e.prototype;return t.sample=function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},e}();t.default=n},"./src/utils/fetch-loader.ts":
|
|
|
/*!***********************************!*\
|
|
|
!*** ./src/utils/fetch-loader.ts ***!
|
|
|
\***********************************/
|
|
|
/*! exports provided: fetchSupported, default */function(e,t,r){"use strict";r.r(t),r.d(t,"fetchSupported",(function(){return f}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),a=r(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts");function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,e)})(e)}function o(e,t,r){return(o=l()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&u(i,r.prototype),i}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function f(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}var h=function(){function e(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||p,this.controller=new self.AbortController,this.stats=new i.LoadStats}var t=e.prototype;return t.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},t.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.abort())},t.abort=function(){var e;this.abortInternal(),null!==(e=this.callbacks)&&void 0!==e&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},t.load=function(e,t,r){var i=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var s=function(e,t){var r={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(d({},e.headers))};return e.rangeEnd&&r.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),r}(e,this.controller.signal),o=r.onProgress,l="arraybuffer"===e.responseType,u=l?"byteLength":"length";this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout((function(){i.abortInternal(),r.onTimeout(a,e,i.response)}),t.timeout),self.fetch(this.request).then((function(r){if(i.response=i.loader=r,!r.ok){var s=r.status,u=r.statusText;throw new g(u||"fetch, bad network response",s,r)}return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(r.headers.get("Content-Length")||"0"),o&&Object(n.isFiniteNumber)(t.highWaterMark)?i.loadProgressively(r,a,e,t.highWaterMark,o):l?r.arrayBuffer():r.text()})).then((function(s){var l=i.response;self.clearTimeout(i.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first),a.loaded=a.total=s[u];var c={url:l.url,data:s};o&&!Object(n.isFiniteNumber)(t.highWaterMark)&&o(a,e,s,l),r.onSuccess(c,a,e,l)})).catch((function(t){if(self.clearTimeout(i.requestTimeout),!a.aborted){var n=t.code||0;r.onError({code:n,text:t.message},e,t.details)}}))},t.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},t.loadProgressively=function(e,t,r,n,i){void 0===n&&(n=0);var s=new a.default,o=e.body.getReader();return function a(){return o.read().then((function(o){if(o.done)return s.dataLength&&i(t,r,s.flush(),e),Promise.resolve(new ArrayBuffer(0));var l=o.value,u=l.length;return t.loaded+=u,u<n||s.dataLength?(s.push(l),s.dataLength>=n&&i(t,r,s.flush(),e)):i(t,r,l,e),a()})).catch((function(){return Promise.reject()}))}()},e}();function p(e,t){return new self.Request(e.url,t)}var g=function(e){var t,r;function n(t,r,n){var i;return(i=e.call(this,t)||this).code=void 0,i.details=void 0,i.code=r,i.details=n,i}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,u(t,r),n}(s(Error));t.default=h},"./src/utils/imsc1-ttml-parser.ts":
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/utils/imsc1-ttml-parser.ts ***!
|
|
|
\****************************************/
|
|
|
/*! exports provided: IMSC1_CODEC, parseIMSC1 */function(e,t,r){"use strict";r.r(t),r.d(t,"IMSC1_CODEC",(function(){return c})),r.d(t,"parseIMSC1",(function(){return p}));var n=r(/*! ./mp4-tools */"./src/utils/mp4-tools.ts"),i=r(/*! ./vttparser */"./src/utils/vttparser.ts"),a=r(/*! ./vttcue */"./src/utils/vttcue.ts"),s=r(/*! ../demux/id3 */"./src/demux/id3.ts"),o=r(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),l=r(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts");function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var c="stpp.ttml.im1t",d=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,f=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,h={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(e,t,r,i,c){var d=Object(n.findBox)(new Uint8Array(e),["mdat"]);if(0!==d.length){var f=d[0],p=Object(s.utf8ArrayToStr)(new Uint8Array(e,f.start,f.end-f.start)),E=Object(o.toTimescaleFromScale)(t,1,r);try{i(function(e,t){var r=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");var n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(n).reduce((function(e,t){return e[t]=r.getAttribute("ttp:"+t)||n[t],e}),{}),s="preserve"!==r.getAttribute("xml:space"),o=m(g(r,"styling","style")),c=m(g(r,"layout","region")),d=g(r,"body","[begin]");return[].map.call(d,(function(e){var r=function e(t,r){return[].slice.call(t.childNodes).reduce((function(t,n,i){var a;return"br"===n.nodeName&&i?t+"\n":null!==(a=n.childNodes)&&void 0!==a&&a.length?e(n,r):r?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent}),"")}(e,s);if(!r||!e.hasAttribute("begin"))return null;var n=b(e.getAttribute("begin"),i),d=b(e.getAttribute("dur"),i),f=b(e.getAttribute("end"),i);if(null===n)throw y(e);if(null===f){if(null===d)throw y(e);f=n+d}var p=new a.default(n-t,f-t,r);p.id=Object(l.generateCueId)(p.startTime,p.endTime,p.text);var g=c[e.getAttribute("region")],m=o[e.getAttribute("style")];p.position=10,p.size=80;var E=function(e,t){var r="http://www.w3.org/ns/ttml#styling";return["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((function(n,i){var a=v(t,r,i)||v(e,r,i);return a&&(n[i]=a),n}),{})}(g,m),x=E.textAlign;if(x){var S=h[x];S&&(p.lineAlign=S),p.align=x}return u(p,E),p})).filter((function(e){return null!==e}))}(p,E))}catch(e){c(e)}}else c(new Error("Could not parse IMSC1 mdat"))}function g(e,t,r){var n=e.getElementsByTagName(t)[0];return n?[].slice.call(n.querySelectorAll(r)):[]}function m(e){return e.reduce((function(e,t){var r=t.getAttribute("xml:id");return r&&(e[r]=t),e}),{})}function v(e,t,r){return e.hasAttributeNS(t,r)?e.getAttributeNS(t,r):null}function y(e){return new Error("Could not parse ttml timestamp "+e)}function b(e,t){if(!e)return null;var r=Object(i.parseTimeStamp)(e);return null===r&&(d.test(e)?r=function(e,t){var r=d.exec(e),n=(0|r[4])+(0|r[5])/t.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+n/t.frameRate}(e,t):f.test(e)&&(r=function(e,t){var r=f.exec(e),n=Number(r[1]);switch(r[2]){case"h":return 3600*n;case"m":return 60*n;case"ms":return 1e3*n;case"f":return n/t.frameRate;case"t":return n/t.tickRate}return n}(e,t))),r}},"./src/utils/logger.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/utils/logger.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: enableLogs, logger */function(e,t,r){"use strict";r.r(t),r.d(t,"enableLogs",(function(){return o})),r.d(t,"logger",(function(){return l}));var n=function(){},i={trace:n,debug:n,log:n,warn:n,info:n,error:n},a=i;function s(e){var t=self.console[e];return t?t.bind(self.console,"["+e+"] >"):n}function o(e){if(self.console&&!0===e||"object"==typeof e){!function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];r.forEach((function(t){a[t]=e[t]?e[t].bind(e):s(t)}))}(e,"debug","log","info","warn","error");try{a.log()}catch(e){a=i}}else a=i}var l=i},"./src/utils/mediakeys-helper.ts":
|
|
|
/*!***************************************!*\
|
|
|
!*** ./src/utils/mediakeys-helper.ts ***!
|
|
|
\***************************************/
|
|
|
/*! exports provided: KeySystems, requestMediaKeySystemAccess */function(e,t,r){"use strict";var n;r.r(t),r.d(t,"KeySystems",(function(){return n})),r.d(t,"requestMediaKeySystemAccess",(function(){return i})),function(e){e.WIDEVINE="com.widevine.alpha",e.PLAYREADY="com.microsoft.playready"}(n||(n={}));var i="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./src/utils/mediasource-helper.ts ***!
|
|
|
\*****************************************/
|
|
|
/*! exports provided: getMediaSource */function(e,t,r){"use strict";function n(){return self.MediaSource||self.WebKitMediaSource}r.r(t),r.d(t,"getMediaSource",(function(){return n}))},"./src/utils/mp4-tools.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/utils/mp4-tools.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: bin2str, readUint16, readUint32, writeUint32, findBox, parseSegmentIndex, parseInitSegment, getStartDTS, getDuration, computeRawDurationFromSamples, offsetStartDTS, segmentValidRange, appendUint8Array */function(e,t,r){"use strict";r.r(t),r.d(t,"bin2str",(function(){return o})),r.d(t,"readUint16",(function(){return l})),r.d(t,"readUint32",(function(){return u})),r.d(t,"writeUint32",(function(){return c})),r.d(t,"findBox",(function(){return d})),r.d(t,"parseSegmentIndex",(function(){return f})),r.d(t,"parseInitSegment",(function(){return h})),r.d(t,"getStartDTS",(function(){return p})),r.d(t,"getDuration",(function(){return g})),r.d(t,"computeRawDurationFromSamples",(function(){return m})),r.d(t,"offsetStartDTS",(function(){return v})),r.d(t,"segmentValidRange",(function(){return y})),r.d(t,"appendUint8Array",(function(){return b}));var n=r(/*! ./typed-array */"./src/utils/typed-array.ts"),i=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),a=Math.pow(2,32)-1,s=[].push;function o(e){return String.fromCharCode.apply(null,e)}function l(e,t){"data"in e&&(t+=e.start,e=e.data);var r=e[t]<<8|e[t+1];return r<0?65536+r:r}function u(e,t){"data"in e&&(t+=e.start,e=e.data);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return r<0?4294967296+r:r}function c(e,t,r){"data"in e&&(t+=e.start,e=e.data),e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r}function d(e,t){var r,n,i,a=[];if(!t.length)return a;"data"in e?(r=e.data,n=e.start,i=e.end):(n=0,i=(r=e).byteLength);for(var l=n;l<i;){var c=u(r,l),f=c>1?l+c:i;if(o(r.subarray(l+4,l+8))===t[0])if(1===t.length)a.push({data:r,start:l+8,end:f});else{var h=d({data:r,start:l+8,end:f},t.slice(1));h.length&&s.apply(a,h)}l=f}return a}function f(e){var t=d(e,["moov"])[0],r=t?t.end:null,n=d(e,["sidx"]);if(!n||!n[0])return null;var i=[],a=n[0],s=a.data[0],o=0===s?8:16,c=u(a,o);o+=4,o+=0===s?8:16,o+=2;var f=a.end+0,h=l(a,o);o+=2;for(var p=0;p<h;p++){var g=o,m=u(a,g);g+=4;var v=2147483647&m;if(1==(2147483648&m)>>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;var y=u(a,g);g+=4,i.push({referenceSize:v,subsegmentDuration:y,info:{duration:y/c,start:f,end:f+v-1}}),f+=v,o=g+=4}return{earliestPresentationTime:0,timescale:c,version:s,referencesCount:h,references:i,moovEndOffset:r}}function h(e){for(var t=[],r=d(e,["moov","trak"]),n=0;n<r.length;n++){var a=r[n],s=d(a,["tkhd"])[0];if(s){var l=s.data[s.start],c=0===l?12:20,f=u(s,c),h=d(a,["mdia","mdhd"])[0];if(h){var p=u(h,c=0===(l=h.data[h.start])?12:20),g=d(a,["mdia","hdlr"])[0];if(g){var m=o(g.data.subarray(g.start+8,g.start+12)),v={soun:i.ElementaryStreamTypes.AUDIO,vide:i.ElementaryStreamTypes.VIDEO}[m];if(v){var y=d(a,["mdia","minf","stbl","stsd"])[0],b=void 0;y&&(b=o(y.data.subarray(y.start+12,y.start+16))),t[f]={timescale:p,type:v},t[v]={timescale:p,id:f,codec:b}}}}}}return d(e,["moov","mvex","trex"]).forEach((function(e){var r=u(e,4),n=t[r];n&&(n.default={duration:u(e,12),flags:u(e,20)})})),t}function p(e,t){return d(t,["moof","traf"]).reduce((function(t,r){var n=d(r,["tfdt"])[0],i=n.data[n.start],a=d(r,["tfhd"]).reduce((function(t,r){var a=u(r,4),s=e[a];if(s){var o=u(n,4);1===i&&(o*=Math.pow(2,32),o+=u(n,8));var l=o/(s.timescale||9e4);if(isFinite(l)&&(null===t||l<t))return l}return t}),null);return null!==a&&isFinite(a)&&(null===t||a<t)?a:t}),null)||0}function g(e,t){for(var r=0,n=0,a=0,s=d(e,["moof","traf"]),o=0;o<s.length;o++){var l=s[o],c=d(l,["tfhd"])[0],h=t[u(c,4)];if(h){var p=h.default,g=u(c,0)|(null==p?void 0:p.flags),v=null==p?void 0:p.duration;8&g&&(v=u(c,2&g?12:8));for(var y=h.timescale||9e4,b=d(l,["trun"]),E=0;E<b.length;E++)r=v?v*u(b[E],4):m(b[E]),h.type===i.ElementaryStreamTypes.VIDEO?n+=r/y:h.type===i.ElementaryStreamTypes.AUDIO&&(a+=r/y)}}if(0===n&&0===a){var x=f(e);if(null!=x&&x.references)return x.references.reduce((function(e,t){return e+t.info.duration||0}),0)}return n||a}function m(e){var t=u(e,0),r=8;1&t&&(r+=4),4&t&&(r+=4);for(var n=0,i=u(e,4),a=0;a<i;a++)256&t&&(n+=u(e,r),r+=4),512&t&&(r+=4),1024&t&&(r+=4),2048&t&&(r+=4);return n}function v(e,t,r){d(t,["moof","traf"]).forEach((function(t){d(t,["tfhd"]).forEach((function(n){var i=u(n,4),s=e[i];if(s){var o=s.timescale||9e4;d(t,["tfdt"]).forEach((function(e){var t=e.data[e.start],n=u(e,4);if(0===t)c(e,4,n-r*o);else{n*=Math.pow(2,32),n+=u(e,8),n-=r*o,n=Math.max(n,0);var i=Math.floor(n/(a+1)),s=Math.floor(n%(a+1));c(e,4,i),c(e,8,s)}}))}}))}))}function y(e){var t={valid:null,remainder:null},r=d(e,["moof"]);if(!r)return t;if(r.length<2)return t.remainder=e,t;var i=r[r.length-1];return t.valid=Object(n.sliceUint8)(e,0,i.start-8),t.remainder=Object(n.sliceUint8)(e,i.start-8),t}function b(e,t){var r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}},"./src/utils/output-filter.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/utils/output-filter.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}var t=e.prototype;return t.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},t.newCue=function(e,t,r){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[]},e}()},"./src/utils/texttrack-utils.ts":
|
|
|
/*!**************************************!*\
|
|
|
!*** ./src/utils/texttrack-utils.ts ***!
|
|
|
\**************************************/
|
|
|
/*! exports provided: sendAddTrackEvent, addCueToTrack, clearCurrentCues, removeCuesInRange, getCuesInRange */function(e,t,r){"use strict";r.r(t),r.d(t,"sendAddTrackEvent",(function(){return i})),r.d(t,"addCueToTrack",(function(){return a})),r.d(t,"clearCurrentCues",(function(){return s})),r.d(t,"removeCuesInRange",(function(){return o})),r.d(t,"getCuesInRange",(function(){return l}));var n=r(/*! ./logger */"./src/utils/logger.ts");function i(e,t){var r;try{r=new Event("addtrack")}catch(e){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=e,t.dispatchEvent(r)}function a(e,t){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(r){n.logger.debug("[texttrack-utils]: "+r);var i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}"disabled"===r&&(e.mode=r)}function s(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var r=e.cues.length;r--;)e.removeCue(e.cues[r]);"disabled"===t&&(e.mode=t)}function o(e,t,r){var n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var i=l(e.cues,t,r),a=0;a<i.length;a++)e.removeCue(i[a]);"disabled"===n&&(e.mode=n)}function l(e,t,r){var n=[],i=function(e,t){if(t<e[0].startTime)return 0;var r=e.length-1;if(t>e[r].endTime)return-1;for(var n=0,i=r;n<=i;){var a=Math.floor((i+n)/2);if(t<e[a].startTime)i=a-1;else{if(!(t>e[a].startTime&&n<r))return a;n=a+1}}return e[n].startTime-t<t-e[i].startTime?n:i}(e,t);if(i>-1)for(var a=i,s=e.length;a<s;a++){var o=e[a];if(o.startTime>=t&&o.endTime<=r)n.push(o);else if(o.startTime>r)return n}return n}},"./src/utils/time-ranges.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/utils/time-ranges.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),t.default={toString:function(e){for(var t="",r=e.length,n=0;n<r;n++)t+="["+e.start(n).toFixed(3)+","+e.end(n).toFixed(3)+"]";return t}}},"./src/utils/timescale-conversion.ts":
|
|
|
/*!*******************************************!*\
|
|
|
!*** ./src/utils/timescale-conversion.ts ***!
|
|
|
\*******************************************/
|
|
|
/*! exports provided: toTimescaleFromBase, toTimescaleFromScale, toMsFromMpegTsClock, toMpegTsClockFromTimescale */function(e,t,r){"use strict";function n(e,t,r,n){void 0===r&&(r=1),void 0===n&&(n=!1);var i=e*t*r;return n?Math.round(i):i}function i(e,t,r,i){return void 0===r&&(r=1),void 0===i&&(i=!1),n(e,t,1/r,i)}function a(e,t){return void 0===t&&(t=!1),n(e,1e3,1/9e4,t)}function s(e,t){return void 0===t&&(t=1),n(e,9e4,1/t)}r.r(t),r.d(t,"toTimescaleFromBase",(function(){return n})),r.d(t,"toTimescaleFromScale",(function(){return i})),r.d(t,"toMsFromMpegTsClock",(function(){return a})),r.d(t,"toMpegTsClockFromTimescale",(function(){return s}))},"./src/utils/typed-array.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/utils/typed-array.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: sliceUint8 */function(e,t,r){"use strict";function n(e,t,r){return Uint8Array.prototype.slice?e.slice(t,r):new Uint8Array(Array.prototype.slice.call(e,t,r))}r.r(t),r.d(t,"sliceUint8",(function(){return n}))},"./src/utils/vttcue.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/utils/vttcue.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t),t.default=function(){if("undefined"!=typeof self&&self.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function r(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;var r=t.toLowerCase();return!!~e.indexOf(r)&&r}function n(e){return r(t,e)}function i(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i=1;i<arguments.length;i++){var a=arguments[i];for(var s in a)e[s]=a[s]}return e}function a(t,a,s){var o=this,l={enumerable:!0};o.hasBeenReset=!1;var u="",c=!1,d=t,f=a,h=s,p=null,g="",m=!0,v="auto",y="start",b=50,E="middle",x=50,S="middle";Object.defineProperty(o,"id",i({},l,{get:function(){return u},set:function(e){u=""+e}})),Object.defineProperty(o,"pauseOnExit",i({},l,{get:function(){return c},set:function(e){c=!!e}})),Object.defineProperty(o,"startTime",i({},l,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",i({},l,{get:function(){return f},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");f=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",i({},l,{get:function(){return h},set:function(e){h=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",i({},l,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",i({},l,{get:function(){return g},set:function(t){var n=function(t){return r(e,t)}(t);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");g=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",i({},l,{get:function(){return m},set:function(e){m=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",i({},l,{get:function(){return v},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",i({},l,{get:function(){return y},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",i({},l,{get:function(){return b},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",i({},l,{get:function(){return E},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",i({},l,{get:function(){return x},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");x=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",i({},l,{get:function(){return S},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),o.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}()},"./src/utils/vttparser.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/utils/vttparser.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: parseTimeStamp, fixLineBreaks, VTTParser */function(e,t,r){"use strict";r.r(t),r.d(t,"parseTimeStamp",(function(){return a})),r.d(t,"fixLineBreaks",(function(){return d})),r.d(t,"VTTParser",(function(){return f}));var n=r(/*! ./vttcue */"./src/utils/vttcue.ts"),i=function(){function e(){}return e.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},e}();function a(e){function t(e,t,r,n){return 3600*(0|e)+60*(0|t)+(0|r)+parseFloat(n||0)}var r=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?t(r[2],r[3],0,r[4]):t(r[1],r[2],r[3],r[4]):null}var s=function(){function e(){this.values=Object.create(null)}var t=e.prototype;return t.set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,r){for(var n=0;n<r.length;++n)if(t===r[n]){this.set(e,t);break}},t.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},t.percent=function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var r=parseFloat(t);if(r>=0&&r<=100)return this.set(e,r),!0}return!1},e}();function o(e,t,r,n){var i=n?e.split(n):[e];for(var a in i)if("string"==typeof i[a]){var s=i[a].split(r);2===s.length&&t(s[0],s[1])}}var l=new n.default(0,0,""),u="middle"===l.align?"middle":"center";function c(e,t,r){var n=e;function i(){var t=a(e);if(null===t)throw new Error("Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function c(){e=e.replace(/^\s+/,"")}if(c(),t.startTime=i(),c(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),c(),t.endTime=i(),c(),function(e,t){var n=new s;o(e,(function(e,t){var i;switch(e){case"region":for(var a=r.length-1;a>=0;a--)if(r[a].id===t){n.set(e,r[a].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":i=t.split(","),n.integer(e,i[0]),n.percent(e,i[0])&&n.set("snapToLines",!1),n.alt(e,i[0],["auto"]),2===i.length&&n.alt("lineAlign",i[1],["start",u,"end"]);break;case"position":i=t.split(","),n.percent(e,i[0]),2===i.length&&n.alt("positionAlign",i[1],["start",u,"end","line-left","line-right","auto"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start",u,"end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");var i=n.get("line","auto");"auto"===i&&-1===l.line&&(i=-1),t.line=i,t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align",u);var a=n.get("position","auto");"auto"===a&&50===l.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function d(e){return e.replace(/<br(?: \/)?>/gi,"\n")}var f=function(){function e(){this.state="INITIAL",this.buffer="",this.decoder=new i,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var t=e.prototype;return t.parse=function(e){var t=this;function r(){var e=t.buffer,r=0;for(e=d(e);r<e.length&&"\r"!==e[r]&&"\n"!==e[r];)++r;var n=e.substr(0,r);return"\r"===e[r]&&++r,"\n"===e[r]&&++r,t.buffer=e.substr(r),n}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var i="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(i=r()).match(/^()?WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:i=r(),t.state){case"HEADER":/:/.test(i)?o(i,(function(e,t){}),/:/):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new n.default(0,0,""),t.state="CUE",-1===i.indexOf("--\x3e")){t.cue.id=i;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{c(i,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var l=-1!==i.indexOf("--\x3e");if(!i||l&&(s=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=i;continue;case"BADCUE":i||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},t.flush=function(){try{if((this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state||"BADWEBVTT"===this.state)throw new Error("Malformed WebVTT signature.")}catch(e){this.onparsingerror&&this.onparsingerror(e)}return this.onflush&&this.onflush(),this},e}()},"./src/utils/webvtt-parser.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/utils/webvtt-parser.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: generateCueId, parseWebVTT */function(e,t,r){"use strict";r.r(t),r.d(t,"generateCueId",(function(){return d})),r.d(t,"parseWebVTT",(function(){return f}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./vttparser */"./src/utils/vttparser.ts"),a=r(/*! ../demux/id3 */"./src/demux/id3.ts"),s=r(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),o=r(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),l=/\r\n|\n\r|\n|\r/g,u=function(e,t,r){return void 0===r&&(r=0),e.substr(r,t.length)===t},c=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()};function d(e,t,r){return c(e.toString())+c(t.toString())+c(r)}function f(e,t,r,c,f,h,p,g){var m,v=new i.VTTParser,y=Object(a.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(l,"\n").split("\n"),b=[],E=Object(s.toMpegTsClockFromTimescale)(t,r),x="00:00.000",S=0,T=0,k=!0,w=!1;v.oncue=function(e){var t=c[f],r=c.ccOffset,n=(S-E)/9e4;if(null!=t&&t.new&&(void 0!==T?r=c.ccOffset=t.start:function(e,t,r){var n=e[t],i=e[n.prevCC];if(!i||!i.new&&n.new)return e.ccOffset=e.presentationOffset=n.start,void(n.new=!1);for(;null!==(a=i)&&void 0!==a&&a.new;){var a;e.ccOffset+=n.start-i.start,n.new=!1,i=e[(n=i).prevCC]}e.presentationOffset=r}(c,f,n)),n&&(r=n-c.presentationOffset),w){var i=e.endTime-e.startTime,a=Object(o.normalizePts)(9e4*(e.startTime+r-T),9e4*h)/9e4;e.startTime=a,e.endTime=a+i}var s=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(s)),e.id||(e.id=d(e.startTime,e.endTime,s)),e.endTime>0&&b.push(e)},v.onparsingerror=function(e){m=e},v.onflush=function(){m?g(m):p(b)},y.forEach((function(e){if(k){if(u(e,"X-TIMESTAMP-MAP=")){k=!1,w=!0,e.substr(16).split(",").forEach((function(e){u(e,"LOCAL:")?x=e.substr(6):u(e,"MPEGTS:")&&(S=parseInt(e.substr(7)))}));try{T=function(e){var t=parseInt(e.substr(-3)),r=parseInt(e.substr(-6,2)),i=parseInt(e.substr(-9,2)),a=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(n.isFiniteNumber)(t)&&Object(n.isFiniteNumber)(r)&&Object(n.isFiniteNumber)(i)&&Object(n.isFiniteNumber)(a)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*r,t+=6e4*i,t+=36e5*a}(x)/1e3}catch(e){w=!1,m=e}return}""===e&&(k=!1)}v.parse(e+"\n")})),v.flush()}},"./src/utils/xhr-loader.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/utils/xhr-loader.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,r){"use strict";r.r(t);var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=r(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),a=/^age:\s*[\d.]+\s*$/m,s=function(){function e(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e?e.xhrSetup:null,this.stats=new i.LoadStats,this.retryDelay=0}var t=e.prototype;return t.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},t.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))},t.abort=function(){var e;this.abortInternal(),null!==(e=this.callbacks)&&void 0!==e&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},t.load=function(e,t,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e=this.config,t=this.context;if(e){var r=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0;var i=this.xhrSetup;try{if(i)try{i(r,t.url)}catch(e){r.open("GET",t.url,!0),i(r,t.url)}r.readyState||r.open("GET",t.url,!0);var a=this.context.headers;if(a)for(var s in a)r.setRequestHeader(s,a[s])}catch(e){return void this.callbacks.onError({code:r.status,text:e.message},t,r)}t.rangeEnd&&r.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),r.onreadystatechange=this.readystatechange.bind(this),r.onprogress=this.loadprogress.bind(this),r.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),r.send()}},t.readystatechange=function(){var e=this.context,t=this.loader,r=this.stats;if(e&&t){var i=t.readyState,a=this.config;if(!r.aborted&&i>=2)if(self.clearTimeout(this.requestTimeout),0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start)),4===i){t.onreadystatechange=null,t.onprogress=null;var s=t.status;if(s>=200&&s<300){var o,l;if(r.loading.end=Math.max(self.performance.now(),r.loading.first),l="arraybuffer"===e.responseType?(o=t.response).byteLength:(o=t.responseText).length,r.loaded=r.total=l,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(r,e,o,t),!this.callbacks)return;var c={url:t.responseURL,data:o};this.callbacks.onSuccess(c,r,e,t)}else r.retry>=a.maxRetry||s>=400&&s<499?(n.logger.error(s+" while loading "+e.url),this.callbacks.onError({code:s,text:t.statusText},e,t)):(n.logger.warn(s+" while loading "+e.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),r.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},t.loadtimeout=function(){n.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},t.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},t.getCacheAge=function(){var e=null;if(this.loader&&a.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},e}();t.default=s}}).default},e.exports=n())},vHTk:
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./src/components/PreviewAll/index.less?modules ***!
|
|
|
\******************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,r){e.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]); |