|
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[190,5,7,8,10],{"+vTd":
|
|
|
/*!******************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/Topic/index.less?modules ***!
|
|
|
\******************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={flex_box_center:"flex_box_center___37CPQ",flex_space_between:"flex_space_between___1yzV5",flex_box_vertical_center:"flex_box_vertical_center___2QH_C",flex_box_center_end:"flex_box_center_end___22kLi",flex_box_column:"flex_box_column___1Y3On",list:"list___1gpez",row:"row___3uQSh",typeRow:"typeRow___ADZSj",type:"type___2pfNZ",typeName:"typeName___8ZhPv",typeIcon:"typeIcon___1Xniv",unpublished:"unpublished___dTXTI",private:"private___XQiDx",public:"public___iIFou",reviewFlag:"reviewFlag___YP4vk",typeRightAction:"typeRightAction___1PQjp",actionLink:"actionLink___2E5q_",actionIcon:"actionIcon___GCvNK",topicTitle:"topicTitle___3fJds",topicTitleContent:"topicTitleContent___35cf9",judgmentContent:"judgmentContent___SU5rV",programContent:"programContent___3G6-D",otherContent:"otherContent___1JHnX",combinationContent:"combinationContent___6ZXO-",con:"con___1_qCl",otherContentItem:"otherContentItem___18WrV",otehrContentHtml:"otehrContentHtml___LW3nV",difficultyRow:"difficultyRow___3HvT0",updateTimeRow:"updateTimeRow___1dNd0",updateTimeWrap:"updateTimeWrap___2PKks",updateTimeContent:"updateTimeContent___1mNBy",programLanguage:"programLanguage___3CnaJ",updateTimeRowAction:"updateTimeRowAction___1DaMt",bottomAction:"bottomAction___Y-BNC",borderColorBlue:"borderColorBlue___2Xd-0",borderColorRed:"borderColorRed___2zA_q",borderColorFFF:"borderColorFFF___2R5-5",borderColorGray:"borderColorGray___nZnDe",selectIcon:"selectIcon___2byLd",colorGreen:"colorGreen___1iOKR",parseAnswerBorder:"parseAnswerBorder___1LTYn",answer:"answer___2L9lv",answerHtml:"answerHtml___3zrOk",parse:"parse___3d3dm",parseText:"parseText___1C_VL",parseAnswer:"parseAnswer___QMVPC",parseAnswerHtml:"parseAnswerHtml___2TCVz",actionBar:"actionBar___2ItMN",line:"line___-rzSr",know:"know___y8QKK",title:"title___21uOv",tr:"tr___3kTJL",menu:"menu___SYdg7",bottom:"bottom___2dFIa"}},"+z73":
|
|
|
/*!*******************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/Crumbs/index.less?modules ***!
|
|
|
\*******************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={flex_box_center:"flex_box_center___3WSrc",flex_space_between:"flex_space_between___1fpCp",flex_box_vertical_center:"flex_box_vertical_center___3Wy8W",flex_box_center_end:"flex_box_center_end___3YIs2",flex_box_column:"flex_box_column___3CNwR",pWrap:"pWrap___2jVbQ",few:"few___3Eebn"}},"1ZF9":
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./src/assets/images/Authorize.png ***!
|
|
|
\*****************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports=n.p+"static/Authorize.cc9c212f.png"},"6+eU":
|
|
|
/*!************************************************************!*\
|
|
|
!*** ./node_modules/rc-pagination/es/index.js + 4 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/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-pagination/es/locale/zh_CN.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,n){"use strict";n.d(t,"a",(function(){return x}));var i=n("wx14"),r=n("rePB"),a=n("VTBJ"),s=n("1OyB"),o=n("vuIU"),l=n("Ji7U"),c=n("LK+K"),u=n("q1tI"),h=n.n(u),d=n("TSYQ"),f=n.n(d),p=function(e){var t,n="".concat(e.rootPrefixCls,"-item"),i=f()(n,"".concat(n,"-").concat(e.page),(t={},Object(r.a)(t,"".concat(n,"-active"),e.active),Object(r.a)(t,e.className,!!e.className),Object(r.a)(t,"".concat(n,"-disabled"),!e.page),t));return h.a.createElement("li",{title:e.showTitle?e.page:null,className:i,onClick:function(){e.onClick(e.page)},onKeyPress:function(t){e.onKeyPress(t,e.onClick,e.page)},tabIndex:"0"},e.itemRender(e.page,"page",h.a.createElement("a",{rel:"nofollow"},e.page)))},g=13,v=38,m=40,y=function(e){Object(l.a)(n,e);var t=Object(c.a)(n);function n(){var e;Object(s.a)(this,n);for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return(e=t.call.apply(t,[this].concat(r))).state={goInputText:""},e.buildOptionText=function(t){return"".concat(t," ").concat(e.props.locale.items_per_page)},e.changeSize=function(t){e.props.changeSize(Number(t))},e.handleChange=function(t){e.setState({goInputText:t.target.value})},e.handleBlur=function(t){var n=e.props,i=n.goButton,r=n.quickGo,a=n.rootPrefixCls,s=e.state.goInputText;i||""===s||t.relatedTarget&&(t.relatedTarget.className.indexOf("".concat(a,"-prev"))>=0||t.relatedTarget.className.indexOf("".concat(a,"-next"))>=0)||(e.setState({goInputText:""}),r(e.getValidValue()))},e.go=function(t){""!==e.state.goInputText&&(t.keyCode!==g&&"click"!==t.type||(e.setState({goInputText:""}),e.props.quickGo(e.getValidValue())))},e}return Object(o.a)(n,[{key:"getValidValue",value:function(){var e=this.state,t=e.goInputText,n=e.current;return!t||isNaN(t)?n:Number(t)}},{key:"getPageSizeOptions",value:function(){var e=this.props,t=e.pageSize,n=e.pageSizeOptions;return n.some((function(e){return e.toString()===t.toString()}))?n:n.concat([t.toString()]).sort((function(e,t){return(isNaN(Number(e))?0:Number(e))-(isNaN(Number(t))?0:Number(t))}))}},{key:"render",value:function(){var e=this,t=this.props,n=t.pageSize,i=t.locale,r=t.rootPrefixCls,a=t.changeSize,s=t.quickGo,o=t.goButton,l=t.selectComponentClass,c=t.buildOptionText,u=t.selectPrefixCls,d=t.disabled,f=this.state.goInputText,p="".concat(r,"-options"),g=l,v=null,m=null,y=null;if(!a&&!s)return null;var b=this.getPageSizeOptions();if(a&&g){var E=b.map((function(t,n){return h.a.createElement(g.Option,{key:n,value:t.toString()},(c||e.buildOptionText)(t))}));v=h.a.createElement(g,{disabled:d,prefixCls:u,showSearch:!1,className:"".concat(p,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(n||b[0]).toString(),onChange:this.changeSize,getPopupContainer:function(e){return e.parentNode}},E)}return s&&(o&&(y="boolean"==typeof o?h.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:d,className:"".concat(p,"-quick-jumper-button")},i.jump_to_confirm):h.a.createElement("span",{onClick:this.go,onKeyUp:this.go},o)),m=h.a.createElement("div",{className:"".concat(p,"-quick-jumper")},i.jump_to,h.a.createElement("input",{disabled:d,type:"text",value:f,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),i.page,y)),h.a.createElement("li",{className:"".concat(p)},v,m)}}]),n}(h.a.Component);y.defaultProps={pageSizeOptions:["10","20","50","100"]};var b=y,E=n("N2Kk");function k(){}function C(e,t,n){var i=void 0===e?t.pageSize:e;return Math.floor((n.total-1)/i)+1}var S=function(e){Object(l.a)(n,e);var t=Object(c.a)(n);function n(e){var i;Object(s.a)(this,n),(i=t.call(this,e)).getJumpPrevPage=function(){return Math.max(1,i.state.current-(i.props.showLessItems?3:5))},i.getJumpNextPage=function(){return Math.min(C(void 0,i.state,i.props),i.state.current+(i.props.showLessItems?3:5))},i.getItemIcon=function(e,t){var n=i.props.prefixCls,r=e||h.a.createElement("button",{type:"button","aria-label":t,className:"".concat(n,"-item-link")});return"function"==typeof e&&(r=h.a.createElement(e,Object(a.a)({},i.props))),r},i.savePaginationNode=function(e){i.paginationNode=e},i.isValid=function(e){return"number"==typeof(t=e)&&isFinite(t)&&Math.floor(t)===t&&e!==i.state.current;var t},i.shouldDisplayQuickJumper=function(){var e=i.props,t=e.showQuickJumper,n=e.pageSize;return!(e.total<=n)&&t},i.handleKeyDown=function(e){e.keyCode!==v&&e.keyCode!==m||e.preventDefault()},i.handleKeyUp=function(e){var t=i.getValidValue(e);t!==i.state.currentInputValue&&i.setState({currentInputValue:t}),e.keyCode===g?i.handleChange(t):e.keyCode===v?i.handleChange(t-1):e.keyCode===m&&i.handleChange(t+1)},i.changePageSize=function(e){var t=i.state.current,n=C(e,i.state,i.props);t=t>n?n:t,0===n&&(t=i.state.current),"number"==typeof e&&("pageSize"in i.props||i.setState({pageSize:e}),"current"in i.props||i.setState({current:t,currentInputValue:t})),i.props.onShowSizeChange(t,e),"onChange"in i.props&&i.props.onChange&&i.props.onChange(t,e)},i.handleChange=function(e){var t=i.props.disabled,n=e;if(i.isValid(n)&&!t){var r=C(void 0,i.state,i.props);n>r?n=r:n<1&&(n=1),"current"in i.props||i.setState({current:n,currentInputValue:n});var a=i.state.pageSize;return i.props.onChange(n,a),n}return i.state.current},i.prev=function(){i.hasPrev()&&i.handleChange(i.state.current-1)},i.next=function(){i.hasNext()&&i.handleChange(i.state.current+1)},i.jumpPrev=function(){i.handleChange(i.getJumpPrevPage())},i.jumpNext=function(){i.handleChange(i.getJumpNextPage())},i.hasPrev=function(){return i.state.current>1},i.hasNext=function(){return i.state.current<C(void 0,i.state,i.props)},i.runIfEnter=function(e,t){if("Enter"===e.key||13===e.charCode){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];t.apply(void 0,i)}},i.runIfEnterPrev=function(e){i.runIfEnter(e,i.prev)},i.runIfEnterNext=function(e){i.runIfEnter(e,i.next)},i.runIfEnterJumpPrev=function(e){i.runIfEnter(e,i.jumpPrev)},i.runIfEnterJumpNext=function(e){i.runIfEnter(e,i.jumpNext)},i.handleGoTO=function(e){e.keyCode!==g&&"click"!==e.type||i.handleChange(i.state.currentInputValue)};var r=e.onChange!==k;"current"in e&&!r&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var o=e.defaultCurrent;"current"in e&&(o=e.current);var l=e.defaultPageSize;return"pageSize"in e&&(l=e.pageSize),o=Math.min(o,C(l,void 0,e)),i.state={current:o,currentInputValue:o,pageSize:l},i}return Object(o.a)(n,[{key:"componentDidUpdate",value:function(e,t){var n=this.props.prefixCls;if(t.current!==this.state.current&&this.paginationNode){var i=this.paginationNode.querySelector(".".concat(n,"-item-").concat(t.current));i&&document.activeElement===i&&i.blur()}}},{key:"getValidValue",value:function(e){var t=e.target.value,n=C(void 0,this.state,this.props),i=this.state.currentInputValue;return""===t?t:isNaN(Number(t))?i:t>=n?n:Number(t)}},{key:"getShowSizeChanger",value:function(){var e=this.props,t=e.showSizeChanger,n=e.total,i=e.totalBoundaryShowSizeChanger;return void 0!==t?t:n>i}},{key:"renderPrev",value:function(e){var t=this.props,n=t.prevIcon,i=(0,t.itemRender)(e,"prev",this.getItemIcon(n,"prev page")),r=!this.hasPrev();return Object(u.isValidElement)(i)?Object(u.cloneElement)(i,{disabled:r}):i}},{key:"renderNext",value:function(e){var t=this.props,n=t.nextIcon,i=(0,t.itemRender)(e,"next",this.getItemIcon(n,"next page")),r=!this.hasNext();return Object(u.isValidElement)(i)?Object(u.cloneElement)(i,{disabled:r}):i}},{key:"render",value:function(){var e=this,t=this.props,n=t.prefixCls,a=t.className,s=t.style,o=t.disabled,l=t.hideOnSinglePage,c=t.total,d=t.locale,g=t.showQuickJumper,v=t.showLessItems,m=t.showTitle,y=t.showTotal,E=t.simple,k=t.itemRender,S=t.showPrevNextJumpers,x=t.jumpPrevIcon,w=t.jumpNextIcon,T=t.selectComponentClass,_=t.selectPrefixCls,O=t.pageSizeOptions,A=this.state,L=A.current,D=A.pageSize,R=A.currentInputValue;if(!0===l&&c<=D)return null;var I=C(void 0,this.state,this.props),N=[],P=null,M=null,j=null,B=null,F=null,U=g&&g.goButton,G=v?1:2,H=L-1>0?L-1:0,K=L+1<I?L+1:I,z=Object.keys(this.props).reduce((function(t,n){return"data-"!==n.substr(0,5)&&"aria-"!==n.substr(0,5)&&"role"!==n||(t[n]=e.props[n]),t}),{});if(E)return U&&(F="boolean"==typeof U?h.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},d.jump_to_confirm):h.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},U),F=h.a.createElement("li",{title:m?"".concat(d.jump_to).concat(L,"/").concat(I):null,className:"".concat(n,"-simple-pager")},F)),h.a.createElement("ul",Object(i.a)({className:f()(n,"".concat(n,"-simple"),Object(r.a)({},"".concat(n,"-disabled"),o),a),style:s,ref:this.savePaginationNode},z),h.a.createElement("li",{title:m?d.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:f()("".concat(n,"-prev"),Object(r.a)({},"".concat(n,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(H)),h.a.createElement("li",{title:m?"".concat(L,"/").concat(I):null,className:"".concat(n,"-simple-pager")},h.a.createElement("input",{type:"text",value:R,disabled:o,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),h.a.createElement("span",{className:"".concat(n,"-slash")},"/"),I),h.a.createElement("li",{title:m?d.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:f()("".concat(n,"-next"),Object(r.a)({},"".concat(n,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(K)),F);if(I<=3+2*G){var V={locale:d,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:m,itemRender:k};I||N.push(h.a.createElement(p,Object(i.a)({},V,{key:"noPager",page:I,className:"".concat(n,"-disabled")})));for(var W=1;W<=I;W+=1){var Y=L===W;N.push(h.a.createElement(p,Object(i.a)({},V,{key:W,page:W,active:Y})))}}else{var q=v?d.prev_3:d.prev_5,X=v?d.next_3:d.next_5;S&&(P=h.a.createElement("li",{title:m?q:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:f()("".concat(n,"-jump-prev"),Object(r.a)({},"".concat(n,"-jump-prev-custom-icon"),!!x))},k(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(x,"prev page"))),M=h.a.createElement("li",{title:m?X:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:f()("".concat(n,"-jump-next"),Object(r.a)({},"".concat(n,"-jump-next-custom-icon"),!!w))},k(this.getJumpNextPage(),"jump-next",this.getItemIcon(w,"next page")))),B=h.a.createElement(p,{locale:d,last:!0,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:I,page:I,active:!1,showTitle:m,itemRender:k}),j=h.a.createElement(p,{locale:d,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:m,itemRender:k});var Q=Math.max(1,L-G),J=Math.min(L+G,I);L-1<=G&&(J=1+2*G),I-L<=G&&(Q=I-2*G);for(var Z=Q;Z<=J;Z+=1){var $=L===Z;N.push(h.a.createElement(p,{locale:d,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Z,page:Z,active:$,showTitle:m,itemRender:k}))}L-1>=2*G&&3!==L&&(N[0]=Object(u.cloneElement)(N[0],{className:"".concat(n,"-item-after-jump-prev")}),N.unshift(P)),I-L>=2*G&&L!==I-2&&(N[N.length-1]=Object(u.cloneElement)(N[N.length-1],{className:"".concat(n,"-item-before-jump-next")}),N.push(M)),1!==Q&&N.unshift(j),J!==I&&N.push(B)}var ee=null;y&&(ee=h.a.createElement("li",{className:"".concat(n,"-total-text")},y(c,[0===c?0:(L-1)*D+1,L*D>c?c:L*D])));var te=!this.hasPrev()||!I,ne=!this.hasNext()||!I;return h.a.createElement("ul",Object(i.a)({className:f()(n,a,Object(r.a)({},"".concat(n,"-disabled"),o)),style:s,unselectable:"unselectable",ref:this.savePaginationNode},z),ee,h.a.createElement("li",{title:m?d.prev_page:null,onClick:this.prev,tabIndex:te?null:0,onKeyPress:this.runIfEnterPrev,className:f()("".concat(n,"-prev"),Object(r.a)({},"".concat(n,"-disabled"),te)),"aria-disabled":te},this.renderPrev(H)),N,h.a.createElement("li",{title:m?d.next_page:null,onClick:this.next,tabIndex:ne?null:0,onKeyPress:this.runIfEnterNext,className:f()("".concat(n,"-next"),Object(r.a)({},"".concat(n,"-disabled"),ne)),"aria-disabled":ne},this.renderNext(K)),h.a.createElement(b,{disabled:o,locale:d,rootPrefixCls:n,selectComponentClass:T,selectPrefixCls:_,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:L,pageSize:D,pageSizeOptions:O,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:U}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n={};if("current"in e&&(n.current=e.current,e.current!==t.current&&(n.currentInputValue=n.current)),"pageSize"in e&&e.pageSize!==t.pageSize){var i=t.current,r=C(e.pageSize,t,e);i=i>r?r:i,"current"in e||(n.current=i,n.currentInputValue=i),n.pageSize=e.pageSize}return n}}]),n}(h.a.Component);S.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:k,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:k,locale:E.a,style:{},itemRender:function(e,t,n){return n},totalBoundaryShowSizeChanger:50};var x=S},"815F":
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./node_modules/rc-tree/es/utils/treeUtil.js ***!
|
|
|
\***************************************************/
|
|
|
/*! exports provided: getKey, warningWithoutKey, convertTreeToData, flattenTreeData, traverseDataNodes, convertDataToEntities, getTreeNodeProps, convertNodePropsToEventData */
|
|
|
/*! exports used: convertDataToEntities, convertNodePropsToEventData, convertTreeToData, flattenTreeData, getKey, getTreeNodeProps */function(e,t,n){"use strict";n.d(t,"e",(function(){return c})),n.d(t,"c",(function(){return u})),n.d(t,"d",(function(){return h})),n.d(t,"a",(function(){return f})),n.d(t,"f",(function(){return p})),n.d(t,"b",(function(){return g}));var i=n(/*! @babel/runtime/helpers/esm/toConsumableArray */"KQm4"),r=n(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),a=n(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),s=n(/*! rc-util/es/Children/toArray */"Zm9Q"),o=n(/*! rc-util/es/warning */"Kwbf"),l=n(/*! ../util */"OZM5");function c(e,t){return null!=e?e:t}function u(e){return function e(t){return Object(s.a)(t).map((function(t){if(!Object(l.i)(t))return Object(o.a)(!t,"Tree/TreeNode can only accept TreeNode as children."),null;var n=t.key,i=t.props,s=i.children,c=Object(a.a)(i,["children"]),u=Object(r.a)({key:n},c),h=e(s);return h.length&&(u.children=h),u})).filter((function(e){return e}))}(e)}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Set(!0===t?[]:t),a=[];function s(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.map((function(u,h){var d=Object(l.h)(o?o.pos:"0",h),f=c(u.key,d),p=Object(r.a)(Object(r.a)({},u),{},{parent:o,pos:d,children:null,data:u,isStart:[].concat(Object(i.a)(o?o.isStart:[]),[0===h]),isEnd:[].concat(Object(i.a)(o?o.isEnd:[]),[h===e.length-1])});return a.push(p),!0===t||n.has(f)?p.children=s(u.children||[],p):p.children=[],p}))}return s(e),a}function d(e,t,n){var i;n?"string"==typeof n?i=function(e){return e[n]}:"function"==typeof n&&(i=function(e){return n(e)}):i=function(e,t){return c(e.key,t)},function n(r,a,s){var o=r?r.children:e,c=r?Object(l.h)(s.pos,a):"0";if(r){var u=i(r,c),h={node:r,index:a,pos:c,key:u,parentPos:s.node?s.pos:null,level:s.level+1};t(h)}o&&o.forEach((function(e,t){n(e,t,{node:r,pos:c,level:s?s.level+1:-1})}))}(null)}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.initWrapper,i=t.processEntity,r=t.onProcessFinished,a=arguments.length>2?arguments[2]:void 0,s={},o={},l={posEntities:s,keyEntities:o};return n&&(l=n(l)||l),d(e,(function(e){var t=e.node,n=e.index,r=e.pos,a=e.key,u=e.parentPos,h={node:t,index:n,key:a,pos:r,level:e.level},d=c(a,r);s[r]=h,o[d]=h,h.parent=s[u],h.parent&&(h.parent.children=h.parent.children||[],h.parent.children.push(h)),i&&i(h,l)}),a),r&&r(l),l}function p(e,t){var n=t.expandedKeys,i=t.selectedKeys,r=t.loadedKeys,a=t.loadingKeys,s=t.checkedKeys,o=t.halfCheckedKeys,l=t.dragOverNodeKey,c=t.dropPosition,u=t.keyEntities[e];return{eventKey:e,expanded:-1!==n.indexOf(e),selected:-1!==i.indexOf(e),loaded:-1!==r.indexOf(e),loading:-1!==a.indexOf(e),checked:-1!==s.indexOf(e),halfChecked:-1!==o.indexOf(e),pos:String(u?u.pos:""),dragOver:l===e&&0===c,dragOverGapTop:l===e&&-1===c,dragOverGapBottom:l===e&&1===c}}function g(e){var t=e.data,n=e.expanded,i=e.selected,a=e.checked,s=e.loaded,l=e.loading,c=e.halfChecked,u=e.dragOver,h=e.dragOverGapTop,d=e.dragOverGapBottom,f=e.pos,p=e.active,g=Object(r.a)(Object(r.a)({},t),{},{expanded:n,selected:i,checked:a,loaded:s,loading:l,halfChecked:c,dragOver:u,dragOverGapTop:h,dragOverGapBottom:d,pos:f,active:p});return"props"in g||Object.defineProperty(g,"props",{get:function(){return Object(o.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),e}}),g}},"8hTe":
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./src/components/RenderHtml/index.less?modules ***!
|
|
|
\******************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={button:"button___1wy9m"}},"9Bee":
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./src/components/RenderHtml/index.tsx + 3 modules ***!
|
|
|
\*********************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */
|
|
|
/*! 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/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 ./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/components/RenderHtml/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/PreviewAll/index.tsx */
|
|
|
/*! 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/space/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/space/style/index.js */
|
|
|
/*! 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,n){"use strict";n("DYRE");var i=n("zeV3"),r=(n("+L6B"),n("2/Rp")),a=n("k1fw"),s=n("9og8"),o=n("tJVT"),l=n("WmNS"),c=n.n(l),u=n("q1tI"),h=n.n(u),d=(n("vg9a"),n("DlQD")),f=n.n(d),p=n("rUJ1");var g=[],v=["<ul>"],m=new f.a.Renderer,y=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function b(){g.length=0,v=["<ul>"]}var E={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function k(){return function e(t,n,i,r){if(n>=t.length||t[n].level<=i)return n;var a=t[n];r.push("<li><a href='#"+a.anchor+"'>"+a.text+"</a>");var s=[];return n=e(t,++n,a.level,s),s.length>0&&(r.push("<ul>"),s.forEach((function(e){r.push(e)})),r.push("</ul>")),r.push("</li>"),n=e(t,n,i,r)}(g,0,0,v),v.push("</ul>"),v.join("")}var C={heading:function(e){var t=y.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 n=t[0],i=function(e,t){var n=e.match(/^(\s+)(?:```)/);if(null===n)return t;var i=n[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:Object(o.a)(t,1)[0].length>=i.length?e.slice(i.length):e})).join("\n")}(n,t[3]||""),r=t[2]?t[2].trim():t[2];if(["latex","katex","math"].indexOf(r)>=0){var a=w(),s=i;i=a,T[a]={type:"block",expression:s}}return{type:"code",raw:n,lang:r,text:i}}}},S=/(?:\${2})([^\n`]+?)(?:\${2})/gi,x=0,w=function(){return"__special_katext_id_".concat(x++,"__")},T={};function _(){x=0,T={}}function O(e){return e=e.replace(S,(function(e,t){var n=w();return T[n]={type:"inline",expression:t},n}))}var A=m.listitem;m.listitem=function(e){return A(O(e))};var L=m.paragraph;m.paragraph=function(e){return L(O(e))};var D=m.tablecell;m.tablecell=function(e,t){return D(O(e),t)},m.code=function(e,t,n){var i=(t||"").match(/\S*/)[0];return i?["latex","katex","math"].indexOf(i)>=0?"<p class='editormd-tex'>".concat(e,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(t,'">').concat(n?e:Object(p.escape)(e,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(n?e:Object(p.escape)(e,!0))+"</code></pre>"},m.heading=function(e,t,n){var i=this.options.headerPrefix+n.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return g.push({anchor:i,level:t,text:e}),"<h"+t+' id="'+i+'">'+e+"</h"+t+">"},f.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),f.a.use({tokenizer:C,renderer:m});var R=f.a,I=(n("SJMd"),n("ulZh")),N=n.n(I),P=n("m3rI"),M=n("Oy/b"),j=n("p5ED"),B=n("ErOA"),F=function(e,t){return(F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function U(e,t){function n(){this.constructor=e}F(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function G(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}function H(e,t){var n,i,r,a,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}}function K(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var a=arguments[t],s=0,o=a.length;s<o;s++,r++)i[r]=a[s];return i}var z=function(){function e(){}return e.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},e.setAttributes=function(e,t){for(var n=0,i=t;n<i.length;n++){var r=i[n],a=r[0],s=r[1];e.setAttribute(a,s)}},e.createRect=function(t,n,i){var r=document.createElementNS("http://www.w3.org/2000/svg","rect");return r.setAttribute("width",t.toString()),r.setAttribute("height",n.toString()),i&&e.setAttributes(r,i),r},e.createLine=function(t,n,i,r,a){var s=document.createElementNS("http://www.w3.org/2000/svg","line");return s.setAttribute("x1",t.toString()),s.setAttribute("y1",n.toString()),s.setAttribute("x2",i.toString()),s.setAttribute("y2",r.toString()),a&&e.setAttributes(s,a),s},e.createPolygon=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg","polygon");return i.setAttribute("points",t),n&&e.setAttributes(i,n),i},e.createCircle=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg","circle");return i.setAttribute("cx",(t/2).toString()),i.setAttribute("cy",(t/2).toString()),i.setAttribute("r",t.toString()),n&&e.setAttributes(i,n),i},e.createEllipse=function(t,n,i){var r=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return r.setAttribute("cx",(t/2).toString()),r.setAttribute("cy",(n/2).toString()),r.setAttribute("rx",(t/2).toString()),r.setAttribute("ry",(n/2).toString()),i&&e.setAttributes(r,i),r},e.createGroup=function(t){var n=document.createElementNS("http://www.w3.org/2000/svg","g");return t&&e.setAttributes(n,t),n},e.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},e.createMarker=function(t,n,i,r,a,s,o){var l=document.createElementNS("http://www.w3.org/2000/svg","marker");return e.setAttributes(l,[["id",t],["orient",n],["markerWidth",i.toString()],["markerHeight",r.toString()],["refX",a.toString()],["refY",s.toString()]]),l.appendChild(o),l},e.createText=function(t){var n=document.createElementNS("http://www.w3.org/2000/svg","text");return n.setAttribute("x","0"),n.setAttribute("y","0"),t&&e.setAttributes(n,t),n},e.createTSpan=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg","tspan");return i.textContent=t,n&&e.setAttributes(i,n),i},e.createImage=function(t){var n=document.createElementNS("http://www.w3.org/2000/svg","image");return t&&e.setAttributes(n,t),n},e.createPoint=function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return n.x=e,n.y=t,n},e.createPath=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",t),n&&e.setAttributes(i,n),i},e}(),V=function(){function e(){}return e.addKey=function(t){e.key=t},Object.defineProperty(e,"isLicensed",{get:function(){return!!e.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(e.key)},enumerable:!1,configurable:!0}),e}(),W=function(){function e(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return e.prototype.rasterize=function(e,t,n){var i=this;return new Promise((function(r){var a=void 0!==n?n:document.createElement("canvas");null===e&&(i.markersOnly=!0,i.naturalSize=!1);var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",t.width.baseVal.valueAsString),s.setAttribute("height",t.height.baseVal.valueAsString),s.setAttribute("viewBox","0 0 "+t.viewBox.baseVal.width.toString()+" "+t.viewBox.baseVal.height.toString()),s.innerHTML=t.innerHTML,!0===i.naturalSize?(s.width.baseVal.value=e.naturalWidth,s.height.baseVal.value=e.naturalHeight):void 0!==i.width&&void 0!==i.height&&(s.width.baseVal.value=i.width,s.height.baseVal.value=i.height),a.width=s.width.baseVal.value,a.height=s.height.baseVal.value;var o=s.outerHTML,l=a.getContext("2d");!0!==i.markersOnly&&l.drawImage(e,0,0,a.width,a.height);var c=window.URL,u=new Image(a.width,a.height);u.setAttribute("crossOrigin","anonymous");var h=new Blob([o],{type:"image/svg+xml"}),d=c.createObjectURL(h);u.onload=function(){l.drawImage(u,0,0),c.revokeObjectURL(d);var e=a.toDataURL(i.imageType,i.imageQuality);r(e)},u.src=d}))},e}(),Y=function(){},q=function(){function e(e){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+e+"_"}return Object.defineProperty(e.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),e.prototype.addClass=function(e){return void 0===this.styleSheet&&this.addStyleSheet(),e.name=""+this.classNamePrefix+e.localName,this.classes.push(e),this.styleSheet.sheet.insertRule("."+e.name+" {"+e.style+"}",this.styleSheet.sheet.cssRules.length),e},e.prototype.addRule=function(e){void 0===this.styleSheet&&this.addStyleSheet(),this.rules.push(e),this.styleSheet.sheet.insertRule(e.selector+" {"+e.style+"}",this.styleSheet.sheet.cssRules.length)},e.prototype.addStyleSheet=function(){var e;this.styleSheet=document.createElement("style"),(null!==(e=this.styleSheetRoot)&&void 0!==e?e:document.head).appendChild(this.styleSheet),this.addRule(new X("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new X("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames","\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n ")),this.addRule(new X("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames","\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n ")),this.addClass(new Q("fade_in","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_in_animation_frames;\n ")),this.addClass(new Q("fade_out","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_out_animation_frames;\n "))},e.prototype.removeStyleSheet=function(){var e;this.styleSheet&&((null!==(e=this.styleSheetRoot)&&void 0!==e?e:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},e}(),X=function(e,t){this.selector=e,this.style=t},Q=function(e,t){this.localName=e,this.style=t},J=function(){function e(e,t,n,i,r){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=e,this.displayMode=t,this.markerItems=n,this.uiStyleSettings=i,this.styles=r,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return e.prototype.show=function(e){var t=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=e,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var n=document.createElement("div");n.className=this.toolbarBlockStyleClass.name,n.style.whiteSpace="nowrap",this.uiContainer.appendChild(n),this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(n,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach((function(e){var n=document.createElement("div");n.className=""+t.toolbarButtonStyleClass.name,n.setAttribute("data-type-name",e.typeName),n.innerHTML=e.icon,n.addEventListener("click",(function(){t.markerToolbarButtonClicked(n,e)})),t.buttons.push(n),t.markerButtons.push(n)})),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var i=document.createElement("div");i.className=this.toolbarBlockStyleClass.name,i.style.whiteSpace="nowrap",i.style.display=!1!==this.uiStyleSettings.resultButtonBlockVisible?"":"none",this.uiContainer.appendChild(i),this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(i,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},e.prototype.addButtonClickListener=function(e){this.buttonClickListeners.push(e)},e.prototype.removeButtonClickListener=function(e){this.buttonClickListeners.indexOf(e)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(e),1)},e.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},e.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var e=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var t=0;t<this.markerButtons.length;t++)t<e||t===e&&this.markerButtons.length-1===e?this.markerButtonBlock.appendChild(this.markerButtons[t]):(t===e&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[t]))}},e.prototype.overflowButtonClicked=function(){"none"!==this.markerButtonOverflowBlock.style.display?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},e.prototype.resetButtonStyles=function(){var e=this;this.buttons.forEach((function(t){t.className=t.className.replace(e.uiStyleSettings.toolbarButtonStyleColorsClassName?e.uiStyleSettings.toolbarButtonStyleColorsClassName:e.toolbarButtonStyleColorsClass.name,"").trim(),t.className=t.className.replace(e.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?e.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:e.toolbarActiveButtonStyleColorsClass.name,"").trim(),t.className+=" "+(e.uiStyleSettings.toolbarButtonStyleColorsClassName?e.uiStyleSettings.toolbarButtonStyleColorsClassName:e.toolbarButtonStyleColorsClass.name)}))},e.prototype.addActionButton=function(e,t,n){var i=this,r=document.createElement("div");switch(r.className=""+this.toolbarButtonStyleClass.name,r.innerHTML=t,r.setAttribute("data-action",n),r.addEventListener("click",(function(){i.actionToolbarButtonClicked(r,n)})),n){case"select":r.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":r.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":r.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":r.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":r.style.fill=this.uiStyleSettings.closeButtonColor}e.appendChild(r),this.buttons.push(r)},e.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Q("toolbar","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between; \n height: "+this.uiStyleSettings.toolbarHeight+"px;\n box-sizing: content-box;\n "+("inline"===this.displayMode?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolbarStyleColorsClass=this.styles.addClass(new Q("toolbar_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n box-shadow: 0px 3px rgba(33, 33, 33, 0.1);\n ")),this.toolbarBlockStyleClass=this.styles.addClass(new Q("toolbar-block","\n display: inline-block;\n box-sizing: content-box;\n ")),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Q("toolbar-overflow-block","\n position: absolute;\n top: "+this.uiStyleSettings.toolbarHeight+"px;\n max-width: "+2*this.uiStyleSettings.toolbarHeight+"px;\n z-index: 10;\n box-sizing: content-box;\n ")),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new Q("toolbar-overflow-block_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n "));var e=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Q("toolbar_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*e)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n box-sizing: content-box;\n ")),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Q("toolbar_button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Q("toolbar_active_button","\n fill: "+this.uiStyleSettings.toolbarColor+";\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new X("."+this.toolbarButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n ")),this.styles.addRule(new X("."+this.toolbarButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n "))},e.prototype.markerToolbarButtonClicked=function(e,t){this.setActiveButton(e),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(e){return e("marker",t)})),this.markerButtonOverflowBlock.style.display="none"},e.prototype.actionToolbarButtonClicked=function(e,t){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(e){return e("action",t)})),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},e.prototype.setActiveButton=function(e){this.resetButtonStyles(),e.className=e.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),e.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},e.prototype.setActiveMarkerButton=function(e){var t=this.markerButtons.find((function(t){return t.getAttribute("data-type-name")===e}));t&&this.setActiveButton(t)},e.prototype.setCurrentMarker=function(e){var t=this;this.currentMarker=e,this.buttons.filter((function(e){return/delete|notes/.test(e.getAttribute("data-action"))})).forEach((function(e){void 0===t.currentMarker?(e.style.fillOpacity="0.4",e.style.pointerEvents="none"):(e.style.fillOpacity="1",e.style.pointerEvents="all")}))},e}(),Z=function(){function e(e,t,n,i){this.panels=[],this.panelButtons=[],this.markerjsContainer=e,this.displayMode=t,this.uiStyleSettings=n,this.styles=i,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return e.prototype.addStyles=function(){var e;this.toolboxStyleClass=this.styles.addClass(new Q("toolbox","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n font-family: sans-serif;\n "+("popup"===this.displayMode?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+"\n box-sizing: content-box;\n "+("popup"===this.displayMode?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+"\n "+("inline"===this.displayMode?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolboxStyleColorsClass=this.styles.addClass(new Q("toolbox_colors","\n color: "+this.uiStyleSettings.toolboxColor+";\n "));var t=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Q("toolbox-button-row","\n display: flex;\n cursor: default;\n box-sizing: content-box;\n ")),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Q("toolbox-button-row_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n ")),this.toolboxPanelRowStyleClass=this.styles.addClass(new Q("toolbox-panel-row","\n display: flex;\n "+("inline"===this.displayMode?"position: absolute;":"")+"\n "+("inline"===this.displayMode?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+"\n cursor: default;\n height: "+1.5*this.uiStyleSettings.toolbarHeight+"px;\n "+("inline"===this.displayMode?"width: 100%;":"")+"\n box-sizing: content-box;\n ")),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new Q("toolbox-panel-row_colors","\n background-color: "+(null!==(e=this.uiStyleSettings.toolboxBackgroundColor)&&void 0!==e?e:this.uiStyleSettings.toolbarBackgroundHoverColor)+";\n ")),this.toolboxButtonStyleClass=this.styles.addClass(new Q("toolbox_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n box-sizing: content-box;\n ")),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Q("toolbox-button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Q("toolbox-active-button_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+";\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.styles.addRule(new X("."+this.toolboxButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new X("."+this.toolboxButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n "))},e.prototype.show=function(e){var t;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=e,this.uiContainer.className=this.toolboxStyleClass.name+" "+(null!==(t=this.uiStyleSettings.toolboxStyleColorsClassName)&&void 0!==t?t:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},e.prototype.setPanelButtons=function(e){var t,n,i=this;this.panels=e,void 0!==this.uiContainer&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+(null!==(t=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)&&void 0!==t?t:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+(null!==(n=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)&&void 0!==n?n:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach((function(e){var t;e.uiStyleSettings=i.uiStyleSettings;var n=document.createElement("div");n.className=i.toolboxButtonStyleClass.name+" "+(null!==(t=i.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==t?t:i.toolboxButtonStyleColorsClass.name),n.innerHTML=e.icon,n.title=e.title,n.addEventListener("click",(function(){i.panelButtonClick(e)})),i.panelButtons.push(n),i.buttonRow.appendChild(n)})),"inline"===this.displayMode?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},e.prototype.panelButtonClick=function(e){var t=this,n=-1;if(e!==this.activePanel){n=this.panels.indexOf(e),this.panelRow.innerHTML="";var i=e.getUi();i.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(i),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=e}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout((function(){"inline"===t.displayMode?t.panelRow.style.display="none":t.panelRow.style.visibility="hidden"}),200);this.panelButtons.forEach((function(e,i){var r,a;e.className=t.toolboxButtonStyleClass.name+" "+(i===n?""+(null!==(r=t.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)&&void 0!==r?r:t.toolboxActiveButtonStyleColorsClass.name):""+(null!==(a=t.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==a?a:t.toolboxButtonStyleColorsClass.name))}))},e}(),$=function(e,t){this.title=e,this.icon=t},ee=function(e){function t(t,n,i,r){var a=e.call(this,t,r||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return a.colors=[],a.addTransparent=!1,a.colorBoxes=[],a.colors=n,a.currentColor=i,a.setCurrentColor=a.setCurrentColor.bind(a),a.getColorBox=a.getColorBox.bind(a),a}return U(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.overflow="hidden",t.style.whiteSpace="nowrap",this.colors.forEach((function(n){var i=e.getColorBox(n);t.appendChild(i),e.colorBoxes.push(i)})),t},t.prototype.getColorBox=function(e){var t=this,n=this.uiStyleSettings.toolbarHeight/4,i=this.uiStyleSettings.toolbarHeight-n,r=document.createElement("div");r.style.display="inline-block",r.style.boxSizing="content-box",r.style.width=i-2+"px",r.style.height=i-2+"px",r.style.padding="1px",r.style.marginRight="2px",r.style.marginBottom="2px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderRadius=(i+2)/2+"px",r.style.borderColor=e===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentColor(e,r)}));var a=document.createElement("div");return a.style.display="inline-block",a.style.width=i-2+"px",a.style.height=i-2+"px",a.style.backgroundColor=e,a.style.borderRadius=i/2+"px","transparent"===e&&(a.style.fill=this.uiStyleSettings.toolboxAccentColor,a.innerHTML='<svg viewBox="0 0 24 24">\n <path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />\n </svg>'),r.appendChild(a),r},t.prototype.setCurrentColor=function(e,t){var n=this;this.currentColor=e,this.colorBoxes.forEach((function(e){e.style.borderColor=e===t?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onColorChanged&&this.onColorChanged(e)},t}($),te=function(){function e(e,t,n){this._state="new",this._isSelected=!1,this._container=e,this._overlayContainer=t,this.globalSettings=n,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(e.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(e){return!1},Object.defineProperty(e.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),e.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},e.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},e.prototype.pointerDown=function(e,t){},e.prototype.dblClick=function(e,t){},e.prototype.manipulate=function(e){},e.prototype.pointerUp=function(e){this.stateChanged()},e.prototype.dispose=function(){},e.prototype.addMarkerVisualToContainer=function(e){this.container.childNodes.length>0?this.container.insertBefore(e,this.container.childNodes[0]):this.container.appendChild(e)},e.prototype.getState=function(){return{typeName:e.typeName,state:this.state,notes:this.notes}},e.prototype.restoreState=function(e){this._state=e.state,this.notes=e.notes},e.prototype.scale=function(e,t){},e.prototype.colorChanged=function(e){this.onColorChanged&&this.onColorChanged(e),this.stateChanged()},e.prototype.fillColorChanged=function(e){this.onFillColorChanged&&this.onFillColorChanged(e),this.stateChanged()},e.prototype.stateChanged=function(){if(this.onStateChanged&&"creating"!==this.state&&"new"!==this.state){var e=this.getState();void 0!==this.manipulationStartState&&(this.manipulationStartState.state="select"),e.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(e)&&this.onStateChanged(this)}},e.typeName="MarkerBase",e}(),ne=function(){function e(){this.findGripByVisual=this.findGripByVisual.bind(this)}return e.prototype.findGripByVisual=function(e){return this.topLeft.ownsTarget(e)?this.topLeft:this.topCenter.ownsTarget(e)?this.topCenter:this.topRight.ownsTarget(e)?this.topRight:this.centerLeft.ownsTarget(e)?this.centerLeft:this.centerRight.ownsTarget(e)?this.centerRight:this.bottomLeft.ownsTarget(e)?this.bottomLeft:this.bottomCenter.ownsTarget(e)?this.bottomCenter:this.bottomRight.ownsTarget(e)?this.bottomRight:void 0},e}(),ie=function(){function e(){this.GRIP_SIZE=10,this.visual=z.createGroup(),this.visual.appendChild(z.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(z.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return e.prototype.ownsTarget=function(e){return e===this.visual||e===this.visual.childNodes[0]||e===this.visual.childNodes[1]},e}(),re=function(){function e(){}return e.toITransformMatrix=function(e){return{a:e.a,b:e.b,c:e.c,d:e.d,e:e.e,f:e.f}},e.toSVGMatrix=function(e,t){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e},e}(),ae=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.left=0,r.top=0,r.width=0,r.height=0,r.defaultSize={x:50,y:20},r.offsetX=0,r.offsetY=0,r.rotationAngle=0,r.CB_DISTANCE=10,r._suppressMarkerCreateEvent=!1,r.container.transform.baseVal.appendItem(z.createTransform()),r.setupControlBox(),r}return U(t,e),Object.defineProperty(t.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visual",{get:function(){return this._visual},set:function(e){this._visual=e;var t=z.createTransform();this._visual.transform.baseVal.appendItem(t)},enumerable:!1,configurable:!0}),t.prototype.ownsTarget=function(t){return!!e.prototype.ownsTarget.call(this,t)||!!(void 0!==this.controlGrips.findGripByVisual(t)||void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(t))},t.prototype.pointerDown=function(t,n){e.prototype.pointerDown.call(this,t,n),"new"===this.state&&(this.left=t.x,this.top=t.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var i=this.unrotatePoint(t);if(this.manipulationStartX=i.x,this.manipulationStartY=i.y,this.offsetX=i.x-this.left,this.offsetY=i.y-this.top,"new"!==this.state)if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(n),void 0!==this.activeGrip)this._state="resize";else if(void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(n)){this.activeGrip=this.rotatorGrip;var r=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=r.x-this.width/2,this.top=r.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var a=this.container.transform.baseVal.getItem(0);a.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(a,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},t.prototype.pointerUp=function(t){var n=this.state;e.prototype.pointerUp.call(this,t),"creating"===this.state&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(t),this._state="select","creating"===n&&this.onMarkerCreated&&!1===this._suppressMarkerCreateEvent&&this.onMarkerCreated(this)},t.prototype.moveVisual=function(e){this.visual.style.transform="translate("+e.x+"px, "+e.y+"px)"},t.prototype.manipulate=function(e){var t=this.unrotatePoint(e);"creating"===this.state?this.resize(e):"move"===this.state?(this.left=this.manipulationStartLeft+(t.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(t.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):"resize"===this.state?this.resize(t):"rotate"===this.state&&this.rotate(e)},t.prototype.resize=function(e){var t=this.manipulationStartLeft,n=this.manipulationStartWidth,i=this.manipulationStartTop,r=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:t=this.manipulationStartLeft+e.x-this.manipulationStartX,n=this.manipulationStartWidth+this.manipulationStartLeft-t;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:n=this.manipulationStartWidth+e.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:i=this.manipulationStartTop+e.y-this.manipulationStartY,r=this.manipulationStartHeight+this.manipulationStartTop-i;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:r=this.manipulationStartHeight+e.y-this.manipulationStartY}n>=0?(this.left=t,this.width=n):(this.left=t+n,this.width=-n),r>=0?(this.top=i,this.height=r):(this.top=i+r,this.height=-r),this.setSize()},t.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},t.prototype.rotate=function(e){if(Math.abs(e.x-this.centerX)>.1){var t=Math.sign(e.x-this.centerX);this.rotationAngle=180*Math.atan((e.y-this.centerY)/(e.x-this.centerX))/Math.PI+90*t,this.applyRotation()}},t.prototype.applyRotation=function(){var e=this.container.transform.baseVal.getItem(0);e.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(e,0)},t.prototype.rotatePoint=function(e){if(0===this.rotationAngle)return e;var t=this.container.getCTM(),n=z.createPoint(e.x,e.y);return{x:(n=n.matrixTransform(t)).x,y:n.y}},t.prototype.unrotatePoint=function(e){if(0===this.rotationAngle)return e;var t=this.container.getCTM();t=t.inverse();var n=z.createPoint(e.x,e.y);return{x:(n=n.matrixTransform(t)).x,y:n.y}},t.prototype.select=function(){e.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},t.prototype.deselect=function(){e.prototype.deselect.call(this),this.controlBox.style.display="none"},t.prototype.setupControlBox=function(){this.controlBox=z.createGroup();var e=z.createTransform();e.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(e),this.container.appendChild(this.controlBox),this.controlRect=z.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),!0!==this.globalSettings.disableRotation&&(this.rotatorGripLine=z.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new ne,this.addControlGrips(),this.controlBox.style.display="none"},t.prototype.adjustControlBox=function(){var e=this.controlBox.transform.baseVal.getItem(0);e.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(e,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),void 0!==this.rotatorGripLine&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},t.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),!0!==this.globalSettings.disableRotation&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},t.prototype.createGrip=function(){var e=new ie;return e.visual.transform.baseVal.appendItem(z.createTransform()),this.controlBox.appendChild(e.visual),e},t.prototype.positionGrips=function(){var e=this.controlGrips.topLeft.GRIP_SIZE,t=-e/2,n=t,i=(this.width+this.CB_DISTANCE)/2-e/2,r=(this.height+this.CB_DISTANCE)/2-e/2,a=this.height+this.CB_DISTANCE-e/2,s=this.width+this.CB_DISTANCE-e/2;this.positionGrip(this.controlGrips.topLeft.visual,t,n),this.positionGrip(this.controlGrips.topCenter.visual,i,n),this.positionGrip(this.controlGrips.topRight.visual,s,n),this.positionGrip(this.controlGrips.centerLeft.visual,t,r),this.positionGrip(this.controlGrips.centerRight.visual,s,r),this.positionGrip(this.controlGrips.bottomLeft.visual,t,a),this.positionGrip(this.controlGrips.bottomCenter.visual,i,a),this.positionGrip(this.controlGrips.bottomRight.visual,s,a),void 0!==this.rotatorGrip&&this.positionGrip(this.rotatorGrip.visual,i,n-3*this.CB_DISTANCE)},t.prototype.positionGrip=function(e,t,n){var i=e.transform.baseVal.getItem(0);i.setTranslate(t,n),e.transform.baseVal.replaceItem(i,0)},t.prototype.hideControlBox=function(){this.controlBox.style.display="none"},t.prototype.showControlBox=function(){this.controlBox.style.display=""},t.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:re.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:re.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},e.prototype.getState.call(this))},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var n=t;this.left=n.left,this.top=n.top,this.width=n.width,this.height=n.height,this.rotationAngle=n.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(re.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,n.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(re.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,n.containerTransformMatrix))},t.prototype.scale=function(t,n){e.prototype.scale.call(this,t,n);var i=this.rotatePoint({x:this.left,y:this.top}),r=this.unrotatePoint({x:i.x*t,y:i.y*n});this.left=r.x,this.top=r.y,this.width=this.width*t,this.height=this.height*n,this.adjustControlBox()},t}(te),se=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.fillColor="transparent",r.strokeColor="transparent",r.strokeWidth=0,r.strokeDasharray="",r.opacity=1,r.setStrokeColor=r.setStrokeColor.bind(r),r.setFillColor=r.setFillColor.bind(r),r.setStrokeWidth=r.setStrokeWidth.bind(r),r.setStrokeDasharray=r.setStrokeDasharray.bind(r),r.createVisual=r.createVisual.bind(r),r}return U(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual)},t.prototype.createVisual=function(){this.visual=z.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,n){e.prototype.pointerDown.call(this,t,n),"new"===this.state&&(this.createVisual(),this.moveVisual(t),this._state="creating")},t.prototype.manipulate=function(t){e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this.setSize()},t.prototype.setSize=function(){e.prototype.setSize.call(this),z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},t.prototype.pointerUp=function(t){e.prototype.pointerUp.call(this,t),this.setSize()},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.visual&&z.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(e),this.stateChanged()},t.prototype.setFillColor=function(e){this.fillColor=e,this.visual&&z.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.visual&&z.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.visual&&z.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},t.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},e.prototype.getState.call(this))},t.prototype.restoreState=function(t){var n=t;this.fillColor=n.fillColor,this.strokeColor=n.strokeColor,this.strokeWidth=n.strokeWidth,this.strokeDasharray=n.strokeDasharray,this.opacity=n.opacity,this.createVisual(),e.prototype.restoreState.call(this,t),this.setSize()},t.prototype.scale=function(t,n){e.prototype.scale.call(this,t,n),this.setSize()},t.title="Rectangle marker",t}(ae),oe=function(e){function t(t,n,i,r){var a=e.call(this,t,r||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return a.widths=[],a.widthBoxes=[],a.widths=n,a.currentWidth=i,a.setCurrentWidth=a.setCurrentWidth.bind(a),a}return U(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2",this.widths.forEach((function(n){var i=document.createElement("div");i.style.display="flex",i.style.flexGrow="2",i.style.alignItems="center",i.style.justifyContent="space-between",i.style.padding="5px",i.style.borderWidth="2px",i.style.borderStyle="solid",i.style.borderColor=n===e.currentWidth?e.uiStyleSettings.toolboxAccentColor:"transparent",i.addEventListener("click",(function(){e.setCurrentWidth(n,i)})),t.appendChild(i);var r=document.createElement("div");r.innerText=n.toString(),r.style.marginRight="5px",i.appendChild(r);var a=document.createElement("div");a.style.minHeight="20px",a.style.flexGrow="2",a.style.display="flex",a.style.alignItems="center";var s=document.createElement("hr");s.style.minWidth="20px",s.style.border="0px",s.style.borderTop=n+"px solid "+e.uiStyleSettings.toolboxColor,s.style.flexGrow="2",a.appendChild(s),i.appendChild(a),e.widthBoxes.push(i)})),t},t.prototype.setCurrentWidth=function(e,t){var n=this;this.currentWidth=e,this.widthBoxes.forEach((function(e){e.style.borderColor=e===t?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},t}($),le=function(e){function t(t,n,i,r){var a=e.call(this,t,r||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return a.styles=[],a.styleBoxes=[],a.styles=n,a.currentStyle=i,a.setCurrentStyle=a.setCurrentStyle.bind(a),a}return U(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2",this.styles.forEach((function(n){var i=document.createElement("div");i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="space-between",i.style.padding="5px",i.style.borderWidth="2px",i.style.borderStyle="solid",i.style.overflow="hidden",i.style.maxWidth=100/e.styles.length-5+"%",i.style.borderColor=n===e.currentStyle?e.uiStyleSettings.toolboxAccentColor:"transparent",i.addEventListener("click",(function(){e.setCurrentStyle(n,i)})),t.appendChild(i);var r=document.createElement("div");r.style.minHeight="20px",r.style.flexGrow="2",r.style.overflow="hidden";var a='<svg width="100" height="20">\n <line x1="0" y1="10" x2="100" y2="10" stroke="'+e.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(""!==n?'stroke-dasharray="'+n+'"':"")+" />\n </svg>";r.innerHTML=a,i.appendChild(r),e.styleBoxes.push(i)})),t},t.prototype.setCurrentStyle=function(e,t){var n=this;this.currentStyle=e,this.styleBoxes.forEach((function(e){e.style.borderColor=e===t?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},t}($),ce=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.strokeColor=i.defaultColor,r.strokeWidth=i.defaultStrokeWidth,r.strokeDasharray=i.defaultStrokeDasharray,r.strokePanel=new ee("Line color",i.defaultColorSet,i.defaultColor),r.strokePanel.onColorChanged=r.setStrokeColor,r.strokeWidthPanel=new oe("Line width",i.defaultStrokeWidths,i.defaultStrokeWidth),r.strokeWidthPanel.onWidthChanged=r.setStrokeWidth,r.strokeStylePanel=new le("Line style",i.defaultStrokeDasharrays,i.defaultStrokeDasharray),r.strokeStylePanel.onStyleChanged=r.setStrokeDasharray,r}return U(t,e),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=e.prototype.getState.call(this);return n.typeName=t.typeName,n},t.typeName="FrameMarker",t.title="Frame marker",t.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',t}(se),ue=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},he=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.x1=0,r.y1=0,r.x2=0,r.y2=0,r.defaultLength=50,r.manipulationStartX=0,r.manipulationStartY=0,r.manipulationStartX1=0,r.manipulationStartY1=0,r.manipulationStartX2=0,r.manipulationStartY2=0,r.setupControlBox(),r}return U(t,e),t.prototype.ownsTarget=function(t){return!!e.prototype.ownsTarget.call(this,t)||!(!this.grip1.ownsTarget(t)&&!this.grip2.ownsTarget(t))},t.prototype.pointerDown=function(t,n){e.prototype.pointerDown.call(this,t,n),this.manipulationStartX=t.x,this.manipulationStartY=t.y,"new"===this.state&&(this.x1=t.x,this.y1=t.y,this.x2=t.x,this.y2=t.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,"new"!==this.state&&(this.select(),this.grip1.ownsTarget(n)?this.activeGrip=this.grip1:this.grip2.ownsTarget(n)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},t.prototype.pointerUp=function(t){var n=this.state;e.prototype.pointerUp.call(this,t),"creating"===this.state&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(t),this._state="select","creating"===n&&this.onMarkerCreated&&this.onMarkerCreated(this)},t.prototype.adjustVisual=function(){},t.prototype.manipulate=function(e){"creating"===this.state?this.resize(e):"move"===this.state?(this.x1=this.manipulationStartX1+e.x-this.manipulationStartX,this.y1=this.manipulationStartY1+e.y-this.manipulationStartY,this.x2=this.manipulationStartX2+e.x-this.manipulationStartX,this.y2=this.manipulationStartY2+e.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):"resize"===this.state&&this.resize(e)},t.prototype.resize=function(e){switch(this.activeGrip){case this.grip1:this.x1=e.x,this.y1=e.y;break;case this.grip2:case void 0:this.x2=e.x,this.y2=e.y}this.adjustVisual(),this.adjustControlBox()},t.prototype.select=function(){e.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},t.prototype.deselect=function(){e.prototype.deselect.call(this),this.controlBox.style.display="none"},t.prototype.setupControlBox=function(){this.controlBox=z.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},t.prototype.adjustControlBox=function(){this.positionGrips()},t.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},t.prototype.createGrip=function(){var e=new ie;return e.visual.transform.baseVal.appendItem(z.createTransform()),this.controlBox.appendChild(e.visual),e},t.prototype.positionGrips=function(){var e=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-e/2,this.y1-e/2),this.positionGrip(this.grip2.visual,this.x2-e/2,this.y2-e/2)},t.prototype.positionGrip=function(e,t,n){var i=e.transform.baseVal.getItem(0);i.setTranslate(t,n),e.transform.baseVal.replaceItem(i,0)},t.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},e.prototype.getState.call(this))},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var n=t;this.x1=n.x1,this.y1=n.y1,this.x2=n.x2,this.y2=n.y2},t.prototype.scale=function(t,n){e.prototype.scale.call(this,t,n),this.x1=this.x1*t,this.y1=this.y1*n,this.x2=this.x2*t,this.y2=this.y2*n,this.adjustVisual(),this.adjustControlBox()},t}(te),de=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.strokeColor="transparent",r.strokeWidth=0,r.strokeDasharray="",r.setStrokeColor=r.setStrokeColor.bind(r),r.setStrokeWidth=r.setStrokeWidth.bind(r),r.setStrokeDasharray=r.setStrokeDasharray.bind(r),r.strokeColor=i.defaultColor,r.strokeWidth=i.defaultStrokeWidth,r.strokeDasharray=i.defaultStrokeDasharray,r.strokePanel=new ee("Line color",i.defaultColorSet,i.defaultColor),r.strokePanel.onColorChanged=r.setStrokeColor,r.strokeWidthPanel=new oe("Line width",i.defaultStrokeWidths,i.defaultStrokeWidth),r.strokeWidthPanel.onWidthChanged=r.setStrokeWidth,r.strokeStylePanel=new le("Line style",i.defaultStrokeDasharrays,i.defaultStrokeDasharray),r.strokeStylePanel.onStyleChanged=r.setStrokeDasharray,r}return U(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual&&t!==this.selectorLine&&t!==this.visibleLine)},t.prototype.createVisual=function(){this.visual=z.createGroup(),this.selectorLine=z.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=z.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,n){e.prototype.pointerDown.call(this,t,n),"new"===this.state&&(this.createVisual(),this.adjustVisual(),this._state="creating")},t.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),z.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),z.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),z.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.adjustVisual(),this.colorChanged(e)},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.adjustVisual()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.adjustVisual(),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},e.prototype.getState.call(this));return n.typeName=t.typeName,n},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var n=t;this.strokeColor=n.strokeColor,this.strokeWidth=n.strokeWidth,this.strokeDasharray=n.strokeDasharray,this.createVisual(),this.adjustVisual()},t.typeName="LineMarker",t.title="Line marker",t.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',t}(he),fe=function(e){function t(t,n,i,r){var a=e.call(this,t,r||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return a.fonts=[],a.fontBoxes=[],a.fonts=n,a.currentFont=i,a.setCurrentFont=a.setCurrentFont.bind(a),a}return U(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.overflow="hidden",t.style.flexGrow="2",this.fonts.forEach((function(n){var i=document.createElement("div");i.style.display="inline-block",i.style.alignItems="center",i.style.justifyContent="space-between",i.style.padding="5px",i.style.borderWidth="2px",i.style.borderStyle="solid",i.style.overflow="hidden",i.style.maxWidth=100/e.fonts.length-5+"%",i.style.borderColor=n===e.currentFont?e.uiStyleSettings.toolboxAccentColor:"transparent",i.addEventListener("click",(function(){e.setCurrentFont(n,i)})),t.appendChild(i);var r=document.createElement("div");r.style.display="flex",r.style.minHeight="20px",r.style.flexGrow="2",r.style.fontFamily=n,r.style.overflow="hidden";var a=document.createElement("div");a.style.whiteSpace="nowrap",a.style.overflow="hidden",a.style.textOverflow="ellipsis",a.innerHTML="The quick brown fox jumps over the lazy dog",r.appendChild(a),i.appendChild(r),e.fontBoxes.push(i)})),t},t.prototype.setCurrentFont=function(e,t){var n=this;this.currentFont=e,this.fontBoxes.forEach((function(e){e.style.borderColor=e===t?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onFontChanged&&this.onFontChanged(this.currentFont)},t}($),pe=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.color="transparent",r.padding=5,r.DEFAULT_TEXT="your text here",r.text=r.DEFAULT_TEXT,r.isMoved=!1,r.color=i.defaultColor,r.fontFamily=i.defaultFontFamily,r.defaultSize={x:100,y:30},r.setColor=r.setColor.bind(r),r.setFont=r.setFont.bind(r),r.renderText=r.renderText.bind(r),r.sizeText=r.sizeText.bind(r),r.textEditDivClicked=r.textEditDivClicked.bind(r),r.showTextEditor=r.showTextEditor.bind(r),r.setSize=r.setSize.bind(r),r.positionTextEditor=r.positionTextEditor.bind(r),r.colorPanel=new ee("Color",i.defaultColorSet,i.defaultColor),r.colorPanel.onColorChanged=r.setColor,r.fontFamilyPanel=new fe("Font",i.defaultFontFamilies,i.defaultFontFamily),r.fontFamilyPanel.onFontChanged=r.setFont,r}return U(t,e),t.prototype.ownsTarget=function(t){if(e.prototype.ownsTarget.call(this,t)||t===this.visual||t===this.textElement||t===this.bgRectangle)return!0;var n=!1;return this.textElement.childNodes.forEach((function(e){e===t&&(n=!0)})),n},t.prototype.createVisual=function(){this.visual=z.createGroup(),this.bgRectangle=z.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=z.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(z.createTransform()),this.textElement.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},t.prototype.pointerDown=function(t,n){e.prototype.pointerDown.call(this,t,n),this.isMoved=!1,this.pointerDownPoint=t,this.pointerDownTimestamp=Date.now(),"new"===this.state&&(this.createVisual(),this.moveVisual(t),this._state="creating")},t.prototype.renderText=function(){var e=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach((function(t){e.textElement.appendChild(z.createTSpan(""===t.trim()?" ":t.trim(),[["x","0"],["dy","1.2em"]]))})),setTimeout(this.sizeText,10)}},t.prototype.getTextScale=function(){var e=this.textElement.getBBox(),t=1;if(e.width>0&&e.height>0){var n=(1*this.width-this.width*this.padding*2/100)/e.width,i=(1*this.height-this.height*this.padding*2/100)/e.height;t=Math.min(n,i)}return t},t.prototype.getTextPosition=function(e){var t=this.textElement.getBBox(),n=0,i=0;return t.width>0&&t.height>0&&(n=(this.width-t.width*e)/2,i=this.height/2-t.height*e/2),{x:n,y:i}},t.prototype.sizeText=function(){var e=this.textElement.getBBox(),t=this.getTextScale(),n=this.getTextPosition(t);n.y-=e.y*t,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+n.x+"px, "+n.y+"px) scale("+t+", "+t+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(n.x,n.y),this.textElement.transform.baseVal.getItem(1).setScale(t,t))},t.prototype.manipulate=function(t){e.prototype.manipulate.call(this,t),void 0!==this.pointerDownPoint&&(this.isMoved=Math.abs(t.x-this.pointerDownPoint.x)>5||Math.abs(t.y-this.pointerDownPoint.y)>5)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this.isMoved=!0,this.setSize(),this.sizeText()},t.prototype.setSize=function(){e.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),z.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},t.prototype.pointerUp=function(t){var n=this.state;"creating"===n&&(this._suppressMarkerCreateEvent=!0),e.prototype.pointerUp.call(this,t),this.setSize(),("creating"===n||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},t.prototype.showTextEditor=function(){var e=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",(function(e){e.stopPropagation()})),this.textEditor.addEventListener("input",(function(){for(var t=Number.parseFloat(e.textEditor.style.fontSize);e.textEditor.clientWidth>=Number.parseInt(e.textEditor.style.maxWidth)&&t>.9;)t-=.1,e.textEditor.style.fontSize=Math.max(t,.9)+"em"})),this.textEditor.addEventListener("keyup",(function(e){e.cancelBubble=!0})),this.textEditor.addEventListener("paste",(function(e){if(e.clipboardData){var t=e.clipboardData.getData("text"),n=window.getSelection();if(!n.rangeCount)return!1;n.deleteFromDocument(),n.getRangeAt(0).insertNode(document.createTextNode(t)),e.preventDefault()}})),this.textEditDiv.addEventListener("pointerup",(function(){e.textEditDivClicked(e.textEditor.innerText)})),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},t.prototype.positionTextEditor=function(){if("edit"===this.state)if(void 0===this.textEditor)this.showTextEditor();else{this.textElement.style.display="";var e=this.getTextScale(),t=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),n=this.textElement.getBBox(),i={x:n.width*e,y:n.height*e};t.x-=i.x/2,t.y-=i.y/2,this.textEditor.style.top=t.y+"px",this.textEditor.style.left=t.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-t.x+"px",this.textEditor.style.fontSize=Math.max(16*e,12)+"px",this.textElement.style.display="none"}},t.prototype.textEditDivClicked=function(e){this.text=e.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},t.prototype.select=function(){e.prototype.select.call(this),"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText)},t.prototype.deselect=function(){"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText),e.prototype.deselect.call(this)},t.prototype.dblClick=function(t,n){e.prototype.dblClick.call(this,t,n),this.showTextEditor()},t.prototype.setColor=function(e){this.textElement&&z.setAttributes(this.textElement,[["fill",e]]),this.color=e,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(e)},t.prototype.setFont=function(e){this.textElement&&z.setAttributes(this.textElement,[["font-family",e]]),this.fontFamily=e,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},t.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},t.prototype.showVisual=function(){"edit"===this.state&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},e.prototype.getState.call(this));return n.typeName=t.typeName,n},t.prototype.restoreState=function(t){var n=t;this.color=n.color,this.fontFamily=n.fontFamily,this.padding=n.padding,this.text=n.text,this.createVisual(),e.prototype.restoreState.call(this,t),this.setSize()},t.prototype.scale=function(t,n){e.prototype.scale.call(this,t,n),this.setSize(),this.sizeText(),this.positionTextEditor()},t.typeName="TextMarker",t.title="Text marker",t.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',t}(ae),ge=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.color="transparent",r.lineWidth=3,r.drawing=!1,r.pixelRatio=1,r.color=i.defaultColor,r.lineWidth=i.defaultStrokeWidth,r.pixelRatio=i.freehandPixelRatio,r.setColor=r.setColor.bind(r),r.addCanvas=r.addCanvas.bind(r),r.finishCreation=r.finishCreation.bind(r),r.setLineWidth=r.setLineWidth.bind(r),r.colorPanel=new ee("Color",i.defaultColorSet,i.defaultColor),r.colorPanel.onColorChanged=r.setColor,r.lineWidthPanel=new oe("Line width",i.defaultStrokeWidths,i.defaultStrokeWidth),r.lineWidthPanel.onWidthChanged=r.setLineWidth,r}return U(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual&&t!==this.drawingImage)},t.prototype.createVisual=function(){this.visual=z.createGroup(),this.drawingImage=z.createImage(),this.visual.appendChild(this.drawingImage);var e=z.createTransform();this.visual.transform.baseVal.appendItem(e),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,n){"new"===this.state&&(this.addCanvas(),this.createVisual(),this._state="creating"),"creating"===this.state?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(t.x,t.y),this.drawing=!0):e.prototype.pointerDown.call(this,t,n)},t.prototype.manipulate=function(t){"creating"===this.state?this.drawing&&(this.canvasContext.lineTo(t.x,t.y),this.canvasContext.stroke()):e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),z.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},t.prototype.pointerUp=function(t){"creating"===this._state?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):e.prototype.pointerUp.call(this,t)},t.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},t.prototype.select=function(){"creating"===this.state&&this.finishCreation(),e.prototype.select.call(this)},t.prototype.deselect=function(){"creating"===this.state&&this.finishCreation(),e.prototype.deselect.call(this)},t.prototype.finishCreation=function(){for(var e=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),t=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],n=t[0],i=t[1],r=t[2],a=t[3],s=!1,o=0;o<this.canvasElement.height;o++)for(var l=0;l<this.canvasElement.width;l++)e.data[o*this.canvasElement.width*4+4*l+3]>0&&(s=!0,o<i&&(i=o),l<n&&(n=l),o>a&&(a=o),l>r&&(r=l));if(s){this.left=n/this.pixelRatio,this.top=i/this.pixelRatio,this.width=(r-n)/this.pixelRatio,this.height=(a-i)/this.pixelRatio;var c=document.createElement("canvas");c.width=r-n,c.height=a-i,c.getContext("2d").putImageData(this.canvasContext.getImageData(n,i,r-n,a-i),0,0),this.drawingImgUrl=c.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},t.prototype.setDrawingImage=function(){z.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),z.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},t.prototype.setColor=function(e){this.color=e,this.colorChanged(e)},t.prototype.setLineWidth=function(e){this.lineWidth=e},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return"new"===this.state||"creating"===this.state?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=Object.assign({drawingImgUrl:this.drawingImgUrl},e.prototype.getState.call(this));return n.typeName=t.typeName,n},t.prototype.restoreState=function(t){this.createVisual(),e.prototype.restoreState.call(this,t),this.drawingImgUrl=t.drawingImgUrl,this.setDrawingImage()},t.prototype.scale=function(t,n){e.prototype.scale.call(this,t,n),this.setDrawingImage()},t.typeName="FreehandMarker",t.title="Freehand marker",t.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',t}(ae),ve=function(e){function t(t,n,i){var r=e.call(this,t,i||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return r.typeBoxes=[],r.currentType=n,r.setCurrentType=r.setCurrentType.bind(r),r}return U(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2";for(var n=function(n){var r="both";switch(n){case 0:r="both";break;case 1:r="start";break;case 2:r="end";break;case 3:r="none"}var a=document.createElement("div");if(a.style.display="flex",a.style.flexGrow="2",a.style.alignItems="center",a.style.justifyContent="space-between",a.style.padding="5px",a.style.borderWidth="2px",a.style.borderStyle="solid",a.style.borderColor=r===i.currentType?i.uiStyleSettings.toolboxAccentColor:"transparent",a.addEventListener("click",(function(){e.setCurrentType(r,a)})),t.appendChild(a),"both"===r||"start"===r){var s=document.createElement("div");s.style.display="flex",s.style.alignItems="center",s.style.minHeight="20px",s.innerHTML='<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">\n <polygon points="0,5 10,0 10,10" fill="'+(void 0!==i.uiStyleSettings?i.uiStyleSettings.toolboxColor:"#eeeeee")+'" />\n </svg>',s.style.marginLeft="5px",a.appendChild(s)}var o=document.createElement("div");o.style.display="flex",o.style.alignItems="center",o.style.minHeight="20px",o.style.flexGrow="2";var l=document.createElement("hr");if(l.style.minWidth="20px",l.style.border="0px",l.style.borderTop="3px solid "+(void 0!==i.uiStyleSettings?i.uiStyleSettings.toolboxColor:"#eeeeee"),l.style.flexGrow="2",o.appendChild(l),a.appendChild(o),"both"===r||"end"===r){var c=document.createElement("div");c.style.display="flex",c.style.alignItems="center",c.style.minHeight="20px",c.innerHTML='<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">\n <polygon points="0,0 10,5 0,10" fill="'+(void 0!==i.uiStyleSettings?i.uiStyleSettings.toolboxColor:"#eeeeee")+'" />\n </svg>',c.style.marginRight="5px",a.appendChild(c)}i.typeBoxes.push(a)},i=this,r=0;r<4;r++)n(r);return t},t.prototype.setCurrentType=function(e,t){var n=this;this.currentType=e,this.typeBoxes.forEach((function(e){e.style.borderColor=e===t?void 0!==n.uiStyleSettings?n.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"})),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},t}($),me=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.arrowType="end",r.arrowBaseHeight=10,r.arrowBaseWidth=10,r.getArrowPoints=r.getArrowPoints.bind(r),r.setArrowType=r.setArrowType.bind(r),r.arrowTypePanel=new ve("Arrow type","end"),r.arrowTypePanel.onArrowTypeChanged=r.setArrowType,r}return U(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.arrow1&&t!==this.arrow2)},t.prototype.getArrowPoints=function(e,t){var n=this.arrowBaseWidth+2*this.strokeWidth,i=this.arrowBaseHeight+2*this.strokeWidth;return e-n/2+","+(t+i/2)+" "+e+","+(t-i/2)+" "+(e+n/2)+","+(t+i/2)},t.prototype.createTips=function(){this.arrow1=z.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=z.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.arrow2)},t.prototype.pointerDown=function(t,n){e.prototype.pointerDown.call(this,t,n),"creating"===this.state&&this.createTips()},t.prototype.adjustVisual=function(){if(e.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display="both"===this.arrowType||"start"===this.arrowType?"":"none",this.arrow2.style.display="both"===this.arrowType||"end"===this.arrowType?"":"none",z.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),z.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var t=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),n=this.arrow1.transform.baseVal.getItem(0);n.setRotate(t,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(n,0);var i=this.arrow2.transform.baseVal.getItem(0);i.setRotate(t+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(i,0)}},t.prototype.setArrowType=function(e){this.arrowType=e,this.adjustVisual(),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=Object.assign({arrowType:this.arrowType},e.prototype.getState.call(this));return n.typeName=t.typeName,n},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var n=t;this.arrowType=n.arrowType,this.createTips(),this.adjustVisual()},t.typeName="ArrowMarker",t.title="Arrow marker",t.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',t}(de),ye=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.fillColor=i.defaultFillColor,r.strokeWidth=0,r.fillPanel=new ee("Color",i.defaultColorSet,i.defaultFillColor),r.fillPanel.onColorChanged=r.setFillColor,r}return U(t,e),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=e.prototype.getState.call(this);return n.typeName=t.typeName,n},t.typeName="CoverMarker",t.title="Cover marker",t.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',t}(se),be=function(e){function t(t,n,i,r){var a=e.call(this,t,r||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return a.opacities=[],a.opacityBoxes=[],a.opacities=n,a.currentOpacity=i,a.setCurrentOpacity=a.setCurrentOpacity.bind(a),a}return U(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2",t.style.justifyContent="space-between",this.opacities.forEach((function(n){var i=document.createElement("div");i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.padding="5px",i.style.borderWidth="2px",i.style.borderStyle="solid",i.style.borderColor=n===e.currentOpacity?e.uiStyleSettings.toolboxAccentColor:"transparent",i.addEventListener("click",(function(){e.setCurrentOpacity(n,i)})),t.appendChild(i);var r=document.createElement("div");r.innerText=100*n+"%",i.appendChild(r),e.opacityBoxes.push(i)})),t},t.prototype.setCurrentOpacity=function(e,t){var n=this;this.currentOpacity=e,this.opacityBoxes.forEach((function(e){e.style.borderColor=e===t?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},t}($),Ee=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.setOpacity=r.setOpacity.bind(r),r.fillColor=i.defaultHighlightColor,r.strokeWidth=0,r.opacity=i.defaultHighlightOpacity,r.fillPanel=new ee("Color",i.defaultColorSet,r.fillColor),r.fillPanel.onColorChanged=r.setFillColor,r.opacityPanel=new be("Opacity",i.defaultOpacitySteps,r.opacity),r.opacityPanel.onOpacityChanged=r.setOpacity,r}return U(t,e),t.prototype.setOpacity=function(e){this.opacity=e,this.visual&&z.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=e.prototype.getState.call(this);return n.typeName=t.typeName,n},t.typeName="HighlightMarker",t.title="Highlight marker",t.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',t}(ye),ke='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',Ce=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.bgColor="transparent",r.tipPosition={x:0,y:0},r.tipBase1Position={x:0,y:0},r.tipBase2Position={x:0,y:0},r.tipMoving=!1,r.color=i.defaultStrokeColor,r.bgColor=i.defaultFillColor,r.fontFamily=i.defaultFontFamily,r.defaultSize={x:100,y:30},r.setBgColor=r.setBgColor.bind(r),r.getTipPoints=r.getTipPoints.bind(r),r.positionTip=r.positionTip.bind(r),r.setTipPoints=r.setTipPoints.bind(r),r.colorPanel=new ee("Text color",i.defaultColorSet,r.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),r.colorPanel.onColorChanged=r.setColor,r.bgColorPanel=new ee("Fill color",i.defaultColorSet,r.bgColor,ke),r.bgColorPanel.onColorChanged=r.setBgColor,r.fontFamilyPanel=new fe("Font",i.defaultFontFamilies,i.defaultFontFamily),r.fontFamilyPanel.onFontChanged=r.setFont,r.tipGrip=new ie,r.tipGrip.visual.transform.baseVal.appendItem(z.createTransform()),r.controlBox.appendChild(r.tipGrip.visual),r}return U(t,e),t.prototype.ownsTarget=function(t){return e.prototype.ownsTarget.call(this,t)||this.tipGrip.ownsTarget(t)||this.tip===t},t.prototype.createTip=function(){z.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=z.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},t.prototype.pointerDown=function(t,n){"new"===this.state&&e.prototype.pointerDown.call(this,t,n),"creating"===this.state?this.createTip():this.tipGrip.ownsTarget(n)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):e.prototype.pointerDown.call(this,t,n)},t.prototype.pointerUp=function(t){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,e.prototype.pointerUp.call(this,t);else{var n="creating"===this.state;e.prototype.pointerUp.call(this,t),this.setTipPoints(n),this.positionTip()}},t.prototype.manipulate=function(t){if(this.tipMoving){var n=this.unrotatePoint(t);this.tipPosition={x:n.x-this.manipulationStartLeft,y:n.y-this.manipulationStartTop},this.positionTip()}else e.prototype.manipulate.call(this,t)},t.prototype.setBgColor=function(e){this.bgRectangle&&this.tip&&(z.setAttributes(this.bgRectangle,[["fill",e]]),z.setAttributes(this.tip,[["fill",e]])),this.bgColor=e,this.fillColorChanged(e)},t.prototype.getTipPoints=function(){return this.setTipPoints("creating"===this.state),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},t.prototype.setTipPoints=function(e){void 0===e&&(e=!1);var t=Math.min(this.height/2,15),n=this.height/5;e&&(this.tipPosition={x:t+n/2,y:this.height+20});var i=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?i<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(n=this.width/5,t=Math.min(this.width/2,15),this.tipBase1Position={x:t,y:0},this.tipBase2Position={x:t+n,y:0}):(this.tipBase1Position={x:0,y:t},this.tipBase2Position={x:0,y:t+n}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?i<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(n=this.width/5,t=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-t-n,y:0},this.tipBase2Position={x:this.width-t,y:0}):(this.tipBase1Position={x:this.width,y:t},this.tipBase2Position={x:this.width,y:t+n}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?i<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(n=this.width/5,t=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-t-n,y:this.height},this.tipBase2Position={x:this.width-t,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-t-n},this.tipBase2Position={x:this.width,y:this.height-t}):i<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(n=this.width/5,t=Math.min(this.width/2,15),this.tipBase1Position={x:t,y:this.height},this.tipBase2Position={x:t+n,y:this.height}):(this.tipBase1Position={x:0,y:this.height-t},this.tipBase2Position={x:0,y:this.height-t-n})},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this.positionTip()},t.prototype.positionTip=function(){z.setAttributes(this.tip,[["points",this.getTipPoints()]]);var e=this.tipGrip.visual.transform.baseVal.getItem(0);e.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(e,0)},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),t.prototype.select=function(){this.positionTip(),e.prototype.select.call(this)},t.prototype.getState=function(){var n=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},e.prototype.getState.call(this));return n.typeName=t.typeName,n},t.prototype.restoreState=function(t){var n=t;this.bgColor=n.bgColor,this.tipPosition=n.tipPosition,e.prototype.restoreState.call(this,t),this.createTip(),this.setTipPoints()},t.prototype.scale=function(t,n){e.prototype.scale.call(this,t,n),this.tipPosition={x:this.tipPosition.x*t,y:this.tipPosition.y*n},this.positionTip()},t.typeName="CalloutMarker",t.title="Callout marker",t.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',t}(pe),Se=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.fillColor="transparent",r.strokeColor="transparent",r.strokeWidth=0,r.strokeDasharray="",r.opacity=1,r.strokeColor=i.defaultColor,r.strokeWidth=i.defaultStrokeWidth,r.strokeDasharray=i.defaultStrokeDasharray,r.fillColor=i.defaultFillColor,r.setStrokeColor=r.setStrokeColor.bind(r),r.setFillColor=r.setFillColor.bind(r),r.setStrokeWidth=r.setStrokeWidth.bind(r),r.setStrokeDasharray=r.setStrokeDasharray.bind(r),r.setOpacity=r.setOpacity.bind(r),r.createVisual=r.createVisual.bind(r),r.strokePanel=new ee("Line color",K(i.defaultColorSet,["transparent"]),i.defaultColor),r.strokePanel.onColorChanged=r.setStrokeColor,r.fillPanel=new ee("Fill color",K(i.defaultColorSet,["transparent"]),r.fillColor,ke),r.fillPanel.onColorChanged=r.setFillColor,r.strokeWidthPanel=new oe("Line width",i.defaultStrokeWidths,i.defaultStrokeWidth),r.strokeWidthPanel.onWidthChanged=r.setStrokeWidth,r.strokeStylePanel=new le("Line style",i.defaultStrokeDasharrays,i.defaultStrokeDasharray),r.strokeStylePanel.onStyleChanged=r.setStrokeDasharray,r.opacityPanel=new be("Opacity",i.defaultOpacitySteps,r.opacity),r.opacityPanel.onOpacityChanged=r.setOpacity,r}return U(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual)},t.prototype.createVisual=function(){this.visual=z.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,n){e.prototype.pointerDown.call(this,t,n),"new"===this.state&&(this.createVisual(),this.moveVisual(t),this._state="creating")},t.prototype.manipulate=function(t){e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this.setSize()},t.prototype.setSize=function(){e.prototype.setSize.call(this),z.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},t.prototype.pointerUp=function(t){e.prototype.pointerUp.call(this,t),this.setSize()},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.visual&&z.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(e),this.stateChanged()},t.prototype.setFillColor=function(e){this.fillColor=e,this.visual&&z.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(e),this.stateChanged()},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.visual&&z.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.visual&&z.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},t.prototype.setOpacity=function(e){this.opacity=e,this.visual&&z.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},e.prototype.getState.call(this));return n.typeName=t.typeName,n},t.prototype.restoreState=function(t){var n=t;this.fillColor=n.fillColor,this.strokeColor=n.strokeColor,this.strokeWidth=n.strokeWidth,this.strokeDasharray=n.strokeDasharray,this.opacity=n.opacity,this.createVisual(),e.prototype.restoreState.call(this,t),this.setSize()},t.prototype.scale=function(t,n){e.prototype.scale.call(this,t,n),this.setSize()},t.typeName="EllipseMarker",t.title="Ellipse marker",t.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',t}(ae),xe=function(e){function t(t,n,i){return e.call(this,t,n,i)||this}return U(t,e),Object.defineProperty(t.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.tip1&&t!==this.tip2)},t.prototype.createTips=function(){this.tip1=z.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.tip1),this.tip2=z.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(z.createTransform()),this.visual.appendChild(this.tip2)},t.prototype.pointerDown=function(t,n){e.prototype.pointerDown.call(this,t,n),"creating"===this.state&&this.createTips()},t.prototype.adjustVisual=function(){if(e.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(z.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),z.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var t=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),n=this.tip1.transform.baseVal.getItem(0);n.setRotate(t,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(n,0);var i=this.tip2.transform.baseVal.getItem(0);i.setRotate(t+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(i,0)}},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=e.prototype.getState.call(this);return n.typeName=t.typeName,n},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t),this.createTips(),this.adjustVisual()},t.typeName="MeasurementMarker",t.title="Measurement marker",t.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',t}(de),we=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.strokePanel.colors=i.defaultColorSet,r.fillColor="transparent",r}return U(t,e),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=e.prototype.getState.call(this);return n.typeName=t.typeName,n},t.typeName="EllipseFrameMarker",t.title="Ellipse frame marker",t.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',t}(Se),Te=function(){function e(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(e.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),e.prototype.addUndoStep=function(e){0!==this.undoStack.length&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(e)||(this.undoStack.push(e),JSON.stringify(this.lastRedoStep)!==JSON.stringify(e)&&this.redoStack.splice(0,this.redoStack.length))},e.prototype.replaceLastUndoStep=function(e){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=e)},e.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},e.prototype.undo=function(){if(this.undoStack.length>1){var e=this.undoStack.pop();return void 0!==e&&this.redoStack.push(e),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},e.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},e}(),_e=function(e){function t(t,n,i){var r=e.call(this,t,n,i)||this;return r.strokeColor="transparent",r.strokeWidth=0,r.strokeDasharray="",r.curveX=0,r.curveY=0,r.manipulationStartCurveX=0,r.manipulationStartCurveY=0,r.setStrokeColor=r.setStrokeColor.bind(r),r.setStrokeWidth=r.setStrokeWidth.bind(r),r.setStrokeDasharray=r.setStrokeDasharray.bind(r),r.positionGrips=r.positionGrips.bind(r),r.addControlGrips=r.addControlGrips.bind(r),r.adjustVisual=r.adjustVisual.bind(r),r.setupControlBox=r.setupControlBox.bind(r),r.resize=r.resize.bind(r),r.strokeColor=i.defaultColor,r.strokeWidth=i.defaultStrokeWidth,r.strokeDasharray=i.defaultStrokeDasharray,r.strokePanel=new ee("Line color",i.defaultColorSet,i.defaultColor),r.strokePanel.onColorChanged=r.setStrokeColor,r.strokeWidthPanel=new oe("Line width",i.defaultStrokeWidths,i.defaultStrokeWidth),r.strokeWidthPanel.onWidthChanged=r.setStrokeWidth,r.strokeStylePanel=new le("Line style",i.defaultStrokeDasharrays,i.defaultStrokeDasharray),r.strokeStylePanel.onStyleChanged=r.setStrokeDasharray,r}return U(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual&&t!==this.selectorCurve&&t!==this.visibleCurve&&!this.curveGrip.ownsTarget(t))},t.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},t.prototype.createVisual=function(){this.visual=z.createGroup(),this.selectorCurve=z.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=z.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,n){e.prototype.pointerDown.call(this,t,n),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,"new"===this.state&&(this.curveX=t.x,this.curveY=t.y),"new"===this.state?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(n)&&(this.activeGrip=this.curveGrip,this._state="resize")},t.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),z.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),z.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),z.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},t.prototype.setupControlBox=function(){e.prototype.setupControlBox.call(this),this.curveControlLine1=z.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=z.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},t.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,e.prototype.addControlGrips.call(this)},t.prototype.positionGrips=function(){e.prototype.positionGrips.call(this);var t=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-t/2,this.curveY-t/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},t.prototype.manipulate=function(t){"move"===this.state&&(this.curveX=this.manipulationStartCurveX+t.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+t.y-this.manipulationStartY),e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){this.activeGrip===this.curveGrip&&(this.curveX=t.x,this.curveY=t.y),e.prototype.resize.call(this,t),"creating"===this.state&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.adjustVisual(),this.colorChanged(e)},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.adjustVisual()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.adjustVisual()},t.prototype.scale=function(t,n){this.curveX=this.curveX*t,this.curveY=this.curveY*n,e.prototype.scale.call(this,t,n)},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var n=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},e.prototype.getState.call(this));return n.typeName=t.typeName,n},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var n=t;this.strokeColor=n.strokeColor,this.strokeWidth=n.strokeWidth,this.strokeDasharray=n.strokeDasharray,this.curveX=n.curveX,this.curveY=n.curveY,this.createVisual(),this.adjustVisual()},t.typeName="CurveMarker",t.title="Curve marker",t.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',t}(he),Oe=function(){function e(e,t){void 0===t&&(t=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=e,this.cancelable=t}return Object.defineProperty(e.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),e.prototype.preventDefault=function(){this._defaultPrevented=!0},e}(),Ae=function(e){function t(t,n,i){var r=e.call(this,t,!1)||this;return r.dataUrl=n,r.state=i,r}return U(t,e),t}(Oe),Le=function(e){function t(t,n,i){void 0===i&&(i=!1);var r=e.call(this,t,i)||this;return r.marker=n,r}return U(t,e),t}(Oe),De=function(){function e(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return e.prototype.addEventListener=function(e,t){this[e].push(t)},e.prototype.removeEventListener=function(e,t){var n=this[e].indexOf(t);n>-1&&this[e].splice(n,1)},e}(),Re=function(){function e(t){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ue,this._isOpen=!1,this.undoRedoManager=new Te,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new De,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=e.instanceCounter++,this.styles=new q(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=t,this.targetRoot=document.body,this.width=t.clientWidth,this.height=t.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(e.prototype,"ALL_MARKER_TYPES",{get:function(){return[ce,ge,me,pe,we,Se,Ee,Ce,xe,ye,de,_e]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ce,ge,me,pe,Se,Ee,Ce]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ce,ge,me,pe,Ee]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(e){var t=this;this._availableMarkerTypes.splice(0),e.forEach((function(e){if("string"==typeof e){var n=t.ALL_MARKER_TYPES.find((function(t){return t.typeName===e}));void 0!==n&&t._availableMarkerTypes.push(n)}else t._availableMarkerTypes.push(e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(e){this._zoomLevel=e,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),e.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),"popup"===this.settings.displayMode&&this.onPopupTargetResize(),V.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},e.prototype.show=function(){var e=this;void 0===this.styles.styleSheetRoot&&void 0!==Y.styleSheetRoot&&(this.styles.styleSheetRoot=Y.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach((function(t){return t(new Oe(e))}))},e.prototype.render=function(){return G(this,void 0,void 0,(function(){var e;return H(this,(function(t){switch(t.label){case 0:return this.setCurrentMarker(),(e=new W).naturalSize=this.renderAtNaturalSize,e.imageType=this.renderImageType,e.imageQuality=this.renderImageQuality,e.markersOnly=this.renderMarkersOnly,e.width=this.renderWidth,e.height=this.renderHeight,[4,e.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return t.sent(),[4,e.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,t.sent()]}}))}))},e.prototype.close=function(e){var t=this;if(void 0===e&&(e=!1),this.isOpen){var n=!1;e||this.eventListeners.beforeclose.forEach((function(e){var i=new Oe(t,!0);e(i),i.defaultPrevented&&(n=!0)})),n||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.settings.displayMode&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach((function(e){return e(new Oe(t))})),this.detachEvents(),this._isOpen=!1)}},e.prototype.addMarkersToToolbar=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this._availableMarkerTypes).push.apply(e,t)},e.prototype.addRenderEventListener=function(e){this.addEventListener("render",(function(t){e(t.dataUrl,t.state)}))},e.prototype.removeRenderEventListener=function(e){},e.prototype.addCloseEventListener=function(e){this.addEventListener("close",(function(){e()}))},e.prototype.removeCloseEventListener=function(e){},e.prototype.setupResizeObserver=function(){var e=this;"inline"===this.settings.displayMode?window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){e.resize(e.target.clientWidth,e.target.clientHeight)})),this.targetObserver.observe(this.target)):"popup"===this.settings.displayMode&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){return e.onPopupTargetResize()})),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},e.prototype.onPopupTargetResize=function(){var e=1*this.target.clientWidth/this.target.clientHeight,t=this.editorCanvas.clientWidth/e>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*e:this.editorCanvas.clientWidth,n=t<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/e;this.resize(t,n)},e.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},e.prototype.resize=function(e,t){this._isResizing=!0;var n=e/this.imageWidth,i=t/this.imageHeight;this.imageWidth=Math.round(e),this.imageHeight=Math.round(t),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px","popup"!==this.settings.displayMode?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),void 0!==this.toolbar&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(n,i),this._isResizing=!1},e.prototype.scaleMarkers=function(e,t){var n,i=this;this._currentMarker&&this._currentMarker instanceof pe?this._currentMarker.scale(e,t):(n=this._currentMarker,this.setCurrentMarker()),this.markers.forEach((function(n){n!==i._currentMarker&&n.scale(e,t)})),void 0!==n&&this.setCurrentMarker(n)},e.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},e.prototype.setTopLeft=function(){var e=this.editingTarget.getBoundingClientRect(),t=this.editorCanvas.getBoundingClientRect();this.left=e.left-t.left,this.top=e.top-t.top},e.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},e.prototype.addDefs=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.defs=z.createDefs(),this.addDefsToImage(),(e=this.defs).append.apply(e,t)},e.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},e.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},e.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},e.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},e.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},e.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},e.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},e.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var e=document.createElement("a");e.href="https://markerjs.com/",e.target="_blank",e.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',e.title="Powered by marker.js",e.style.display="grid",e.style.alignItems="center",e.style.justifyItems="center",e.style.padding="3px",e.style.width="20px",e.style.height="20px",this.logoUI.appendChild(e),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},e.prototype.positionLogo=function(){this.logoUI&&("right"!==this.uiStyleSettings.logoPosition?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},e.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},e.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},e.prototype.showUI=function(){switch("popup"===this.settings.displayMode&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var e=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=e+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=void 0!==this.uiStyleSettings.zIndex?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=void 0!==this.uiStyleSettings.zIndex?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin="popup"===this.settings.displayMode?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new J(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1","popup"===this.settings.displayMode&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex","popup"===this.settings.displayMode&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Z(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},e.prototype.closeUI=function(){"popup"===this.settings.displayMode&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},e.prototype.removeMarker=function(e){this.markerImage.removeChild(e.container),this.markers.indexOf(e)>-1&&this.markers.splice(this.markers.indexOf(e),1),e.dispose()},e.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),void 0!==this._currentMarker&&("new"!==this._currentMarker.state?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},e.prototype.toolbarButtonClicked=function(e,t){if("marker"===e&&void 0!==t)this.createNewMarker(t);else if("action"===e)switch(t){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":void 0===this.notesArea?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},e.prototype.deleteSelectedMarker=function(){var e=this;if(void 0!==this._currentMarker){var t=!1;if(this.eventListeners.markerbeforedelete.forEach((function(n){var i=new Le(e,e._currentMarker,!0);n(i),i.defaultPrevented&&(t=!0)})),!t){var n=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach((function(t){return t(new Le(e,n))}))}}},e.prototype.clear=function(){var e=this,t=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach((function(n){var i=new Le(e,void 0,!0);n(i),i.defaultPrevented&&(t=!0)})),!t)){this.setCurrentMarker();for(var n=function(t){var n=i.markers[t];i.setCurrentMarker(i.markers[t]),i._currentMarker.dispose(),i.markerImage.removeChild(i._currentMarker.container),i.markers.splice(i.markers.indexOf(i._currentMarker),1),i.eventListeners.markerdelete.forEach((function(t){return t(new Le(e,n))}))},i=this,r=this.markers.length-1;r>=0;r--)n(r);this.addUndoStep()}},Object.defineProperty(e.prototype,"isNotesAreaOpen",{get:function(){return void 0!==this.notesArea},enumerable:!1,configurable:!0}),e.prototype.showNotesEditor=function(){var e;void 0!==this._currentMarker&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=null!==(e=this._currentMarker.notes)&&void 0!==e?e:"",this.overlayContainer.appendChild(this.notesArea))},e.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(void 0!==this._currentMarker&&(this._currentMarker.notes=""!==this.notesArea.value.trim()?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},e.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},e.prototype.addUndoStep=function(){var e=this;if(void 0===this._currentMarker||"edit"!==this._currentMarker.state){var t=this.getState(),n=this.undoRedoManager.getLastUndoStep();if(!n||n.width===t.width&&n.height===t.height){var i=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(t),i<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach((function(t){return t(new Oe(e))}))}else this.undoRedoManager.replaceLastUndoStep(t),this.eventListeners.statechange.forEach((function(t){return t(new Oe(e))}))}},e.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},e.prototype.undoStep=function(){var e=this,t=this.undoRedoManager.undo();void 0!==t&&(this.restoreState(t),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach((function(t){return t(new Oe(e))})))},e.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},e.prototype.redoStep=function(){var e=this,t=this.undoRedoManager.redo();void 0!==t&&(this.restoreState(t),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach((function(t){return t(new Oe(e))})))},e.prototype.stepZoom=function(){var e=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=e<this.zoomSteps.length-1?this.zoomSteps[e+1]:this.zoomSteps[0]},e.prototype.panTo=function(e){this.contentDiv.scrollBy({left:this.prevPanPoint.x-e.x,top:this.prevPanPoint.y-e.y}),this.prevPanPoint=e},e.prototype.startRenderAndClose=function(){return G(this,void 0,void 0,(function(){var e,t,n=this;return H(this,(function(i){switch(i.label){case 0:return[4,this.render()];case 1:return e=i.sent(),t=this.getState(),this.eventListeners.render.forEach((function(i){return i(new Ae(n,e,t))})),this.close(!0),[2]}}))}))},e.prototype.getState=function(e){!0===e&&this.setCurrentMarker();var t={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach((function(e){return t.markers.push(e.getState())})),t},e.prototype.restoreState=function(e){var t=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);e.markers.forEach((function(e){var n=t._availableMarkerTypes.find((function(t){return t.typeName===e.typeName}));if(void 0!==n){var i=t.addNewMarker(n);i.restoreState(e),t.markers.push(i)}})),e.width&&e.height&&(e.width!==this.imageWidth||e.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/e.width,this.imageHeight/e.height),this.eventListeners.restorestate.forEach((function(e){return e(new Oe(t))}))},e.prototype.addNewMarker=function(e){var t=z.createGroup();return this.markerImage.appendChild(t),new e(t,this.overlayContainer,this.settings)},e.prototype.createNewMarker=function(e){var t,n=this;(t="string"==typeof e?this._availableMarkerTypes.find((function(t){return t.typeName===e})):e)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(t),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(t.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach((function(e){return e(new Le(n,n._currentMarker))})))},e.prototype.markerCreated=function(e){var t=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(e),this.setCurrentMarker(e),e instanceof ge&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ge):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach((function(e){return e(new Le(t,t._currentMarker))}))},e.prototype.colorChanged=function(e){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=e,this.settings.defaultStrokeColor=e)},e.prototype.fillColorChanged=function(e){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=e)},e.prototype.markerStateChanged=function(e){var t=this;this.eventListeners.markerchange.forEach((function(n){return n(new Le(t,e))}))},e.prototype.setCurrentMarker=function(e){var t=this;this._currentMarker!==e&&void 0!==this._currentMarker&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach((function(e){return e(new Le(t,t._currentMarker))}))),this._currentMarker=e,void 0===this._currentMarker||this._currentMarker.isSelected||("new"!==this._currentMarker.state&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach((function(e){return e(new Le(t,t._currentMarker))})))},e.prototype.onPointerDown=function(e){if(this._isFocused||this.focus(),this.touchPoints++,1===this.touchPoints||"touch"!==e.pointerType)if(void 0===this._currentMarker||"new"!==this._currentMarker.state&&"creating"!==this._currentMarker.state){if("select"===this.mode){var t=this.markers.find((function(t){return t.ownsTarget(e.target)}));void 0!==t?(this.setCurrentMarker(t),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(e.clientX,e.clientY),e.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:e.clientX,y:e.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(e.clientX,e.clientY))},e.prototype.onDblClick=function(e){if(this._isFocused||this.focus(),"select"===this.mode){var t=this.markers.find((function(t){return t.ownsTarget(e.target)}));void 0!==t&&t!==this._currentMarker&&this.setCurrentMarker(t),void 0!==this._currentMarker?this._currentMarker.dblClick(this.clientToLocalCoordinates(e.clientX,e.clientY),e.target):this.setCurrentMarker()}},e.prototype.onPointerMove=function(e){1!==this.touchPoints&&"touch"===e.pointerType||(void 0!==this._currentMarker||this.isDragging)&&(void 0!==this._currentMarker&&"edit"===this._currentMarker.state||e.preventDefault(),void 0!==this._currentMarker?this._currentMarker.manipulate(this.clientToLocalCoordinates(e.clientX,e.clientY)):this.zoomLevel>1&&this.panTo({x:e.clientX,y:e.clientY}))},e.prototype.onPointerUp=function(e){this.touchPoints>0&&this.touchPoints--,0===this.touchPoints&&this.isDragging&&void 0!==this._currentMarker&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(e.clientX,e.clientY)),this.isDragging=!1,this.addUndoStep()},e.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},e.prototype.onKeyUp=function(e){void 0===this._currentMarker||void 0!==this.notesArea||"Delete"!==e.key&&"Backspace"!==e.key||this.deleteSelectedMarker()},e.prototype.clientToLocalCoordinates=function(e,t){var n=this.markerImage.getBoundingClientRect();return{x:(e-n.left)/this.zoomLevel,y:(t-n.top)/this.zoomLevel}},e.prototype.onWindowResize=function(){this.positionUI()},e.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var e=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=e+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},e.prototype.addLicenseKey=function(e){V.addKey(e)},e.prototype.addEventListener=function(e,t){this.eventListeners.addEventListener(e,t)},e.prototype.removeEventListener=function(e,t){this.eventListeners.removeEventListener(e,t)},e.prototype.renderState=function(e){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(e),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(e.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),e.prototype.focus=function(){var e=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,void 0!==this._previousCurrentMarker&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach((function(t){return t(new Oe(e))})))},e.prototype.blur=function(){var e=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach((function(t){return t(new Oe(e))})))},e.instanceCounter=0,e}(),Ie=function(e,t){return(Ie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};
|
|
|
/* **********************************
|
|
|
cropro version 1.2.0
|
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
|
|
copyright Alan Mendelevich
|
|
|
see README and LICENSE for details
|
|
|
********************************** */
|
|
|
/*! *****************************************************************************
|
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
purpose with or without fee is hereby granted.
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
|
***************************************************************************** */function Ne(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Ie(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Pe(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((i=i.apply(e,t||[])).next())}))}function Me(e,t){var n,i,r,a,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}}var je=function(){function e(){}return e.addKey=function(t){e.key=t},Object.defineProperty(e,"isLicensed",{get:function(){return!!e.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(e.key)},enumerable:!1,configurable:!0}),e}(),Be=function(){function e(){}return e.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},e.setAttributes=function(e,t){for(var n=0,i=t;n<i.length;n++){var r=i[n],a=r[0],s=r[1];e.setAttribute(a,s)}},e.createRect=function(t,n,i){var r=document.createElementNS("http://www.w3.org/2000/svg","rect");return r.setAttribute("width",t.toString()),r.setAttribute("height",n.toString()),i&&e.setAttributes(r,i),r},e.createLine=function(t,n,i,r,a){var s=document.createElementNS("http://www.w3.org/2000/svg","line");return s.setAttribute("x1",t.toString()),s.setAttribute("y1",n.toString()),s.setAttribute("x2",i.toString()),s.setAttribute("y2",r.toString()),a&&e.setAttributes(s,a),s},e.createPolygon=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg","polygon");return i.setAttribute("points",t),n&&e.setAttributes(i,n),i},e.createCircle=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg","circle");return i.setAttribute("cx",(t/2).toString()),i.setAttribute("cy",(t/2).toString()),i.setAttribute("r",t.toString()),n&&e.setAttributes(i,n),i},e.createEllipse=function(t,n,i){var r=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return r.setAttribute("cx",(t/2).toString()),r.setAttribute("cy",(n/2).toString()),r.setAttribute("rx",(t/2).toString()),r.setAttribute("ry",(n/2).toString()),i&&e.setAttributes(r,i),r},e.createGroup=function(t){var n=document.createElementNS("http://www.w3.org/2000/svg","g");return t&&e.setAttributes(n,t),n},e.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},e.createMarker=function(t,n,i,r,a,s,o){var l=document.createElementNS("http://www.w3.org/2000/svg","marker");return e.setAttributes(l,[["id",t],["orient",n],["markerWidth",i.toString()],["markerHeight",r.toString()],["refX",a.toString()],["refY",s.toString()]]),l.appendChild(o),l},e.createText=function(t){var n=document.createElementNS("http://www.w3.org/2000/svg","text");return n.setAttribute("x","0"),n.setAttribute("y","0"),t&&e.setAttributes(n,t),n},e.createTSpan=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg","tspan");return i.textContent=t,n&&e.setAttributes(i,n),i},e.createImage=function(t){var n=document.createElementNS("http://www.w3.org/2000/svg","image");return t&&e.setAttributes(n,t),n},e.createPoint=function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return n.x=e,n.y=t,n},e.createPath=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",t),n&&e.setAttributes(i,n),i},e.createElement=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg",t);return n&&e.setAttributes(i,n),i},e.getHollowRectanglePath=function(e,t,n,i,r,a,s,o){return"M"+e+","+t+"V"+(t+i)+"H"+(e+n)+"V"+t+"H"+r+"V"+a+"H"+(r+s)+"V"+(a+o)+"H"+r+"V"+t+"Z"},e}(),Fe=function(){function e(e){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+e+"_"}return Object.defineProperty(e.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),e.prototype.addClass=function(e){return void 0===this.styleSheet&&this.addStyleSheet(),e.name=""+this.classNamePrefix+e.localName,this.classes.push(e),this.styleSheet.sheet.insertRule("."+e.name+" {"+e.style+"}",this.styleSheet.sheet.cssRules.length),e},e.prototype.addRule=function(e){void 0===this.styleSheet&&this.addStyleSheet(),this.rules.push(e),this.styleSheet.sheet.insertRule(e.selector+" {"+e.style+"}",this.styleSheet.sheet.cssRules.length)},e.prototype.addStyleSheet=function(){var e;this.styleSheet=document.createElement("style"),(null!==(e=this.styleSheetRoot)&&void 0!==e?e:document.head).appendChild(this.styleSheet),this.addRule(new Ue("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ue("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames","\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n ")),this.addRule(new Ue("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames","\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n ")),this.addClass(new Ge("_fade_in","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_in_animation_frames;\n ")),this.addClass(new Ge("_fade_out","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_out_animation_frames;\n "))},e.prototype.removeStyleSheet=function(){var e;this.styleSheet&&((null!==(e=this.styleSheetRoot)&&void 0!==e?e:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},e}(),Ue=function(e,t){this.selector=e,this.style=t},Ge=function(e,t){this.localName=e,this.style=t},He=function(){function e(){this.blocks=[],this.display=""}return e.prototype.addButtonBlock=function(e){e.className=this.blockClassName,e.buttonClassName=this.buttonClassName,e.buttonColorsClassName=this.buttonColorsClassName,e.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(e)},e.prototype.addElementBlock=function(e){void 0===e.className&&(e.className=this.blockClassName),this.blocks.push(e)},e.prototype.getUI=function(){var e=document.createElement("div");return e.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,e.style.display=this.display,this.blocks.forEach((function(t){return e.appendChild(t.getUI())})),e},e}(),Ke=function(){function e(){}return e.prototype.getUI=function(){var e=document.createElement("div");if(e.className=this.className,void 0!==this.minWidth&&(e.style.minWidth=this.minWidth),void 0!==this.contentAlign)switch(this.contentAlign){case"start":e.style.justifyContent="flex-start";break;case"center":e.style.justifyContent="center";break;case"end":e.style.justifyContent="flex-end"}return e.style.whiteSpace="nowrap",e},e}(),ze=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buttons=[],t}return Ne(t,e),t.prototype.addButton=function(e){e.className=this.buttonClassName,e.colorsClassName=this.buttonColorsClassName,e.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(e)},t.prototype.getUI=function(){var t=e.prototype.getUI.call(this);return this.buttons.forEach((function(e){return t.appendChild(e.getUI())})),t},t}(Ke),Ve=function(){function e(e,t){this._isActive=!1,this._isHidden=!1,this._icon=e,this.title=t,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(e.prototype,"icon",{get:function(){return this._icon},set:function(e){this._icon=e,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},set:function(e){this._isActive=e,this.adjustClassName()},enumerable:!1,configurable:!0}),e.prototype.getUI=function(){var e=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",(function(){return e.onClick()})),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},e.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},e.prototype.hide=function(){this._isHidden=!0},e}(),We=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.elements=[],t}return Ne(t,e),t.prototype.addElement=function(e){this.elements.push(e)},t.prototype.getUI=function(){var t=e.prototype.getUI.call(this);return this.elements.forEach((function(e){return t.appendChild(e)})),t},t}(Ke),Ye=function(){function e(e,t){this.horizontal=e,this.vertical=t}return Object.defineProperty(e.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),e.prototype.getVerticalLength=function(e){return e/this.ratio},e.prototype.getHorizontalLength=function(e){return e*this.ratio},e}(),qe=function(){function e(){}return e.getIcon=function(e,t){if(e>0&&t>0){var n=new Ye(e,t),i=n.ratio>=1?20:n.getHorizontalLength(20),r=n.ratio<1?20:n.getVerticalLength(20),a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(a);var s=Be.createDefs();a.appendChild(s);var o=Be.createElement("clipPath",[["id","text-bg-clip"]]);s.appendChild(o);var l=Be.createPath(Be.getHollowRectanglePath((24-i)/2,(24-r)/2,i,r,(24-i)/2+2,(24-r)/2+2,i-4,r-4));a.appendChild(l);var c=Be.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);c.appendChild(Be.createTSpan(e+":"+t)),a.appendChild(c);var u=c.getBBox();Be.setAttributes(c,[["x",((24-u.width)/2).toString()],["y",((24-u.height)/2-u.y).toString()]]);var h=Be.createPath(Be.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(u.width))/2,(24-Math.ceil(u.height))/2,Math.ceil(u.width),Math.ceil(u.height)));return o.appendChild(h),Be.setAttributes(l,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(a),a.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},e}(),Xe=function(e){function t(t,n,i){var r=e.call(this,t,n)||this;return r.isDropdownOpen=!1,r.onClick=r.dropdownButtonClicked,r.dropdownButtons=i,r}return Ne(t,e),t.prototype.setupDropdown=function(){var e=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach((function(t){t.className=e.className,t.colorsClassName=e.colorsClassName,e.dropdownBlock.appendChild(t.getUI())})),this.uiContainer.appendChild(this.dropdownBlock)},t.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},t.prototype.dropdownButtonClicked=function(){void 0===this.dropdownBlock&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},t.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},t.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},t.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},t}(Ve),Qe=function(){function e(e,t){this.GRIP_SIZE=10,this.color=e,this.fillColor=t,this.visual=Be.createGroup(),this.visual.appendChild(Be.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Be.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return e.prototype.ownsTarget=function(e){return e===this.visual||e===this.visual.childNodes[0]||e===this.visual.childNodes[1]},e.prototype.setCenter=function(e,t){this.visual.childNodes.forEach((function(n){return Be.setAttributes(n,[["cx",e.toString()],["cy",t.toString()]])}))},e}(),Je=function(){function e(e,t,n,i){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=e,this.canvasHeight=t,this.margin=n,this.container=i,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(e.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(e){this._aspectRatio=e,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(e){this._isGridVisible=e,this.gridContainer&&Be.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(e){this._zoomFactor=e,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),e.prototype.open=function(){var e=this;this.cropShadeElement=Be.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Be.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var t=0;t<this.numberOfGridLines;t++)this.horizontalGridLines.push(Be.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Be.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach((function(t){return e.gridContainer.appendChild(t)})),this.verticalGridLines.forEach((function(t){return e.gridContainer.appendChild(t)})),this.cropRectElement=Be.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Qe(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Qe(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Qe(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Qe(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},e.prototype.setCropRectangle=function(e){this.cropRect=e;var t=Object.assign({},this.cropRect);1!==this.zoomFactor&&(t.width=this.cropRect.width*this.zoomFactor,t.height=this.cropRect.height*this.zoomFactor,t.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-t.width/2,t.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-t.height/2),Be.setAttributes(this.cropRectElement,[["x",t.x.toString()],["y",t.y.toString()],["width",t.width.toString()],["height",t.height.toString()]]);var n=t.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach((function(e,i){var r=t.y+n*(i+1);Be.setAttributes(e,[["x1",""+t.x],["y1",""+r],["x2",""+(t.x+t.width)],["y2",""+r]])}));var i=t.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach((function(e,n){var r=t.x+i*(n+1);Be.setAttributes(e,[["x1",""+r],["y1",""+t.y],["x2",""+r],["y2",""+(t.y+t.height)]])})),Be.setAttributes(this.cropShadeElement,[["d",Be.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,t.x,t.y,t.width,t.height)]]),this.topLeftGrip.setCenter(t.x,t.y),this.topRightGrip.setCenter(t.x+t.width,t.y),this.bottomLeftGrip.setCenter(t.x,t.y+t.height),this.bottomRightGrip.setCenter(t.x+t.width,t.y+t.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},e.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},e.prototype.clientToLocalCoordinates=function(e,t){var n=this.container.getBoundingClientRect();return{x:e-n.left+this.margin,y:t-n.top+this.margin}},e.prototype.onPointerDown=function(e){this.container.setPointerCapture(e.pointerId),this.previousPoint=this.clientToLocalCoordinates(e.clientX,e.clientY),this.cropRectElement===e.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(e.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(e.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(e.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(e.target)&&(this.activeGrip=this.bottomRightGrip)},e.prototype.onPointerMove=function(e){if(this.isMoving)this.move(this.clientToLocalCoordinates(e.clientX,e.clientY));else if(this.activeGrip){var t=this.clientToLocalCoordinates(e.clientX,e.clientY);this.resize(t)}e.preventDefault()},e.prototype.onPointerUp=function(e){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(e.pointerId)},e.prototype.move=function(e){var t=e.x-this.previousPoint.x,n=e.y-this.previousPoint.y;1!==this.zoomFactor&&(t=-t/this.zoomFactor,n=-n/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+t),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+n),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=e},e.prototype.resize=function(e){var t=Object.assign({},this.cropRect),n=e.x-this.previousPoint.x,i=e.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:t.x+n<this.margin&&(n=this.margin-t.x),t.x+=n,t.width=this.cropRect.x+this.cropRect.width-t.x;break;case this.bottomRightGrip:case this.topRightGrip:t.width+n>this.canvasWidth*this.zoomFactor&&(n=this.canvasWidth*this.zoomFactor-t.width),t.width+=n}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(t.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(n),t.height=this.aspectRatio.getVerticalLength(t.width)):(t.y+=i,t.height=this.cropRect.y+this.cropRect.height-t.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?t.height=this.aspectRatio.getVerticalLength(t.width):t.height+=i}t.width<10&&(t.x=this.cropRect.x,t.width=10),t.height<10&&(t.y=this.cropRect.y,t.height=10),this.previousPoint=e,t.x>=this.margin&&t.y>=this.margin&&t.x-this.margin+t.width<=this.canvasWidth&&t.y-this.margin+t.height<=this.canvasHeight&&(this.cropRect=t,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},e.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var e=this.cropRect.x+this.cropRect.width/2,t=this.cropRect.y+this.cropRect.height/2,n=this.aspectRatio.getHorizontalLength(this.cropRect.height),i=this.aspectRatio.getVerticalLength(this.cropRect.width);n/this.canvasWidth<i/this.canvasHeight?this.cropRect.width=n:this.cropRect.height=i,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=e-this.cropRect.width/2,this.cropRect.y=t-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},e.prototype.getRescaledRect=function(e,t,n,i,r,a){var s=n/e,o=i/t;return{x:(r.x-a)*s+a,y:(r.y-a)*o+a,width:r.width*s,height:r.height*o}},e.prototype.scaleCanvas=function(e,t){var n=this.getRescaledRect(this.canvasWidth,this.canvasHeight,e,t,this.cropRect,this.margin);this.canvasWidth=e,this.canvasHeight=t,this.onCropChange&&this.onCropChange(n),this.setCropRectangle(n)},e}(),Ze=function(){function e(e){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=e,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),e.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},e.prototype.onPointerDown=function(e){this.controlContainer.setPointerCapture(e.pointerId),this.isDragging=!0,this.previousPoint={x:e.clientX,y:e.clientY}},e.prototype.onPointerMove=function(e){this.isDragging&&(this.onAngleChange&&this.onAngleChange((e.clientX-this.previousPoint.x)/5),this.previousPoint.x=e.clientX)},e.prototype.onPointerUp=function(e){this.isDragging&&this.onAngleChange&&this.onAngleChange((e.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(e.pointerId)},e.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var e=this.angleLabelText.getBBox();Be.setAttributes(this.angleLabelElement,[["x",((this.width-e.width)/2).toString()],["y",(this.height/2).toString()]])}},e.prototype.positionScaleShape=function(){if(this.scaleShape){var e=this.scaleShape.transform.baseVal.getItem(0);e.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(e,0)}},e.prototype.getVisual=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width",this.width+"px"),e.setAttribute("height",this.height+"px"),e.setAttribute("viewBox","0 0 "+this.width+" "+this.height),e.style.flexShrink="0",document.body.appendChild(e);for(var t="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,n=1;n<=this.width/5+10;n++){var i=n%5==0?this.height/3:this.height/6;t+="h4v"+-i+"h1v"+i}t+="v1H0Z",this.scaleShape=Be.createPath(t);var r=Be.createTransform();this.scaleShape.transform.baseVal.appendItem(r),e.appendChild(this.scaleShape),this.angleLabelElement=Be.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Be.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var a=Be.createTSpan("");return a.innerHTML="°",this.angleLabelElement.appendChild(a),e.appendChild(this.angleLabelElement),document.body.removeChild(e),e},e}(),$e=function(){function e(){this.naturalSize=!1,this.imageType="image/png"}return e.prototype.rasterize=function(e,t,n,i,r,a,s){var o=this;return new Promise((function(l){var c=document.createElement("canvas");c.width=e.width.baseVal.value-2*i,c.height=e.height.baseVal.value-2*i;var u=1,h=1;!0===o.naturalSize?(u=t.naturalWidth/(e.width.baseVal.value-2*i)/a,h=t.naturalHeight/(e.height.baseVal.value-2*i)/s,c.width=t.naturalWidth/a,c.height=t.naturalHeight/s):void 0!==o.width&&void 0!==o.height&&(u=o.width/n.width,h=o.height/n.height,c.width*=u,c.height*=h);var d=c.getContext("2d");d.translate(c.width/2,c.height/2),d.rotate(r*Math.PI/180),d.scale(a,s),d.translate(-c.width/2,-c.height/2),d.drawImage(t,0,0,c.width,c.height);var f=document.createElement("canvas");f.width=n.width*u,f.height=n.height*h,f.getContext("2d").putImageData(d.getImageData((n.x-i)*u,(n.y-i)*h,n.width*u,n.height*h),0,0),l(f.toDataURL(o.imageType,o.imageQuality))}))},e}(),et=function(){function e(t){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=e.instanceCounter++,this.styles=new Fe(this.instanceNo),this.target=t,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(e.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(e){this._zoomToCropEnabled=e,e?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(e){this._isGridVisible=e,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gridLines",{get:function(){return this._gridLines},set:function(e){this._gridLines=e,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(e){this._rotationAngle=e,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatio",{get:function(){var e;return null!==(e=this._aspectRatio)&&void 0!==e?e:this.aspectRatios[0]},set:function(e){this._aspectRatio=e},enumerable:!1,configurable:!0}),e.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),"popup"===this.displayMode&&this.onPopupResize(),this._isOpen=!0},e.prototype.show=function(){this.showUI(),this.open()},e.prototype.close=function(e){void 0===e&&(e=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.displayMode&&window.removeEventListener("resize",this.setWindowHeight),e||this.closeEventListeners.forEach((function(e){return e()})),this._isOpen=!1)},e.prototype.addRenderEventListener=function(e){this.renderEventListeners.push(e)},e.prototype.removeRenderEventListener=function(e){this.renderEventListeners.indexOf(e)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(e),1)},e.prototype.addCloseEventListener=function(e){this.closeEventListeners.push(e)},e.prototype.removeCloseEventListener=function(e){this.closeEventListeners.indexOf(e)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(e),1)},e.prototype.setupResizeObserver=function(){var e=this;"inline"===this.displayMode?window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){e.resize(e.target.clientWidth,e.target.clientHeight)})),this.targetObserver.observe(this.target)):"popup"===this.displayMode&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},e.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var e=1*this.target.clientWidth/this.target.clientHeight,t=this.contentDiv.clientWidth/e>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*e:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,n=t+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/e;this.resize(t,n)}},e.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},e.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",Be.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},e.prototype.resize=function(e,t){this.imageWidth=Math.round(e),this.imageHeight=Math.round(t),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px","popup"!==this.displayMode?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},e.prototype.setEditingTarget=function(){var e=document.createElement("canvas");e.width=this.target.naturalWidth,e.height=this.target.naturalHeight,e.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var t=e.toDataURL();Be.setAttributes(this.editingTarget,[["href",t]]),this.setEditingTargetSize()},e.prototype.setTopLeft=function(){var e=this.target.getBoundingClientRect(),t=this.editorCanvas.getBoundingClientRect();this.left=e.left-t.left-this.CANVAS_MARGIN,this.top=e.top-t.top-this.CANVAS_MARGIN},e.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=Be.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Be.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Be.createGroup(),this.editingTargetRotationScaleContainer=Be.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var e=Be.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(e);var t=Be.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(t),this.editingTargetContainer=Be.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},e.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},e.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Be.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Je(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},e.prototype.zoomToCrop=function(){if(this.cropRect){var e=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,t=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=e+"px "+t+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-e+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-t+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},e.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},e.prototype.cropRectChanged=function(e){this.cropRect=e,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},e.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},e.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},e.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},e.prototype.showUI=function(){switch(this.addStyles(),"popup"===this.displayMode&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var e=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,t=this.target.offsetTop>e+this.CANVAS_MARGIN?this.target.offsetTop-(e+this.CANVAS_MARGIN):0;this.coverDiv.style.top=t+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=void 0!==this.styles.settings.zIndex?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=void 0!==this.styles.settings.zIndex?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin="popup"===this.displayMode?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,"popup"===this.displayMode&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex","popup"===this.displayMode&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},e.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},e.prototype.addTopToolbar=function(){var e=this;this.topToolbar=new He,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var t=new ze;t.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(t);var n=[];this.aspectRatios.forEach((function(t){var i=new Ve(qe.getIcon(t.horizontal,t.vertical),0===t.horizontal&&0===t.vertical?"FREE":t.horizontal+":"+t.vertical);i.onClick=function(){return e.ratioButtonClicked(t)},n.push(i)})),this.aspectRatioButton=new Xe(qe.getIcon(0,0),"Aspect ratio",n),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,t.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var i=new Ve('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");i.isActive=this.isGridVisible,i.onClick=function(){e.isGridVisible=!e.isGridVisible,i.isActive=e.isGridVisible},t.addButton(i);var r=new Ve('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(r.isActive=this.zoomToCropEnabled,r.onClick=function(){e.zoomToCropEnabled=!e.zoomToCropEnabled,r.isActive=e.zoomToCropEnabled},t.addButton(r),!je.isLicensed){var a=new We;this.topToolbar.addElementBlock(a);var s=document.createElement("div");s.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var o=document.createElement("a");o.style.color="currentColor",o.href="https://markerjs.com/products/cropro",o.target="_blank",o.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',s.appendChild(o),a.addElement(s)}var l=new ze;l.minWidth=3*this.toolbarHeight+"px",l.contentAlign="end",this.topToolbar.addButtonBlock(l);var c=new Ve('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");c.onClick=this.startRenderAndClose,l.addButton(c),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(c.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var u=new Ve('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");u.onClick=this.close,l.addButton(u),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(u.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},e.prototype.addBottomToolbar=function(){var e=this;this.bottomToolbar=new He,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var t=new ze;t.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(t);var n=new Ve('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");n.onClick=this.rotateLeftButtonClicked,t.addButton(n);var i=new Ve('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");i.onClick=this.rotateRightButtonClicked,t.addButton(i);var r=new We;r.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(r),this.straightener=new Ze("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(t){e.rotateBy(t),e.straightener.angle=e.rotationAngle},r.addElement(this.straightener.getUI());var a=new ze;a.minWidth=2*this.toolbarHeight+"px",a.contentAlign="end",this.bottomToolbar.addButtonBlock(a);var s=new Ve('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");s.onClick=this.flipHorizontallyButtonClicked,a.addButton(s);var o=new Ve('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");o.onClick=this.flipVerticallyButtonClicked,a.addButton(o)},e.prototype.ratioButtonClicked=function(e){this.aspectRatio=e,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},e.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=qe.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},e.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&0!==this.aspectRatio.horizontal&&0!==this.aspectRatio.vertical?this.cropLayer.aspectRatio=new Ye(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},e.prototype.closeUI=function(){"popup"===this.displayMode&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},e.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},e.prototype.restoreState=function(e){if(e){var t=this.cropLayer.getRescaledRect(e.width,e.height,this.imageWidth,this.imageHeight,e.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(t),this.cropRectChanged(t),this.flippedHorizontally=e.flippedHorizontally,this.flippedVertically=e.flippedVertically,this.applyFlip(),this.rotationAngle=e.rotationAngle,this.applyRotation()}},e.prototype.clientToLocalCoordinates=function(e,t){var n=this.cropImage.getBoundingClientRect();return{x:e-n.left,y:t-n.top}},e.prototype.onWindowResize=function(){this.positionUI()},e.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var e=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=e+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},e.prototype.rotateLeftButtonClicked=function(){var e=this.rotationAngle-90;this.rotationAngle%90!=0&&(e+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(e)},e.prototype.rotateRightButtonClicked=function(){var e=this.rotationAngle+90;this.rotationAngle%90!=0&&(e-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(e)},e.prototype.rotateTo=function(e){e=(e=e>180?e-360:e)<=-180?e+360:e,this.rotationAngle=e,this.applyRotation()},e.prototype.rotateBy=function(e){this.rotateTo((this.rotationAngle+e)%360)},e.prototype.applyRotation=function(){var e=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var t=this.editingTargetRotationContainer.transform.baseVal.getItem(0);t.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(t,0);var n=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/n.width,this.imageHeight/n.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=e},e.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},e.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},e.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},e.prototype.startRenderAndClose=function(){return Pe(this,void 0,void 0,(function(){var e,t;return Me(this,(function(n){switch(n.label){case 0:return[4,this.render()];case 1:return e=n.sent(),t=this.getState(),this.renderEventListeners.forEach((function(n){return n(e,t)})),this.close(!0),[2]}}))}))},e.prototype.render=function(){return Pe(this,void 0,void 0,(function(){var e;return Me(this,(function(t){switch(t.label){case 0:return(e=new $e).naturalSize=this.renderAtNaturalSize,e.imageType=this.renderImageType,e.imageQuality=this.renderImageQuality,e.width=this.renderWidth,e.height=this.renderHeight,this.unzoomFromCrop(),Be.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,e.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return t.sent(),[4,e.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,t.sent()]}}))}))},e.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ge("toolbar","\n width: "+("inline"===this.displayMode?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+";\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between; \n height: "+this.toolbarHeight+"px;\n box-sizing: content-box;\n overflow: hidden;\n line-height: 0px;\n ")),this.toolbarStyleColorsClass=this.styles.addClass(new Ge("toolbar_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarBlockStyleClass=this.styles.addClass(new Ge("toolbar-block","\n display: flex;\n align-items: center;\n box-sizing: content-box;\n "));var e=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ge("toolbar_button","\n display: inline-block;\n width: "+(this.toolbarHeight-2*e)+"px;\n height: "+(this.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ge("toolbar_button_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n ")),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ge("toolbar_active_button","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n background-color: "+this.styles.settings.toolbarBackgroundActiveColor+"\n ")),this.styles.addRule(new Ue("."+this.toolbarButtonStyleClass.name+" svg","\n height: "+this.toolbarHeight/2+"px;\n ")),this.styles.addRule(new Ue("."+this.toolbarButtonStyleColorsClass.name+":hover","\n background-color: "+this.styles.settings.toolbarBackgroundHoverColor+"\n ")),this.toolbarDropdownStyleClass=this.styles.addClass(new Ge("toolbar_dropdown","\n position: absolute;\n max-width: "+4*this.toolbarHeight+"px;\n z-index: 20;\n white-space: normal;\n box-sizing: content-box;\n box-shadow: 3px 3px rgba(33, 33, 33, 0.1);\n margin: "+("inline"===this.displayMode?"0":this.popupMargin)+"px;\n line-height: 0px;\n ")),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Ge("toolbar_dropdown_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ge("toolbar_straightener_block","\n display: flex;\n overflow: hidden;\n justify-content: center;\n -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);\n ")),this.toolbarStraightenerStyleClass=this.styles.addClass(new Ge("toolbar_straightener","\n display: flex;\n overflow: hidden;\n justify-content: center;\n height: "+(this.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ge("toolbar_straightener_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n "))},e.instanceCounter=0,e}(),tt=n("8hTe"),nt=n.n(tt),it=/<pre[^>]*>/g;t.a=function(e){var t=e.value,n=void 0===t?"":t,l=e.edit,d=void 0!==l&&l,f=e.className,p=e.showTextOnly,g=e.showLines,v=e.replaces,m=e.zoomImg,y=e.hasMask,C=e.style,S=void 0===C?{}:C,x=e.stylesPrev,w=void 0===x?{}:x,O=String(n),A=Object(u.useRef)(),L=Object(u.useRef)(),D=Object(u.useState)(""),I=Object(o.a)(D,2),F=I[0],U=I[1],G=Object(u.useState)("office"),H=Object(o.a)(G,2),K=H[0],z=H[1],V=Object(u.useMemo)((function(){try{O=(O=O.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+P.a.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+P.a.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+P.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=R(O),t=T;if(O.match(/\[TOC\]/)&&(e=e.replace("<p>[TOC]</p>",k()),b()),e=(e=e.replace(/(__special_katext_id_\d+__)/g,(function(e,n){var i=t[n],r=i.type,a=i.expression;return Object(M.renderToString)(function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue}(a)||"",{displayMode:"block"===r,throwOnError:!1,output:"html"})}))).replace(/▁/g,"▁▁▁"),_(),p){var n=document.createElement("div");return n.innerHTML=e,n.innerText}return setTimeout((function(){return q()}),500),e}),[O]),W=Object(u.useRef)();function Y(e){var t=e.target;if("IMG"===t.tagName.toUpperCase()){if(m){var n=t.getAttribute("src");U(n),z("image")}}else if("A"===t.tagName.toUpperCase()){var i=t.getAttribute("href");if(i.indexOf("office")>-1)e.preventDefault(),U(i),z("office");else if(i.indexOf("application/pdf")>-1)e.preventDefault(),U(i),z("pdf");else if(i.indexOf("type=text")>-1)e.preventDefault(),U(i),z("html");else if(i.startsWith("#")){e.preventDefault();var r=document.getElementById(i.replace("#",""));r&&r.scrollIntoView(!0)}}}E.WebkitLineClamp=g,g&&(S=Object(a.a)(Object(a.a)({},S),E));var q=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(N.a.isSupported()){var t=new N.a;t.loadSource(e.src),t.attachMedia(e)}}))};Object(u.useEffect)((function(){if(W.current&&V&&V.match(it)&&window.PR.prettyPrint(),W.current)return W.current.addEventListener("click",Y),function(){W.current.removeEventListener("click",Y),_(),b()}}),[V,W.current,Y]);return h.a.createElement("div",{style:{position:"relative"}},h.a.createElement("div",{ref:W,style:Object(a.a)({},S),className:"".concat(f||""," markdown-body ").concat(nt.a.mdBody),onMouseOver:function(e){d&&("IMG"===e.target.nodeName?(A.current.style.display="flex",A.current.style.width=e.target.clientWidth+"px",A.current.style.height=e.target.clientHeight+"px",A.current.style.top=e.target.offsetTop+"px",A.current.style.left=e.target.offsetLeft+"px",L.current.src=e.target.getAttribute("src")):A.current.style.display="none")},dangerouslySetInnerHTML:{__html:V}}),h.a.createElement("div",{ref:A,className:nt.a.button},h.a.createElement(i.a,null,h.a.createElement(r.a,{onClick:function(){return(e=new et(L.current)).displayMode="popup",e.addRenderEventListener(function(){var e=Object(s.a)(c.a.mark((function e(t){var n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return A.current.style.display="none",e.next=3,Object(B.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:t}});case 3:null!=(n=e.sent)&&n.id&&v(L.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==n?void 0:n.id,"?type=").concat(n.content_type));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),void e.show();var e}},"裁剪"),h.a.createElement(r.a,{onClick:function(){return(e=new Re(L.current)).settings.displayMode="popup",e.addEventListener("render",function(){var e=Object(s.a)(c.a.mark((function e(t){var n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(A.current.style.display="none",!L.current){e.next=6;break}return e.next=4,Object(B.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:t.dataUrl}});case 4:null!=(n=e.sent)&&n.id&&v(L.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==n?void 0:n.id,"?type=").concat(n.content_type));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.show(),void(window.markerArea=e);var e}},"编辑"))),h.a.createElement("img",{ref:L,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),h.a.createElement(j.a,{close:!0,data:F,hasMask:y,type:null!=F&&F.length?K:"",style:Object(a.a)({},w),onClose:function(){return U("")}}))}},"A60/":
|
|
|
/*!**************************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/BasketSideBar/index.less?modules ***!
|
|
|
\**************************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={wrap:"wrap___37dvp",right20:"right20___2yZBe",right180:"right180___14fSn",basket:"basket___32ZdA",count:"count___2ydNT",iconWrap:"iconWrap___2cEp5",icon:"icon___3fYs3",name:"name___7IPYm"}},BU3w:
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./node_modules/rc-util/es/Dom/dynamicCSS.js ***!
|
|
|
\***************************************************/
|
|
|
/*! exports provided: injectCSS, updateCSS */
|
|
|
/*! exports used: updateCSS */function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var i=n(/*! ./canUseDom */"MNnm");function r(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function a(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object(i.a)())return null;var a,s=document.createElement("style");(null===(t=n.csp)||void 0===t?void 0:t.nonce)&&(s.nonce=null===(a=n.csp)||void 0===a?void 0:a.nonce);s.innerHTML=e;var o=r(n),l=o.firstChild;return n.prepend&&o.prepend?o.prepend(s):n.prepend&&l?o.insertBefore(s,l):o.appendChild(s),s}var s=new Map;function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(n);if(!s.has(i)){var o=a("",n),l=o.parentNode;s.set(i,l),l.removeChild(o)}var c=Array.from(s.get(i).children).find((function(e){return"STYLE"===e.tagName&&e["rc-util-key"]===t}));if(c){var u,h,d;if((null===(u=n.csp)||void 0===u?void 0:u.nonce)&&c.nonce!==(null===(h=n.csp)||void 0===h?void 0:h.nonce))c.nonce=null===(d=n.csp)||void 0===d?void 0:d.nonce;return c.innerHTML!==e&&(c.innerHTML=e),c}var f=a(e,n);return f["rc-util-key"]=t,f}},BdwD:
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./src/components/NoData/index.tsx ***!
|
|
|
\*****************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,n){"use strict";n(/*! antd/es/button/style */"+L6B");var i=n(/*! antd/es/button */"2/Rp"),r=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends */"0Owb"),a=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),s=n(/*! react */"q1tI"),o=n.n(s),l=n(/*! @/assets/images/icons/nodata.png */"FOrL"),c=n.n(l);t.a=function(e){var t=e.buttonProps,n=void 0===t?{}:t,s=e.styles,l=void 0===s?{}:s,u=e.customText,h=e.ButtonText,d=e.ButtonClick,f=e.Buttonclass,p=e.ButtonTwo;return o.a.createElement("section",{className:"tc animated fadeIn",style:Object(a.a)(Object(a.a)({},{color:"#999",margin:"200px auto"}),l)},o.a.createElement("img",{src:c.a}),o.a.createElement("p",{className:"mt20 font14"},u||"暂时还没有相关数据哦!"),h&&o.a.createElement(i.a,Object(r.a)({className:f,onClick:d},n),h),p&&p)}},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,n){e.exports=function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function n(e,n){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=function(e,n){if(e){if("string"==typeof e)return t(e,n);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?t(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){i&&(e=i);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}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(i=e[Symbol.iterator]()).next.bind(i)}var i=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}}})),r=(i.defaults,i.getDefaults,i.changeDefaults,/[&<>"']/),a=/[&<>"']/g,s=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,l={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(e){return l[e]},u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function h(e){return e.replace(u,(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 d=/(^|[^\[])\^/g,f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,g={},v=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function b(e,t){g[" "+e]||(v.test(e)?g[" "+e]=e+"/":g[" "+e]=E(e,"/",!0));var n=-1===(e=g[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(m,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(y,"$1")+t:e+t}function E(e,t,n){var i=e.length;if(0===i)return"";for(var r=0;r<i;){var a=e.charAt(i-r-1);if(a!==t||n){if(a===t||!n)break;r++}else r++}return e.substr(0,i-r)}var k=function(e,t){if(t){if(r.test(e))return e.replace(a,c)}else if(s.test(e))return e.replace(o,c);return e},C=h,S=function(e,t){e=e.source||e,t=t||"";var n={replace:function(t,i){return i=(i=i.source||i).replace(d,"$1"),e=e.replace(t,i),n},getRegex:function(){return new RegExp(e,t)}};return n},x=function(e,t,n){if(e){var i;try{i=decodeURIComponent(h(n)).replace(f,"").toLowerCase()}catch(e){return null}if(0===i.indexOf("javascript:")||0===i.indexOf("vbscript:")||0===i.indexOf("data:"))return null}t&&!p.test(n)&&(n=b(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n},w={exec:function(){}},T=function(e){for(var t,n,i=1;i<arguments.length;i++)for(n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},_=function(e,t){var n=e.replace(/\|/g,(function(e,t,n){for(var i=!1,r=t;--r>=0&&"\\"===n[r];)i=!i;return i?"|":" |"})).split(/ \|/),i=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n},O=E,A=function(e,t){if(-1===e.indexOf(t[1]))return-1;for(var n=e.length,i=0,r=0;r<n;r++)if("\\"===e[r])r++;else if(e[r]===t[0])i++;else if(e[r]===t[1]&&--i<0)return r;return-1},L=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")},D=i.defaults,R=O,I=_,N=k,P=A;function M(e,t,n){var i=t.href,r=t.title?N(t.title):null,a=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:n,href:i,title:r,text:a}:{type:"image",raw:n,href:i,title:r,text:N(a)}}var j=function(){function e(e){this.options=e||D}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 n=this.rules.block.code.exec(e);if(n){var i=t[t.length-1];if(i&&"paragraph"===i.type)return{raw:n[0],text:n[0].trimRight()};var r=n[0].replace(/^ {4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:R(r,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var n=t[0],i=function(e,t){var n=e.match(/^(\s+)(?:```)/);if(null===n)return t;var i=n[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=i.length?e.slice(i.length):e})).join("\n")}(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim():t[2],text:i}}},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 n={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(n.header.length===n.align.length){var i,r=n.align.length;for(i=0;i<r;i++)/^ *-+: *$/.test(n.align[i])?n.align[i]="right":/^ *:-+: *$/.test(n.align[i])?n.align[i]="center":/^ *:-+ *$/.test(n.align[i])?n.align[i]="left":n.align[i]=null;for(r=n.cells.length,i=0;i<r;i++)n.cells[i]=I(n.cells[i],n.header.length);return n}}},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 n=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],text:n}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){for(var n,i,r,a,s,o,l,c=t[0],u=t[2],h=u.length>1,d=")"===u[u.length-1],f={type:"list",raw:c,ordered:h,start:h?+u.slice(0,-1):"",loose:!1,items:[]},p=t[0].match(this.rules.block.item),g=!1,v=p.length,m=0;m<v;m++)c=n=p[m],i=n.length,~(n=n.replace(/^ *([*+-]|\d+[.)]) */,"")).indexOf("\n ")&&(i-=n.length,n=this.options.pedantic?n.replace(/^ {1,4}/gm,""):n.replace(new RegExp("^ {1,"+i+"}","gm"),"")),m!==v-1&&(r=this.rules.block.bullet.exec(p[m+1])[0],(h?1===r.length||!d&&")"===r[r.length-1]:r.length>1||this.options.smartLists&&r!==u)&&(a=p.slice(m+1).join("\n"),f.raw=f.raw.substring(0,f.raw.length-a.length),m=v-1)),s=g||/\n\n(?!\s*$)/.test(n),m!==v-1&&(g="\n"===n.charAt(n.length-1),s||(s=g)),s&&(f.loose=!0),l=void 0,(o=/^\[[ xX]\] /.test(n))&&(l=" "!==n[1],n=n.replace(/^\[[ xX]\] +/,"")),f.items.push({type:"list_item",raw:c,task:o,checked:l,loose:s,text:n});return f}},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]):N(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 n={type:"table",header:I(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(n.header.length===n.align.length){n.raw=t[0];var i,r=n.align.length;for(i=0;i<r;i++)/^ *-+: *$/.test(n.align[i])?n.align[i]="right":/^ *:-+: *$/.test(n.align[i])?n.align[i]="center":/^ *:-+ *$/.test(n.align[i])?n.align[i]="left":n.align[i]=null;for(r=n.cells.length,i=0;i<r;i++)n.cells[i]=I(n.cells[i].replace(/^ *\| *| *\| *$/g,""),n.header.length);return n}}},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 n=this.rules.block.text.exec(e);if(n){var i=t[t.length-1];return i&&"text"===i.type?{raw:n[0],text:n[0]}:{type:"text",raw:n[0],text:n[0]}}},t.escape=function(e){var t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:N(t[1])}},t.tag=function(e,t,n){var i=this.rules.inline.tag.exec(e);if(i)return!t&&/^<a /i.test(i[0])?t=!0:t&&/^<\/a>/i.test(i[0])&&(t=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:i[0],inLink:t,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):N(i[0]):i[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var n=P(t[2],"()");if(n>-1){var i=(0===t[0].indexOf("!")?5:4)+t[1].length+n;t[2]=t[2].substring(0,n),t[0]=t[0].substring(0,i).trim(),t[3]=""}var r=t[2],a="";if(this.options.pedantic){var s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);s?(r=s[1],a=s[3]):a=""}else a=t[3]?t[3].slice(1,-1):"";return M(t,{href:(r=r.trim().replace(/^<([\s\S]*)>$/,"$1"))?r.replace(this.rules.inline._escapes,"$1"):r,title:a?a.replace(this.rules.inline._escapes,"$1"):a},t[0])}},t.reflink=function(e,t){var n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){var i=(n[2]||n[1]).replace(/\s+/g," ");if(!(i=t[i.toLowerCase()])||!i.href){var r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return M(n,i,n[0])}},t.strong=function(e,t,n){void 0===n&&(n="");var i=this.rules.inline.strong.start.exec(e);if(i&&(!i[1]||i[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var r,a="**"===i[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(a.lastIndex=0;null!=(i=a.exec(t));)if(r=this.rules.inline.strong.middle.exec(t.slice(0,i.index+3)))return{type:"strong",raw:e.slice(0,r[0].length),text:e.slice(2,r[0].length-2)}}},t.em=function(e,t,n){void 0===n&&(n="");var i=this.rules.inline.em.start.exec(e);if(i&&(!i[1]||i[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){t=t.slice(-1*e.length);var r,a="*"===i[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(a.lastIndex=0;null!=(i=a.exec(t));)if(r=this.rules.inline.em.middle.exec(t.slice(0,i.index+2)))return{type:"em",raw:e.slice(0,r[0].length),text:e.slice(1,r[0].length-1)}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var n=t[2].replace(/\n/g," "),i=/[^ ]/.test(n),r=n.startsWith(" ")&&n.endsWith(" ");return i&&r&&(n=n.substring(1,n.length-1)),n=N(n,!0),{type:"codespan",raw:t[0],text:n}}},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 n,i,r=this.rules.inline.autolink.exec(e);if(r)return i="@"===r[2]?"mailto:"+(n=N(this.options.mangle?t(r[1]):r[1])):n=N(r[1]),{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}},t.url=function(e,t){var n;if(n=this.rules.inline.url.exec(e)){var i,r;if("@"===n[2])r="mailto:"+(i=N(this.options.mangle?t(n[0]):n[0]));else{var a;do{a=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(a!==n[0]);i=N(n[0]),r="www."===n[1]?"http://"+i:i}return{type:"link",raw:n[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}},t.inlineText=function(e,t,n){var i,r=this.rules.inline.text.exec(e);if(r)return i=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):N(r[0]):r[0]:N(this.options.smartypants?n(r[0]):r[0]),{type:"text",raw:r[0],text:i}},e}(),B=w,F=S,U=T,G={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?'|\([^()]*\))/};G.def=F(G.def).replace("label",G._label).replace("title",G._title).getRegex(),G.bullet=/(?:[*+-]|\d{1,9}[.)])/,G.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,G.item=F(G.item,"gm").replace(/bull/g,G.bullet).getRegex(),G.list=F(G.list).replace(/bull/g,G.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+G.def.source+")").getRegex(),G._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",G._comment=/<!--(?!-?>)[\s\S]*?-->/,G.html=F(G.html,"i").replace("comment",G._comment).replace("tag",G._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),G.paragraph=F(G._paragraph).replace("hr",G.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",G._tag).getRegex(),G.blockquote=F(G.blockquote).replace("paragraph",G.paragraph).getRegex(),G.normal=U({},G),G.gfm=U({},G.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*|$)"}),G.gfm.nptable=F(G.gfm.nptable).replace("hr",G.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",G._tag).getRegex(),G.gfm.table=F(G.gfm.table).replace("hr",G.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",G._tag).getRegex(),G.pedantic=U({},G.normal,{html:F("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",G._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:F(G.normal._paragraph).replace("hr",G.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",G.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var H={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:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};H.punctuation=F(H.punctuation).replace(/punctuation/g,H._punctuation).getRegex(),H._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",H._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",H.em.start=F(H.em.start).replace(/punctuation/g,H._punctuation).getRegex(),H.em.middle=F(H.em.middle).replace(/punctuation/g,H._punctuation).replace(/overlapSkip/g,H._overlapSkip).getRegex(),H.em.endAst=F(H.em.endAst,"g").replace(/punctuation/g,H._punctuation).getRegex(),H.em.endUnd=F(H.em.endUnd,"g").replace(/punctuation/g,H._punctuation).getRegex(),H.strong.start=F(H.strong.start).replace(/punctuation/g,H._punctuation).getRegex(),H.strong.middle=F(H.strong.middle).replace(/punctuation/g,H._punctuation).replace(/blockSkip/g,H._blockSkip).getRegex(),H.strong.endAst=F(H.strong.endAst,"g").replace(/punctuation/g,H._punctuation).getRegex(),H.strong.endUnd=F(H.strong.endUnd,"g").replace(/punctuation/g,H._punctuation).getRegex(),H.blockSkip=F(H._blockSkip,"g").getRegex(),H.overlapSkip=F(H._overlapSkip,"g").getRegex(),H._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,H._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,H._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])?)+(?![-_])/,H.autolink=F(H.autolink).replace("scheme",H._scheme).replace("email",H._email).getRegex(),H._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,H.tag=F(H.tag).replace("comment",G._comment).replace("attribute",H._attribute).getRegex(),H._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,H._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,H._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,H.link=F(H.link).replace("label",H._label).replace("href",H._href).replace("title",H._title).getRegex(),H.reflink=F(H.reflink).replace("label",H._label).getRegex(),H.reflinkSearch=F(H.reflinkSearch,"g").replace("reflink",H.reflink).replace("nolink",H.nolink).getRegex(),H.normal=U({},H),H.pedantic=U({},H.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:F(/^!?\[(label)\]\((.*?)\)/).replace("label",H._label).getRegex(),reflink:F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",H._label).getRegex()}),H.gfm=U({},H.normal,{escape:F(H.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),H.gfm.url=F(H.gfm.url,"i").replace("email",H.gfm._extended_email).getRegex(),H.breaks=U({},H.gfm,{br:F(H.br).replace("{2,}","*").getRegex(),text:F(H.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var K={block:G,inline:H},z=i.defaults,V=K.block,W=K.inline;function Y(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 q(e){var t,n,i="",r=e.length;for(t=0;t<r;t++)n=e.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),i+="&#"+n+";";return i}var X=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||z,this.options.tokenizer=this.options.tokenizer||new j,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:V.normal,inline:W.normal};this.options.pedantic?(t.block=V.pedantic,t.inline=W.pedantic):this.options.gfm&&(t.block=V.gfm,this.options.breaks?t.inline=W.breaks:t.inline=W.gfm),this.tokenizer.rules=t}t.lex=function(e,n){return new t(n).lex(e)};var n,i,r,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,n){var i,r,a,s;for(void 0===t&&(t=[]),void 0===n&&(n=!0),e=e.replace(/^ +$/gm,"");e;)if(i=this.tokenizer.space(e))e=e.substring(i.raw.length),i.type&&t.push(i);else if(i=this.tokenizer.code(e,t))e=e.substring(i.raw.length),i.type?t.push(i):((s=t[t.length-1]).raw+="\n"+i.raw,s.text+="\n"+i.text);else if(i=this.tokenizer.fences(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.heading(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.nptable(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.hr(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.blockquote(e))e=e.substring(i.raw.length),i.tokens=this.blockTokens(i.text,[],n),t.push(i);else if(i=this.tokenizer.list(e)){for(e=e.substring(i.raw.length),a=i.items.length,r=0;r<a;r++)i.items[r].tokens=this.blockTokens(i.items[r].text,[],!1);t.push(i)}else if(i=this.tokenizer.html(e))e=e.substring(i.raw.length),t.push(i);else if(n&&(i=this.tokenizer.def(e)))e=e.substring(i.raw.length),this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});else if(i=this.tokenizer.table(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.lheading(e))e=e.substring(i.raw.length),t.push(i);else if(n&&(i=this.tokenizer.paragraph(e)))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.text(e,t))e=e.substring(i.raw.length),i.type?t.push(i):((s=t[t.length-1]).raw+="\n"+i.raw,s.text+="\n"+i.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,n,i,r,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:[]},r=s.header.length,n=0;n<r;n++)s.tokens.header[n]=[],this.inlineTokens(s.header[n],s.tokens.header[n]);for(r=s.cells.length,n=0;n<r;n++)for(a=s.cells[n],s.tokens.cells[n]=[],i=0;i<a.length;i++)s.tokens.cells[n][i]=[],this.inlineTokens(a[i],s.tokens.cells[n][i]);break;case"blockquote":this.inline(s.tokens);break;case"list":for(r=s.items.length,n=0;n<r;n++)this.inline(s.items[n].tokens)}return e},a.inlineTokens=function(e,t,n,i,r){var a;void 0===t&&(t=[]),void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===r&&(r="");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,n,i))e=e.substring(a.raw.length),n=a.inLink,i=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,i)),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,i)),t.push(a);else if(a=this.tokenizer.strong(e,o,r))e=e.substring(a.raw.length),a.tokens=this.inlineTokens(a.text,[],n,i),t.push(a);else if(a=this.tokenizer.em(e,o,r))e=e.substring(a.raw.length),a.tokens=this.inlineTokens(a.text,[],n,i),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,[],n,i),t.push(a);else if(a=this.tokenizer.autolink(e,q))e=e.substring(a.raw.length),t.push(a);else if(n||!(a=this.tokenizer.url(e,q))){if(a=this.tokenizer.inlineText(e,i,Y))e=e.substring(a.raw.length),r=a.raw.slice(-1),t.push(a);else if(e){var c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}}else e=e.substring(a.raw.length),t.push(a);return t},n=t,r=[{key:"rules",get:function(){return{block:V,inline:W}}}],(i=null)&&e(n.prototype,i),r&&e(n,r),t}(),Q=i.defaults,J=x,Z=k,$=function(){function e(e){this.options=e||Q}var t=e.prototype;return t.code=function(e,t,n){var i=(t||"").match(/\S*/)[0];if(this.options.highlight){var r=this.options.highlight(e,i);null!=r&&r!==e&&(n=!0,e=r)}return i?'<pre><code class="'+this.options.langPrefix+Z(i,!0)+'">'+(n?e:Z(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:Z(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,n,i){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+i.slug(n)+'">'+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,n){var i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+i+">\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 n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\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,n){if(null===(e=J(this.options.sanitize,this.options.baseUrl,e)))return n;var i='<a href="'+Z(e)+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>"},t.image=function(e,t,n){if(null===(e=J(this.options.sanitize,this.options.baseUrl,e)))return n;var i='<img src="'+e+'" alt="'+n+'"';return t&&(i+=' title="'+t+'"'),i+=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,n){return""+n},t.image=function(e,t,n){return""+n},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 n=t;do{this.seen[n]++,t=n+"-"+this.seen[n]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t},e}(),ne=i.defaults,ie=C,re=function(){function e(e){this.options=e||ne,this.options.renderer=this.options.renderer||new $,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ee,this.slugger=new te}e.parse=function(t,n){return new e(n).parse(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var n,i,r,a,s,o,l,c,u,h,d,f,p,g,v,m,y,b,E="",k=e.length;for(n=0;n<k;n++)switch((h=e[n]).type){case"space":continue;case"hr":E+=this.renderer.hr();continue;case"heading":E+=this.renderer.heading(this.parseInline(h.tokens),h.depth,ie(this.parseInline(h.tokens,this.textRenderer)),this.slugger);continue;case"code":E+=this.renderer.code(h.text,h.lang,h.escaped);continue;case"table":for(c="",l="",a=h.header.length,i=0;i<a;i++)l+=this.renderer.tablecell(this.parseInline(h.tokens.header[i]),{header:!0,align:h.align[i]});for(c+=this.renderer.tablerow(l),u="",a=h.cells.length,i=0;i<a;i++){for(l="",s=(o=h.tokens.cells[i]).length,r=0;r<s;r++)l+=this.renderer.tablecell(this.parseInline(o[r]),{header:!1,align:h.align[r]});u+=this.renderer.tablerow(l)}E+=this.renderer.table(c,u);continue;case"blockquote":u=this.parse(h.tokens),E+=this.renderer.blockquote(u);continue;case"list":for(d=h.ordered,f=h.start,p=h.loose,a=h.items.length,u="",i=0;i<a;i++)m=(v=h.items[i]).checked,y=v.task,g="",v.task&&(b=this.renderer.checkbox(m),p?v.tokens.length>0&&"text"===v.tokens[0].type?(v.tokens[0].text=b+" "+v.tokens[0].text,v.tokens[0].tokens&&v.tokens[0].tokens.length>0&&"text"===v.tokens[0].tokens[0].type&&(v.tokens[0].tokens[0].text=b+" "+v.tokens[0].tokens[0].text)):v.tokens.unshift({type:"text",text:b}):g+=b),g+=this.parse(v.tokens,p),u+=this.renderer.listitem(g,y,m);E+=this.renderer.list(u,d,f);continue;case"html":E+=this.renderer.html(h.text);continue;case"paragraph":E+=this.renderer.paragraph(this.parseInline(h.tokens));continue;case"text":for(u=h.tokens?this.parseInline(h.tokens):h.text;n+1<k&&"text"===e[n+1].type;)u+="\n"+((h=e[++n]).tokens?this.parseInline(h.tokens):h.text);E+=t?this.renderer.paragraph(u):u;continue;default:var C='Token with "'+h.type+'" type was not found.';if(this.options.silent)return void console.error(C);throw new Error(C)}return E},t.parseInline=function(e,t){t=t||this.renderer;var n,i,r="",a=e.length;for(n=0;n<a;n++)switch((i=e[n]).type){case"escape":r+=t.text(i.text);break;case"html":r+=t.html(i.text);break;case"link":r+=t.link(i.href,i.title,this.parseInline(i.tokens,t));break;case"image":r+=t.image(i.href,i.title,i.text);break;case"strong":r+=t.strong(this.parseInline(i.tokens,t));break;case"em":r+=t.em(this.parseInline(i.tokens,t));break;case"codespan":r+=t.codespan(i.text);break;case"br":r+=t.br();break;case"del":r+=t.del(this.parseInline(i.tokens,t));break;case"text":r+=t.text(i.text);break;default:var s='Token with "'+i.type+'" type was not found.';if(this.options.silent)return void console.error(s);throw new Error(s)}return r},e}(),ae=T,se=L,oe=k,le=i.getDefaults,ce=i.changeDefaults,ue=i.defaults;function he(e,t,n){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&&(n=t,t=null),t=ae({},he.defaults,t||{}),se(t),n){var i,r=t.highlight;try{i=X.lex(e,t)}catch(e){return n(e)}var a=function(e){var a;if(!e)try{a=re.parse(i,t)}catch(t){e=t}return t.highlight=r,e?n(e):n(null,a)};if(!r||r.length<3)return a();if(delete t.highlight,!i.length)return a();var s=0;return he.walkTokens(i,(function(e){"code"===e.type&&(s++,setTimeout((function(){r(e.text,e.lang,(function(t,n){if(t)return a(t);null!=n&&n!==e.text&&(e.text=n,e.escaped=!0),0==--s&&a()}))}),0))})),void(0===s&&a())}try{var o=X.lex(e,t);return t.walkTokens&&he.walkTokens(o,t.walkTokens),re.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 he.options=he.setOptions=function(e){return ae(he.defaults,e),ce(he.defaults),he},he.getDefaults=le,he.defaults=ue,he.use=function(e){var t=ae({},e);if(e.renderer&&function(){var n=he.defaults.renderer||new $,i=function(t){var i=n[t];n[t]=function(){for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];var o=e.renderer[t].apply(n,a);return!1===o&&(o=i.apply(n,a)),o}};for(var r in e.renderer)i(r);t.renderer=n}(),e.tokenizer&&function(){var n=he.defaults.tokenizer||new j,i=function(t){var i=n[t];n[t]=function(){for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];var o=e.tokenizer[t].apply(n,a);return!1===o&&(o=i.apply(n,a)),o}};for(var r in e.tokenizer)i(r);t.tokenizer=n}(),e.walkTokens){var n=he.defaults.walkTokens;t.walkTokens=function(t){e.walkTokens(t),n&&n(t)}}he.setOptions(t)},he.walkTokens=function(e,t){for(var i,r=n(e);!(i=r()).done;){var a=i.value;switch(t(a),a.type){case"table":for(var s,o=n(a.tokens.header);!(s=o()).done;){var l=s.value;he.walkTokens(l,t)}for(var c,u=n(a.tokens.cells);!(c=u()).done;)for(var h,d=n(c.value);!(h=d()).done;){var f=h.value;he.walkTokens(f,t)}break;case"list":he.walkTokens(a.items,t);break;default:a.tokens&&he.walkTokens(a.tokens,t)}}},he.Parser=re,he.parser=re.parse,he.Renderer=$,he.TextRenderer=ee,he.Lexer=X,he.lexer=X.lex,he.Tokenizer=j,he.Slugger=te,he.parse=he,he}()},FOrL:
|
|
|
/*!********************************************!*\
|
|
|
!*** ./src/assets/images/icons/nodata.png ***!
|
|
|
\********************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports=n.p+"static/nodata.a6b3f948.png"},IPdS:
|
|
|
/*!*************************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/BasketDrawer/index.less?modules ***!
|
|
|
\*************************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={drawerWrap:"drawerWrap___nRvfD",title:"title___e_1lX",problemset:"problemset___1u9oP",content:"content___1WwQ5",delete:"delete___3Q7nc",deleteIcon:"deleteIcon___ObOyh",previewWrap:"previewWrap___25lTY",preview:"preview___3uiyE"}},JUtD:
|
|
|
/*!*****************************************************!*\
|
|
|
!*** ./src/pages/Problemset/index.tsx + 19 modules ***!
|
|
|
\*****************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! all exports used */
|
|
|
/*! 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/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/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/toConsumableArray.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/Problemset/components/AddModal/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/BasketDrawer/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/BasketSideBar/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/Crumbs/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/ExportFolderModal/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/Folder/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/SelectShixuns/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/ShareModal/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/TeachGroup/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/Topic/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/components/index.less?modules (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Problemset/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/CustomTree/index.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/LanguageSelect/index.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/NoData/index.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/service/problemset.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/service/shixuns.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/service/user.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/authority.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/export.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/fetch.ts */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/util.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/verifyLogin.tsx */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./src/assets/images/classModalclose.png (<- Module is not an ECMAScript module) */
|
|
|
/*! 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/checkbox/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/checkbox/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/divider/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/divider/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/drawer/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/drawer/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/dropdown/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/dropdown/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/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/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/pagination/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/pagination/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/radio/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/spin/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/spin/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tabs/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tabs/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tooltip/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tooltip/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tree/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tree/style/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/lodash/lodash.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-router/esm/react-router.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,n){"use strict";n.r(t);n("DjyN");var i=n("NUBc"),r=(n("T2oS"),n("W9HT")),a=(n("qVdP"),n("jsC+")),s=n("k1fw"),o=(n("+L6B"),n("2/Rp")),l=(n("5Dmo"),n("3S7+")),c=(n("lUTK"),n("BvKs")),u=n("oBTY"),h=(n("sRBo"),n("kaz8")),d=(n("miYZ"),n("tsqr")),f=(n("7Kak"),n("9yH6")),p=(n("2qtc"),n("kLXV")),g=n("9og8"),v=n("tJVT"),m=n("PpiC"),y=(n("5NDa"),n("5rEg")),b=(n("Znn+"),n("ZTPi")),E=n("WmNS"),k=n.n(E),C=n("q1tI"),S=n.n(C),x=n("9kvl"),w=n("iris"),T=n("d5o6"),_=n.n(T),O=n("P/tu"),A=n("WCUW"),L=Object(x.a)((function(e){return{problemset:e.problemset}}))((function(e){var t=e.problemset,n=e.dispatch,i=e.onOk,r=Object(C.useState)(""),a=Object(v.a)(r,2),s=a[0],o=a[1],l=Object(C.useState)([0]),c=Object(v.a)(l,2),u=c[0],h=c[1],f=function(){n({type:"problemset/setActionTabs",payload:{}})};Object(C.useEffect)((function(){var e,n;"新建文件夹"===t.actionTabs.key&&(h([null===(e=t.actionTabs)||void 0===e||null===(n=e.params)||void 0===n?void 0:n.group_id]),o(""))}),[t.actionTabs.key]);var m=function(){var e=Object(g.a)(k.a.mark((function e(){var t,n,r;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=["?","、","/","╲","*","<",">","|"],s.trim()){e.next=4;break}return d.b.warn("请输入文件夹名称"),e.abrupt("return");case 4:if(" "!==s.charAt(0)){e.next=7;break}return d.b.warn("首字符不能为空格"),e.abrupt("return");case 7:n=0;case 8:if(!(n<s.length)){e.next=15;break}if(!t.includes(s.charAt(n))){e.next=12;break}return d.b.warn("文件夹名称包含特殊字符"),e.abrupt("return",!1);case 12:n++,e.next=8;break;case 15:return e.next=17,Object(A.n)({parent_id:u.length>0?u[0]:0,name:s});case 17:0===(r=e.sent).status&&(f(),i(null==r?void 0:r.id));case 19:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return S.a.createElement(p.a,{centered:!0,title:"新建文件夹",visible:"新建文件夹"===t.actionTabs.key,width:500,onCancel:f,onOk:m,destroyOnClose:!0},S.a.createElement("div",{className:_.a.addModal},S.a.createElement("div",{className:_.a.row},S.a.createElement("span",{className:_.a.label},"文件夹名称: "),S.a.createElement(y.a,{placeholder:"请输入文件夹名称",value:s,onChange:function(e){return o(e.target.value)}})),S.a.createElement("div",{className:_.a.row,style:{alignItems:"start",maxHeight:500,overflow:"auto"}},S.a.createElement("span",{className:_.a.label},"文件夹位置: "),S.a.createElement(O.a,{value:u,onChange:function(e){return h(e)}}))))})),D=n("BdwD"),R=n("iNYN"),I=n.n(R),N=Object(x.a)((function(e){var t=e.problemset,n=e.loading;return{problemset:t,globalSetting:e.globalSetting,loading:n.effects}}))((function(e){var t=e.problemset,n=(e.globalSetting,e.loading,e.dispatch);Object(m.a)(e,["problemset","globalSetting","loading","dispatch"]);return S.a.createElement(p.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:"Problemset-PublicReview"===t.actionTabs.key,title:"提示",okText:"知道啦",cancelText:"",width:"442px",onOk:function(){n({type:"problemset/setActionTabs",payload:{}})},onCancel:function(){n({type:"problemset/setActionTabs",payload:{}})}},S.a.createElement("div",{className:I.a.modalContent},"公开申请已提交,请等待管理员的审核"),S.a.createElement("div",{className:I.a.modalContent},"我们将在1-2个工作日内完成审核"))})),P=n("xlxt"),M=n.n(P),j=n("mgmH"),B=Object(x.a)((function(e){return{problemset:e.problemset}}))((function(e){var t=e.problemset,n=e.dispatch,i=Object(C.useState)([]),r=Object(v.a)(i,2),a=r[0],s=r[1],o=function(){n({type:"problemset/setActionTabs",payload:{}})};Object(C.useEffect)((function(){var e,n;"导出试题"===t.actionTabs.key&&s([null===(e=t.actionTabs)||void 0===e||null===(n=e.params)||void 0===n?void 0:n.group_id])}),[t.actionTabs.key]);return S.a.createElement(p.a,{centered:!0,title:"导出试题",visible:"导出试题"===t.actionTabs.key,width:718,destroyOnClose:!0,wrapClassName:M.a.customModal,onCancel:o,onOk:function(){0!==a.length?(Object(j.k)({group_id:a[0]}),o()):d.b.warn("请选择文件夹")}},S.a.createElement("aside",{className:M.a.exportModal},S.a.createElement(O.a,{value:a,onChange:function(e){return s(e)}})))})),F=n("i8i3"),U=n.n(F),G=n("Ty5D"),H=Object(x.a)((function(e){return{problemset:e.problemset}}))((function(e){var t,n,i=e.problemset,a=e.dispatch,s=e.onOk,l=(Object(G.i)(),Object(C.useState)([])),c=Object(v.a)(l,2),u=(c[0],c[1]),f=Object(C.useState)(1),m=Object(v.a)(f,2),y=m[0],b=m[1],E=Object(C.useState)([]),x=Object(v.a)(E,2),w=x[0],T=x[1],_=Object(C.useState)([]),L=Object(v.a)(_,2),D=L[0],R=L[1],I=Object(C.useState)(!0),N=Object(v.a)(I,2),P=N[0],M=N[1],j=Object(C.useState)(!1),B=Object(v.a)(j,2),F=B[0],H=B[1],K=Object(C.useState)(!1),z=Object(v.a)(K,2),V=(z[0],z[1]);Object(C.useEffect)((function(){var e,t;"共享试题"===i.actionTabs.key&&(W(),T([null===(e=i.actionTabs)||void 0===e||null===(t=e.params)||void 0===t?void 0:t.group_id]))}),[i.actionTabs.key]);var W=function(){var e=Object(g.a)(k.a.mark((function e(){var t,n,i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return M(!0),e.next=3,Object(A.v)({type:0,page:1,per_page:10,order_by:"new"});case 3:null!=(t=e.sent)&&t.item_banks_group&&(n={id:-1,item_banks_count:(null==t?void 0:t.no_group_count)||0,name:{name:"未加入分组"}},i=[n].concat((null==t?void 0:t.item_banks_group)||[]),u(i)),M(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Y=function(){a({type:"problemset/setActionTabs",payload:{}})},q=function(){var e=Object(g.a)(k.a.mark((function e(){var t;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==w.length){e.next=3;break}return d.b.warn("请选择需要的文件夹"),e.abrupt("return");case 3:if(1!==y){e.next=6;break}return b(2),e.abrupt("return");case 6:return H(!0),e.next=9,Object(A.j)({item_banks_group_ids:w,clazz:"ItemBank",group_ids:D});case 9:0===(null==(t=e.sent)?void 0:t.status)&&(s(),Y()),H(!1);case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return S.a.createElement(p.a,{centered:!0,afterClose:function(){R([]),b(1),V(!1),u([])},title:"共享试题".concat(y,"/2"),visible:"共享试题"===i.actionTabs.key,footer:null,width:718,destroyOnClose:!0,wrapClassName:U.a.customModal,onCancel:Y},S.a.createElement("aside",{className:U.a.shareModal},S.a.createElement(r.a,{spinning:P},S.a.createElement("div",{className:U.a.content},1===y&&S.a.createElement("div",{className:U.a.group},S.a.createElement(O.a,{value:w,onChange:function(e){return T(e)}})),2===y&&S.a.createElement("div",{className:U.a.teachGroup},S.a.createElement("p",null,"共享至教研团队"),S.a.createElement(h.a.Group,{value:D,onChange:function(e){return R(e)}},null==i||null===(t=i.teachGroupData)||void 0===t||null===(n=t.groups)||void 0===n?void 0:n.map((function(e){return S.a.createElement(h.a,{key:e.group_id,value:e.group_id},null==e?void 0:e.name)}))))),S.a.createElement("div",{className:U.a.footer},S.a.createElement(o.a,{onClick:Y},"取消"),S.a.createElement(o.a,{loading:F,onClick:q,type:"primary"},1===y?"下一步":"确认共享")))))})),K=Object(x.a)((function(e){var t=e.problemset,n=e.loading;return{problemset:t,globalSetting:e.globalSetting,loading:n.effects}}))((function(e){var t=e.problemset,n=(e.globalSetting,e.loading),i=e.dispatch,r=e.onReloadData,a=void 0===r?function(){}:r,s=(Object(m.a)(e,["problemset","globalSetting","loading","dispatch","onReloadData"]),Object(C.useRef)(!1)),o=Object(C.useState)(!1),l=Object(v.a)(o,2),c=l[0],u=l[1];Object(C.useEffect)((function(){"Problemset-SetPrivate"===t.actionTabs.key?"1"===window.localStorage.getItem("problemset-set-private-hint-flag")?d():u(!0):u(!1)}),[t.actionTabs.key]);var d=function(){var e=Object(g.a)(k.a.mark((function e(){var n;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.current&&window.localStorage.setItem("problemset-set-private-hint-flag","1"),e.next=3,i({type:"problemset/setPrivate",payload:t.actionTabs.params});case 3:n=e.sent,i({type:"problemset/setActionTabs",payload:{}}),s.current=!1,0===n.status&&a();case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return S.a.createElement(p.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:c,title:"撤销公开告知",okText:"确定",cancelText:"取消",confirmLoading:n["problemset/setPrivate"],width:"442px",onOk:d,onCancel:function(){i({type:"problemset/setActionTabs",payload:{}}),s.current=!1}},S.a.createElement("div",{className:I.a.modalContentLeft},"本题已公开,撤销公开可能导致部分用户对本题的使用受损。"),S.a.createElement("div",{className:I.a.modalContentLeft},"确认撤销公开回到自有状态吗?"),S.a.createElement("div",null,S.a.createElement(h.a,{className:"mt10",defaultChecked:!1,onChange:function(e){return s.current=e.target.checked}},"不再提示")))})),z=Object(x.a)((function(e){var t=e.problemset,n=e.loading;return{problemset:t,globalSetting:e.globalSetting,loading:n.effects}}))((function(e){var t=e.problemset,n=(e.globalSetting,e.loading),i=e.dispatch,r=e.onReloadData,a=void 0===r?function(){}:r,s=(Object(m.a)(e,["problemset","globalSetting","loading","dispatch","onReloadData"]),function(){var e=Object(g.a)(k.a.mark((function e(){var n;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i({type:"problemset/handleDelete",payload:t.actionTabs.params});case 2:n=e.sent,i({type:"problemset/setActionTabs",payload:{}}),0===n.status&&a();case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}());return S.a.createElement(p.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:"Problemset-Delete"===t.actionTabs.key,title:"提示",okText:"确定",cancelText:"取消",confirmLoading:n["problemset/handleDelete"],width:"442px",onOk:s,onCancel:function(){i({type:"problemset/setActionTabs",payload:{}})}},S.a.createElement("div",{className:I.a.modalContent},"确认删除后,无法撤销"),S.a.createElement("div",{className:I.a.modalContent},"是否确认删除?"))})),V=n("LvDl"),W=n("9Bee"),Y=Object(x.a)((function(e){return{problemset:e.problemset}}))((function(e){var t,n=e.problemset,i=e.dispatch,r=Object(C.useState)({}),a=Object(v.a)(r,2),o=a[0],l=a[1],c=Object(C.useState)([]),u=Object(v.a)(c,2),h=u[0],m=u[1],y=Object(C.useState)(!1),b=Object(v.a)(y,2),E=b[0],x=b[1],w=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];Object(C.useEffect)((function(){var e;if("SINGLE"===(null==n||null===(e=n.actionTabs)||void 0===e?void 0:e.key)){var t,i=Object(V.cloneDeep)(null==n||null===(t=n.actionTabs)||void 0===t?void 0:t.params);l(i),m(i.choices)}}),[null==n||null===(t=n.actionTabs)||void 0===t?void 0:t.key]);var T=function(){var e=Object(g.a)(k.a.mark((function e(){var t,i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h.some((function(e){return null==e?void 0:e.checked}))){e.next=3;break}return d.b.warn("请您作答后再提交"),e.abrupt("return");case 3:E&&(i=Object(V.cloneDeep)(null==n||null===(t=n.actionTabs)||void 0===t?void 0:t.params),m(i.choices)),x(!E);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return S.a.createElement(p.a,{centered:!0,destroyOnClose:!0,visible:"SINGLE"===n.actionTabs.key,title:"试题体验",okText:E?"重新答题":"提交答案",cancelText:"取消",width:708,onOk:T,onCancel:function(){l({}),m([]),x(!1),i({type:"problemset/setActionTabs",payload:{}})}},S.a.createElement("div",null,S.a.createElement("div",{className:"c-light-primary mb5 font16"},"单选题"),S.a.createElement(W.a,{value:null==o?void 0:o.name}),null==h?void 0:h.map((function(e,t){var n=e.is_answer,i=e.checked,r=e.choice_text,a="";return E&&n&&(a=I.a.green),E&&!n&&i&&(a=I.a.red),S.a.createElement("div",{key:t,style:{pointerEvents:E?"none":"auto"},className:"".concat(I.a.row," ").concat(a)},S.a.createElement(f.a,{onChange:function(e){return function(e,t){console.log(e.target.checked);var n=h.map((function(n,i){return Object(s.a)(Object(s.a)({},n),{},{checked:i===t&&e.target.checked})}));m(n)}(e,t)},checked:i}),S.a.createElement("span",null,w[t],". "),S.a.createElement(W.a,{className:I.a.html,value:r}),E&&n&&S.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),E&&!n&&i&&S.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))})),E&&S.a.createElement(C.Fragment,null,S.a.createElement("div",{className:I.a.line}),S.a.createElement("div",{className:"c-grey-333 mb5"},S.a.createElement("b",null,"正确答案: "),w[h.findIndex((function(e){return e.is_answer}))]),S.a.createElement("div",{className:"c-grey-333 mb10"},S.a.createElement("b",null,"解析: "),(null==o?void 0:o.analysis)||"暂无解析"))))})),q=Object(x.a)((function(e){return{problemset:e.problemset}}))((function(e){var t,n=e.problemset,i=e.dispatch,r=Object(C.useState)({}),a=Object(v.a)(r,2),o=a[0],l=a[1],c=Object(C.useState)([]),u=Object(v.a)(c,2),f=u[0],m=u[1],y=Object(C.useState)(!1),b=Object(v.a)(y,2),E=b[0],x=b[1],w=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];Object(C.useEffect)((function(){var e;if("MULTIPLE"===(null==n||null===(e=n.actionTabs)||void 0===e?void 0:e.key)){var t,i=Object(V.cloneDeep)(null==n||null===(t=n.actionTabs)||void 0===t?void 0:t.params);l(i),m(i.choices)}}),[null==n||null===(t=n.actionTabs)||void 0===t?void 0:t.key]);var T,_=function(){var e=Object(g.a)(k.a.mark((function e(){var t,i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f.some((function(e){return null==e?void 0:e.checked}))){e.next=3;break}return d.b.warn("请您作答后再提交"),e.abrupt("return");case 3:E&&(i=Object(V.cloneDeep)(null==n||null===(t=n.actionTabs)||void 0===t?void 0:t.params),m(i.choices)),x(!E);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return S.a.createElement(p.a,{centered:!0,destroyOnClose:!0,visible:"MULTIPLE"===n.actionTabs.key,title:"试题体验",okText:E?"重新答题":"提交答案",cancelText:"取消",width:708,onOk:_,onCancel:function(){l({}),m([]),x(!1),i({type:"problemset/setActionTabs",payload:{}})}},S.a.createElement("div",null,S.a.createElement("div",{className:"c-light-primary mb5 font16"},"多选题"),S.a.createElement(W.a,{value:null==o?void 0:o.name}),null==f?void 0:f.map((function(e,t){var n=e.is_answer,i=e.checked,r=e.choice_text,a="";return E&&n&&(a=I.a.green),E&&!n&&i&&(a=I.a.red),S.a.createElement("div",{key:t,style:{pointerEvents:E?"none":"auto"},className:"".concat(I.a.row," ").concat(a)},S.a.createElement(h.a,{style:{padding:3},onChange:function(e){return function(e,t){console.log(e.target.checked);var n=f.map((function(n,i){return Object(s.a)(Object(s.a)({},n),{},{checked:i===t?e.target.checked:n.checked})}));m(n)}(e,t)},checked:i}),S.a.createElement("span",null,w[t],". "),S.a.createElement(W.a,{className:I.a.html,value:r}),E&&n&&S.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),E&&!n&&i&&S.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))})),E&&S.a.createElement(C.Fragment,null,S.a.createElement("div",{className:I.a.line}),S.a.createElement("div",{className:"c-grey-333 mb5"},S.a.createElement("b",null,"正确答案: "),(T="",f.forEach((function(e,t){e.is_answer&&(T+=w[t])})),T)),S.a.createElement("div",{className:"c-grey-333 mb10"},S.a.createElement("b",null,"解析: "),(null==o?void 0:o.analysis)||"暂无解析"))))})),X=Object(x.a)((function(e){return{problemset:e.problemset}}))((function(e){var t,n,i=e.problemset,r=e.dispatch,a=Object(C.useState)({}),o=Object(v.a)(a,2),l=o[0],c=o[1],u=Object(C.useState)([]),h=Object(v.a)(u,2),m=h[0],y=h[1],b=Object(C.useState)(!1),E=Object(v.a)(b,2),x=E[0],w=E[1];Object(C.useEffect)((function(){var e;if("JUDGMENT"===(null==i||null===(e=i.actionTabs)||void 0===e?void 0:e.key)){var t,n=Object(V.cloneDeep)(null==i||null===(t=i.actionTabs)||void 0===t?void 0:t.params);c(n),y(n.choices)}}),[null==i||null===(t=i.actionTabs)||void 0===t?void 0:t.key]);var T=function(){var e=Object(g.a)(k.a.mark((function e(){var t,n;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m.some((function(e){return null==e?void 0:e.checked}))){e.next=3;break}return d.b.warn("请您作答后再提交"),e.abrupt("return");case 3:x&&(n=Object(V.cloneDeep)(null==i||null===(t=i.actionTabs)||void 0===t?void 0:t.params),y(n.choices)),w(!x);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return S.a.createElement(p.a,{centered:!0,destroyOnClose:!0,visible:"JUDGMENT"===i.actionTabs.key,title:"试题体验",okText:x?"重新答题":"提交答案",cancelText:"取消",width:708,onOk:T,onCancel:function(){c({}),y([]),w(!1),r({type:"problemset/setActionTabs",payload:{}})}},S.a.createElement("div",null,S.a.createElement("div",{className:"c-light-primary mb5 font16"},"判断题"),S.a.createElement(W.a,{value:null==l?void 0:l.name}),null==m?void 0:m.map((function(e,t){var n=e.is_answer,i=e.checked,r=e.choice_text,a="";return x&&n&&(a=I.a.green),x&&!n&&i&&(a=I.a.red),S.a.createElement("div",{key:t,style:{pointerEvents:x?"none":"auto"},className:"".concat(I.a.row," ").concat(a)},S.a.createElement(f.a,{onChange:function(e){return function(e,t){console.log(e.target.checked);var n=m.map((function(n,i){return Object(s.a)(Object(s.a)({},n),{},{checked:i===t&&e.target.checked})}));y(n)}(e,t)},checked:i}),S.a.createElement(W.a,{className:I.a.html,value:r}),x&&n&&S.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),x&&!n&&i&&S.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))})),x&&S.a.createElement(C.Fragment,null,S.a.createElement("div",{className:I.a.line}),S.a.createElement("div",{className:"c-grey-333 mb5"},S.a.createElement("b",null,"正确答案: "),null===(n=m.find((function(e){return e.is_answer})))||void 0===n?void 0:n.choice_text),S.a.createElement("div",{className:"c-grey-333 mb10"},S.a.createElement("b",null,"解析: "),(null==l?void 0:l.analysis)||"暂无解析"))))})),Q=Object(x.a)((function(e){return{problemset:e.problemset}}))((function(e){var t,n,i=e.problemset,r=e.dispatch,a=Object(C.useState)({}),o=Object(v.a)(a,2),l=o[0],c=o[1],u=Object(C.useState)([]),h=Object(v.a)(u,2),f=h[0],m=h[1],b=Object(C.useState)(!1),E=Object(v.a)(b,2),x=E[0],w=E[1];Object(C.useEffect)((function(){var e;if("COMPLETION"===(null==i||null===(e=i.actionTabs)||void 0===e?void 0:e.key)){var t,n,r=Object(V.cloneDeep)(null==i||null===(t=i.actionTabs)||void 0===t?void 0:t.params);c(r),m(null==r||null===(n=r.standard_answer)||void 0===n?void 0:n.map((function(e){return{value:"",answer:(null==e?void 0:e.answer_text)||[]}})))}}),[null==i||null===(t=i.actionTabs)||void 0===t?void 0:t.key]);var T=function(){var e=Object(g.a)(k.a.mark((function e(){var t,n,r;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!f.some((function(e){return""===(null==e?void 0:e.value)}))){e.next=3;break}return d.b.warn("请您作答后再提交"),e.abrupt("return");case 3:x&&(r=Object(V.cloneDeep)(null==i||null===(t=i.actionTabs)||void 0===t?void 0:t.params),m(null==r||null===(n=r.standard_answer)||void 0===n?void 0:n.map((function(e){return{value:"",answer:(null==e?void 0:e.answer_text)||[]}})))),w(!x);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return S.a.createElement(p.a,{centered:!0,destroyOnClose:!0,visible:"COMPLETION"===i.actionTabs.key,title:"试题体验",okText:x?"重新答题":"提交答案",cancelText:"取消",width:708,onOk:T,onCancel:function(){c({}),m([]),w(!1),r({type:"problemset/setActionTabs",payload:{}})}},S.a.createElement("div",null,S.a.createElement("div",{className:"c-light-primary mb5 font16"},"填空题"),S.a.createElement(W.a,{value:null==l?void 0:l.name}),null==f?void 0:f.map((function(e,t){var n=e.value,i=e.answer,r="";return x&&null!=i&&i.includes(n)&&(r=I.a.green),!x||null!=i&&i.includes(n)||(r=I.a.red),S.a.createElement("div",{key:t,style:{pointerEvents:x?"none":"auto",marginTop:10},className:"".concat(I.a.row," ").concat(r)},S.a.createElement("div",{style:{minWidth:80}},"填空",t+1,"答案:"),S.a.createElement(y.a.TextArea,{className:I.a.textArea,style:{width:610,marginRight:10},onChange:function(e){return function(e,t){var n=f.map((function(n,i){return Object(s.a)(Object(s.a)({},n),{},{value:i===t?e.target.value:n.value})}));m(n)}(e,t)},value:n}),x&&(null==i?void 0:i.includes(n))&&S.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),x&&!(null!=i&&i.includes(n))&&S.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))})),x&&S.a.createElement(C.Fragment,null,S.a.createElement("div",{className:I.a.line}),null==l||null===(n=l.standard_answer)||void 0===n?void 0:n.map((function(e,t){var n;return S.a.createElement("div",{className:"c-grey-333 mb5"},S.a.createElement("b",null,"填空",t+1,"答案: "),(null==e||null===(n=e.answer_text)||void 0===n?void 0:n.join("、"))||"")})),S.a.createElement("div",{className:"c-grey-333 mb10"},S.a.createElement("b",null,"解析: "),(null==l?void 0:l.analysis)||"暂无解析"))))})),J=(n("Q9mQ"),n("diRs")),Z=n("+z73"),$=n.n(Z),ee=function(e){var t,n,i,r=e.data,a=void 0===r?[]:r,s=e.onClick;return S.a.createElement("aside",{style:{overflowX:"auto"}},(null==a?void 0:a.length)>5?(t=!0,n=a.slice(2,-2),i=S.a.createElement("div",{className:$.a.pWrap},n.map((function(e){return S.a.createElement("span",{title:e.name,onClick:function(){return s(e.id)},key:e.id},e.name)}))),a.map((function(e,n){var r=null;return n>1&&n<a.length-2?t&&(r=S.a.createElement(J.a,{key:n,placement:"bottom",content:i},S.a.createElement("span",{style:{color:"#999",cursor:"pointer"}},".../")),t=!1):r=S.a.createElement("div",{key:n,className:$.a.few},S.a.createElement("b",{title:e.name,style:{color:0===n?"#333333":"#999999"},onClick:function(){return s(e.id)}},e.name),n<a.length-1&&S.a.createElement("span",null,"/")),r}))):a.map((function(e,t){return S.a.createElement("div",{key:t,className:$.a.few},S.a.createElement("b",{title:e.name,style:{color:0===t?"#333333":"#999999"},onClick:function(){return s(e.id)}},e.name),t<a.length-1&&S.a.createElement("span",null,"/"))})))},te=n("tK3L"),ne=n.n(te),ie=(n("bbsP"),n("/wGt")),re=n("IPdS"),ae=n.n(re),se=[],oe=function(e){se.forEach((function(t){e.target===t.element||le.isParent(e.target,t.element)||t.callbacks.forEach((function(e){return e()}))}))};window.document.body?window.document.body.addEventListener("click",oe):window.addEventListener("DOMContentLoaded",(function(){window.document.body.addEventListener("click",oe)}));var le={isParent:function(e,t){for(var n=e;n&&n.tagName&&"body"!==n.tagName.toLowerCase();){if(n===t)return!0;n=n.parentNode}return!1},init:function(e,t){var n=se.filter((function(t){return t.element===e}));return n.length>0?n[0].callbacks.push(t):se.push({element:e,callbacks:[t]}),{clear:function(){se=se.filter((function(t){return t.element!==e}))}}}},ce=le,ue=[{stateName:"single_questions_count",type:"SINGLE",typeName:"单选题"},{stateName:"multiple_questions_count",type:"MULTIPLE",typeName:"多选题"},{stateName:"judgement_questions_count",type:"JUDGMENT",typeName:"判断题"},{stateName:"completion_questions_count",type:"COMPLETION",typeName:"填空题"},{stateName:"subjective_questions_count",type:"SUBJECTIVE",typeName:"简答题"},{stateName:"program_questions_count",type:"PROGRAM",typeName:"编程题"},{stateName:"practical_questions_count",type:"PRACTICAL",typeName:"实训题"},{stateName:"combination_questions_count",type:"COMBINATION",typeName:"组合题"}],he=function(e){var t=e.visible,n=e.basketData,i=e.basketTotal,r=e.onClose,a=void 0===r?function(){}:r,s=e.onDelete,o=void 0===s?function(){}:s,l=Object(C.useRef)(),c=Object(C.useRef)();return Object(C.useEffect)((function(){if(c.current)return i>=0&&!l.current&&(l.current=ce.init(c.current,(function(){a()}))),function(){l.current&&l.current.clear()}}),[c.current]),S.a.createElement(ie.a,{className:ae.a.drawerWrap,placement:"right",closable:!1,mask:!1,visible:t,forceRender:!0,onClose:a},i>0?S.a.createElement("div",{style:{height:"100%"},ref:c},S.a.createElement("div",{className:ae.a.title},"试题篮"),ue.map((function(e){return n[e.stateName]>0&&S.a.createElement("div",{className:ae.a.problemset,key:e.type},S.a.createElement("div",{className:ae.a.content},e.typeName,"(",n[e.stateName],")"),S.a.createElement("div",{className:ae.a.delete,onClick:function(){return o(e.type)}},S.a.createElement("i",{className:"iconfont icon-shanchu1 ".concat(ae.a.deleteIcon)})))})),S.a.createElement("div",{className:ae.a.previewWrap},S.a.createElement("div",{className:ae.a.preview,onClick:function(){return x.d.push("/problemset/preview")}},"试卷预览"))):S.a.createElement("div",{ref:c},S.a.createElement(D.a,{customText:"请选择试题进行组卷"})))},de={SINGLE:"单选题",MULTIPLE:"多选题",JUDGMENT:"判断题",COMPLETION:"填空题",SUBJECTIVE:"简答题",PROGRAM:"编程题",PRACTICAL:"实训题",COMBINATION:"组合题"},fe=Object(x.a)((function(e){var t=e.problemset,n=e.loading;return{problemset:t,globalSetting:e.globalSetting,loading:n.effects}}))((function(e){var t,n,i=e.problemset,r=(e.globalSetting,e.loading),a=e.dispatch,s=e.onReloadData,o=void 0===s?function(){}:s,l=e.onReloadBasketData,c=void 0===l?function(){}:l,u=(Object(m.a)(e,["problemset","globalSetting","loading","dispatch","onReloadData","onReloadBasketData"]),function(){var e=Object(g.a)(k.a.mark((function e(){var t;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a({type:"problemset/basketDelete",payload:i.actionTabs.params});case 2:t=e.sent,a({type:"problemset/setActionTabs",payload:{}}),0===t.status&&(o(),c());case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}());return S.a.createElement(p.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:"Problemset-BasketDelete"===i.actionTabs.key,title:"提示",okText:"确定",cancelText:"取消",confirmLoading:r["problemset/handleDelete"],width:"442px",onOk:u,onCancel:function(){a({type:"problemset/setActionTabs",payload:{}})}},S.a.createElement("div",{className:I.a.modalContent},"是否删除试题篮中",de[null===(t=i.actionTabs)||void 0===t||null===(n=t.params)||void 0===n?void 0:n.type]))})),pe=n("A60/"),ge=n.n(pe),ve=function(e){var t=e.count,n=e.visibleBasket,i=e.onToggleVisible,r=void 0===i?function(){}:i;return S.a.createElement("div",{className:"".concat(n?ge.a.right180:ge.a.right20," ").concat(ge.a.wrap)},S.a.createElement(l.a,{title:"试题篮",placement:"left"},S.a.createElement("div",{className:ge.a.basket,onClick:r},t>0&&S.a.createElement("div",{className:ge.a.count},t),S.a.createElement("span",{className:ge.a.iconWrap},S.a.createElement("i",{className:"".concat(ge.a.icon," iconfont icon-shitilan")})),S.a.createElement("p",{className:ge.a.name},"试题篮"))))},me=n("+vTd"),ye=n.n(me),be=n("xKgJ"),Ee=["A.","B.","C.","D.","E.","F.","G.","H.","I.","J.","K.","L.","M.","N.","O.","P.","Q.","R.","S.","T.","U.","V.","W.","X.","Y.","Z."],ke=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ce=function(e){var t,n,i,r,s,o,l,u,h,d,f,p,g,v,m,y,b=e.isProblemset,E=e.data,k=e.user,C=e.activeTabsKey,x=e.onPublicReview,w=void 0===x?function(){}:x,T=(e.onStartExperience,e.onSetPrivate),_=void 0===T?function(){}:T,O=e.onCorrection,A=void 0===O?function(){}:O,L=e.onCollect,D=void 0===L?function(){}:L,R=e.onSetPublic,I=void 0===R?function(){}:R,N=e.onDelete,P=void 0===N?function(){}:N,M=(e.onCancel,e.onSelect,e.onMoveTo),j=void 0===M?function(){}:M,B=e.onSetShare,F=void 0===B?function(){}:B,U=e.onCancelShare,G=void 0===U?function(){}:U,H=e.onPublish,K=void 0===H?function(){}:H,z=e.onCancelPublish,V=void 0===z?function(){}:z,W="PROGRAM"===E.item_type?"/problems/".concat(null===(t=E.program_attr)||void 0===t?void 0:t.identifier,"/edit"):"/problemset/edit/".concat(E.id),Y="0"===C&&!E.public&&!E.apply&&("PROGRAM"===E.item_type&&0!==(null===(n=E.program_attr)||void 0===n?void 0:n.status)||"PROGRAM"!==E.item_type),q=S.a.createElement(c.a,{forceSubMenuRender:!0,className:ye.a.menu},"0"===C&&!E.public&&S.a.createElement(c.a.Item,{key:"-1"},S.a.createElement("a",{className:ye.a.actionLink,target:"_blank",href:W},"编辑")),("0"===C||"3"===C)&&"PROGRAM"===E.item_type&&0!==(null===(i=E.program_attr)||void 0===i?void 0:i.status)&&!E.public&&(null===(r=E.author)||void 0===r?void 0:r.login)===(null===(s=k.userInfo)||void 0===s?void 0:s.login)&&S.a.createElement(c.a.Item,{key:"0"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){var e;return V(null==E||null===(e=E.program_attr)||void 0===e?void 0:e.identifier)}},"撤销发布")),"0"===C&&S.a.createElement(c.a.Item,{key:"1"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return j(E.id)}},"移动到")),"0"===C&&!(null!=E&&E.is_share)&&S.a.createElement(c.a.Item,{key:"3"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return F(E.id)}},"共享")),("0"===C&&(null==E?void 0:E.is_share)||"3"===C&&(null===(o=E.author)||void 0===o?void 0:o.login)===(null===(l=k.userInfo)||void 0===l?void 0:l.login))&&S.a.createElement(c.a.Item,{key:"3"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return G(E.id)}},"撤销共享")),Y&&S.a.createElement(c.a.Item,{key:"4"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return I(E.id)}},"公开")),"0"===C&&!E.public&&E.apply&&("PROGRAM"===E.item_type&&0!==E.program_attr.status||"PROGRAM"!==E.item_type)&&S.a.createElement(c.a.Item,{key:"5"},S.a.createElement("a",{className:ye.a.reviewFlag,onClick:w},"审核中")),("0"===C||"1"===C)&&E.public&&(null===(u=E.author)||void 0===u?void 0:u.login)===(null===(h=k.userInfo)||void 0===h?void 0:h.login)&&S.a.createElement(c.a.Item,{key:"6"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return _(E.id)}},"撤销公开")),"2"===C&&S.a.createElement(c.a.Item,{key:"7"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return D(E.id,E.is_collected)}},"取消收藏")),("0"===C||"3"===C)&&"PROGRAM"===E.item_type&&0===(null===(d=E.program_attr)||void 0===d?void 0:d.status)&&!E.public&&(null===(f=E.author)||void 0===f?void 0:f.login)===(null===(p=k.userInfo)||void 0===p?void 0:p.login)&&S.a.createElement(c.a.Item,{key:"8"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){var e;return K(null==E||null===(e=E.program_attr)||void 0===e?void 0:e.identifier)}},"发布")),("1"===C||"3"===C)&&!Object(be.o)()&&!Object(be.m)()&&(null===(g=E.author)||void 0===g?void 0:g.login)!==(null===(v=k.userInfo)||void 0===v?void 0:v.login)&&S.a.createElement(c.a.Item,{key:"9"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return D(E.id,E.is_collected)}},E.is_collected?"取消收藏":"收藏")),"0"!==C&&!Object(be.o)()&&!Object(be.m)()&&S.a.createElement(c.a.Item,{key:"10"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return A(E.id)}},"纠错")),("0"===C&&!E.public||"1"===C&&Object(be.o)()&&(null===(m=E.author)||void 0===m?void 0:m.login)!==(null===(y=k.userInfo)||void 0===y?void 0:y.login))&&S.a.createElement(c.a.Item,{key:"11"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return P(E.id)}},"删除"))),X=S.a.createElement(c.a,{forceSubMenuRender:!0,className:ye.a.menu},S.a.createElement(c.a.Item,{key:"10"},S.a.createElement("a",{className:ye.a.actionLink,onClick:function(){return A(E.id)}},"纠错"))),Q="0"!==C&&!Object(be.o)()&&!Object(be.m)();return S.a.createElement(S.a.Fragment,null,"4"==C?S.a.createElement(S.a.Fragment,null):b?S.a.createElement(a.a,{className:"ml40",overlay:q},S.a.createElement("span",{style:{cursor:"default"},onClick:function(e){return e.preventDefault()}},S.a.createElement("span",{className:"c-light-primary"},"更多"))):Q?S.a.createElement(a.a,{className:"ml40",overlay:X},S.a.createElement("span",{style:{cursor:"default"},onClick:function(e){return e.preventDefault()}},S.a.createElement("span",{className:"c-light-primary"},"更多"))):S.a.createElement("span",null))},Se=function(e){e.isProblemset;var t,n,i,r=e.data,a=(e.user,e.selectIds),s=e.activeTabsKey,o=(e.onPublicReview,e.onStartExperience),l=void 0===o?function(){}:o,c=e.onSelectCheckBox,d=void 0===c?function(){}:c,p=(e.onSetPrivate,e.onCorrection,e.onCollect,e.onSetPublic,e.onDelete,e.onCancel,e.onSelect,e.onMoveTo,e.onSetShare,e.onCancelShare,e.onPublish,e.onCancelPublish,Object(C.useState)(!1)),g=Object(v.a)(p,2),m=g[0],y=g[1];return S.a.createElement("div",{className:ye.a.itemWrap},S.a.createElement("div",{className:ye.a.list},"4"==s?S.a.createElement(S.a.Fragment,null):S.a.createElement(h.a,{className:"mr10",onChange:function(e){var t=Object(u.a)(a);e.target.checked?t.push(r.id):t=t.filter((function(e){return e!==r.id})),d(t)},checked:a.includes(r.id)}),S.a.createElement("div",{className:ye.a.title},S.a.createElement(W.a,{key:1,showLines:1,showTextOnly:!0,className:ye.a.topicTitleContent,value:r.name})),!m&&S.a.createElement("div",{onClick:function(){return y(!m)},className:ye.a.tr},"展开",S.a.createElement("i",{style:{transform:"rotate(90deg)"},className:"iconfont icon-lujing"}))),S.a.createElement("aside",{style:m?{height:"auto"}:{overflow:"hidden",height:0}},S.a.createElement(W.a,{key:2,className:"".concat(ye.a.topicTitleContent," mt20"),value:r.name}),S.a.createElement("div",{className:"".concat(ye.a.row," mt15")},"JUDGMENT"===r.item_type?S.a.createElement("div",{className:ye.a.judgmentContent},r.choices.map((function(e,t){return S.a.createElement(f.a,{key:t,disabled:!0},e.choice_text)}))):"PROGRAM"===r.item_type?S.a.createElement("div",{className:ye.a.programContent},S.a.createElement(W.a,{value:null===(n=r.program_attr)||void 0===n?void 0:n.description})):"COMBINATION"===r.item_type?S.a.createElement("div",{className:ye.a.combinationContent},null==r||null===(i=r.sub_item_banks)||void 0===i?void 0:i.map((function(e,t){var n,i="(题目".concat(t+1,"-单选题) ");return S.a.createElement(C.Fragment,null,S.a.createElement("div",{style:{marginTop:10,marginBottom:10}},S.a.createElement(W.a,{value:i+e.name})),e.choices.map((function(e,t){return S.a.createElement("div",{key:t,className:ye.a.otherContentItem},S.a.createElement("p",null,Ee[t]),S.a.createElement(W.a,{className:ye.a.otehrContentHtml,value:e.choice_text}))})),S.a.createElement("div",{className:ye.a.con},S.a.createElement("b",{className:"c-grey-333 font14"}," 答案:",null==ke?void 0:ke[null==e||null===(n=e.choices)||void 0===n?void 0:n.findIndex((function(e){return null==e?void 0:e.is_answer}))]," "),S.a.createElement("div",null,S.a.createElement("span",null,"解析:"),S.a.createElement(W.a,{className:ye.a.parseAnswerHtml,value:e.analysis||"暂无解析"}))))}))):S.a.createElement("div",{className:ye.a.otherContent},r.choices.map((function(e,t){return S.a.createElement("div",{key:t,className:ye.a.otherContentItem},S.a.createElement("p",null,Ee[t]),S.a.createElement(W.a,{className:ye.a.otehrContentHtml,value:e.choice_text}))})))),S.a.createElement("div",{className:ye.a.row},S.a.createElement("div",{className:ye.a.updateTimeRow},S.a.createElement("div",{className:ye.a.updateTimeWrap},"PROGRAM"===r.item_type&&S.a.createElement("p",{className:ye.a.programLanguage},"编程语言:",null===(t=r.program_attr)||void 0===t?void 0:t.language)))),"PROGRAM"!==r.item_type&&"COMBINATION"!==r.item_type&&S.a.createElement("div",null,S.a.createElement("div",{className:ye.a.parseAnswerBorder}),S.a.createElement("div",{className:ye.a.answer},function(){var e,t,n,i={SUBJECTIVE:null===(e=r.answer_texts)||void 0===e?void 0:e[0],JUDGMENT:null===(t=r.choices)||void 0===t||null===(n=t.find((function(e){return e.is_answer})))||void 0===n?void 0:n.choice_text},a=r.choices.map((function(e){return e.is_answer})).findIndex((function(e){return e})),s=a>-1?ke[a]:"",o="";r.choices.map((function(e,t){e.is_answer&&(o+=ke[t])}));var l,c=i[r.item_type],u={SINGLE:S.a.createElement(W.a,{className:ye.a.answerHtml,value:"答案:".concat(s||"无")}),MULTIPLE:S.a.createElement(W.a,{className:ye.a.answerHtml,value:"答案:".concat(o||"无")}),COMPLETION:S.a.createElement("div",null,null===(l=r.standard_answer)||void 0===l?void 0:l.map((function(e,t){return S.a.createElement(W.a,{key:t,className:ye.a.answerHtml,value:"答案(填空".concat(e.position,"):").concat(e.answer_text.join("、"))})})))},h=S.a.createElement(W.a,{className:ye.a.answerHtml,value:"答案:".concat(c||"无")});return u[r.item_type]||h}()),S.a.createElement("div",{className:ye.a.parse},S.a.createElement("div",{className:ye.a.parseText},"解析:"),S.a.createElement("div",{className:ye.a.parseAnswer},r.analysis?S.a.createElement(W.a,{className:ye.a.parseAnswerHtml,value:r.analysis}):"暂无解析"))),S.a.createElement("div",{className:ye.a.bottom},"SUBJECTIVE"!==r.item_type&&"COMBINATION"!==r.item_type&&S.a.createElement("span",{onClick:function(){return l(r)}},"体验"),S.a.createElement("span",{onClick:function(){return y(!1)}},"收起",S.a.createElement("i",{className:"iconfont icon-zhankaijiantou"})," "))))},xe=(n("ozfa"),n("MJZm")),we=n("YaiT"),Te=n.n(we),_e=n("ErOA"),Oe=n("w2Yr"),Ae=n.n(Oe),Le=n("jb+D"),De=function(e){var t=e.isProblemset,n=e.data,r=e.user,a=e.onOpen,s=void 0===a?function(){}:a,l=e.onMove,c=void 0===l?function(){}:l,u=e.onRenameOk,f=void 0===u?function(){}:u,m=e.onDeleteOk,b=void 0===m?function(){}:m,E=Object(C.useState)(!1),x=Object(v.a)(E,2),w=x[0],T=x[1],_=Object(C.useState)(void 0),O=Object(v.a)(_,2),L=O[0],R=O[1],I=Object(C.useState)(!1),N=Object(v.a)(I,2),P=N[0],M=N[1],j=Object(C.useState)([]),B=Object(v.a)(j,2),F=B[0],U=B[1],G=Object(C.useState)(0),H=Object(v.a)(G,2),K=H[0],z=H[1],V=Object(C.useState)(!1),W=Object(v.a)(V,2),Y=W[0],q=W[1],X=Object(C.useState)([]),Q=Object(v.a)(X,2),J=Q[0],Z=Q[1],$=Object(C.useState)(void 0),ee=Object(v.a)($,2),te=ee[0],ne=ee[1],ie=Object(C.useState)({username:r.userInfo.login,is_show_class:1,per_page:10,page:1}),re=Object(v.a)(ie,2),ae=re[0],se=re[1];Object(C.useEffect)((function(){n.name&&R(null==n?void 0:n.name)}),[null==n?void 0:n.name]);var oe=function(){var e=Object(g.a)(k.a.mark((function e(t){var n,i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=["?","、","/","╲","*","<",">","|"],L.trim()){e.next=4;break}return d.b.warn("请输入文件夹名称"),e.abrupt("return");case 4:if(" "!==L.charAt(0)){e.next=7;break}return d.b.warn("首字符不能为空格"),e.abrupt("return");case 7:i=0;case 8:if(!(i<L.length)){e.next=15;break}if(!n.includes(L.charAt(i))){e.next=12;break}return d.b.warn("文件夹名称包含特殊字符"),e.abrupt("return",!1);case 12:i++,e.next=8;break;case 15:return e.next=17,Object(_e.a)("/api/item_banks_groups/".concat(Math.abs(t),".json"),{method:"put",body:{name:L}});case 17:0===e.sent.status&&(T(!1),f());case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),le=function(){var e=Object(g.a)(k.a.mark((function e(){var t;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(Le.i)(ae);case 2:t=e.sent,z(t.count),U(t.courses.map((function(e){return{key:e.id,title:e.name,children:e.course_groups.map((function(e){return{key:e.course_group_id,title:e.course_group_name}}))}})));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ce=function(){var e=Object(g.a)(k.a.mark((function e(t){var n,i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.target.checked){e.next=12;break}return q(!0),Z([]),n=[],i=function(){var e=Object(g.a)(k.a.mark((function e(){var t;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(Le.i)(ae);case 2:if((t=e.sent).courses.map((function(e){return n.push({key:e.id,title:e.name,children:e.course_groups.map((function(e){return{key:e.course_group_id,title:e.course_group_name}}))})})),!(t.courses.length>=ae.per_page)){e.next=9;break}return 1==ae.page?ae.page+=1:ae.page=1,se(ae),e.next=9,i();case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.next=7,i();case 7:ne(n.length),n.map((function(e){J.push(e.key),0!=e.children.length&&e.children.map((function(e){return J.push(e.key)}))})),Z(J),e.next=14;break;case 12:q(!1),Z([]);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ue=function(){var e=Object(g.a)(k.a.mark((function e(t){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ae.page=t,se(ae),e.next=4,le();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),he=function(){var e=Object(g.a)(k.a.mark((function e(){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,le();case 2:M(!0);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),de=function(){var e=Object(g.a)(k.a.mark((function e(){var t;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(A.y)({category_id:Math.abs(n.id),course_group_ids:J});case 2:return t=e.sent,e.next=5,t.status;case 5:if(e.t0=e.sent,0!=e.t0){e.next=10;break}d.b.success("发布成功"),e.next=11;break;case 10:d.b.error("发布失败");case 11:return e.next=13,M(!1);case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return S.a.createElement("div",{className:Te.a.list},S.a.createElement(p.a,{visible:P,width:676,centered:!0,footer:null,closable:!1,destroyOnClose:!0},0==F.length?S.a.createElement(D.a,null):S.a.createElement("div",{className:Te.a.ClassModal},S.a.createElement("div",{className:Te.a.top},S.a.createElement("div",{className:Te.a.title},"发送至班级"),S.a.createElement("img",{src:Ae.a,className:Te.a.icon,onClick:function(){return M(!1)}})),S.a.createElement("div",{className:Te.a.tips},"将该文件夹一并发送到对应班级里的学生"),S.a.createElement(xe.a,{checkable:!0,treeData:F,height:400,checkedKeys:J,onCheck:function(e){e.length==te?q(!0):q(!1),Z(e)}}),S.a.createElement("div",{className:Te.a.page},S.a.createElement(h.a,{onChange:ce,checked:Y},"全选"),S.a.createElement(i.a,{className:Te.a.pagination,defaultCurrent:ae.page,showSizeChanger:!1,total:K,hideOnSinglePage:!0,onChange:ue}),S.a.createElement("div",null,S.a.createElement(o.a,{onClick:function(){return M(!1)},style:{marginRight:"20px"}},"取消"),S.a.createElement(o.a,{type:"primary",onClick:de},"确定"))))),S.a.createElement("div",{className:"iconfont icon-wenjianjia2 c-light-primary mr10"}),w?S.a.createElement(y.a,{style:{maxWidth:800},value:L,onChange:function(e){return R(e.target.value)}}):S.a.createElement("div",{title:null==n?void 0:n.name,onClick:function(){return s(n.id)},className:Te.a.name},null==n?void 0:n.name),t&&S.a.createElement("div",{className:Te.a.btns},w?S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{onClick:function(){return oe(n.id)},className:"ml0"},S.a.createElement("i",{className:"iconfont icon-chenggong1",style:{color:"#33BD8C"}})),S.a.createElement("div",{onClick:function(){return T(!1)},className:"ml10"},S.a.createElement("i",{className:"iconfont icon-qingchu"}))):S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{onClick:function(){return c(n.id,!0)},className:"ml0"},S.a.createElement("i",{className:"iconfont icon-shangyi3",style:{transform:"translateY(2px)"}})),S.a.createElement("div",{onClick:function(){return c(n.id,!1)},className:"ml10",style:{transform:"rotate(180deg) translateY(1px)"}},S.a.createElement("i",{className:"iconfont icon-shangyi3"}))),Object(be.l)()&&S.a.createElement(o.a,{type:"link",onClick:he},"发送至班级"),S.a.createElement(o.a,{style:{marginLeft:16},onClick:function(){return T(!0)},type:"link"},"重命名"),S.a.createElement(o.a,{onClick:function(){return e=n.id,void p.a.confirm({title:"提示",okText:"确认删除",className:"custom-modal-divider ",icon:null,content:S.a.createElement("div",null,S.a.createElement("p",null,"本次删除操作确定后内容将无法恢复,是否继续?"),S.a.createElement("p",null,"删除文件夹,将同步删除其所包含的全部子文件夹和试题,请慎重操作!")),cancelText:"取消",onOk:(t=Object(g.a)(k.a.mark((function t(){return k.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(_e.a)("/api/item_banks_groups/".concat(Math.abs(e),".json"),{method:"delete",body:{}});case 2:0===t.sent.status&&b([e]);case 4:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})});var e,t},type:"link",danger:!0},"删除")))},Re=n("rCGY"),Ie=n.n(Re),Ne=function(e){e.dispatch;var t,n,i=e.problemset,r=e.groupIds,a=void 0===r?[]:r,s=e.onChangeTeachGroup,o=void 0===s?function(){}:s,l=i.teachGroupData;return!(null==l||null===(t=l.groups)||void 0===t||!t.length)&&S.a.createElement("div",{className:Ie.a.groupWrap},S.a.createElement("span",{className:"".concat(Ie.a.minWidth73," ml20 mt3")},"教研团队:"),S.a.createElement("span",null,S.a.createElement("li",{className:"mr10 mb10 ".concat(Ie.a.minWidth60," ").concat(Ie.a.directionItem," ").concat(null!=a&&a.length?"":Ie.a.active),onClick:function(){return o([])}},"全部")),S.a.createElement("div",{className:Ie.a.directionContentWrap},null==l||null===(n=l.groups)||void 0===n?void 0:n.map((function(e){return S.a.createElement("span",null,S.a.createElement("li",{key:e.group_id,onClick:function(){return o([e.group_id])},className:"".concat(Ie.a.directionItem," ").concat(null!=a&&a.includes(e.group_id)?Ie.a.active:"")},e.name))}))))},Pe=n("1vsH"),Me=(n("/zsF"),n("PArb")),je=(n("14J3"),n("BMrR")),Be=(n("jCWc"),n("kPKH")),Fe=(n("y8nQ"),n("Vl3Y")),Ue=n("nSDg"),Ge=n.n(Ue),He=n("HBuW"),Ke=n("NLgs"),ze=y.a.Search,Ve={id:"type",name:"来源",children:[{name:"全部",id:"all",type:"type"},{name:"我的",id:"mine",type:"type"}]},We={id:"diff",name:"难度",children:[{name:"全部",id:"",type:"diff"},{name:"初级",id:1,type:"diff"},{name:"中级",id:2,type:"diff"},{name:"中高级",id:3,type:"diff"},{name:"高级",id:4,type:"diff"}]},Ye=Object(x.a)((function(e){return{classroomList:e.classroomList,loading:e.loading}}))((function(e){var t,n,r,a,c=e.classroomList,u=(e.loading,e.dispatch),f=e.cb,p=e.shixunIds,m=void 0===p?[]:p,y=Object(G.i)(),b=(Object(G.h)(),c.actionTabs,Fe.a.useForm()),E=(Object(v.a)(b,1)[0],c.shixunLists),x=Object(C.useState)([]),w=Object(v.a)(x,2),T=w[0],_=w[1],O=Object(C.useState)([]),A=Object(v.a)(O,2),L=A[0],R=A[1],I=Object(C.useState)({page:1,type:"all",diff:0,status:"published",order:"desc",limit:10,sort:"myshixuns_count",tag_level:null,sub_discipline_id:null,discipline_id:null}),N=Object(v.a)(I,2),P=N[0],M=N[1];Object(C.useEffect)((function(){"选用实践项目"===c.actionTabs.key&&u({type:"classroomList/getShixunLists",payload:Object(s.a)({},P)})}),[c.actionTabs.key,P]),Object(C.useEffect)((function(){try{"选用实践项目"===c.actionTabs.key?(document.body.removeAttribute("data-custom"),document.body.setAttribute("data-self","height")):document.body.removeAttribute("data-self")}catch(e){}return function(){document.body.removeAttribute("data-self"),document.body.setAttribute("data-custom","initial")}}),[c.actionTabs.key]),Object(C.useEffect)((function(){j()}),[y]);var j=function(){var e=Object(g.a)(k.a.mark((function e(){var t;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(He.ob)({});case 2:t=e.sent,R((null==t?void 0:t.disciplines)||[]);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(e,t,n){P.tag_level=e,P.sub_discipline_id=t,P.discipline_id=n,M(Object(s.a)({},P)),u({type:"classroomList/getShixunLists",payload:Object(s.a)({},P)})},F=function(){u({type:"classroomList/setActionTabs",payload:{}}),M({page:1,type:"all",diff:0,status:"all",order:"desc",limit:10,sort:"myshixuns_count",tag_level:null,sub_discipline_id:null,discipline_id:null})};return"选用实践项目"!==c.actionTabs.key?null:S.a.createElement(ie.a,{placement:"bottom",height:"100%",closable:!0,onClose:F,visible:"选用实践项目"===c.actionTabs.key,key:"bottom",className:Ge.a.drawer,footer:S.a.createElement("div",{className:"tc"},S.a.createElement(o.a,{size:"large",onClick:function(){F(),_([])},style:{marginRight:8}},"取消"),S.a.createElement(o.a,{size:"large",onClick:Object(g.a)(k.a.mark((function e(){var t,n,i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=function(e){var t,n,i=T[e];if(m.includes(i))return d.b.info("请勿重复选择:".concat(null==E||null===(t=E.shixun_list)||void 0===t||null===(n=t.find((function(e){return e.id===i})))||void 0===n?void 0:n.title)),{v:void 0}},n=0;case 2:if(!(n<(null==T?void 0:T.length))){e.next=9;break}if("object"!=typeof(i=t(n))){e.next=6;break}return e.abrupt("return",i.v);case 6:n++,e.next=2;break;case 9:F(),f(T),_([]);case 12:case"end":return e.stop()}}),e)}))),type:"primary"},"确定"))},S.a.createElement("section",{className:"tc"},S.a.createElement(ze,{placeholder:"实训信息/院校名称/创建者",enterButton:"搜索",size:"large",className:Ge.a.search,onSearch:function(e){P.keyword=e,P.page=1,u({type:"classroomList/getShixunLists",payload:Object(s.a)({},P)})}})),S.a.createElement("section",{className:"edu-container"},S.a.createElement("ul",{className:Ge.a.menu},S.a.createElement("li",null,Ve.name),null==Ve||null===(t=Ve.children)||void 0===t?void 0:t.map((function(e,t){return S.a.createElement("li",{className:P[Ve.id]==e.id?Ge.a.actived:"",onClick:function(){P[Ve.id]=e.id,M(Object(s.a)({},P)),u({type:"classroomList/getShixunLists",payload:Object(s.a)({},P)})}},S.a.createElement("strong",null,e.name))}))),S.a.createElement("ul",{className:Ge.a.menuDirection},S.a.createElement("li",{className:Ge.a.directionName},"方向"),S.a.createElement("li",{className:P.discipline_id?"":Ge.a.actived,onClick:function(){B(null,null,null)}},S.a.createElement("strong",null,"全部")),null==L?void 0:L.map((function(e,t){return S.a.createElement("li",{key:t,className:P.discipline_id==e.id?Ge.a.actived:""},S.a.createElement("strong",{onClick:function(){B(1,null,e.id)}},e.name),S.a.createElement("div",null,e.sub_disciplines.map((function(t,n){return S.a.createElement("div",{key:n,className:"mt5"},S.a.createElement("div",{className:P.sub_discipline_id==t.id?"".concat(Ge.a.actived2," ").concat(Ge.a.subTag):Ge.a.subTag,onClick:function(){B(2,t.id,e.id)}},t.name),S.a.createElement("ul",{className:"mt5"},t.tags&&t.tags.map((function(t,n){return S.a.createElement("li",{key:n,className:P.sub_discipline_id==t.id&&3===P.tag_level?Ge.a.actived2:"",onClick:function(){B(3,t.id,e.id)}},t.name)}))))}))))}))),S.a.createElement("ul",{className:Ge.a.menu},S.a.createElement("li",null,We.name),null==We||null===(n=We.children)||void 0===n?void 0:n.map((function(e,t){return S.a.createElement("li",{className:P[We.id]==e.id?Ge.a.actived:"",onClick:function(){P[We.id]=e.id,M(Object(s.a)({},P)),u({type:"classroomList/getShixunLists",payload:Object(s.a)({},P)})}},S.a.createElement("strong",null,e.name))}))),S.a.createElement(je.a,null,S.a.createElement(Be.a,{flex:"1"},S.a.createElement("div",{className:Ge.a.menuCourse,style:{margin:"0px 15px"}},S.a.createElement("ul",null,S.a.createElement("li",null,"已选",S.a.createElement("span",{className:"c-blue"},T.length),"个实训"),S.a.createElement("li",null,"共",S.a.createElement("span",{className:"c-blue"},E.shixuns_count),"个课程"),S.a.createElement("li",{className:"current",onClick:function(){P.order="asc"===P.order?"desc":"asc",M(Object(s.a)({},P))}},"学习人数",S.a.createElement("p",{className:"edu-sorter current ".concat(P.order)},"asc"===P.order?S.a.createElement("span",{className:"iconfont icon-sanjiaoxing-up"}):S.a.createElement("span",{className:"iconfont icon-sanjiaoxing-down"})))))),S.a.createElement(Be.a,{className:"c-grey-999"},"仅已发布的实训进入本列表备选")),null==E||null===(r=E.shixun_list)||void 0===r?void 0:r.map((function(e,t){return S.a.createElement("div",{className:Ge.a.listItem,key:t},S.a.createElement(h.a,{checked:T.includes(e.id),value:e.id,disabled:null==e?void 0:e.need_authorize,onChange:function(t){T.indexOf(e.id);T.indexOf(e.id)>-1?_(T.filter((function(t){return t!==e.id}))):_(T.concat(e.id))}}),S.a.createElement("div",{className:Ge.a.info},S.a.createElement("div",{className:Ge.a.title},S.a.createElement("div",{className:Ge.a.titleLeft},S.a.createElement("a",{className:"c-black",href:"/shixuns/".concat(null==e?void 0:e.identifier,"/challenges"),target:"_blank"},S.a.createElement("strong",{className:"font16",dangerouslySetInnerHTML:{__html:e.title}})),(null==e?void 0:e.need_authorize)&&S.a.createElement("span",{onClick:function(){Object(Ke.a)(!1)},style:{marginRight:"auto"},className:"tag-style bg-pink current ml10"},"需授权"),Object(be.v)()&&1===(null==e?void 0:e.mark_status)&&S.a.createElement(l.a,{title:null==e?void 0:e.mark_content},S.a.createElement("span",{style:{marginRight:"auto",background:"#2FA34F"},className:"tag-style current ml10"},"正常")),Object(be.v)()&&2===(null==e?void 0:e.mark_status)&&S.a.createElement(l.a,{title:null==e?void 0:e.mark_content},S.a.createElement("span",{style:{marginRight:"auto",background:"#FF8C29"},className:"tag-style current ml10"},"需完善")),Object(be.v)()&&3===(null==e?void 0:e.mark_status)&&S.a.createElement(l.a,{title:null==e?void 0:e.mark_content},S.a.createElement("span",{style:{marginRight:"auto",background:"#E53333"},className:"tag-style current ml10"},"无法使用")))),S.a.createElement("div",{className:"flex-wrp mt10 font14 c-light-black"},S.a.createElement("span",{className:Ge.a.description,dangerouslySetInnerHTML:{__html:e.description}})),S.a.createElement("div",{className:" mt15"},e.challenge_names.map((function(e,t){return S.a.createElement("span",{key:t,className:"mr30 font12"},"第",t+1,"关 ",e," ")}))),S.a.createElement(Me.a,{dashed:!0}),S.a.createElement("div",{className:"c-light-black mt20 font12"},S.a.createElement("span",null,e.author_name),S.a.createElement("span",{className:"ml15 mr15"},"|"),S.a.createElement("span",null,e.author_school_name),S.a.createElement("span",{className:"ml15 mr15"},"|"),S.a.createElement("span",null,"难度系数 ",e.level),S.a.createElement("span",{className:"ml15 mr15"},"|"),S.a.createElement("span",null,"学习人数 "),S.a.createElement("span",null,e.study_count))))})),0===(null==E||null===(a=E.shixun_list)||void 0===a?void 0:a.length)&&S.a.createElement(D.a,null),S.a.createElement("p",null)),S.a.createElement("div",{className:"tc mt20"},S.a.createElement(i.a,{defaultCurrent:1,hideOnSinglePage:!0,defaultPageSize:20,showSizeChanger:!1,current:P.page||1,showQuickJumper:!0,total:null==E?void 0:E.shixuns_count,onChange:function(e){P.page=e,M(Object(s.a)({},P))}})))})),qe=b.a.TabPane,Xe=y.a.Search,Qe=y.a.TextArea;t.default=Object(x.a)((function(e){var t=e.problemset,n=e.user,i=e.loading;return{problemset:t,user:n,globalSetting:e.globalSetting,loading:i.effects}}))((function(e){var t,n,y,E,T,_,R,I=e.problemset,P=e.user,M=(e.globalSetting,e.loading),F=e.dispatch,U=e.match,G=Object(m.a)(e,["problemset","user","globalSetting","loading","dispatch","match"]),W=Object(C.useState)({discipline_id:null,sub_discipline_id:null,tag_discipline_id:null,group_id:null,type:"0",item_type:null,difficulty:null,keyword:null,page:1,per_page:20,sort_by:"updated_at",sort_direction:"desc",id:(null===(t=G.location)||void 0===t||null===(n=t.query)||void 0===n?void 0:n.id)||null,exam_id:(null==U||null===(y=U.params)||void 0===y?void 0:y.id)||null,exercise_id:(null==U||null===(E=U.params)||void 0===E?void 0:E.categoryId)||null}),J=Object(v.a)(W,2),Z=J[0],$=J[1],te=Object(C.useState)(0),ie=Object(v.a)(te,2),re=ie[0],ae=ie[1],se=Object(C.useState)([]),oe=Object(v.a)(se,2),le=oe[0],ce=oe[1],ue=Object(C.useState)("0"),de=Object(v.a)(ue,2),pe=de[0],ge=de[1],me=Object(C.useState)(0),ye=Object(v.a)(me,2),Ee=ye[0],ke=ye[1],xe=Object(C.useState)(-1),we=Object(v.a)(xe,2),Te=we[0],Oe=we[1],Ae=Object(C.useState)([]),Le=Object(v.a)(Ae,2),Re=Le[0],Ie=Le[1],Me=Object(C.useState)(!1),je=Object(v.a)(Me,2),Be=(je[0],je[1]),Fe=Object(C.useState)([]),Ue=Object(v.a)(Fe,2),Ge=Ue[0],He=Ue[1],Ke=Object(C.useState)(0),ze=Object(v.a)(Ke,2),Ve=ze[0],We=ze[1],Je=Object(C.useState)(!1),Ze=Object(v.a)(Je,2),$e=Ze[0],et=Ze[1],tt=Object(C.useState)(!1),nt=Object(v.a)(tt,2),it=nt[0],rt=nt[1],at=Object(C.useRef)(!1),st=(Object(C.useRef)(""),Object(C.useRef)()),ot=Object(C.useRef)(),lt=Object(C.useRef)(),ct=Object(C.useState)(),ut=Object(v.a)(ct,2),ht=ut[0],dt=ut[1],ft=Object(C.useState)([]),pt=Object(v.a)(ft,2),gt=pt[0],vt=pt[1],mt=Object(C.useRef)(!1),yt="/problemset"===(null==U?void 0:U.url),bt=P.userInfo||{},Et=bt.admin,kt=bt.business,Ct=bt.is_shixun_marker,St=bt.is_teacher,xt=bt.user_identity,wt=Et||kt||Ct||St||"学生"!==xt,Tt=Object(C.useState)("按更新时间降序"),_t=Object(v.a)(Tt,2),Ot=_t[0],At=_t[1],Lt=Object(C.useState)([]),Dt=Object(v.a)(Lt,2),Rt=Dt[0],It=Dt[1],Nt=Object(C.useState)(0),Pt=Object(v.a)(Nt,2),Mt=Pt[0],jt=Pt[1],Bt=Object(C.useRef)(null),Ft=Object(C.useRef)(!1),Ut=Object(C.useState)(!1),Gt=Object(v.a)(Ut,2),Ht=Gt[0],Kt=Gt[1],zt=[{name:"按更新时间升序",type:"updated_at",direction:"asc"},{name:"按更新时间降序",type:"updated_at",direction:"desc"},{name:"按使用次数升序",type:"quotes",direction:"asc"},{name:"按使用次数降序",type:"quotes",direction:"desc"}];Object(C.useEffect)((function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}}),[]),Object(C.useEffect)((function(){var e;F({type:"problemset/getDisciplines",payload:{source:"question"}});var t=(null===(e=G.location.query)||void 0===e?void 0:e.group_id)||0;Z.group_id=Number(t),$(Z),Wt(Z),Yt(),Vt()}),[]),Object(C.useEffect)((function(){return F({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),F({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1}),function(){F({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),F({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}}),[]),Object(C.useEffect)((function(){return F({type:"globalSetting/headerFixedToggle",payload:!0}),function(){F({type:"globalSetting/headerFixedToggle",payload:!1})}}),[]),Object(C.useEffect)((function(){return F({type:"globalSetting/headerFooterToggle",payload:yt}),function(){F({type:"globalSetting/headerFooterToggle",payload:!0})}}),[]),Object(C.useEffect)((function(){var e;I.disciplinesData&&Ie((null==I||null===(e=I.disciplinesData)||void 0===e?void 0:e.tag_disciplines)||[]);Object(Pe.V)("试题库")}),[null==I?void 0:I.disciplinesData]);var Vt=function(){var e=Object(g.a)(k.a.mark((function e(){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:F({type:"problemset/getTeachGroupData"});case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(C.useEffect)((function(){var e=I.basketData||{},t=e.completion_questions_count,n=void 0===t?0:t,i=e.judgement_questions_count,r=void 0===i?0:i,a=e.multiple_questions_count,s=void 0===a?0:a,o=e.practical_questions_count,l=void 0===o?0:o,c=e.program_questions_count,u=void 0===c?0:c,h=e.single_questions_count,d=void 0===h?0:h,f=e.subjective_questions_count,p=void 0===f?0:f,g=e.combination_questions_count;We(n+r+s+l+u+d+p+(void 0===g?0:g))}),[I.basketData]);var Wt=function(){var e=Object(g.a)(k.a.mark((function e(t){var n,i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F({type:"problemset/getItemBanks",payload:t});case 2:(n=e.sent)&&403!==n.status&&401!==n.status&&500!==n.status&&(ae(n.items_count||0),ce(n.items||[]),dt(n.used_shixun_ids||[]),qt(n.items||[]),vt([]),He((null==n?void 0:n.navigation)||[]),It((null==n?void 0:n.item_banks_group)||[]),Ft.current||(jt((null==n||null===(i=n.item_banks_group)||void 0===i?void 0:i.length)>5?1:0),Ft.current=!1),ke((null==n?void 0:n.added_num)||0),Kt(!1));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Yt=function(){F({type:"problemset/getBasketList",payload:{}})},qt=function(e){var t=e.every((function(e){var t;return 0===(null===(t=e.program_attr)||void 0===t?void 0:t.status)}));at.current=t},Xt=function(){Z.per_page=20,$(Z),Wt(Z)},Qt=function(e){var t=e.length===le.length&&Z.page>1?Z.page-1:Z.page;Z.page=t,Z.per_page=20,Yt(),$(Z),Wt(Z)},Jt=function(){F({type:"problemset/setActionTabs",payload:{key:"Problemset-PublicReview"}})},Zt=function(){var e=Object(g.a)(k.a.mark((function e(t,n){var i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=6;break}return e.next=3,Object(A.l)({id:t});case 3:e.t0=e.sent,e.next=9;break;case 6:return e.next=8,Object(A.D)({id:t});case 8:e.t0=e.sent;case 9:0===(null==(i=e.t0)?void 0:i.status)&&Xt();case 11:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),$t=function(){var e=Object(g.a)(k.a.mark((function e(t){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:bn(t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),en=function(){var e=Object(g.a)(k.a.mark((function e(t){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:vn(t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),tn=function(e){ot.current="",st.current="",p.a.confirm({centered:!0,width:530,icon:null,okText:"确定",cancelText:"取消",title:"试题纠错",content:S.a.createElement("div",{className:"font14"},S.a.createElement("div",null,"错误类型:"),S.a.createElement(f.a.Group,{className:"mt10",onChange:function(e){return st.current=e.target.value}},S.a.createElement(f.a,{value:"题干"},"题干"),S.a.createElement(f.a,{value:"答案"},"答案"),S.a.createElement(f.a,{value:"解析"},"解析"),S.a.createElement(f.a,{value:"属性"},"属性"),S.a.createElement(f.a,{value:"其它"},"其它")),S.a.createElement("div",{className:"mt10"},"错误描述:"),S.a.createElement(Qe,{className:"mt10",rows:4,defaultValue:ot.current,onChange:function(e){return ot.current=e.target.value}})),onOk:function(){return new Promise(function(){var t=Object(g.a)(k.a.mark((function t(n,i){return k.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(st.current&&ot.current){t.next=3;break}return d.b.info("请填写错误类型和错误描述!"),t.abrupt("return",i());case 3:return t.next=5,Object(A.m)({id:e,clazz:st.current,description:ot.current});case 5:0===t.sent.status&&d.b.info("添加成功!"),n();case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}})},nn=function(e){F({type:"problemset/setActionTabs",payload:{key:"Problemset-SetPrivate",params:{id:e}}})},rn=function(e){F({type:"problemset/setActionTabs",payload:{key:"Problemset-Delete",params:{id:e}}})},an=function(){var e=Object(g.a)(k.a.mark((function e(t){var n,i,r,a;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("PROGRAM"!==(n=t.item_type)){e.next=12;break}return i=t.program_attr.identifier,e.next=5,F({type:"problemset/startExperience",payload:{id:i}});case 5:if(0!==(r=e.sent).status){e.next=10;break}return a=r.identifier,Object(Pe.Q)("/myproblems/".concat(a)),e.abrupt("return");case 10:return d.b.warn(r.message),e.abrupt("return");case 12:F({type:"problemset/setActionTabs",payload:{key:n,params:t}});case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),sn=function(){var e=Object(g.a)(k.a.mark((function e(t){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Z.exam_id){e.next=6;break}return e.next=3,Object(A.J)({item_id:t,id:Z.exam_id});case 3:return 0===e.sent.status&&Xt(),e.abrupt("return");case 6:if(null==Z||!Z.exercise_id){e.next=12;break}return e.next=9,Object(_e.a)("/api/exercise_questions/delete_by_item_bank.json ",{method:"post",body:{exercise_id:null==Z?void 0:Z.exercise_id,item_bank_ids:[t]}});case 9:return 0===e.sent.status&&Xt(),e.abrupt("return");case 12:return e.next=14,F({type:"problemset/cancel",payload:{id:t,item_bank:1}});case 14:0===e.sent.status&&(Xt(),Yt());case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),on=function(){var e=Object(g.a)(k.a.mark((function e(t){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Z.page=1,Z.per_page=20,Z.group_id=Math.abs(t),$(Z),Wt(Z);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ln=function(){var e=Object(g.a)(k.a.mark((function e(t,n){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ft.current=!0,Kt(!0),!n){e.next=8;break}return e.next=5,Object(A.F)({id:Math.abs(t)});case 5:e.t0=e.sent,e.next=11;break;case 8:return e.next=10,Object(A.E)({id:Math.abs(t)});case 10:e.t0=e.sent;case 11:0===e.t0.status?Xt():(Ft.current=!1,Kt(!1));case 13:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),cn=function(){var e=Object(g.a)(k.a.mark((function e(t){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Z.exam_id){e.next=6;break}return e.next=3,Object(A.q)({exam_id:Z.exam_id,item_bank_ids:[t]});case 3:return 0===e.sent.status&&Xt(),e.abrupt("return");case 6:if(null==Z||!Z.exercise_id){e.next=12;break}return e.next=9,Object(_e.a)("/api/exercises/".concat(null==Z?void 0:Z.exercise_id,"/select_questions.json"),{method:"post",body:{item_bank_ids:[t]}});case 9:return 0===e.sent.status&&Xt(),e.abrupt("return");case 12:if(200!==Ve){e.next=15;break}return d.b.info("已选200个试题(不能在选用更多试题)"),e.abrupt("return");case 15:return e.next=17,F({type:"problemset/select",payload:{item_bank_ids:[t]}});case 17:0===e.sent.status&&(Xt(),Yt());case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),un=function(){var e=Object(g.a)(k.a.mark((function e(t){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}if(null!=gt&>.length){e.next=3;break}return e.abrupt("return",d.b.info("请先选择试题"));case 3:lt.current=[0],p.a.confirm({centered:!0,width:530,okText:"确定",cancelText:"取消",title:"移动到",maskClosable:!0,className:"custom-modal-divider",icon:null,content:S.a.createElement("div",{className:"font14 ".concat(ne.a.overflow),style:{maxHeight:500,overflow:"auto"}},S.a.createElement("p",{className:"c-grey-333"},"请选择需要移动到的文件夹"),S.a.createElement(O.a,{defaultValue:!0,value:lt.current,onChange:function(e){return lt.current=e}})),onOk:function(){var e=Object(g.a)(k.a.mark((function e(){var n,i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(A.f)({ids:t?[t]:gt,groups_ids:null===(n=lt.current)||void 0===n?void 0:n[0]});case 2:i=e.sent,lt.current=[],0===(null==i?void 0:i.status)&&Xt();case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),hn=function(){var e=Object(g.a)(k.a.mark((function e(t){var n,i;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(A.A)({clazz:"ItemBank",id:t});case 2:n=e.sent,i=(null==n?void 0:n.groups)||[],lt.current=[],p.a.confirm({centered:!0,width:530,okText:"确定撤销",cancelText:"取消",title:"本题已共享的教研团队",maskClosable:!0,icon:null,content:S.a.createElement("div",{className:"font14 ".concat(ne.a.overflow)},S.a.createElement("p",{className:"c-grey-999"},"选中并确定,即撤销本题对选中教研团队的分享"),S.a.createElement(h.a.Group,{className:ne.a.checkbox,defaultValue:lt.current,onChange:function(e){return lt.current=e}},null==i?void 0:i.map((function(e){return S.a.createElement(h.a,{key:e.group_id,value:e.group_id},e.name)})))),onOk:function(){var e=Object(g.a)(k.a.mark((function e(){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=Object(g.a)(k.a.mark((function e(n,r){var a,s,o;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(lt.current.length){e.next=3;break}return d.b.warn("请选择需要撤销共享的教研团队"),e.abrupt("return",r());case 3:return s=null==i||null===(a=i.map((function(e){return e.group_id})))||void 0===a?void 0:a.filter((function(e){return!lt.current.includes(e)})),e.next=6,Object(A.j)({ids:[t],clazz:"ItemBank",group_ids:s});case 6:return o=e.sent,lt.current=[],0===(null==o?void 0:o.status)&&(d.b.info("撤销共享成功"),Xt()),e.abrupt("return",n());case 10:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),dn=function(e){var t=gt;if(null==t||!t.length)return d.b.info("请先选择试题");Ve+t.length>200&&e&&yt?d.b.info("试题篮中最多可再加入".concat(200-Ve,"题,当前选中").concat(t.length,"题,请重新选择")):e?fn(t):pn(t)},fn=function(){var e=Object(g.a)(k.a.mark((function e(t){var n;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Object(u.a)(t),le.forEach((function(e){var t;n.includes(e.id)&&("PROGRAM"===e.item_type&&0===(null===(t=e.program_attr)||void 0===t?void 0:t.status)&&Object(V.remove)(n,(function(t){return t===e.id})))})),p.a.confirm({width:530,title:"提示",className:"custom-modal-divider ",icon:null,centered:!0,okText:"确定",cancelText:"取消",content:S.a.createElement("div",null,"当前已选择",t.length,"道试题,已加入过的试题或未发布的编程题将不会重复加入 "),onOk:function(){var e=Object(g.a)(k.a.mark((function e(){var t;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Z.exam_id){e.next=6;break}return e.next=3,Object(A.q)({exam_id:Z.exam_id,item_bank_ids:n});case 3:t=e.sent,e.next=15;break;case 6:if(null==Z||!Z.exercise_id){e.next=12;break}return e.next=9,Object(_e.a)("/api/exercises/".concat(null==Z?void 0:Z.exercise_id,"/select_questions.json"),{method:"post",body:{item_bank_ids:n}});case 9:t=e.sent,e.next=15;break;case 12:return e.next=14,F({type:"problemset/select",payload:{item_bank_ids:n}});case 14:t=e.sent;case 15:0===t.status&&(Xt(),Yt());case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pn=function(){var e=Object(g.a)(k.a.mark((function e(t){var n;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Z.exam_id){e.next=6;break}return e.next=3,Object(_e.a)("/api/examination_banks/".concat(Z.exam_id,"/batch_revoke_item.json"),{method:"post",body:{item_ids:t}});case 3:n=e.sent,e.next=15;break;case 6:if(null==Z||!Z.exercise_id){e.next=12;break}return e.next=9,Object(_e.a)("/api/exercise_questions/delete_by_item_bank.json ",{method:"post",body:{exercise_id:null==Z?void 0:Z.exercise_id,item_bank_ids:t}});case 9:n=e.sent,e.next=15;break;case 12:return e.next=14,F({type:"problemset/unselectAll",payload:{item_ids:t}});case 14:n=e.sent;case 15:0===n.status&&(Xt(),Yt());case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),gn=function(){var e=Object(g.a)(k.a.mark((function e(t){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!yt||200!==Ve){e.next=3;break}return d.b.info("已选200个试题(不能在选用更多试题)"),e.abrupt("return");case 3:if(!Z.exam_id){e.next=10;break}return e.next=6,Object(A.q)({exam_id:Z.exam_id,shixun_ids:t});case 6:0===e.sent.status&&Xt(),e.next=14;break;case 10:return e.next=12,F({type:"problemset/select",payload:{shixun_ids:t}});case 12:0===e.sent.status&&(Yt(),Xt());case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),vn=function(e){var t,n,i,r;if(null!=gt&>.length||e)return null!==(t=I.teachGroupData)&&void 0!==t&&null!==(n=t.groups)&&void 0!==n&&n.length?void p.a.confirm({centered:!0,width:530,okText:"确定",cancelText:"取消",title:"共享至教研团队",maskClosable:!0,icon:null,content:S.a.createElement("div",{className:"font14 ".concat(ne.a.overflow)},S.a.createElement(h.a.Group,{className:ne.a.checkbox,defaultValue:lt.current,onChange:function(e){return lt.current=e}},null===(i=I.teachGroupData)||void 0===i||null===(r=i.groups)||void 0===r?void 0:r.map((function(e){return S.a.createElement(h.a,{key:e.group_id,value:e.group_id},e.name)})))),onOk:function(){return new Promise(function(){var t=Object(g.a)(k.a.mark((function t(n,i){var r,a;return k.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!==(r=lt.current)&&void 0!==r&&r.length){t.next=3;break}return d.b.info("请先选择教研团队"),t.abrupt("return",i());case 3:return t.next=5,Object(A.j)({ids:e?[e]:gt,clazz:"ItemBank",group_ids:lt.current});case 5:0===(null==(a=t.sent)?void 0:a.status)&&(d.b.info("所选试题成功分享至教研团队"),lt.current=[],vt([]),Xt(),n());case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}):d.b.info("您暂未创建或加入任何教研团队,请前往“我的个人中心-教研团队”查看");F({type:"problemset/setActionTabs",payload:{key:"共享试题",params:Z}})},mn=function(){var e=function(){var e=Object(g.a)(k.a.mark((function e(){var t;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Be(!0),e.next=3,Object(A.h)({ids:gt});case 3:t=e.sent,Be(!1),0===(null==t?void 0:t.status)&&p.a.info({centered:!0,width:530,className:"custom-modal-divider ",okText:"确定",title:"删除结果",maskClosable:!1,keyboard:!1,icon:null,content:"本次成功删除".concat(t.success,"条试题,有").concat(t.fail,"条试题因为公开无法删除,请撤销后再进行删除。"),onOk:function(){Qt(new Array(t.success))}});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();null!=gt&>.length?p.a.confirm({centered:!0,width:530,className:"custom-modal-divider ",okText:"确定",title:"提示",cancelText:"取消",icon:null,content:"本次选中了".concat(null==gt?void 0:gt.length,"条试题进行删除操作,删除后将无法恢复,请确认是否删除?"),onOk:e}):d.b.warn("请选择需要删除的试题")},yn=function(){var e,t;return null!=gt&>.length?null!=le&&null!==(e=le.filter((function(e){return gt.includes(e.id)})))&&void 0!==e&&e.every((function(e){return e.public}))?d.b.info("所选试题已公开,请重新选择"):null!=le&&null!==(t=le.filter((function(e){return gt.includes(e.id)})))&&void 0!==t&&t.find((function(e){var t;return"PROGRAM"===e.item_type&&0===(null===(t=e.program_attr)||void 0===t?void 0:t.status)}))?d.b.info("已选题中存在未发布的编程题"):void("1"===window.localStorage.getItem("problemset-set-public-hint-flag")||P.userInfo.professional_certification?bn():p.a.confirm({centered:!0,width:530,okText:"确定",cancelText:"取消",title:"公开规则告知",maskClosable:!0,icon:null,content:S.a.createElement("div",{className:"font16 c-grey-333"},"公开并经平台审核后,该题将在公共试题库可见,Educoder所有用户均可使用该题。",S.a.createElement("br",null),"公开后不可修改,但可以撤销;撤销公开后可以修改。",S.a.createElement("br",null),"是否确认申请公开?",S.a.createElement("br",null),S.a.createElement(h.a,{className:"mt10",defaultChecked:!1,onChange:function(e){return mt.current=e.target.checked}},"不再提示")),onOk:function(){bn()}})):d.b.info("请先选择试题")},bn=function(){var e=Object(g.a)(k.a.mark((function e(t){var n;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="3"===pe?1:2,e.next=3,Object(A.g)({ids:t?[t]:gt,source:n});case 3:0===e.sent.status&&(mt.current&&window.localStorage.setItem("problemset-set-public-hint-flag","1"),mt.current=!1,vt([]),Xt());case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),En=function(e){var t;p.a.confirm({centered:!0,icon:null,title:"提示",className:"custom-modal-divider",content:S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{className:ne.a.modalContent},"发布后即可应用到自己管理的课堂"),S.a.createElement("div",{className:ne.a.modalContent}," 是否确认发布?")),okText:"确定",cancelText:"取消",onOk:(t=Object(g.a)(k.a.mark((function t(){var n;return k.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(A.I)({identifier:e});case 2:0===(null==(n=t.sent)?void 0:n.status)&&(d.b.success("发布成功"),Xt());case 4:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})})},kn=function(e){var t;p.a.confirm({centered:!0,icon:null,title:"提示",className:"custom-modal-divider",content:S.a.createElement("p",{className:ne.a.modalContent},"是否确认撤销发布?"),okText:"确定",cancelText:"取消",onOk:(t=Object(g.a)(k.a.mark((function t(){var n;return k.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(A.H)({identifier:e});case 2:0===(null==(n=t.sent)?void 0:n.status)&&(d.b.success("撤销发布成功"),Xt());case 4:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})})},Cn=(c.a,wt&&c.a.Item,wt&&c.a.Item,"0"===pe&&yt&&c.a.Item,"0"===pe&&yt&&c.a.Item,"0"===pe&&yt&&c.a.Item,"0"===pe&&yt&&c.a.Item,function(e){vt(e)}),Sn=function(e){vt(e?null==le?void 0:le.map((function(e){return e.id})):[])},xn=[{type:"SINGLE",name:"单选题"},{type:"MULTIPLE",name:"多选题"},{type:"JUDGMENT",name:"判断题"},{type:"PROGRAM",name:"编程题"},{type:"SUBJECTIVE",name:"简答题"},{type:"COMPLETION",name:"填空题"},{type:"COMBINATION",name:"组合题"}],wn={1:"简单",2:"适中",3:"困难"},Tn=function(e,t){var n;console.log(e,t);var i=t.id<0?"--":"4"==pe?S.a.createElement("span",{className:ne.a.btnAdd,onClick:function(){return an(t)}},"开始刷题"):wt?t[Z.exercise_id?"added":"choosed"]?S.a.createElement("span",{key:1,className:ne.a.btnCancel,onClick:function(e){e.target.style.pointerEvents="none",sn(t.id)}},yt?"移出试题篮":S.a.createElement("span",null,S.a.createElement("b",{className:"iconfont icon-yichu ".concat(ne.a.cancelC)}),"移出")):"PROGRAM"===t.item_type&&0===(null===(n=t.program_attr)||void 0===n?void 0:n.status)?S.a.createElement(l.a,{placement:"top",title:"编程题未发布,不能加入!"},S.a.createElement("span",{className:ne.a.btnAdd,style:{cursor:"not-allowed",background:"#E3E6EC",color:"#B1BACD"}}," ",yt?"加入试题篮":S.a.createElement("span",{style:{padding:"0 3px"}},S.a.createElement("b",{className:"iconfont icon-jiaru ".concat(ne.a.addC)}),"加入")," ")):S.a.createElement("span",{className:ne.a.btnAdd,onClick:function(){return cn(t.id)}},yt?"加入试题篮":S.a.createElement("span",{style:{padding:"0 3px"}},S.a.createElement("b",{className:"iconfont icon-jiaru ".concat(ne.a.addC)}),"加入")):S.a.createElement(S.a.Fragment,null);return S.a.createElement("span",{className:ne.a.actonBtn},i,t.id>0&&S.a.createElement(Ce,{isProblemset:yt,user:P,key:t.id,data:t,activeTabsKey:pe,selectIds:gt,onCollect:Zt,onSetPublic:$t,onStartExperience:an,onCorrection:tn,onPublicReview:Jt,onSetPrivate:nn,onDelete:rn,onCancel:sn,onSelect:cn,onMoveTo:un,onSetShare:en,onCancelShare:hn,onPublish:En,onCancelPublish:kn}))};return S.a.createElement(C.Fragment,null,S.a.createElement("section",null,S.a.createElement("div",{className:ne.a.wrap},S.a.createElement("div",{className:ne.a.title},"试题库"),S.a.createElement(w.a,{showSelectAll:!1,className:ne.a.select,disciplinesData:null===(T=I.disciplinesData)||void 0===T?void 0:T.disciplines,knowledgeData:Re,directionValue:Z.discipline_id,subDisciplineValue:Z.sub_discipline_id,typeValue:Z.item_type,showKnowledge:!0,knowledgeValue:Te,difficultyValue:Z.difficulty,showShixun:!Object(be.m)()&&!Z.exercise_id,onShixunChange:function(){F({type:"classroomList/setActionTabs",payload:{key:"选用实践项目"}})},onDirectionChange:function(e,t){var n;(Z.discipline_id=e||"",Z.sub_discipline_id=t||"",Z.tag_discipline_id="",Z.page=1,Z.per_page=20,delete Z.id,Oe(null===e?-1:null),$(Z),Wt(Z),null!==e)?Ie(function(e,t){var n,i,r=[];e||(null==I||null===(n=I.disciplinesData)||void 0===n||null===(i=n.disciplines)||void 0===i||i.forEach((function(e){var t;null==e||null===(t=e.sub_disciplines)||void 0===t||t.forEach((function(e){var t;null==e||null===(t=e.tag_disciplines)||void 0===t||t.forEach((function(e){"未匹配知识点"!==e.name&&r.push(e)}))}))})));if(e&&!t){var a,s,o,l=null==I||null===(a=I.disciplinesData)||void 0===a||null===(s=a.disciplines)||void 0===s?void 0:s.find((function(t){return t.id===e}));null==l||null===(o=l.sub_disciplines)||void 0===o||o.forEach((function(e){var t;null==e||null===(t=e.tag_disciplines)||void 0===t||t.forEach((function(e){"未匹配知识点"!==e.name&&r.push(e)}))}))}if(e&&t){var c,u,h,d,f=null==I||null===(c=I.disciplinesData)||void 0===c||null===(u=c.disciplines)||void 0===u?void 0:u.find((function(t){return t.id===e})),p=null==f||null===(h=f.sub_disciplines)||void 0===h?void 0:h.find((function(e){return e.id===t}));null==p||null===(d=p.tag_disciplines)||void 0===d||d.forEach((function(e){"未匹配知识点"!==e.name&&r.push(e)}))}return r}(e,t)):Ie((null==I||null===(n=I.disciplinesData)||void 0===n?void 0:n.tag_disciplines)||[])},onTypeChange:function(e){Z.item_type=e||"",Z.page=1,Z.per_page=20,$(Z),Wt(Z)},onDifficultyChange:function(e){Z.difficulty=e||"",Z.page=1,Z.per_page=20,delete Z.id,$(Z),Wt(Z)},onKnowledgeChange:function(e){var t;(Z.tag_discipline_id=e,Z.page=1,Z.per_page=20,delete Z.id,-1===e)&&(Z.discipline_id="",Z.sub_discipline_id="",Z.tag_discipline_id="",Ie((null==I||null===(t=I.disciplinesData)||void 0===t?void 0:t.tag_disciplines)||[]));Oe(e),$(Z),Wt(Z)}}),S.a.createElement("div",{className:ne.a.contentWrap},S.a.createElement("div",{className:ne.a.tabsWrap},S.a.createElement(b.a,{activeKey:pe,onChange:function(e){Z.discipline_id="",Z.sub_discipline_id="",Z.tag_discipline_id="",Z.item_type=null,Z.difficulty=null,Z.type=e,Z.group_id="0"===e?0:null,Z.page=1,Z.per_page=20,delete Z.id,Oe(-1),ge(e),$(Z),Wt(Z)},tabBarExtraContent:S.a.createElement("div",{className:ne.a.searchWrap},"0"===pe&&yt&&S.a.createElement("div",{className:ne.a.searchContent},S.a.createElement(o.a,{type:"primary",ghost:!0,onClick:function(){F({type:"problemset/setActionTabs",payload:{key:"新建文件夹",params:Z}})},className:"mr20"},S.a.createElement("i",{className:"iconfont icon-xinjianwenjianjia mr5 font14"}),"新建文件夹"),S.a.createElement(o.a,{type:"primary",className:"mr30",ghost:!0,onClick:function(){var e={discipline_id:"&discipline_id=".concat(Z.discipline_id),sub_discipline_id:"&sub_discipline_id=".concat(Z.sub_discipline_id),tag_discipline_id:"&sub_discipline_id=".concat(Z.tag_discipline_id),difficulty:"&difficulty=".concat(Z.difficulty),item_type:"&item_type=".concat(Z.item_type),group_id:"&group_id=".concat(Z.group_id||0)},t="/problemset/newitem?pages=".concat(Z.page);Object.keys(e).forEach((function(n){Z[n]&&(t+=e[n])})),null===x.d||void 0===x.d||x.d.push(t)}},S.a.createElement("i",{className:"iconfont icon-xinzengshiti2 mr5 font14"}),"新增试题")),S.a.createElement(Xe,{allowClear:!0,className:ne.a.search,style:{width:300},placeholder:"请输入关键词搜索",value:Z.keyword,onChange:function(e){Z.keyword=e.target.value,$(Object(s.a)({},Z))},onSearch:function(e){Z.discipline_id="",Z.sub_discipline_id="",Z.tag_discipline_id="",Z.item_type=null,Z.difficulty=null,Z.page=1,Z.keyword=e,delete Z.id,rt(!!e),Oe(-1),$(Z),Wt(Z)}}))},S.a.createElement(qe,{tab:"公共",key:"1"}),(null===(_=I.teachGroupData)||void 0===_||null===(R=_.groups)||void 0===R?void 0:R.length)&&S.a.createElement(qe,{tab:"教研共享",key:"3"}),!Object(be.o)()&&!Object(be.m)()&&S.a.createElement(qe,{tab:"收藏夹",key:"2"}),S.a.createElement(qe,{tab:"我创建的",key:"0"}),Object(be.m)()&&S.a.createElement(qe,{tab:"练习题库",key:"4"}))),S.a.createElement("div",{className:ne.a.batchWrap},S.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center"}},S.a.createElement("div",{className:"font14"},S.a.createElement(a.a,{overlay:S.a.createElement(c.a,{selectedKeys:[Ot]},null==zt?void 0:zt.map((function(e,t){return S.a.createElement(c.a.Item,{key:e.name,onClick:function(){return function(e){Z.sort_by=e.type,Z.sort_direction=e.direction,Z.page=1,Z.per_page=20,At(e.name),$(Z),Wt(Z)}(e)}},e.name)})))},S.a.createElement("span",{style:{color:"#464F66"}},S.a.createElement("i",{className:"iconfont icon-paixu font14 mr5 c-light-primary"}),Ot))),"3"===pe&&S.a.createElement("div",{style:{paddingTop:20,marginLeft:20}},S.a.createElement(Ne,{dispatch:F,problemset:I,groupIds:Z.group_id?[Z.group_id]:[],onChangeTeachGroup:function(e){Z.page=1,Z.group_id=e[0]||null,delete Z.id,$(Z),Wt(Z)}}))),S.a.createElement("div",null,"0"===pe&&yt&&S.a.createElement(o.a,{onClick:function(){null!=gt&>.length?p.a.confirm({centered:!0,width:530,okText:"确定",cancelText:"取消",title:"导出提示",maskClosable:!0,icon:null,content:S.a.createElement("div",{className:"font14 ".concat(ne.a.overflow)},"已选中",null==gt?void 0:gt.length,"道题,其中编程题与实训题暂不支持导出。"),onOk:function(){Object(j.k)({ids:gt})}}):F({type:"problemset/setActionTabs",payload:{key:"导出试题",params:Z}})},type:"link"},S.a.createElement("i",{className:"iconfont icon-daochushiti mr5 c-light-primary"}),S.a.createElement("span",{className:"c-light-primary"},"导出试题")))),it?S.a.createElement("div",null,S.a.createElement(o.a,{style:{paddingLeft:0,marginLeft:25},onClick:function(){Z.page=1,Z.keyword=null,delete Z.id,$(Z),rt(!1),Wt(Z)},type:"link"}," ",S.a.createElement("i",{className:"iconfont icon-fanhui2 font14"}),"返回"),S.a.createElement("span",{className:"font14 mr20 c-grey-333"},"搜索“",Z.keyword,"”")):"0"===pe||"4"===pe?S.a.createElement("div",{style:{overflow:"hidden",height:1===Mt?208:"auto"},ref:Bt,className:ne.a.treeWarp},S.a.createElement(ee,{data:Ge,onClick:on}),S.a.createElement(r.a,{spinning:Ht},null==Rt?void 0:Rt.map((function(e){return S.a.createElement(De,{isProblemset:yt,onRenameOk:function(){Ft.current=!0,Xt()},onDeleteOk:function(){Ft.current=!0,Xt()},user:P,key:e.id,data:e,onOpen:on,onMove:ln})}))),!!Mt&&S.a.createElement("div",{className:ne.a.action},1===Mt&&S.a.createElement("span",{onClick:function(){return jt(2)}},"展开",S.a.createElement("i",{className:"iconfont icon-xiala"})),2===Mt&&S.a.createElement("span",{onClick:function(){return jt(1)}},"收起",S.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))):null,S.a.createElement("div",{className:ne.a.contentListWrap},0!==re?S.a.createElement(r.a,{size:"large",spinning:M["problemset/getItemBanks"]},le.map((function(e,t){var n,i;return S.a.createElement("div",{className:ne.a.li},S.a.createElement("div",{className:ne.a.top},S.a.createElement(Se,{isProblemset:yt,user:P,key:e.id,data:e,activeTabsKey:pe,selectIds:gt,onCollect:Zt,onSetPublic:$t,onStartExperience:an,onCorrection:tn,onPublicReview:Jt,onSetPrivate:nn,onDelete:rn,onCancel:sn,onSelect:cn,onSelectCheckBox:Cn,onMoveTo:un,onSetShare:en,onCancelShare:hn,onPublish:En,onCancelPublish:kn})),S.a.createElement("div",{className:ne.a.bottom},S.a.createElement("p",{className:ne.a.actionLeftItem},null===(n=xn.find((function(t){return t.type===e.item_type})))||void 0===n?void 0:n.name),S.a.createElement("i",{className:ne.a.line}),S.a.createElement("p",{className:ne.a.actionLeftItem},wn[e.difficulty]),S.a.createElement("i",{className:ne.a.line}),S.a.createElement("p",{className:ne.a.actionLeftItem},"创建者:",S.a.createElement("span",{className:"c-grey-333"},null==e||null===(i=e.author)||void 0===i?void 0:i.name)),S.a.createElement("i",{className:ne.a.line}),S.a.createElement("p",{className:ne.a.actionLeftItem},"更新:",S.a.createElement("span",{className:"c-grey-333"},null==e?void 0:e.updated_at)),S.a.createElement("i",{className:ne.a.line}),S.a.createElement("p",{className:ne.a.actionLeftItem},"使用次数:",S.a.createElement("span",{className:"c-grey-333"},null==e?void 0:e.quotes)),S.a.createElement("div",{className:ne.a.more},Tn({},e))))}))):S.a.createElement(r.a,{size:"large",spinning:M["problemset/getItemBanks"]},S.a.createElement(D.a,null))),0!==re&&S.a.createElement(i.a,{showSizeChanger:re>20,showQuickJumper:!0,onChange:function(e,t){Z.page=e,Z.per_page=t,$(Z),Wt(Z)},defaultCurrent:1,pageSize:null==Z?void 0:Z.per_page,current:Z.page||1,total:re,showTotal:function(e){return S.a.createElement("span",{className:"mr10"},"共",S.a.createElement("span",{className:"c-orange"},e),"条数据")}})),yt&&S.a.createElement(he,{basketData:I.basketData,visible:$e,basketTotal:Ve,onClose:function(){return et(!1)},onDelete:function(e){F({type:"problemset/setActionTabs",payload:{key:"Problemset-BasketDelete",params:{type:e}}})}}),!Object(be.m)()&&yt&&S.a.createElement(ve,{visibleBasket:$e,onToggleVisible:function(){return et(!$e)},count:Ve})),S.a.createElement(N,null),S.a.createElement(K,{onReloadData:Xt}),S.a.createElement(z,{onReloadData:function(){return Qt([null])}}),S.a.createElement(fe,{onReloadData:Xt,onReloadBasketData:Yt}),S.a.createElement(Ye,{shixunIds:ht,cb:gn}),S.a.createElement(Y,null),S.a.createElement(q,null),S.a.createElement(X,null),S.a.createElement(Q,null),S.a.createElement(B,null),S.a.createElement(H,{onOk:function(){Z.page=1,$(Z),Wt(Z)}}),S.a.createElement(L,{onOk:function(e){Z.discipline_id="",Z.sub_discipline_id="",Z.tag_discipline_id="",Z.item_type=null,Z.difficulty=null,Z.page=1,Z.per_page=20,Z.group_id=e,Oe(-1),$(Z),Wt(Z)}})),yt?S.a.createElement(C.Fragment,null,!(null==gt||!gt.length)&&S.a.createElement("div",{className:ne.a.batch},S.a.createElement("aside",null,S.a.createElement("div",{style:{flexShrink:0,marginRight:20}},S.a.createElement(h.a,{className:"font14",checked:!(null==le||!le.length)&>.length===(null==le?void 0:le.length),onChange:function(e){return Sn(e.target.checked)}},"本页全选",S.a.createElement("span",{style:{color:"#999",fontSize:12}},"/已选(",null==gt?void 0:gt.length,")"))),S.a.createElement("div",{className:ne.a.btns},wt&&S.a.createElement("div",{className:ne.a.btn,onClick:function(){return dn(!0)}},S.a.createElement("i",{className:"iconfont icon-piliangjiaru"}),"批量加入"),wt&&S.a.createElement("div",{className:ne.a.btn,onClick:function(){return dn(!1)}},S.a.createElement("i",{className:"iconfont icon-piliangyichu"}),"批量移出"),"0"===pe&&S.a.createElement("div",{className:ne.a.btn,onClick:function(){return un()}},S.a.createElement("i",{className:"iconfont icon-yidongmulu font16"}),"批量移动"),"0"===pe&&S.a.createElement("div",{className:ne.a.btn,onClick:yn}," ",S.a.createElement("i",{className:"iconfont icon-pilianggongkai"}),"批量公开"),"0"===pe&&S.a.createElement("div",{className:ne.a.btn,onClick:function(){return vn()}}," ",S.a.createElement("i",{className:"iconfont icon-pilianggongxiang"}),"批量共享"),"0"===pe&&S.a.createElement("div",{className:ne.a.btn,onClick:mn}," ",S.a.createElement("i",{className:"iconfont icon-piliangshanchu3 c-red"}),"批量删除"),S.a.createElement("div",{onClick:function(){return vt([])},style:{marginLeft:"auto"},className:ne.a.btn}," ",S.a.createElement("i",{className:"iconfont icon-piliangcaozuoicon2"}),"取消操作"))))):S.a.createElement("div",{className:ne.a.batch},S.a.createElement("aside",null,S.a.createElement("div",{style:{flexShrink:0,marginRight:20}},S.a.createElement(h.a,{className:"font14",checked:!(null==le||!le.length)&>.length===(null==le?void 0:le.length),onChange:function(e){return Sn(e.target.checked)}},"本页全选",S.a.createElement("span",{style:{color:"#999",fontSize:12}},"/已选(",null==gt?void 0:gt.length,")"))),S.a.createElement("div",{className:ne.a.btns},wt&&!(null==gt||!gt.length)&&S.a.createElement("div",{className:ne.a.btn,onClick:function(){return dn(!0)}},S.a.createElement("i",{className:"iconfont icon-piliangjiaru"}),"批量加入"),wt&&!(null==gt||!gt.length)&&S.a.createElement("div",{className:ne.a.btn,onClick:function(){return dn(!1)}},S.a.createElement("i",{className:"iconfont icon-piliangyichu"}),"批量移出"),S.a.createElement("div",{className:"c-grey-333 font12 mr40",style:{marginLeft:"auto"}},"已加入: ",Ee,"题"),S.a.createElement("div",{onClick:function(){var e,t="/problemset/preview";(Z.exam_id&&(t="/paperlibrary/edit/".concat(Z.exam_id)),null!=Z&&Z.exercise_id)&&(t="/classrooms/".concat(null==U||null===(e=U.params)||void 0===e?void 0:e.coursesId,"/exercise/").concat(null==Z?void 0:Z.exercise_id,"/edit"));x.d.push(t)},className:ne.a.btn},"返回试卷")))))}))},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,n){"use strict";n.d(t,"b",(function(){return k})),n.d(t,"a",(function(){return S}));var i=n("1OyB"),r=n("vuIU"),a=n("Ji7U"),s=n("LK+K"),o=n("q1tI"),l=n("rePB"),c=n("Ff2n"),u=n("ODXe"),h=n("4IlW"),d=n("bX4T"),f=n("YrtM"),p=n("TSYQ"),g=n.n(p),v=n("+nKL"),m=n("8OUc"),y=o.forwardRef((function(e,t){var n=e.prefixCls,i=e.id,r=e.flattenOptions,a=e.childrenAsData,s=e.values,p=e.searchValue,y=e.multiple,b=e.defaultActiveFirstOption,E=e.height,k=e.itemHeight,C=e.notFoundContent,S=e.open,x=e.menuItemSelectedIcon,w=e.virtual,T=e.onSelect,_=e.onToggleOpen,O=e.onActiveValue,A=e.onScroll,L=e.onMouseEnter,D="".concat(n,"-item"),R=Object(f.a)((function(){return r}),[S,r],(function(e,t){return t[0]&&e[1]!==t[1]})),I=o.useRef(null),N=function(e){e.preventDefault()},P=function(e){I.current&&I.current.scrollTo({index:e})},M=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=R.length,i=0;i<n;i+=1){var r=(e+i*t+n)%n,a=R[r],s=a.group,o=a.data;if(!s&&!o.disabled)return r}return-1},j=o.useState((function(){return M(0)})),B=Object(u.a)(j,2),F=B[0],U=B[1],G=function(e){U(e);var t=R[e];t?O(t.data.value,e):O(null,-1)};o.useEffect((function(){G(!1!==b?M(0):-1)}),[R.length,p]),o.useEffect((function(){var e=setTimeout((function(){if(!y&&S&&1===s.size){var e=Array.from(s)[0],t=R.findIndex((function(t){return t.data.value===e}));G(t),P(t)}}));return function(){return clearTimeout(e)}}),[S]);var H=function(e){void 0!==e&&T(e,{selected:!s.has(e)}),y||_(!1)};if(o.useImperativeHandle(t,(function(){return{onKeyDown:function(e){var t=e.which;switch(t){case h.a.UP:case h.a.DOWN:var n=0;if(t===h.a.UP?n=-1:t===h.a.DOWN&&(n=1),0!==n){var i=M(F+n,n);P(i),G(i)}break;case h.a.ENTER:var r=R[F];r&&!r.data.disabled?H(r.data.value):H(void 0),S&&e.preventDefault();break;case h.a.ESC:_(!1)}},onKeyUp:function(){},scrollTo:function(e){P(e)}}})),0===R.length)return o.createElement("div",{role:"listbox",id:"".concat(i,"_list"),className:"".concat(D,"-empty"),onMouseDown:N},C);function K(e){var t=R[e];if(!t)return null;var n=t.data||{},r=n.value,l=n.label,c=n.children,u=Object(d.a)(n,!0),h=a?c:l;return t?o.createElement("div",Object.assign({"aria-label":"string"==typeof h?h:null},u,{key:e,role:"option",id:"".concat(i,"_list_").concat(e),"aria-selected":s.has(r)}),r):null}return o.createElement(o.Fragment,null,o.createElement("div",{role:"listbox",id:"".concat(i,"_list"),style:{height:0,width:0,overflow:"hidden"}},K(F-1),K(F),K(F+1)),o.createElement(v.a,{itemKey:"key",ref:I,data:R,height:E,itemHeight:k,fullHeight:!1,onMouseDown:N,onScroll:A,virtual:w,onMouseEnter:L},(function(e,t){var n,i=e.group,r=e.groupOption,u=e.data,h=u.label,d=u.key;if(i)return o.createElement("div",{className:g()(D,"".concat(D,"-group"))},void 0!==h?h:d);var f=u.disabled,p=u.value,v=u.title,y=u.children,b=u.style,E=u.className,k=Object(c.a)(u,["disabled","value","title","children","style","className"]),C=s.has(p),S="".concat(D,"-option"),w=g()(D,S,E,(n={},Object(l.a)(n,"".concat(S,"-grouped"),r),Object(l.a)(n,"".concat(S,"-active"),F===t&&!f),Object(l.a)(n,"".concat(S,"-disabled"),f),Object(l.a)(n,"".concat(S,"-selected"),C),n)),T=a?y:h,_=!x||"function"==typeof x||C;return o.createElement("div",Object.assign({},k,{"aria-selected":C,className:w,title:v,onMouseMove:function(){F===t||f||G(t)},onClick:function(){f||H(p)},style:b}),o.createElement("div",{className:"".concat(S,"-content")},T||p),o.isValidElement(x)||C,_&&o.createElement(m.a,{className:"".concat(D,"-option-state"),customizeIcon:x,customizeIconProps:{isSelected:C}},C?"✓":null))})))}));y.displayName="OptionList";var b=y,E=function(){return null};E.isSelectOption=!0;var k=E,C=function(){return null};C.isSelectOptGroup=!0;var S=C,x=n("VTBJ"),w=n("Zm9Q");function T(e){var t=e.key,n=e.props,i=n.children,r=n.value,a=Object(c.a)(n,["children","value"]);return Object(x.a)({key:t,value:void 0!==r?r:t,children:i},a)}function _(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object(w.a)(e).map((function(e,n){if(!o.isValidElement(e)||!e.type)return null;var i=e.type.isSelectOptGroup,r=e.key,a=e.props,s=a.children,l=Object(c.a)(a,["children"]);return t||!i?T(e):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(null===r?n:r,"__"),label:r},l),{},{options:_(s)})})).filter((function(e){return e}))}var O=n("2Qr1"),A=n("qNPg"),L=n("U8pU"),D=n("Kwbf"),R=n("WKfj");var I=function(e){var t=e.mode,n=e.options,i=e.children,r=e.backfill,a=e.allowClear,s=e.placeholder,l=e.getInputElement,c=e.showSearch,u=e.onSearch,h=e.defaultOpen,d=e.autoFocus,f=e.labelInValue,p=e.value,g=e.inputValue,v=e.optionLabelProp,m="multiple"===t||"tags"===t,y=void 0!==c?c:m||"combobox"===t,b=n||_(i);if(Object(D.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(D.a)(!E,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(D.a)("combobox"!==t||!v,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(D.a)("combobox"===t||!r,"`backfill` only works with `combobox` mode."),Object(D.a)("combobox"===t||!l,"`getInputElement` only work with `combobox` mode."),Object(D.b)("combobox"!==t||!l||!a||!s,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),u&&!y&&"combobox"!==t&&"tags"!==t&&Object(D.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(D.b)(!h||d,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),null!=p){var k=Object(R.d)(p);Object(D.a)(!f||k.every((function(e){return"object"===Object(L.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(D.a)(!m||Array.isArray(p),"`value` should be array when `mode` is `multiple` or `tags`")}if(i){var C=null;Object(w.a)(i).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)||(C=t.type,!1)})):(C=t,!0))})),C&&Object(D.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(C.displayName||C.name||C,"`.")),Object(D.a)(void 0===g,"`inputValue` is deprecated, please use `searchValue` instead.")}},N=Object(A.a)({prefixCls:"rc-select",components:{optionList:b},convertChildrenToData:_,flattenOptions:O.d,getLabeledValue:O.e,filterOptions:O.b,isValueDisabled:O.g,findValueOption:O.c,warningProps:I,fillOptionsWithMissingValue:O.a}),P=function(e){Object(a.a)(n,e);var t=Object(s.a)(n);function n(){var e;return Object(i.a)(this,n),(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(r.a)(n,[{key:"render",value:function(){return o.createElement(N,Object.assign({ref:this.selectRef},this.props))}}]),n}(o.Component);P.Option=k,P.OptGroup=S;var M=P;t.c=M},NLgs:
|
|
|
/*!***********************************!*\
|
|
|
!*** ./src/utils/verifyLogin.tsx ***!
|
|
|
\***********************************/
|
|
|
/*! exports provided: handleVerify, handleVerifyLogin, handleProfleCompletedModal, handleProfessionalCertificationModal, handleCanShixunAddModal, AuthorizeModel, ShixunStatusModel */
|
|
|
/*! exports used: AuthorizeModel, ShixunStatusModel, handleCanShixunAddModal, handleProfessionalCertificationModal, handleVerify, handleVerifyLogin */function(e,t,n){"use strict";n.d(t,"e",(function(){return k})),n.d(t,"f",(function(){return C})),n.d(t,"d",(function(){return x})),n.d(t,"c",(function(){return w})),n.d(t,"a",(function(){return T})),n.d(t,"b",(function(){return _}));n(/*! antd/es/message/style */"miYZ");var i=n(/*! antd/es/message */"tsqr"),r=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator */"9og8"),a=(n(/*! antd/es/modal/style */"2qtc"),n(/*! antd/es/modal */"kLXV")),s=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator */"WmNS"),o=n.n(s),l=n(/*! react */"q1tI"),c=n.n(l),u=n(/*! umi */"9kvl"),h=n(/*! ./authority */"xKgJ"),d=n(/*! ./util */"1vsH"),f=n(/*! @ant-design/icons */"RCxd"),p=n(/*! @/assets/images/403Qrcode.png */"mOS8"),g=n.n(p),v=n(/*! @/assets/images/Authorize.png */"1ZF9"),m=n.n(v),y=n(/*! @/assets/images/studnetqun.png */"WdTA"),b=n.n(y),E=n(/*! ./env */"m3rI"),k=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!(!C(e)||!S(t))},C=function(e){return!!Object(h.p)()||(e({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},S=function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=Object(u.c)()._store.getState(),i=n.user;return!(null===(e=i.userInfo)||void 0===e||!e.profile_completed)||(a.a.confirm({title:"提示",width:530,centered:!0,content:t?"按照有关政策规定,特殊实验需要先绑定手机号才能使用,请先绑定手机号码":"您需要去完善您的个人资料,才能使用此功能",okText:"立即完善",cancelText:"稍后完善",onOk:function(){u.d.push("/account/profile/edit")}}),!1)},x=function(){var e;return!(null===(e=Object(u.c)()._store.getState().user.userInfo)||void 0===e||!e.professional_certification)||(a.a.confirm({title:"提示",centered:!0,content:c.a.createElement("div",{className:"tc"},"您需要去完成您的职业认证,才能使用此功能"),okText:"立即完善",cancelText:"稍后完善",onOk:function(){Object(d.Q)("/account/certification")}}),!1)},w=function(){return!!Object(h.a)()||(a.a.warning({centered:!0,width:530,title:"提示",content:c.a.createElement("div",{className:"tc",style:{marginLeft:-38}},c.a.createElement("p",null,"您可以扫码加群@群管理员,申请操作权限哦!"),c.a.createElement("img",{src:Object(h.t)()?b.a:"".concat(E.a.IMG_SERVER,"/images/educoder/qqqun20191230.png"),width:200})),okText:"我知道了",maskClosable:!0}),!1)},T=function(e,t){return!!e||(a.a.confirm({centered:!0,zIndex:1e4,width:530,title:"提示",content:c.a.createElement("div",null,c.a.createElement("p",null,t||"该实践资源需授权后才可使用。 您可以在QQ服务群向管理员申请,获得继续操作的权限。"),c.a.createElement("div",{style:{marginLeft:"110px"}},c.a.createElement("img",{src:m.a,width:200}),c.a.createElement("div",{style:{marginLeft:"35px"}},"群号:","714336072"))),okText:"立即联系",cancelText:"取消",onOk:function(){Object(d.Q)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1)},_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=Object(u.c)()._store.getState(),s=n.shixunsDetail.detail;return 2===(null==s?void 0:s.public)||1===(null==s?void 0:s.public)||3===(null==s?void 0:s.shixun_status)?(a.a.info({centered:!0,icon:c.a.createElement(f.a,{style:{color:"#faad14"}}),width:460,title:"提示",content:c.a.createElement("div",{className:"tc",style:{marginLeft:-38}},c.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:38,margin:"12px 0"}},c.a.createElement("span",null,"该实践项目的状态为",2===(null==s?void 0:s.public)?"已公开":1===(null==s?void 0:s.public)?"待审核":"已关闭",",",t,"。"),c.a.createElement("p",null,"如有需要,请联系平台管理员进行技术支持。")),c.a.createElement("img",{style:{border:"4px solid #0152d9",borderRadius:"4px"},src:g.a,alt:"二维码",width:160})),okText:"我知道了"}),!0):2===(null==s?void 0:s.shixun_status)&&(a.a.confirm({centered:!0,icon:c.a.createElement(f.a,null),title:"提示",content:c.a.createElement("div",null,c.a.createElement("span",null,"该实践项目已发布,",t,"。"),c.a.createElement("br",null),c.a.createElement("span",null,"如有需要,您可以撤销发布后,再进行操作。")),okText:"撤销发布",cancelText:"取消",onOk:function(){var t;a.a.confirm({width:440,centered:!0,icon:c.a.createElement(f.a,{style:{color:"#faad14"}}),title:"提示",content:"撤销发布后,学员将无法进行练习。是否确认撤销发布?",okText:"确定撤销发布",cancelText:"取消",onOk:(t=Object(r.a)(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({type:"shixunsDetail/cancelRelease",payload:{id:null==s?void 0:s.identifier}});case 2:401!==t.sent.status&&(i.b.success("撤销发布成功。实训回到未发布的状态。"),e({type:"shixunsDetail/getShixunsDetail",payload:{id:null==s?void 0:s.identifier}}),e({type:"practiceSetting/getCommonData",payload:{id:null==s?void 0:s.identifier}}));case 4:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)})})}}),!0)}},NvD2:
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./node_modules/rc-tree/es/utils/conductUtil.js ***!
|
|
|
\******************************************************/
|
|
|
/*! exports provided: isCheckDisabled, conductCheck */
|
|
|
/*! exports used: conductCheck */function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var i=n(/*! rc-util/es/warning */"Kwbf");function r(e,t){var n=new Set;return e.forEach((function(e){t.has(e)||n.add(e)})),n}function a(e){var t=e||{},n=t.disabled,i=t.disableCheckbox,r=t.checkable;return!(!n&&!i)||!1===r}function s(e,t,n,s){var o,l=[];o=s||a;var c=new Set(e.filter((function(e){var t=!!n[e];return t||l.push(e),t}))),u=new Map,h=0;return Object.keys(n).forEach((function(e){var t=n[e],i=t.level,r=u.get(i);r||(r=new Set,u.set(i,r)),r.add(t),h=Math.max(h,i)})),Object(i.a)(!l.length,"Tree missing follow keys: ".concat(l.slice(0,100).map((function(e){return"'".concat(e,"'")})).join(", "))),!0===t?function(e,t,n,i){for(var a=new Set(e),s=new Set,o=0;o<=n;o+=1){(t.get(o)||new Set).forEach((function(e){var t=e.key,n=e.node,r=e.children,s=void 0===r?[]:r;a.has(t)&&!i(n)&&s.filter((function(e){return!i(e.node)})).forEach((function(e){a.add(e.key)}))}))}for(var l=new Set,c=n;c>=0;c-=1){(t.get(c)||new Set).forEach((function(e){var t=e.parent,n=e.node;if(!i(n)&&e.parent&&!l.has(e.parent.key))if(i(e.parent.node))l.add(t.key);else{var r=!0,o=!1;(t.children||[]).filter((function(e){return!i(e.node)})).forEach((function(e){var t=e.key,n=a.has(t);r&&!n&&(r=!1),o||!n&&!s.has(t)||(o=!0)})),r&&a.add(t.key),o&&s.add(t.key),l.add(t.key)}}))}return{checkedKeys:Array.from(a),halfCheckedKeys:Array.from(r(s,a))}}(c,u,h,o):function(e,t,n,i,a){for(var s=new Set(e),o=new Set(t),l=0;l<=i;l+=1){(n.get(l)||new Set).forEach((function(e){var t=e.key,n=e.node,i=e.children,r=void 0===i?[]:i;s.has(t)||o.has(t)||a(n)||r.filter((function(e){return!a(e.node)})).forEach((function(e){s.delete(e.key)}))}))}o=new Set;for(var c=new Set,u=i;u>=0;u-=1){(n.get(u)||new Set).forEach((function(e){var t=e.parent,n=e.node;if(!a(n)&&e.parent&&!c.has(e.parent.key))if(a(e.parent.node))c.add(t.key);else{var i=!0,r=!1;(t.children||[]).filter((function(e){return!a(e.node)})).forEach((function(e){var t=e.key,n=s.has(t);i&&!n&&(i=!1),r||!n&&!o.has(t)||(r=!0)})),i||s.delete(t.key),r&&o.add(t.key),c.add(t.key)}}))}return{checkedKeys:Array.from(s),halfCheckedKeys:Array.from(r(o,s))}}(c,t.halfCheckedKeys,u,h,o)}},OZM5:
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./node_modules/rc-tree/es/util.js ***!
|
|
|
\*****************************************/
|
|
|
/*! exports provided: arrDel, arrAdd, posToArr, getPosition, isTreeNode, getDragNodesKeys, calcDropPosition, calcSelectedKeys, convertDataToTree, parseCheckedKeys, conductExpandParent, getDataAndAria */
|
|
|
/*! exports used: arrAdd, arrDel, calcDropPosition, calcSelectedKeys, conductExpandParent, getDataAndAria, getDragNodesKeys, getPosition, isTreeNode, parseCheckedKeys, posToArr */function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return o})),n.d(t,"k",(function(){return l})),n.d(t,"h",(function(){return c})),n.d(t,"i",(function(){return u})),n.d(t,"g",(function(){return h})),n.d(t,"c",(function(){return d})),n.d(t,"d",(function(){return f})),n.d(t,"j",(function(){return p})),n.d(t,"e",(function(){return g})),n.d(t,"f",(function(){return v}));var i=n(/*! @babel/runtime/helpers/esm/toConsumableArray */"KQm4"),r=n(/*! @babel/runtime/helpers/esm/typeof */"U8pU"),a=(n(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),n(/*! react */"q1tI"),n(/*! rc-util/es/warning */"Kwbf"));n(/*! ./TreeNode */"WaYH");function s(e,t){var n=e.slice(),i=n.indexOf(t);return i>=0&&n.splice(i,1),n}function o(e,t){var n=e.slice();return-1===n.indexOf(t)&&n.push(t),n}function l(e){return e.split("-")}function c(e,t){return"".concat(e,"-").concat(t)}function u(e){return e&&e.type&&e.type.isTreeNode}function h(e,t){var n=[e];return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.forEach((function(t){var i=t.key,r=t.children;n.push(i),e(r)}))}(t[e].children),n}function d(e,t){var n=e.clientY,i=t.selectHandle.getBoundingClientRect(),r=i.top,a=i.bottom,s=i.height,o=Math.max(.25*s,2);return n<=r+o?-1:n>=a-o?1:0}function f(e,t){if(e)return t.multiple?e.slice():e.length?[e[0]]:e}function p(e){if(!e)return null;var t;if(Array.isArray(e))t={checkedKeys:e,halfCheckedKeys:void 0};else{if("object"!==Object(r.a)(e))return Object(a.a)(!1,"`checkedKeys` is not an array or an object"),null;t={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0}}return t}function g(e,t){var n=new Set;return(e||[]).forEach((function(e){!function e(i){if(!n.has(i)){var r=t[i];if(r){n.add(i);var a=r.parent;r.node.disabled||a&&e(a.key)}}}(e)})),Object(i.a)(n)}function v(e){var t={};return Object.keys(e).forEach((function(n){(n.startsWith("data-")||n.startsWith("aria-"))&&(t[n]=e[n])})),t}},"P/tu":
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./src/components/CustomTree/index.tsx ***!
|
|
|
\*********************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,n){"use strict";n(/*! antd/es/tree/style */"ozfa");var i=n(/*! antd/es/tree */"MJZm"),r=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends */"0Owb"),a=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator */"9og8"),s=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),o=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties */"PpiC"),l=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator */"WmNS"),c=n.n(l),u=n(/*! react */"q1tI"),h=n.n(u),d=n(/*! @/service/problemset */"WCUW"),f=n(/*! ./index.less?modules */"spXi"),p=n.n(f);t.a=function(e){var t=e.value,n=e.onChange,l=e.defaultValue,f=e.disabled,g=Object(o.a)(e,["value","onChange","defaultValue","disabled"]),v=Object(u.useState)([]),m=Object(s.a)(v,2),y=m[0],b=m[1],E=Object(u.useState)("1"),k=Object(s.a)(E,2),C=k[0],S=k[1];Object(u.useEffect)((function(){x()}),[]);var x=function(){var e=Object(a.a)(c.a.mark((function e(){var t,n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(d.x)({});case 2:null!=(t=e.sent)&&t.data&&(n=[{title:h.a.createElement("div",{title:"根目录",className:p.a.name},"根目录"),value:0,key:0,icon:h.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:w(t.data||[])}],b(n),S("2"));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),w=function(e){return null==e?void 0:e.map((function(e){return function e(t){var n=t.children,i=Array.isArray(n)&&n.length>0,r=null==t?void 0:t.group_id;return{title:h.a.createElement("div",{title:null==t?void 0:t.name,className:p.a.name},null==t?void 0:t.name),value:r,key:r,icon:h.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:i?null==n?void 0:n.map((function(t){return e(t)})):[]}}(e)}))},T=l?{defaultExpandedKeys:[0]}:{selectedKeys:t,defaultExpandedKeys:t};return h.a.createElement("div",{className:p.a.customTree},h.a.createElement(i.a,Object(r.a)({key:C},T,{showIcon:!0,treeData:y,onSelect:n,disabled:f},g)))}},Q0Vu:
|
|
|
/*!**********************************************************!*\
|
|
|
!*** ./src/components/LanguageSelect/index.less?modules ***!
|
|
|
\**********************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={flex_box_center:"flex_box_center___3fHaw",flex_space_between:"flex_space_between___1tu3K",flex_box_vertical_center:"flex_box_vertical_center___3kmTT",flex_box_center_end:"flex_box_center_end___19OcD",flex_box_column:"flex_box_column___1aMoy",main:"main___JkLSb",wrap:"wrap___1k_Ib",content:"content___1by-P",name:"name___2mlTd",directionContentWrap:"directionContentWrap___3qsxQ",directionItem:"directionItem___2aAvu",active:"active___ACZqb",subActive:"subActive___2RkoB",subItem:"subItem___3tJgX",subMenu:"subMenu___Y_7S_",action:"action___xqgFs"}},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"],n=[[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"],i=[n,"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"],r=[n,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],a=[n,"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=[n,"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"],c=[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"],u=[t,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],h=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;function d(e,t,n,i,r){if(n){var a={sourceNode:e,pre:1,langExtension:null,numberLines:null,sourceCode:n,spans:null,basePos:t,decorations:null};i(a),r.push.apply(r,a.decorations)}}var f=/\S/;function p(e){for(var t=void 0,n=e.firstChild;n;n=n.nextSibling){var i=n.nodeType;t=1===i?t?e:n:3===i&&f.test(n.nodeValue)?e:t}return t===e?void 0:t}function g(e,t){var n,i={};!function(){for(var r=e.concat(t),a=[],s={},o=0,l=r.length;o<l;++o){var c=r[o],u=c[3];if(u)for(var h=u.length;--h>=0;)i[u.charAt(h)]=c;var d=c[1],f=""+d;s.hasOwnProperty(f)||(a.push(d),s[f]=null)}a.push(/[\0-\uffff]/),n=function(e){for(var t=0,n=!1,i=!1,r=0,a=e.length;r<a;++r){if((d=e[r]).ignoreCase)i=!0;else if(/[a-z]/i.test(d.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){n=!0,i=!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 n=e.charAt(1);return(t=s[n])||("0"<=n&&n<="7"?parseInt(e.substring(1),8):"u"===n||"x"===n?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 c(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")),n=[],i="^"===t[0],r=["["];i&&r.push("^");for(var a=i?1:0,s=t.length;a<s;++a){var c=t[a];if(/\\[bdsw]/i.test(c))r.push(c);else{var u,h=o(c);a+2<s&&"-"===t[a+1]?(u=o(t[a+2]),a+=2):u=h,n.push([h,u]),u<65||h>122||(u<65||h>90||n.push([32|Math.max(65,h),32|Math.min(u,90)]),u<97||h>122||n.push([-33&Math.max(97,h),-33&Math.min(u,122)]))}}n.sort((function(e,t){return e[0]-t[0]||t[1]-e[1]}));var d=[],f=[];for(a=0;a<n.length;++a){(p=n[a])[0]<=f[1]+1?f[1]=Math.max(f[1],p[1]):d.push(f=p)}for(a=0;a<d.length;++a){var p=d[a];r.push(l(p[0])),p[1]>p[0]&&(p[1]+1>p[0]&&r.push("-"),r.push(l(p[1])))}return r.push("]"),r.join("")}function u(e){for(var i=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")),r=i.length,a=[],s=0,o=0;s<r;++s){if("("===(h=i[s]))++o;else if("\\"===h.charAt(0)){(u=+h.substring(1))&&(u<=o?a[u]=-1:i[s]=l(u))}}for(s=1;s<a.length;++s)-1===a[s]&&(a[s]=++t);for(s=0,o=0;s<r;++s){if("("===(h=i[s]))a[++o]||(i[s]="(?:");else if("\\"===h.charAt(0)){var u;(u=+h.substring(1))&&u<=o&&(i[s]="\\"+a[u])}}for(s=0;s<r;++s)"^"===i[s]&&"^"!==i[s+1]&&(i[s]="");if(e.ignoreCase&&n)for(s=0;s<r;++s){var h,d=(h=i[s]).charAt(0);h.length>=2&&"["===d?i[s]=c(h):"\\"!==d&&(i[s]=h.replace(/[a-zA-Z]/g,(function(e){var t=e.charCodeAt(0);return"["+String.fromCharCode(-33&t,32|t)+"]"})))}return i.join("")}var h=[];for(r=0,a=e.length;r<a;++r){var d;if((d=e[r]).global||d.multiline)throw new Error(""+d);h.push("(?:"+u(d)+")")}return new RegExp(h.join("|"),i?"gi":"g")}(a)}();var r=t.length,a=function(e){for(var s=e.sourceCode,o=e.basePos,l=e.sourceNode,c=[o,"pln"],u=0,h=s.match(n)||[],f={},p=0,g=h.length;p<g;++p){var v,m=h[p],y=f[m],b=void 0;if("string"==typeof y)v=!1;else{var E=i[m.charAt(0)];if(E)b=m.match(E[1]),y=E[0];else{for(var C=0;C<r;++C)if(E=t[C],b=m.match(E[1])){y=E[0];break}b||(y="pln")}!(v=y.length>=5&&"lang-"===y.substring(0,5))||b&&"string"==typeof b[1]||(v=!1,y="src"),v||(f[m]=y)}var S=u;if(u+=m.length,v){var x=b[1],w=m.indexOf(x),T=w+x.length;b[2]&&(w=(T=m.length-b[2].length)-x.length);var _=y.substring(5);d(l,o+S,m.substring(0,w),a,c),d(l,o+S+w,x,k(_,x),c),d(l,o+S+T,m.substring(T),a,c)}else c.push(o+S,y)}e.decorations=c};return a}function v(e){var t=[],n=[];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&&n.push(["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var i=e.hashComments;i&&(e.cStyleComments?(i>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,"#"]),n.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):t.push(["com",/^#[^\r\n]*/,null,"#"])),e.cStyleComments&&(n.push(["com",/^\/\/[^\r\n]*/,null]),n.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var r=e.regexLiterals;if(r){var a=r>1?"":"\n\r",s=a?".":"[\\S\\s]",o="/(?=[^/*"+a+"])(?:[^/\\x5B\\x5C"+a+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+a+"]|\\x5C"+s+")*(?:\\x5D|$))+/";n.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+o+")")])}var l=e.types;l&&n.push(["typ",l]);var c=(""+e.keywords).replace(/^ | $/g,"");c.length&&n.push(["kwd",new RegExp("^(?:"+c.replace(/[\s,]+/g,"|")+")\\b"),null]),t.push(["pln",/^\s+/,null," \r\n\t "]);var u="^.[^\\s\\w.$@'\"`/\\\\]*";return e.regexLiterals&&(u+="(?!s*/)"),n.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(u),null]),g(t,n)}var m=v({keywords:[i,a,r,s,o,l,c,u],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function y(e,t,n){for(var i=/(?:^|\s)nocode(?:\s|$)/,r=/\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||i.test(e.className)){if((3==t||4==t)&&n){var s=e.nodeValue,o=s.match(r);if(o){var u=s.substring(0,o.index);e.nodeValue=u;var h=s.substring(o.index+o[0].length);if(h)e.parentNode.insertBefore(a.createTextNode(h),e.nextSibling);c(e),u||e.parentNode.removeChild(e)}}}else if("br"===e.nodeName)c(e),e.parentNode&&e.parentNode.removeChild(e);else for(var d=e.firstChild;d;d=d.nextSibling)l(d)}function c(e){for(;!e.nextSibling;)if(!(e=e.parentNode))return;for(var t,n=function e(t,n){var i=n?t.cloneNode(!1):t,r=t.parentNode;if(r){var a=e(r,1),s=t.nextSibling;a.appendChild(i);for(var o=s;o;o=s)s=o.nextSibling,a.appendChild(o)}return i}(e.nextSibling,0);(t=n.parentNode)&&1===t.nodeType;)n=t;o.push(n)}for(var u=0;u<o.length;++u)l(o[u]);t===(0|t)&&o[0].setAttribute("value",t);var h=a.createElement("ol");h.className="linenums";for(var d=Math.max(0,t-1|0)||0,f=(u=0,o.length);u<f;++u)(s=o[u]).className="L"+(u+d)%10,s.firstChild||s.appendChild(a.createTextNode(" ")),h.appendChild(s);e.appendChild(h)}var b={};function E(t,n){for(var i=n.length;--i>=0;){var r=n[i];b.hasOwnProperty(r)?e.console&&console.warn("cannot override language handler %s",r):b[r]=t}}function k(e,t){return e&&b.hasOwnProperty(e)||(e=/^\s*</.test(t)?"default-markup":"default-code"),b[e]}function C(t){var n,i,r,a,s,o,l,c=t.langExtension;try{var u=(n=t.sourceNode,i=t.pre,r=/(?:^|\s)nocode(?:\s|$)/,a=[],s=0,o=[],l=0,function e(t){var n=t.nodeType;if(1==n){if(r.test(t.className))return;for(var c=t.firstChild;c;c=c.nextSibling)e(c);var u=t.nodeName.toLowerCase();"br"!==u&&"li"!==u||(a[l]="\n",o[l<<1]=s++,o[l++<<1|1]=t)}else if(3==n||4==n){var h=t.nodeValue;h.length&&(h=i?h.replace(/\r\n?/g,"\n"):h.replace(/[ \t\r\n]+/g," "),a[l]=h,o[l<<1]=s,s+=h.length,o[l++<<1|1]=t)}}(n),{sourceCode:a.join("").replace(/\n$/,""),spans:o}),h=u.sourceCode;t.sourceCode=h,t.spans=u.spans,t.basePos=0,k(c,h)(t),function(e){var t=/\bMSIE\s(\d+)/.exec(navigator.userAgent);t=t&&+t[1]<=8;var n,i,r=/\n/g,a=e.sourceCode,s=a.length,o=0,l=e.spans,c=l.length,u=0,h=e.decorations,d=h.length,f=0;for(h[d]=s,i=n=0;i<d;)h[i]!==h[i+2]?(h[n++]=h[i++],h[n++]=h[i++]):i+=2;for(d=n,i=n=0;i<d;){for(var p=h[i],g=h[i+1],v=i+2;v+2<=d&&h[v+1]===g;)v+=2;h[n++]=p,h[n++]=g,i=v}d=h.length=n;var m=e.sourceNode,y="";m&&(y=m.style.display,m.style.display="none");try{for(;u<c;){l[u];var b,E=l[u+2]||s,k=h[f+2]||s,C=(v=Math.min(E,k),l[u+1]);if(1!==C.nodeType&&(b=a.substring(o,v))){t&&(b=b.replace(r,"\r")),C.nodeValue=b;var S=C.ownerDocument,x=S.createElement("span");x.className=h[f+1];var w=C.parentNode;w.replaceChild(x,C),x.appendChild(C),o<E&&(l[u+1]=C=S.createTextNode(a.substring(v,E)),w.insertBefore(C,x.nextSibling))}(o=v)>=E&&(u+=2),o>=k&&(f+=2)}}finally{m&&(m.style.display=y)}}(t)}catch(t){e.console&&console.log(t&&t.stack||t)}}function S(e,t,n){var i=n||!1,r=t||null,a=document.createElement("div");return a.innerHTML="<pre>"+e+"</pre>",a=a.firstChild,i&&y(a,i,!0),C({langExtension:r,numberLines:i,sourceNode:a,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null}),a.innerHTML}function x(t,n){var i=n||document.body,r=i.ownerDocument||document;function a(e){return i.getElementsByTagName(e)}for(var s=[a("pre"),a("code"),a("xmp")],o=[],l=0;l<s.length;++l)for(var c=0,u=s[l].length;c<u;++c)o.push(s[l][c]);s=null;var h=Date;h.now||(h={now:function(){return+new Date}});var d=0,f=/\blang(?:uage)?-([\w.]+)(?!\S)/,g=/\bprettyprint\b/,v=/\bprettyprinted\b/,m=/pre|xmp/i,b=/^code$/i,E=/^(?:pre|code|xmp)$/i,k={};!function n(){for(var i=e.PR_SHOULD_USE_CONTINUATION?h.now()+250:1/0;d<o.length&&h.now()<i;d++){for(var a=o[d],s=k,l=a;l=l.previousSibling;){var c=l.nodeType,u=(7===c||8===c)&&l.nodeValue;if(u?!/^\??prettify\b/.test(u):3!==c||/\S/.test(l.nodeValue))break;if(u){s={},u.replace(/\b(\w+)=([\w:.%+-]+)/g,(function(e,t,n){s[t]=n}));break}}var S=a.className;if((s!==k||g.test(S))&&!v.test(S)){for(var x=!1,w=a.parentNode;w;w=w.parentNode){var T=w.tagName;if(E.test(T)&&w.className&&g.test(w.className)){x=!0;break}}if(!x){a.className+=" prettyprinted";var _,O,A=s.lang;if(!A)!(A=S.match(f))&&(_=p(a))&&b.test(_.tagName)&&(A=_.className.match(f)),A&&(A=A[1]);if(m.test(a.tagName))O=1;else{var L=a.currentStyle,D=r.defaultView,R=L?L.whiteSpace:D&&D.getComputedStyle?D.getComputedStyle(a,null).getPropertyValue("white-space"):0;O=R&&"pre"===R.substring(0,3)}var I=s.linenums;(I="true"===I||+I)||(I=!!(I=S.match(/\blinenums\b(?::(\d+))?/))&&(!I[1]||!I[1].length||+I[1])),I&&y(a,I,O),C({langExtension:A,sourceNode:a,numberLines:I,pre:O,sourceCode:null,basePos:null,spans:null,decorations:null})}}}d<o.length?e.setTimeout(n,250):"function"==typeof t&&t()}()}E(m,["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(v({keywords:i,hashComments:!0,cStyleComments:!0,types:h}),["c","cc","cpp","cxx","cyc","m"]),E(v({keywords:"null,true,false"}),["json"]),E(v({keywords:a,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:h}),["cs"]),E(v({keywords:r,cStyleComments:!0}),["java"]),E(v({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),E(v({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),E(v({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),E(v({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),E(v({keywords:s,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),E(v({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:v,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:S,prettyPrint:x},T=e.define;"function"==typeof T&&T.amd&&T("google-code-prettify",[],(function(){return w}))}()},WaYH:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./node_modules/rc-tree/es/TreeNode.js + 1 modules ***!
|
|
|
\*********************************************************/
|
|
|
/*! exports provided: InternalTreeNode, default */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js */
|
|
|
/*! 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/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/contextTypes.js because of ./node_modules/rc-tree/es/Tree.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/util.js because of ./node_modules/antd/es/table/hooks/useSelection.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/treeUtil.js because of ./node_modules/antd/es/table/hooks/useSelection.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,n){"use strict";var i=n("rePB"),r=n("Ff2n"),a=n("VTBJ"),s=n("1OyB"),o=n("vuIU"),l=n("JX7q"),c=n("Ji7U"),u=n("LK+K"),h=n("q1tI"),d=n("TSYQ"),f=n.n(d),p=n("sboe"),g=n("OZM5"),v=function(e){var t=e.prefixCls,n=e.level,r=e.isStart,a=e.isEnd;if(!n)return null;for(var s="".concat(t,"-indent-unit"),o=[],l=0;l<n;l+=1){var c;o.push(h.createElement("span",{key:l,className:f()(s,(c={},Object(i.a)(c,"".concat(s,"-start"),r[l+1]),Object(i.a)(c,"".concat(s,"-end"),a[l+1]),Object(i.a)(c,"".concat(s,"-end-first-level"),!l&&a[0]),c))}))}return h.createElement("span",{"aria-hidden":"true",className:"".concat(t,"-indent")},o)},m=n("815F"),y=function(e){Object(c.a)(n,e);var t=Object(u.a)(n);function n(){var e;return Object(s.a)(this,n),(e=t.apply(this,arguments)).state={dragNodeHighlight:!1},e.onSelectorClick=function(t){(0,e.props.context.onNodeClick)(t,Object(m.b)(e.props)),e.isSelectable()?e.onSelect(t):e.onCheck(t)},e.onSelectorDoubleClick=function(t){(0,e.props.context.onNodeDoubleClick)(t,Object(m.b)(e.props))},e.onSelect=function(t){if(!e.isDisabled()){var n=e.props.context.onNodeSelect;t.preventDefault(),n(t,Object(m.b)(e.props))}},e.onCheck=function(t){if(!e.isDisabled()){var n=e.props,i=n.disableCheckbox,r=n.checked,a=e.props.context.onNodeCheck;if(e.isCheckable()&&!i){t.preventDefault();var s=!r;a(t,Object(m.b)(e.props),s)}}},e.onMouseEnter=function(t){(0,e.props.context.onNodeMouseEnter)(t,Object(m.b)(e.props))},e.onMouseLeave=function(t){(0,e.props.context.onNodeMouseLeave)(t,Object(m.b)(e.props))},e.onContextMenu=function(t){(0,e.props.context.onNodeContextMenu)(t,Object(m.b)(e.props))},e.onDragStart=function(t){var n=e.props.context.onNodeDragStart;t.stopPropagation(),e.setState({dragNodeHighlight:!0}),n(t,Object(l.a)(e));try{t.dataTransfer.setData("text/plain","")}catch(e){}},e.onDragEnter=function(t){var n=e.props.context.onNodeDragEnter;t.preventDefault(),t.stopPropagation(),n(t,Object(l.a)(e))},e.onDragOver=function(t){var n=e.props.context.onNodeDragOver;t.preventDefault(),t.stopPropagation(),n(t,Object(l.a)(e))},e.onDragLeave=function(t){var n=e.props.context.onNodeDragLeave;t.stopPropagation(),n(t,Object(l.a)(e))},e.onDragEnd=function(t){var n=e.props.context.onNodeDragEnd;t.stopPropagation(),e.setState({dragNodeHighlight:!1}),n(t,Object(l.a)(e))},e.onDrop=function(t){var n=e.props.context.onNodeDrop;t.preventDefault(),t.stopPropagation(),e.setState({dragNodeHighlight:!1}),n(t,Object(l.a)(e))},e.onExpand=function(t){(0,e.props.context.onNodeExpand)(t,Object(m.b)(e.props))},e.setSelectHandle=function(t){e.selectHandle=t},e.getNodeState=function(){var t=e.props.expanded;return e.isLeaf()?null:t?"open":"close"},e.hasChildren=function(){var t=e.props.eventKey;return!!((e.props.context.keyEntities[t]||{}).children||[]).length},e.isLeaf=function(){var t=e.props,n=t.isLeaf,i=t.loaded,r=e.props.context.loadData,a=e.hasChildren();return!1!==n&&(n||!r&&!a||r&&i&&!a)},e.isDisabled=function(){var t=e.props.disabled;return!(!e.props.context.disabled&&!t)},e.isCheckable=function(){var t=e.props.checkable,n=e.props.context.checkable;return!(!n||!1===t)&&n},e.syncLoadData=function(t){var n=t.expanded,i=t.loading,r=t.loaded,a=e.props.context,s=a.loadData,o=a.onNodeLoad;i||s&&n&&!e.isLeaf()&&(e.hasChildren()||r||o(Object(m.b)(e.props)))},e.renderSwitcher=function(){var t=e.props,n=t.expanded,i=t.switcherIcon,r=e.props.context,s=r.prefixCls,o=r.switcherIcon,l=i||o;if(e.isLeaf())return h.createElement("span",{className:f()("".concat(s,"-switcher"),"".concat(s,"-switcher-noop"))},"function"==typeof l?l(Object(a.a)(Object(a.a)({},e.props),{},{isLeaf:!0})):l);var c=f()("".concat(s,"-switcher"),"".concat(s,"-switcher_").concat(n?"open":"close"));return h.createElement("span",{onClick:e.onExpand,className:c},"function"==typeof l?l(Object(a.a)(Object(a.a)({},e.props),{},{isLeaf:!1})):l)},e.renderCheckbox=function(){var t=e.props,n=t.checked,i=t.halfChecked,r=t.disableCheckbox,a=e.props.context.prefixCls,s=e.isDisabled(),o=e.isCheckable();if(!o)return null;var l="boolean"!=typeof o?o:null;return h.createElement("span",{className:f()("".concat(a,"-checkbox"),n&&"".concat(a,"-checkbox-checked"),!n&&i&&"".concat(a,"-checkbox-indeterminate"),(s||r)&&"".concat(a,"-checkbox-disabled")),onClick:e.onCheck},l)},e.renderIcon=function(){var t=e.props.loading,n=e.props.context.prefixCls;return h.createElement("span",{className:f()("".concat(n,"-iconEle"),"".concat(n,"-icon__").concat(e.getNodeState()||"docu"),t&&"".concat(n,"-icon_loading"))})},e.renderSelector=function(){var t,n,i=e.state.dragNodeHighlight,r=e.props,a=r.title,s=r.selected,o=r.icon,l=r.loading,c=r.data,u=e.props.context,d=u.prefixCls,p=u.showIcon,g=u.icon,v=u.draggable,m=u.loadData,y=u.titleRender,b=e.isDisabled(),E="".concat(d,"-node-content-wrapper");if(p){var k=o||g;t=k?h.createElement("span",{className:f()("".concat(d,"-iconEle"),"".concat(d,"-icon__customize"))},"function"==typeof k?k(e.props):k):e.renderIcon()}else m&&l&&(t=e.renderIcon());n="function"==typeof a?a(c):y?y(c):a;var C=h.createElement("span",{className:"".concat(d,"-title")},n);return h.createElement("span",{ref:e.setSelectHandle,title:"string"==typeof a?a:"",className:f()("".concat(E),"".concat(E,"-").concat(e.getNodeState()||"normal"),!b&&(s||i)&&"".concat(d,"-node-selected"),!b&&v&&"draggable"),draggable:!b&&v||void 0,"aria-grabbed":!b&&v||void 0,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onContextMenu:e.onContextMenu,onClick:e.onSelectorClick,onDoubleClick:e.onSelectorDoubleClick,onDragStart:v?e.onDragStart:void 0},t,C)},e}return Object(o.a)(n,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var e=this.props.selectable,t=this.props.context.selectable;return"boolean"==typeof e?e:t}},{key:"render",value:function(){var e,t=this.props,n=t.eventKey,a=t.className,s=t.style,o=t.dragOver,l=t.dragOverGapTop,c=t.dragOverGapBottom,u=t.isLeaf,d=t.isStart,p=t.isEnd,y=t.expanded,b=t.selected,E=t.checked,k=t.halfChecked,C=t.loading,S=t.domRef,x=t.active,w=t.onMouseMove,T=Object(r.a)(t,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),_=this.props.context,O=_.prefixCls,A=_.filterTreeNode,L=_.draggable,D=_.keyEntities,R=this.isDisabled(),I=Object(g.f)(T),N=(D[n]||{}).level,P=p[p.length-1];return h.createElement("div",Object.assign({ref:S,className:f()(a,"".concat(O,"-treenode"),(e={},Object(i.a)(e,"".concat(O,"-treenode-disabled"),R),Object(i.a)(e,"".concat(O,"-treenode-switcher-").concat(y?"open":"close"),!u),Object(i.a)(e,"".concat(O,"-treenode-checkbox-checked"),E),Object(i.a)(e,"".concat(O,"-treenode-checkbox-indeterminate"),k),Object(i.a)(e,"".concat(O,"-treenode-selected"),b),Object(i.a)(e,"".concat(O,"-treenode-loading"),C),Object(i.a)(e,"".concat(O,"-treenode-active"),x),Object(i.a)(e,"".concat(O,"-treenode-leaf-last"),P),Object(i.a)(e,"drag-over",!R&&o),Object(i.a)(e,"drag-over-gap-top",!R&&l),Object(i.a)(e,"drag-over-gap-bottom",!R&&c),Object(i.a)(e,"filter-node",A&&A(Object(m.b)(this.props))),e)),style:s,onDragEnter:L?this.onDragEnter:void 0,onDragOver:L?this.onDragOver:void 0,onDragLeave:L?this.onDragLeave:void 0,onDrop:L?this.onDrop:void 0,onDragEnd:L?this.onDragEnd:void 0,onMouseMove:w},I),h.createElement(v,{prefixCls:O,level:N,isStart:d,isEnd:p}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),n}(h.Component),b=function(e){return h.createElement(p.a.Consumer,null,(function(t){return h.createElement(y,Object.assign({},e,{context:t}))}))};b.displayName="TreeNode",b.defaultProps={title:"---"},b.isTreeNode=1;t.a=b},WdTA:
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/assets/images/studnetqun.png ***!
|
|
|
\******************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports=n.p+"static/studnetqun.598eeb43.png"},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,n){"use strict";n.r(t),n.d(t,"ResizableTextArea",(function(){return I}));var i=n("wx14"),r=n("1OyB"),a=n("vuIU"),s=n("Ji7U"),o=n("LK+K"),l=n("q1tI"),c=n("VTBJ"),u=n("rePB"),h=n("Zm9Q"),d=(n("Kwbf"),n("c+Xe")),f=n("m+aA"),p=n("bdgK"),g=new Map;var v=new p.default((function(e){e.forEach((function(e){var t,n=e.target;null===(t=g.get(n))||void 0===t||t.forEach((function(e){return e(n)}))}))}));var m=function(e){Object(s.a)(n,e);var t=Object(o.a)(n);function n(){return Object(r.a)(this,n),t.apply(this,arguments)}return Object(a.a)(n,[{key:"render",value:function(){return this.props.children}}]),n}(l.Component),y=l.createContext(null);function b(e){var t=e.children,n=e.disabled,i=l.useRef(null),r=l.useRef(null),a=l.useContext(y),s=l.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),o=l.isValidElement(t)&&Object(d.c)(t),u=o?t.ref:null,h=l.useMemo((function(){return Object(d.a)(u,i)}),[u,i]),p=l.useRef(e);p.current=e;var b=l.useCallback((function(e){var t=p.current,n=t.onResize,i=t.data,r=e.getBoundingClientRect(),o=r.width,l=r.height,u=e.offsetWidth,h=e.offsetHeight,d=Math.floor(o),f=Math.floor(l);if(s.current.width!==d||s.current.height!==f||s.current.offsetWidth!==u||s.current.offsetHeight!==h){var g={width:d,height:f,offsetWidth:u,offsetHeight:h};s.current=g;var v=u===Math.round(o)?o:u,m=h===Math.round(l)?l:h,y=Object(c.a)(Object(c.a)({},g),{},{offsetWidth:v,offsetHeight:m});null==a||a(y,e,i),n&&Promise.resolve().then((function(){n(y,e)}))}}),[]);return l.useEffect((function(){var e,t,a=Object(f.a)(i.current)||Object(f.a)(r.current);return a&&!n&&(e=a,t=b,g.has(e)||(g.set(e,new Set),v.observe(e)),g.get(e).add(t)),function(){return function(e,t){g.has(e)&&(g.get(e).delete(t),g.get(e).size||(v.unobserve(e),g.delete(e)))}(a,b)}}),[i.current,n]),l.createElement(m,{ref:r},o?l.cloneElement(t,{ref:h}):t)}function E(e){var t=e.children;return Object(h.a)(t).map((function(t,n){var r=(null==t?void 0:t.key)||"".concat("rc-observer-key","-").concat(n);return l.createElement(b,Object(i.a)({},e,{key:r}),t)}))}E.Collection=function(e){var t=e.children,n=e.onBatchResize,i=l.useRef(0),r=l.useRef([]),a=l.useContext(y),s=l.useCallback((function(e,t,s){i.current+=1;var o=i.current;r.current.push({size:e,element:t,data:s}),Promise.resolve().then((function(){o===i.current&&(null==n||n(r.current),r.current=[])})),null==a||a(e,t,s)}),[n,a]);return l.createElement(y.Provider,{value:s},t)};var k,C=E,S=n("bT9E"),x=n("TSYQ"),w=n.n(x),T="\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",_=["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"],O={};function A(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&O[n])return O[n];var i=window.getComputedStyle(e),r=i.getPropertyValue("box-sizing")||i.getPropertyValue("-moz-box-sizing")||i.getPropertyValue("-webkit-box-sizing"),a=parseFloat(i.getPropertyValue("padding-bottom"))+parseFloat(i.getPropertyValue("padding-top")),s=parseFloat(i.getPropertyValue("border-bottom-width"))+parseFloat(i.getPropertyValue("border-top-width")),o=_.map((function(e){return"".concat(e,":").concat(i.getPropertyValue(e))})).join(";"),l={sizingStyle:o,paddingSize:a,borderSize:s,boxSizing:r};return t&&n&&(O[n]=l),l}var L,D=n("Gytx"),R=n.n(D);!function(e){e[e.NONE=0]="NONE",e[e.RESIZING=1]="RESIZING",e[e.RESIZED=2]="RESIZED"}(L||(L={}));var I=function(e){Object(s.a)(n,e);var t=Object(o.a)(n);function n(e){var a;return Object(r.a)(this,n),(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,n=a.props,i=n.autoSize,r=n.onResize;t===L.NONE&&("function"==typeof r&&r(e),i&&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,n=e.maxRows,i=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;k||((k=document.createElement("textarea")).setAttribute("tab-index","-1"),k.setAttribute("aria-hidden","true"),document.body.appendChild(k)),e.getAttribute("wrap")?k.setAttribute("wrap",e.getAttribute("wrap")):k.removeAttribute("wrap");var r=A(e,t),a=r.paddingSize,s=r.borderSize,o=r.boxSizing,l=r.sizingStyle;k.setAttribute("style","".concat(l,";").concat(T)),k.value=e.value||e.placeholder||"";var c,u=Number.MIN_SAFE_INTEGER,h=Number.MAX_SAFE_INTEGER,d=k.scrollHeight;if("border-box"===o?d+=s:"content-box"===o&&(d-=a),null!==n||null!==i){k.value=" ";var f=k.scrollHeight-a;null!==n&&(u=f*n,"border-box"===o&&(u=u+a+s),d=Math.max(u,d)),null!==i&&(h=f*i,"border-box"===o&&(h=h+a+s),c=d>h?"":"hidden",d=Math.min(h,d))}return{height:d,minHeight:u,maxHeight:h,overflowY:c,resize:"none"}}(a.textArea,!1,t,n);a.setState({textareaStyles:i,resizeStatus:L.RESIZING},(function(){cancelAnimationFrame(a.resizeFrameId),a.resizeFrameId=requestAnimationFrame((function(){a.setState({resizeStatus:L.RESIZED},(function(){a.resizeFrameId=requestAnimationFrame((function(){a.setState({resizeStatus:L.NONE}),a.fixFirefoxAutoScroll()}))}))}))}))}},a.renderTextArea=function(){var e=a.props,t=e.prefixCls,n=void 0===t?"rc-textarea":t,r=e.autoSize,s=e.onResize,o=e.className,h=e.disabled,d=a.state,f=d.textareaStyles,p=d.resizeStatus,g=Object(S.a)(a.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),v=w()(n,o,Object(u.a)({},"".concat(n,"-disabled"),h));"value"in g&&(g.value=g.value||"");var m=Object(c.a)(Object(c.a)(Object(c.a)({},a.props.style),f),p===L.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return l.createElement(C,{onResize:a.handleResize,disabled:!(r||s)},l.createElement("textarea",Object(i.a)({},g,{className:v,style:m,ref:a.saveTextArea})))},a.state={textareaStyles:{},resizeStatus:L.NONE},a}return Object(a.a)(n,[{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()}}]),n}(l.Component),N=function(e){Object(s.a)(n,e);var t=Object(o.a)(n);function n(e){var i;Object(r.a)(this,n),(i=t.call(this,e)).resizableTextArea=void 0,i.focus=function(){i.resizableTextArea.textArea.focus()},i.saveTextArea=function(e){i.resizableTextArea=e},i.handleChange=function(e){var t=i.props.onChange;i.setValue(e.target.value,(function(){i.resizableTextArea.resizeTextarea()})),t&&t(e)},i.handleKeyDown=function(e){var t=i.props,n=t.onPressEnter,r=t.onKeyDown;13===e.keyCode&&n&&n(e),r&&r(e)};var a=void 0===e.value||null===e.value?e.defaultValue:e.value;return i.state={value:a},i}return Object(a.a)(n,[{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(i.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}}]),n}(l.Component);t.default=N},YaiT:
|
|
|
/*!*******************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/Folder/index.less?modules ***!
|
|
|
\*******************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={list:"list___mDipN",btns:"btns___2c8h_",name:"name___eV55A",ClassModal:"ClassModal___1azfa",top:"top___3Z5DL",title:"title___P_Yo0",icon:"icon___extcv",tips:"tips___3t9lr",cent:"cent___1t5tO",page:"page___3Qj4R",pagination:"pagination___H4G8C"}},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,n){"use strict";n.d(t,"a",(function(){return m}));var i=n("k1fw"),r=(n("miYZ"),n("tsqr")),a=n("rAM+"),s=n("tJVT"),o=n("PpiC"),l=n("q1tI"),c=n.n(l),u=n("bdgK");function h(e,t,n,r,a){var s=t.getWordUntilPosition(n),o={startLineNumber:n.lineNumber,endLineNumber:n.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},l=r.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(i.a)(Object(i.a)({},e),{},{range:o}))})),l}n("LvDl");function d(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}function f(){}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 n=0;n<e.length;n++){var i=p[e[n]];if(i)return i}return t[0]}return p[t]||t}var v=null;t.b=function(e){var t=e.width,p=void 0===t?"100%":t,m=e.height,y=void 0===m?"100%":m,b=e.value,E=e.language,k=void 0===E?"javascript":E,C=e.style,S=void 0===C?{}:C,x=e.options,w=void 0===x?{}:x,T=e.overrideServices,_=void 0===T?{}:T,O=e.theme,A=void 0===O?"vs-dark":O,L=e.onEditBlur,D=e.onSave,R=e.autoHeight,I=void 0!==R&&R,N=e.forbidCopy,P=void 0!==N&&N,M=e.onChange,j=void 0===M?f:M,B=e.editorDidMount,F=void 0===B?f:B,U=e.onFocus,G=void 0===U?f:U,H=e.filename,K=void 0===H?"educoder.txt":H,z=(Object(o.a)(e,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Object(l.useRef)()),V=Object(l.useRef)({}),W=Object(l.useRef)(),Y=Object(l.useRef)(!1),q=Object(l.useRef)(),X=Object(l.useState)(!1),Q=Object(s.a)(X,2),J=Q[0],Z=Q[1];function $(){r.b.warn(decodeURIComponent("该任务关卡设置了禁止复制粘贴,请手动输入代码。"))}function ee(){var e=V.current.instance;if(e){var t=e.getSelection(),n=V.current.pastePos||{},i=new v.Range(n.startLineNumber||t.endLineNumber,n.startColumn||t.endColumn,n.endLineNumber||t.endLineNumber,n.endColumn||t.endColumn);setTimeout((function(){e.executeEdits("",[{range:i,text:""}])}),300)}}function te(e){(window.navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&83==e.keyCode&&(e.preventDefault(),D())}Object(l.useEffect)((function(){W.current&&clearTimeout(W.current),W.current=setTimeout((function(){!function(){var e=V.current.instance;if(null!=b&&e&&J){var t=e.getModel();t&&b!==t.getValue()&&(!0,t.setValue(b),e.layout(),!1)}}()}),500)}),[b,J,V.current]);var ne=function(){if(I&&V.current.instance){var e=V.current.instance.getContentHeight();ue(e<y?y:e)}else ue(y)};function ie(e,t){var n,i,r=window.URL||window.webkitURL||window,a=new Blob([t]),s=document.createElementNS("http://www.w3.org/1999/xhtml","a");s.href=r.createObjectURL(a),s.download=e,n=s,(i=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),n.dispatchEvent(i)}Object(l.useEffect)((function(){ne()}),[ne]),Object(l.useEffect)((function(){z.current&&!J&&n.e(/*! import() | monaco-editor */27).then(n.t.bind(null,/*! monaco-editor/esm/vs/editor/editor.api.js */"M/lh",7)).then((function(e){try{v=e,V.current.instance=v.editor.create(z.current,{value:b,language:g(k),theme:A,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},_);var t=V.current.instance;if(F(t,v),setTimeout((function(){ne(),V.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ie(K||"educoder.txt",t.getValue())}})}),500),V.current.subscription=t.onDidChangeModelContent((function(e){Y.current?clearTimeout(q.current):(ne(),j(t.getValue(),e)),q.current=setTimeout((function(){Y.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},n=["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(i,r){return{suggestions:h(e,i,r,n,[t])}}});var i=["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,n){var r=[{label:"print",kind:e.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet}];return{suggestions:h(e,t,n,i,r)}}});var r=["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(n,i){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:h(e,n,i,r,a)}}})}(v),P&&(t.addCommand(v.KeyMod.CtrlCmd|v.KeyMod.Shift|v.KeyCode.KEY_V,(function(){return $(),null})),t.addCommand(v.KeyMod.CtrlCmd|v.KeyCode.KEY_C,(function(){return $(),null}))),window.Monaco=v,L&&t.onDidBlurEditorWidget((function(){L(t.getValue())})),G&&t.onDidFocusEditorText((function(){G(t.getValue())})),P){t.addCommand(v.KeyMod.CtrlCmd|v.KeyCode.KEY_V,(function(){return $(),null})),t.onDidPaste((function(e){V.current.pastePos=e}));try{window.addEventListener("paste",ee)}catch(e){}}var n=function(){var e;return z.current&&(e=new u.default((function(e){var t,n=Object(a.a)(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;(i.target.offsetHeight>0||i.target.offsetWidth>0)&&V.current.instance.layout()}}catch(e){n.e(e)}finally{n.f()}}))).observe(z.current),e}();return Z(!0),function(){var e=V.current.instance;e.dispose();var t=e.getModel();t&&t.dispose(),V.current.subscription&&V.current.subscription.dispose(),P&&window.removeEventListener("paste",ee),n.unobserve(z.current)}}catch(e){}}))}),[]),Object(l.useEffect)((function(){if(V.current.instance&&J)return document.addEventListener("keydown",te,!1),function(){document.removeEventListener("keydown",te)}}),[D,J]),Object(l.useEffect)((function(){var e=V.current.instance;if(e&&J){var t=g(k);v.editor.setModelLanguage(e.getModel(),t),console.log("language:",k,e.getModel(),t)}}),[k,J]),Object(l.useEffect)((function(){V.current.instance&&J&&v.editor.setTheme(A)}),[A,J]),Object(l.useEffect)((function(){var e=V.current.instance;e&&J&&(e.updateOptions(Object(i.a)({},w)),setTimeout((function(){e.getModel().updateOptions(Object(i.a)({},w))}),200))}),[JSON.stringify(w),J]),Object(l.useEffect)((function(){var e=V.current.instance;e&&J&&e.layout()}),[p,y,J]);var re=Object(l.useState)(d(p)),ae=Object(s.a)(re,2),se=ae[0],oe=(ae[1],Object(l.useState)(d(y))),le=Object(s.a)(oe,2),ce=le[0],ue=le[1],he=Object(i.a)(Object(i.a)({},S),{},{width:se,height:ce});return c.a.createElement("div",{className:"my-monaco-editor",ref:z,style:he})};function m(e){var t=e.width,r=void 0===t?"100%":t,o=e.height,h=void 0===o?"100%":o,f=e.original,p=e.modified,g=e.language,m=e.options,y=void 0===m?{}:m,b=Object(l.useRef)(),E=Object(l.useState)(null),k=Object(s.a)(E,2),C=k[0],S=k[1];Object(l.useEffect)((function(){b.current&&n.e(/*! import() | monaco-editor */27).then(n.t.bind(null,/*! monaco-editor/esm/vs/editor/editor.api.js */"M/lh",7)).then((function(e){var t=(v=e).editor.createDiffEditor(b.current,Object(i.a)(Object(i.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}));S(t);var n=function(e){var t;return b.current&&(t=new u.default((function(t){var n,i=Object(a.a)(t);try{for(i.s();!(n=i.n()).done;){var r=n.value;(r.target.offsetHeight>0||r.target.offsetWidth>0)&&e.layout()}}catch(e){i.e(e)}finally{i.f()}}))).observe(b.current),t}(t);return function(){t.dispose();var e=t.getModel();e&&e.dispose(),n.unobserve(b.current)}}))}),[]),Object(l.useEffect)((function(){C&&C.setModel({original:v.editor.createModel(f,g),modified:v.editor.createModel(p,g)})}),[f,p,g,C]);var x={width:d(r),height:d(h)};return c.a.createElement("div",{className:"my-diff-editor",ref:b,style:x})}},ZpRC:
|
|
|
/*!*************************************************************************!*\
|
|
|
!*** ./node_modules/scroll-into-view-if-needed/es/index.js + 1 modules ***!
|
|
|
\*************************************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,n){"use strict";function i(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function r(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function a(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return r(n.overflowY,t)||r(n.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,n,i,r,a,s,o){return a<e&&s>t||a>e&&s<t?0:a<=e&&o<=n||s>=t&&o>=n?a-e-i:s>t&&o<n||a<e&&o>n?s-t+r:0}var o=function(e,t){var n=window,r=t.scrollMode,o=t.block,l=t.inline,c=t.boundary,u=t.skipOverflowHiddenElements,h="function"==typeof c?c:function(e){return e!==c};if(!i(e))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,f=[],p=e;i(p)&&h(p);){if((p=p.parentElement)===d){f.push(p);break}null!=p&&p===document.body&&a(p)&&!a(document.documentElement)||null!=p&&a(p,u)&&f.push(p)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,v=n.visualViewport?n.visualViewport.height:innerHeight,m=window.scrollX||pageXOffset,y=window.scrollY||pageYOffset,b=e.getBoundingClientRect(),E=b.height,k=b.width,C=b.top,S=b.right,x=b.bottom,w=b.left,T="start"===o||"nearest"===o?C:"end"===o?x:C+E/2,_="center"===l?w+k/2:"end"===l?S:w,O=[],A=0;A<f.length;A++){var L=f[A],D=L.getBoundingClientRect(),R=D.height,I=D.width,N=D.top,P=D.right,M=D.bottom,j=D.left;if("if-needed"===r&&C>=0&&w>=0&&x<=v&&S<=g&&C>=N&&x<=M&&w>=j&&S<=P)return O;var B=getComputedStyle(L),F=parseInt(B.borderLeftWidth,10),U=parseInt(B.borderTopWidth,10),G=parseInt(B.borderRightWidth,10),H=parseInt(B.borderBottomWidth,10),K=0,z=0,V="offsetWidth"in L?L.offsetWidth-L.clientWidth-F-G:0,W="offsetHeight"in L?L.offsetHeight-L.clientHeight-U-H:0;if(d===L)K="start"===o?T:"end"===o?T-v:"nearest"===o?s(y,y+v,v,U,H,y+T,y+T+E,E):T-v/2,z="start"===l?_:"center"===l?_-g/2:"end"===l?_-g:s(m,m+g,g,F,G,m+_,m+_+k,k),K=Math.max(0,K+y),z=Math.max(0,z+m);else{K="start"===o?T-N-U:"end"===o?T-M+H+W:"nearest"===o?s(N,M,R,U,H+W,T,T+E,E):T-(N+R/2)+W/2,z="start"===l?_-j-F:"center"===l?_-(j+I/2)+V/2:"end"===l?_-P+G+V:s(j,P,I,F,G+V,_,_+k,k);var Y=L.scrollLeft,q=L.scrollTop;T+=q-(K=Math.max(0,Math.min(q+K,L.scrollHeight-R+W))),_+=Y-(z=Math.max(0,Math.min(Y+z,L.scrollWidth-I+V)))}O.push({el:L,top:K,left:z})}return O};function l(e){return e===Object(e)&&0!==Object.keys(e).length}t.a=function(e,t){var n=!e.ownerDocument.documentElement.contains(e);if(l(t)&&"function"==typeof t.behavior)return t.behavior(n?[]:o(e,t));if(!n){var i=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 n="scrollBehavior"in document.body.style;e.forEach((function(e){var i=e.el,r=e.top,a=e.left;i.scroll&&n?i.scroll({top:r,left:a,behavior:t}):(i.scrollTop=r,i.scrollLeft=a)}))}(o(e,i),i.behavior)}}},bT9E:
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./node_modules/rc-util/es/omit.js ***!
|
|
|
\*****************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var i=n(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ");function r(e,t){var n=Object(i.a)({},e);return Array.isArray(t)&&t.forEach((function(e){delete n[e]})),n}},d5o6:
|
|
|
/*!*********************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/AddModal/index.less?modules ***!
|
|
|
\*********************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={flex_box_center:"flex_box_center___2-Tej",flex_space_between:"flex_space_between___1Q3vH",flex_box_vertical_center:"flex_box_vertical_center___2x9ha",flex_box_center_end:"flex_box_center_end___1fvRI",flex_box_column:"flex_box_column___2RmOE",addModal:"addModal___2Pv06",row:"row___2XmSi",label:"label___1L8pt"}},fAei:
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./node_modules/rc-tree/es/index.js + 4 modules ***!
|
|
|
\******************************************************/
|
|
|
/*! exports provided: TreeNode, default */
|
|
|
/*! exports used: TreeNode, 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/toConsumableArray.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-motion/es/index.js (<- Module is referenced from these modules with unsupported syntax: ./node_modules/antd/lib/button/LoadingIcon.js (referenced with cjs require)) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/TreeNode.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/contextTypes.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/util.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/conductUtil.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/treeUtil.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.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,n){"use strict";n.d(t,"a",(function(){return C.a}));var i=n("rePB"),r=n("VTBJ"),a=n("KQm4"),s=n("1OyB"),o=n("vuIU"),l=n("Ji7U"),c=n("LK+K"),u=n("q1tI"),h=n("4IlW"),d=n("Kwbf"),f=n("TSYQ"),p=n.n(f),g=n("sboe"),v=n("OZM5"),m=n("815F"),y=n("ODXe"),b=n("Ff2n"),E=n("+nKL"),k=n("8XRh"),C=n("WaYH"),S=function(e,t){var n=e.className,i=e.style,r=e.motion,a=e.motionNodes,s=e.motionType,o=e.onMotionStart,l=e.onMotionEnd,c=e.active,h=e.treeNodeRequiredProps,d=Object(b.a)(e,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),f=u.useState(!0),v=Object(y.a)(f,2),E=v[0],S=v[1],x=u.useContext(g.a).prefixCls,w=u.useRef(!1),T=function(){w.current||l(),w.current=!0};return Object(u.useEffect)((function(){a&&"hide"===s&&E&&S(!1)}),[a]),Object(u.useEffect)((function(){return a&&o(),function(){a&&T()}}),[]),a?u.createElement(k.default,Object.assign({ref:t,visible:E},r,{motionAppear:"show"===s,onAppearEnd:T,onLeaveEnd:T}),(function(e,t){var n=e.className,i=e.style;return u.createElement("div",{ref:t,className:p()("".concat(x,"-treenode-motion"),n),style:i},a.map((function(e){var t=e.data,n=t.key,i=Object(b.a)(t,["key"]),r=e.isStart,a=e.isEnd;delete i.children;var s=Object(m.f)(n,h);return u.createElement(C.a,Object.assign({},i,s,{active:c,data:e.data,key:n,isStart:r,isEnd:a}))})))})):u.createElement(C.a,Object.assign({domRef:t,className:n,style:i},d,{active:c}))};S.displayName="MotionTreeNode";var x=u.forwardRef(S);function w(e,t,n){var i=e.findIndex((function(e){return e.data.key===n})),r=e[i+1],a=t.findIndex((function(e){return e.data.key===n}));if(r){var s=t.findIndex((function(e){return e.data.key===r.data.key}));return t.slice(a+1,s)}return t.slice(a+1)}var T={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},_=function(){},O="RC_TREE_MOTION_".concat(Math.random()),A={key:O},L={key:O,level:0,index:0,pos:"0",node:A},D={parent:null,children:[],pos:L.pos,data:A,isStart:[],isEnd:[]};function R(e,t,n,i){return!1!==t&&n?e.slice(0,Math.ceil(n/i)+1):e}function I(e){var t=e.data.key,n=e.pos;return Object(m.e)(t,n)}var N=u.forwardRef((function(e,t){var n=e.prefixCls,i=e.data,r=(e.selectable,e.checkable,e.expandedKeys),a=e.selectedKeys,s=e.checkedKeys,o=e.loadedKeys,l=e.loadingKeys,c=e.halfCheckedKeys,h=e.keyEntities,d=e.disabled,f=e.dragging,p=e.dragOverNodeKey,g=e.dropPosition,v=e.motion,k=e.height,C=e.itemHeight,S=e.virtual,A=e.focusable,L=e.activeItem,N=e.focused,P=e.tabIndex,M=e.onKeyDown,j=e.onFocus,B=e.onBlur,F=e.onActiveChange,U=e.onListChangeStart,G=e.onListChangeEnd,H=Object(b.a)(e,["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"]),K=u.useRef(null);u.useImperativeHandle(t,(function(){return{scrollTo:function(e){K.current.scrollTo(e)}}}));var z=u.useState(r),V=Object(y.a)(z,2),W=V[0],Y=V[1],q=u.useState(i),X=Object(y.a)(q,2),Q=X[0],J=X[1],Z=u.useState(i),$=Object(y.a)(Z,2),ee=$[0],te=$[1],ne=u.useState([]),ie=Object(y.a)(ne,2),re=ie[0],ae=ie[1],se=u.useState(null),oe=Object(y.a)(se,2),le=oe[0],ce=oe[1];function ue(){J(i),te(i),ae([]),ce(null),G()}u.useEffect((function(){Y(r);var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.length,i=t.length;if(1!==Math.abs(n-i))return{add:!1,key:null};function r(e,t){var n=new Map;e.forEach((function(e){n.set(e,!0)}));var i=t.filter((function(e){return!n.has(e)}));return 1===i.length?i[0]:null}return n<i?{add:!0,key:r(e,t)}:{add:!1,key:r(t,e)}}(W,r);if(null!==e.key)if(e.add){var t=Q.findIndex((function(t){return t.data.key===e.key})),n=R(w(Q,i,e.key),S,k,C),a=Q.slice();a.splice(t+1,0,D),te(a),ae(n),ce("show")}else{var s=i.findIndex((function(t){return t.data.key===e.key})),o=R(w(i,Q,e.key),S,k,C),l=i.slice();l.splice(s+1,0,D),te(l),ae(o),ce("hide")}else Q!==i&&(J(i),te(i))}),[r,i]),u.useEffect((function(){f||ue()}),[f]);var he=v?ee:i,de={expandedKeys:r,selectedKeys:a,loadedKeys:o,loadingKeys:l,checkedKeys:s,halfCheckedKeys:c,dragOverNodeKey:p,dropPosition:g,keyEntities:h};return u.createElement(u.Fragment,null,N&&L&&u.createElement("span",{style:T,"aria-live":"assertive"},function(e){for(var t=String(e.data.key),n=e;n.parent;)n=n.parent,t="".concat(n.data.key," > ").concat(t);return t}(L)),u.createElement("div",{role:"tree"},u.createElement("input",{style:T,disabled:!1===A||d,tabIndex:!1!==A?P:null,onKeyDown:M,onFocus:j,onBlur:B,value:"",onChange:_})),u.createElement(E.a,Object.assign({},H,{data:he,itemKey:I,height:k,fullHeight:!1,virtual:S,itemHeight:C,prefixCls:"".concat(n,"-list"),ref:K}),(function(e){var t=e.pos,n=e.data,i=n.key,r=Object(b.a)(n,["key"]),a=e.isStart,s=e.isEnd,o=Object(m.e)(i,t);delete r.children;var l=Object(m.f)(o,de);return u.createElement(x,Object.assign({},r,l,{active:L&&i===L.data.key,pos:t,data:e.data,isStart:a,isEnd:s,motion:v,motionNodes:i===O?re:null,motionType:le,onMotionStart:U,onMotionEnd:ue,treeNodeRequiredProps:de,onMouseMove:function(){F(null)}}))})))}));N.displayName="NodeList";var P=N,M=n("NvD2"),j=function(e){Object(l.a)(n,e);var t=Object(c.a)(n);function n(){var e;return Object(s.a)(this,n),(e=t.apply(this,arguments)).destroyed=!1,e.state={keyEntities:{},selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],dragging:!1,dragNodesKeys:[],dragOverNodeKey:null,dropPosition:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null},e.listRef=u.createRef(),e.onNodeDragStart=function(t,n){var i=e.state,r=i.expandedKeys,a=i.keyEntities,s=e.props.onDragStart,o=n.props.eventKey;e.dragNode=n;var l=Object(v.b)(r,o);e.setState({dragging:!0,dragNodesKeys:Object(v.g)(o,a)}),e.setExpandedKeys(l),s&&s({event:t,node:Object(m.b)(n.props)})},e.onNodeDragEnter=function(t,n){var i=e.state,r=i.expandedKeys,s=i.keyEntities,o=i.dragNodesKeys,l=e.props.onDragEnter,c=n.props,u=c.pos,h=c.eventKey;if(e.dragNode&&-1===o.indexOf(h)){var d=Object(v.c)(t,n);e.dragNode.props.eventKey!==h||0!==d?setTimeout((function(){e.setState({dragOverNodeKey:h,dropPosition:d}),e.delayedDragEnterLogic||(e.delayedDragEnterLogic={}),Object.keys(e.delayedDragEnterLogic).forEach((function(t){clearTimeout(e.delayedDragEnterLogic[t])})),e.delayedDragEnterLogic[u]=window.setTimeout((function(){if(e.state.dragging){var i=Object(a.a)(r),o=s[h];o&&(o.children||[]).length&&(i=Object(v.a)(r,h)),"expandedKeys"in e.props||e.setExpandedKeys(i),l&&l({event:t,node:Object(m.b)(n.props),expandedKeys:i})}}),400)}),0):e.setState({dragOverNodeKey:"",dropPosition:null})}},e.onNodeDragOver=function(t,n){var i=e.state.dragNodesKeys,r=e.props.onDragOver,a=n.props.eventKey;if(-1===i.indexOf(a)){if(e.dragNode&&a===e.state.dragOverNodeKey){var s=Object(v.c)(t,n);if(s===e.state.dropPosition)return;e.setState({dropPosition:s})}r&&r({event:t,node:Object(m.b)(n.props)})}},e.onNodeDragLeave=function(t,n){var i=e.props.onDragLeave;e.setState({dragOverNodeKey:""}),i&&i({event:t,node:Object(m.b)(n.props)})},e.onNodeDragEnd=function(t,n){var i=e.props.onDragEnd;e.setState({dragOverNodeKey:""}),e.cleanDragState(),i&&i({event:t,node:Object(m.b)(n.props)}),e.dragNode=null},e.onNodeDrop=function(t,n){var i=e.state,r=i.dragNodesKeys,a=void 0===r?[]:r,s=i.dropPosition,o=e.props.onDrop,l=n.props,c=l.eventKey,u=l.pos;if(e.setState({dragOverNodeKey:""}),e.cleanDragState(),-1===a.indexOf(c)){var h=Object(v.k)(u),f={event:t,node:Object(m.b)(n.props),dragNode:e.dragNode?Object(m.b)(e.dragNode.props):null,dragNodesKeys:a.slice(),dropPosition:s+Number(h[h.length-1]),dropToGap:!1};0!==s&&(f.dropToGap=!0),o&&o(f),e.dragNode=null}else Object(d.a)(!1,"Can not drop to dragNode(include it's children node)")},e.cleanDragState=function(){e.state.dragging&&e.setState({dragging:!1})},e.onNodeClick=function(t,n){var i=e.props.onClick;i&&i(t,n)},e.onNodeDoubleClick=function(t,n){var i=e.props.onDoubleClick;i&&i(t,n)},e.onNodeSelect=function(t,n){var i=e.state.selectedKeys,r=e.state.keyEntities,a=e.props,s=a.onSelect,o=a.multiple,l=n.selected,c=n.key,u=!l,h=(i=u?o?Object(v.a)(i,c):[c]:Object(v.b)(i,c)).map((function(e){var t=r[e];return t?t.node:null})).filter((function(e){return e}));e.setUncontrolledState({selectedKeys:i}),s&&s(i,{event:"select",selected:u,node:n,selectedNodes:h,nativeEvent:t.nativeEvent})},e.onNodeCheck=function(t,n,i){var r,s=e.state,o=s.keyEntities,l=s.checkedKeys,c=s.halfCheckedKeys,u=e.props,h=u.checkStrictly,d=u.onCheck,f=n.key,p={event:"check",node:n,checked:i,nativeEvent:t.nativeEvent};if(h){var g=i?Object(v.a)(l,f):Object(v.b)(l,f);r={checked:g,halfChecked:Object(v.b)(c,f)},p.checkedNodes=g.map((function(e){return o[e]})).filter((function(e){return e})).map((function(e){return e.node})),e.setUncontrolledState({checkedKeys:g})}else{var m=Object(M.a)([].concat(Object(a.a)(l),[f]),!0,o),y=m.checkedKeys,b=m.halfCheckedKeys;if(!i){var E=new Set(y);E.delete(f);var k=Object(M.a)(Array.from(E),{checked:!1,halfCheckedKeys:b},o);y=k.checkedKeys,b=k.halfCheckedKeys}r=y,p.checkedNodes=[],p.checkedNodesPositions=[],p.halfCheckedKeys=b,y.forEach((function(e){var t=o[e];if(t){var n=t.node,i=t.pos;p.checkedNodes.push(n),p.checkedNodesPositions.push({node:n,pos:i})}})),e.setUncontrolledState({checkedKeys:y},!1,{halfCheckedKeys:b})}d&&d(r,p)},e.onNodeLoad=function(t){return new Promise((function(n){e.setState((function(i){var r=i.loadedKeys,a=void 0===r?[]:r,s=i.loadingKeys,o=void 0===s?[]:s,l=e.props,c=l.loadData,u=l.onLoad,h=t.key;return c&&-1===a.indexOf(h)&&-1===o.indexOf(h)?(c(t).then((function(){var i=e.state,r=i.loadedKeys,a=i.loadingKeys,s=Object(v.a)(r,h),o=Object(v.b)(a,h);u&&u(s,{event:"load",node:t}),e.setUncontrolledState({loadedKeys:s}),e.setState({loadingKeys:o}),n()})),{loadingKeys:Object(v.a)(o,h)}):{}}))}))},e.onNodeMouseEnter=function(t,n){var i=e.props.onMouseEnter;i&&i({event:t,node:n})},e.onNodeMouseLeave=function(t,n){var i=e.props.onMouseLeave;i&&i({event:t,node:n})},e.onNodeContextMenu=function(t,n){var i=e.props.onRightClick;i&&(t.preventDefault(),i({event:t,node:n}))},e.onFocus=function(){var t=e.props.onFocus;e.setState({focused:!0}),t&&t.apply(void 0,arguments)},e.onBlur=function(){var t=e.props.onBlur;e.setState({focused:!1}),e.onActiveChange(null),t&&t.apply(void 0,arguments)},e.getTreeNodeRequiredProps=function(){var t=e.state;return{expandedKeys:t.expandedKeys||[],selectedKeys:t.selectedKeys||[],loadedKeys:t.loadedKeys||[],loadingKeys:t.loadingKeys||[],checkedKeys:t.checkedKeys||[],halfCheckedKeys:t.halfCheckedKeys||[],dragOverNodeKey:t.dragOverNodeKey,dropPosition:t.dropPosition,keyEntities:t.keyEntities}},e.setExpandedKeys=function(t){var n=e.state.treeData,i=Object(m.d)(n,t);e.setUncontrolledState({expandedKeys:t,flattenNodes:i},!0)},e.onNodeExpand=function(t,n){var i=e.state.expandedKeys,r=e.state.listChanging,a=e.props,s=a.onExpand,o=a.loadData,l=n.key,c=n.expanded;if(!r){var u=i.indexOf(l),h=!c;if(Object(d.a)(c&&-1!==u||!c&&-1===u,"Expand state not sync with index check"),i=h?Object(v.a)(i,l):Object(v.b)(i,l),e.setExpandedKeys(i),s&&s(i,{node:n,expanded:h,nativeEvent:t.nativeEvent}),h&&o){var f=e.onNodeLoad(n);f&&f.then((function(){var t=Object(m.d)(e.state.treeData,i);e.setUncontrolledState({flattenNodes:t})}))}}},e.onListChangeStart=function(){e.setUncontrolledState({listChanging:!0})},e.onListChangeEnd=function(){setTimeout((function(){e.setUncontrolledState({listChanging:!1})}))},e.onActiveChange=function(t){var n=e.state.activeKey,i=e.props.onActiveChange;n!==t&&(e.setState({activeKey:t}),null!==t&&e.scrollTo({key:t}),i&&i(t))},e.getActiveItem=function(){var t=e.state,n=t.activeKey,i=t.flattenNodes;return null===n?null:i.find((function(e){return e.data.key===n}))||null},e.offsetActiveKey=function(t){var n=e.state,i=n.flattenNodes,r=n.activeKey,a=i.findIndex((function(e){return e.data.key===r}));-1===a&&t<0&&(a=i.length);var s=i[a=(a+t+i.length)%i.length];if(s){var o=s.data.key;e.onActiveChange(o)}else e.onActiveChange(null)},e.onKeyDown=function(t){var n=e.state,i=n.activeKey,a=n.expandedKeys,s=n.checkedKeys,o=e.props,l=o.onKeyDown,c=o.checkable,u=o.selectable;switch(t.which){case h.a.UP:e.offsetActiveKey(-1),t.preventDefault();break;case h.a.DOWN:e.offsetActiveKey(1),t.preventDefault()}var d=e.getActiveItem();if(d&&d.data){var f=e.getTreeNodeRequiredProps(),p=!1===d.data.isLeaf||!!(d.data.children||[]).length,g=Object(m.b)(Object(r.a)(Object(r.a)({},Object(m.f)(i,f)),{},{data:d.data,active:!0}));switch(t.which){case h.a.LEFT:p&&a.includes(i)?e.onNodeExpand({},g):d.parent&&e.onActiveChange(d.parent.data.key),t.preventDefault();break;case h.a.RIGHT:p&&!a.includes(i)?e.onNodeExpand({},g):d.children&&d.children.length&&e.onActiveChange(d.children[0].data.key),t.preventDefault();break;case h.a.ENTER:case h.a.SPACE:!c||g.disabled||!1===g.checkable||g.disableCheckbox?c||!u||g.disabled||!1===g.selectable||e.onNodeSelect({},g):e.onNodeCheck({},g,!s.includes(i))}}l&&l(t)},e.setUncontrolledState=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e.destroyed){var a=!1,s=!0,o={};Object.keys(t).forEach((function(n){n in e.props?s=!1:(a=!0,o[n]=t[n])})),!a||n&&!s||e.setState(Object(r.a)(Object(r.a)({},o),i))}},e.scrollTo=function(t){e.listRef.current.scrollTo(t)},e}return Object(o.a)(n,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var e,t=this.state,n=t.focused,r=t.flattenNodes,a=t.keyEntities,s=t.dragging,o=t.activeKey,l=this.props,c=l.prefixCls,h=l.className,d=l.style,f=l.showLine,m=l.focusable,y=l.tabIndex,b=void 0===y?0:y,E=l.selectable,k=l.showIcon,C=l.icon,S=l.switcherIcon,x=l.draggable,w=l.checkable,T=l.checkStrictly,_=l.disabled,O=l.motion,A=l.loadData,L=l.filterTreeNode,D=l.height,R=l.itemHeight,I=l.virtual,N=l.titleRender,M=l.onContextMenu,j=Object(v.f)(this.props);return u.createElement(g.a.Provider,{value:{prefixCls:c,selectable:E,showIcon:k,icon:C,switcherIcon:S,draggable:x,checkable:w,checkStrictly:T,disabled:_,keyEntities:a,loadData:A,filterTreeNode:L,titleRender:N,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},u.createElement("div",{className:p()(c,h,(e={},Object(i.a)(e,"".concat(c,"-show-line"),f),Object(i.a)(e,"".concat(c,"-focused"),n),Object(i.a)(e,"".concat(c,"-active-focused"),null!==o),e))},u.createElement(P,Object.assign({ref:this.listRef,prefixCls:c,style:d,data:r,disabled:_,selectable:E,checkable:!!w,motion:O,dragging:s,height:D,itemHeight:R,virtual:I,focusable:m,focused:n,tabIndex:b,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:M},this.getTreeNodeRequiredProps(),j))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n,a=t.prevProps,s={prevProps:e};function o(t){return!a&&t in e||a&&a[t]!==e[t]}if(o("treeData")?n=e.treeData:o("children")&&(Object(d.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),n=Object(m.c)(e.children)),n){s.treeData=n;var l=Object(m.a)(n);s.keyEntities=Object(r.a)(Object(i.a)({},O,L),l.keyEntities)}var c,u=s.keyEntities||t.keyEntities;if(o("expandedKeys")||a&&o("autoExpandParent"))s.expandedKeys=e.autoExpandParent||!a&&e.defaultExpandParent?Object(v.e)(e.expandedKeys,u):e.expandedKeys;else if(!a&&e.defaultExpandAll){var h=Object(r.a)({},u);delete h[O],s.expandedKeys=Object.keys(h).map((function(e){return h[e].key}))}else!a&&e.defaultExpandedKeys&&(s.expandedKeys=e.autoExpandParent||e.defaultExpandParent?Object(v.e)(e.defaultExpandedKeys,u):e.defaultExpandedKeys);if(s.expandedKeys||delete s.expandedKeys,n||s.expandedKeys){var f=Object(m.d)(n||t.treeData,s.expandedKeys||t.expandedKeys);s.flattenNodes=f}if((e.selectable&&(o("selectedKeys")?s.selectedKeys=Object(v.d)(e.selectedKeys,e):!a&&e.defaultSelectedKeys&&(s.selectedKeys=Object(v.d)(e.defaultSelectedKeys,e))),e.checkable)&&(o("checkedKeys")?c=Object(v.j)(e.checkedKeys)||{}:!a&&e.defaultCheckedKeys?c=Object(v.j)(e.defaultCheckedKeys)||{}:n&&(c=Object(v.j)(e.checkedKeys)||{checkedKeys:t.checkedKeys,halfCheckedKeys:t.halfCheckedKeys}),c)){var p=c,g=p.checkedKeys,y=void 0===g?[]:g,b=p.halfCheckedKeys,E=void 0===b?[]:b;if(!e.checkStrictly){var k=Object(M.a)(y,!0,u);y=k.checkedKeys,E=k.halfCheckedKeys}s.checkedKeys=y,s.halfCheckedKeys=E}return o("loadedKeys")&&(s.loadedKeys=e.loadedKeys),s}}]),n}(u.Component);j.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[]},j.TreeNode=C.a;var B=j;t.b=B},fcSX:
|
|
|
/*!********************************************************!*\
|
|
|
!*** ./node_modules/rc-drawer/es/index.js + 3 modules ***!
|
|
|
\********************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js */
|
|
|
/*! 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/rc-util/es/PortalWrapper.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/getScrollBarSize.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(e,t,n){"use strict";var i=n("Ff2n"),r=n("1OyB"),a=n("vuIU"),s=n("Ji7U"),o=n("md7G"),l=n("foSv"),c=n("1W/9"),u=n("q1tI"),h=n("rePB"),d=n("JX7q"),f=n("TSYQ"),p=n.n(f),g=n("qx4F"),v=n("4IlW");var m={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},y=Object.keys(m).filter((function(e){if("undefined"==typeof document)return!1;var t=document.getElementsByTagName("html")[0];return e in(t?t.style:{})}))[0],b=m[y];function E(e,t,n,i){e.addEventListener?e.addEventListener(t,n,i):e.attachEvent&&e.attachEvent("on".concat(t),n)}function k(e,t,n,i){e.removeEventListener?e.removeEventListener(t,n,i):e.attachEvent&&e.detachEvent("on".concat(t),n)}var C=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},S=!("undefined"!=typeof window&&window.document&&window.document.createElement);function x(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 n,i=Object(l.a)(e);if(t){var r=Object(l.a)(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Object(o.a)(this,n)}}var w={},T=function(e){Object(s.a)(n,e);var t=x(n);function n(e){var i;return Object(r.a)(this,n),(i=t.call(this,e)).domFocus=function(){i.dom&&i.dom.focus()},i.removeStartHandler=function(e){e.touches.length>1||(i.startPos={x:e.touches[0].clientX,y:e.touches[0].clientY})},i.removeMoveHandler=function(e){if(!(e.changedTouches.length>1)){var t=e.currentTarget,n=e.changedTouches[0].clientX-i.startPos.x,r=e.changedTouches[0].clientY-i.startPos.y;(t===i.maskDom||t===i.handlerDom||t===i.contentDom&&function e(t,n,i,r){if(!n||n===document||n instanceof Document)return!1;if(n===t.parentNode)return!0;var a=Math.max(Math.abs(i),Math.abs(r))===Math.abs(r),s=Math.max(Math.abs(i),Math.abs(r))===Math.abs(i),o=n.scrollHeight-n.clientHeight,l=n.scrollWidth-n.clientWidth,c=document.defaultView.getComputedStyle(n),u="auto"===c.overflowY||"scroll"===c.overflowY,h="auto"===c.overflowX||"scroll"===c.overflowX,d=o&&u,f=l&&h;return!!(a&&(!d||d&&(n.scrollTop>=o&&r<0||n.scrollTop<=0&&r>0))||s&&(!f||f&&(n.scrollLeft>=l&&i<0||n.scrollLeft<=0&&i>0)))&&e(t,n.parentNode,i,r)}(t,e.target,n,r))&&e.cancelable&&e.preventDefault()}},i.transitionEnd=function(e){var t=e.target;k(t,b,i.transitionEnd),t.style.transition=""},i.onKeyDown=function(e){if(e.keyCode===v.a.ESC){var t=i.props.onClose;e.stopPropagation(),t&&t(e)}},i.onWrapperTransitionEnd=function(e){var t=i.props,n=t.open,r=t.afterVisibleChange;e.target===i.contentWrapper&&e.propertyName.match(/transform$/)&&(i.dom.style.transition="",!n&&i.getCurrentDrawerSome()&&(document.body.style.overflowX="",i.maskDom&&(i.maskDom.style.left="",i.maskDom.style.width="")),r&&r(!!n))},i.openLevelTransition=function(){var e=i.props,t=e.open,n=e.width,r=e.height,a=i.getHorizontalBoolAndPlacementName(),s=a.isHorizontal,o=a.placementName,l=i.contentDom?i.contentDom.getBoundingClientRect()[s?"width":"height"]:0,c=(s?n:r)||l;i.setLevelAndScrolling(t,o,c)},i.setLevelTransform=function(e,t,n,r){var a=i.props,s=a.placement,o=a.levelMove,l=a.duration,c=a.ease,u=a.showMask;i.levelDom.forEach((function(a){a.style.transition="transform ".concat(l," ").concat(c),E(a,b,i.transitionEnd);var h,d,f,p=e?n:0;if(o){var g=(d={target:a,open:e},f="function"==typeof(h=o)?h(d):h,Array.isArray(f)?2===f.length?f:[f[0],f[1]]:[f]);p=e?g[0]:g[1]||0}var v="number"==typeof p?"".concat(p,"px"):p,m="left"===s||"top"===s?v:"-".concat(v);m=u&&"right"===s&&r?"calc(".concat(m," + ").concat(r,"px)"):m,a.style.transform=p?"".concat(t,"(").concat(m,")"):""}))},i.setLevelAndScrolling=function(e,t,n){var r=i.props.onChange;if(!S){var a=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(g.a)(!0):0;i.setLevelTransform(e,t,n,a),i.toggleScrollingToDrawerAndBody(a)}r&&r(e)},i.toggleScrollingToDrawerAndBody=function(e){var t=i.props,n=t.getOpenCount,r=t.getContainer,a=t.showMask,s=t.open,o=r&&r(),l=n&&n();if(o&&o.parentNode===document.body&&a){var c=["touchstart"],u=[document.body,i.maskDom,i.handlerDom,i.contentDom];s&&"hidden"!==document.body.style.overflow?(e&&i.addScrollingEffect(e),1===l&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",u.forEach((function(e,t){e&&E(e,c[t]||"touchmove",t?i.removeMoveHandler:i.removeStartHandler,i.passive)}))):i.getCurrentDrawerSome()&&(l||(document.body.style.overflow=""),document.body.style.touchAction="",e&&i.remScrollingEffect(e),u.forEach((function(e,t){e&&k(e,c[t]||"touchmove",t?i.removeMoveHandler:i.removeStartHandler,i.passive)})))}},i.addScrollingEffect=function(e){var t=i.props,n=t.placement,r=t.duration,a=t.ease,s=t.getOpenCount,o=t.switchScrollingEffect;1===(s&&s())&&o();var l="width ".concat(r," ").concat(a),c="transform ".concat(r," ").concat(a);switch(i.dom.style.transition="none",n){case"right":i.dom.style.transform="translateX(-".concat(e,"px)");break;case"top":case"bottom":i.dom.style.width="calc(100% - ".concat(e,"px)"),i.dom.style.transform="translateZ(0)"}clearTimeout(i.timeout),i.timeout=setTimeout((function(){i.dom&&(i.dom.style.transition="".concat(c,",").concat(l),i.dom.style.width="",i.dom.style.transform="")}))},i.remScrollingEffect=function(e){var t,n=i.props,r=n.placement,a=n.duration,s=n.ease,o=n.getOpenCount,l=n.switchScrollingEffect;o&&o()||l(!0),y&&(document.body.style.overflowX="hidden"),i.dom.style.transition="none";var c="width ".concat(a," ").concat(s),u="transform ".concat(a," ").concat(s);switch(r){case"left":i.dom.style.width="100%",c="width 0s ".concat(s," ").concat(a);break;case"right":i.dom.style.transform="translateX(".concat(e,"px)"),i.dom.style.width="100%",c="width 0s ".concat(s," ").concat(a),i.maskDom&&(i.maskDom.style.left="-".concat(e,"px"),i.maskDom.style.width="calc(100% + ".concat(e,"px)"));break;case"top":case"bottom":i.dom.style.width="calc(100% + ".concat(e,"px)"),i.dom.style.height="100%",i.dom.style.transform="translateZ(0)",t="height 0s ".concat(s," ").concat(a)}clearTimeout(i.timeout),i.timeout=setTimeout((function(){i.dom&&(i.dom.style.transition="".concat(u,",").concat(t?"".concat(t,","):"").concat(c),i.dom.style.transform="",i.dom.style.width="",i.dom.style.height="")}))},i.getCurrentDrawerSome=function(){return!Object.keys(w).some((function(e){return w[e]}))},i.getLevelDom=function(e){var t=e.level,n=e.getContainer;if(!S){var r,a=n&&n(),s=a?a.parentNode:null;if(i.levelDom=[],"all"===t)(s?Array.prototype.slice.call(s.children):[]).forEach((function(e){"SCRIPT"!==e.nodeName&&"STYLE"!==e.nodeName&&"LINK"!==e.nodeName&&e!==a&&i.levelDom.push(e)}));else t&&(r=t,Array.isArray(r)?r:[r]).forEach((function(e){document.querySelectorAll(e).forEach((function(e){i.levelDom.push(e)}))}))}},i.getHorizontalBoolAndPlacementName=function(){var e=i.props.placement,t="left"===e||"right"===e;return{isHorizontal:t,placementName:"translate".concat(t?"X":"Y")}},i.state={_self:Object(d.a)(i)},i}return Object(a.a)(n,[{key:"componentDidMount",value:function(){var e=this;if(!S){var t=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return t=!0,null}}))}catch(e){}this.passive=!!t&&{passive:!1}}var n=this.props,i=n.open,r=n.getContainer,a=r&&r();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(9*Math.random()).toString())).toString(16)),this.getLevelDom(this.props),i&&(a&&a.parentNode===document.body&&(w[this.drawerId]=i),this.openLevelTransition(),this.forceUpdate((function(){e.domFocus()})))}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.open,i=t.getContainer,r=i&&i();n!==e.open&&(n&&this.domFocus(),r&&r.parentNode===document.body&&(w[this.drawerId]=!!n),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var e=this.props,t=e.getOpenCount,n=e.open,i=e.switchScrollingEffect,r="function"==typeof t&&t();delete w[this.drawerId],n&&(this.setLevelTransform(!1),document.body.style.touchAction=""),r||(document.body.style.overflow="",i(!0))}},{key:"render",value:function(){var e,t=this,n=this.props,r=n.className,a=n.children,s=n.style,o=n.width,l=n.height,c=(n.defaultOpen,n.open),d=n.prefixCls,f=n.placement,g=(n.level,n.levelMove,n.ease,n.duration,n.getContainer,n.handler),v=(n.onChange,n.afterVisibleChange,n.showMask),m=n.maskClosable,y=n.maskStyle,b=n.onClose,E=n.onHandleClick,k=n.keyboard,S=(n.getOpenCount,n.switchScrollingEffect,Object(i.a)(n,["className","children","style","width","height","defaultOpen","open","prefixCls","placement","level","levelMove","ease","duration","getContainer","handler","onChange","afterVisibleChange","showMask","maskClosable","maskStyle","onClose","onHandleClick","keyboard","getOpenCount","switchScrollingEffect"])),x=!!this.dom&&c,w=p()(d,(e={},Object(h.a)(e,"".concat(d,"-").concat(f),!0),Object(h.a)(e,"".concat(d,"-open"),x),Object(h.a)(e,r||"",!!r),Object(h.a)(e,"no-mask",!v),e)),T=this.getHorizontalBoolAndPlacementName().placementName,_="left"===f||"top"===f?"-100%":"100%",O=x?"":"".concat(T,"(").concat(_,")"),A=g&&u.cloneElement(g,{onClick:function(e){g.props.onClick&&g.props.onClick(),E&&E(e)},ref:function(e){t.handlerDom=e}});return u.createElement("div",Object.assign({},S,{tabIndex:-1,className:w,style:s,ref:function(e){t.dom=e},onKeyDown:x&&k?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),v&&u.createElement("div",{className:"".concat(d,"-mask"),onClick:m?b:void 0,style:y,ref:function(e){t.maskDom=e}}),u.createElement("div",{className:"".concat(d,"-content-wrapper"),style:{transform:O,msTransform:O,width:C(o)?"".concat(o,"px"):o,height:C(l)?"".concat(l,"px"):l},ref:function(e){t.contentWrapper=e}},u.createElement("div",{className:"".concat(d,"-content"),ref:function(e){t.contentDom=e},onTouchStart:x&&v?this.removeStartHandler:void 0,onTouchMove:x&&v?this.removeMoveHandler:void 0},a),A))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevProps,i=t._self,r={prevProps:e};if(void 0!==n){var a=e.placement,s=e.level;a!==n.placement&&(i.contentDom=null),s!==n.level&&i.getLevelDom(e)}return r}}]),n}(u.Component);T.defaultProps={switchScrollingEffect:function(){}};var _=T;function O(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 n,i=Object(l.a)(e);if(t){var r=Object(l.a)(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Object(o.a)(this,n)}}var A=function(e){Object(s.a)(n,e);var t=O(n);function n(e){var i;Object(r.a)(this,n),(i=t.call(this,e)).onHandleClick=function(e){var t=i.props,n=t.onHandleClick,r=t.open;if(n&&n(e),void 0===r){var a=i.state.open;i.setState({open:!a})}},i.onClose=function(e){var t=i.props,n=t.onClose,r=t.open;n&&n(e),void 0===r&&i.setState({open:!1})};var a=void 0!==e.open?e.open:!!e.defaultOpen;return i.state={open:a},"onMaskClick"in e&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),i}return Object(a.a)(n,[{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultOpen,t.getContainer),r=t.wrapperClassName,a=t.forceRender,s=t.handler,o=Object(i.a)(t,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),l=this.state.open;if(!n)return u.createElement("div",{className:r,ref:function(t){e.dom=t}},u.createElement(_,Object.assign({},o,{open:l,handler:s,getContainer:function(){return e.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var h=!!s||a;return u.createElement(c.a,{visible:l,forceRender:h,getContainer:n,wrapperClassName:r},(function(t){var n=t.visible,r=t.afterClose,a=Object(i.a)(t,["visible","afterClose"]);return u.createElement(_,Object.assign({},o,a,{open:void 0!==n?n:l,afterVisibleChange:void 0!==r?r:o.afterVisibleChange,handler:s,onClose:e.onClose,onHandleClick:e.onHandleClick}))}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevProps,i={prevProps:e};return void 0!==n&&e.open!==n.open&&(i.open=e.open),i}}]),n}(u.Component);A.defaultProps={prefixCls:"drawer",placement:"left",getContainer:"body",defaultOpen:!1,level:"all",duration:".3s",ease:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",onChange:function(){},afterVisibleChange:function(){},handler:u.createElement("div",{className:"drawer-handle"},u.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var L=A;t.a=L},i8i3:
|
|
|
/*!***********************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/ShareModal/index.less?modules ***!
|
|
|
\***********************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={flex_box_center:"flex_box_center___3Vf6o",flex_space_between:"flex_space_between___3kR1x",flex_box_vertical_center:"flex_box_vertical_center___25a0b",flex_box_center_end:"flex_box_center_end___3k_KQ",flex_box_column:"flex_box_column___38BD-",customModal:"customModal___2JXW3",shareModal:"shareModal___1xuLw",content:"content___1yjOV",group:"group___2tJcj",teachGroup:"teachGroup___VMxNc",footer:"footer___1OQG5"}},iNYN:
|
|
|
/*!************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/index.less?modules ***!
|
|
|
\************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={modalContent:"modalContent___3NP2x",modalContentLeft:"modalContentLeft___ycFEY",green:"green___2njFR",textArea:"textArea___28pXQ",red:"red___2bPlD",row:"row___tW7CE",html:"html___30ord",line:"line___1f3U7"}},iris:
|
|
|
/*!*************************************************!*\
|
|
|
!*** ./src/components/LanguageSelect/index.tsx ***!
|
|
|
\*************************************************/
|
|
|
/*! exports provided: LanguageSelect */
|
|
|
/*! exports used: LanguageSelect */function(e,t,n){"use strict";n.d(t,"a",(function(){return f}));n(/*! antd/es/dropdown/style */"qVdP");var i=n(/*! antd/es/dropdown */"jsC+"),r=(n(/*! antd/es/menu/style */"lUTK"),n(/*! antd/es/menu */"BvKs")),a=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),s=n(/*! react */"q1tI"),o=n.n(s),l=n(/*! ./index.less?modules */"Q0Vu"),c=n.n(l),u=[{name:"编程题",value:"PROGRAM"},{name:"单选题",value:"SINGLE"},{name:"多选题",value:"MULTIPLE"},{name:"判断题",value:"JUDGMENT"},{name:"填空题",value:"COMPLETION"},{name:"简答题",value:"SUBJECTIVE"},{name:"组合题",value:"COMBINATION"}],h=[{name:"简单",value:1},{name:"适中",value:2},{name:"困难",value:3}],d=[{name:"随机组卷",value:1},{name:"人工组卷",value:2}],f=function(e){e.showSelectAll;var t=e.disciplinesData,n=void 0===t?[]:t,l=e.knowledgeData,f=void 0===l?[]:l,p=e.directionValue,g=e.subDisciplineValue,v=e.typeValue,m=e.knowledgeValue,y=e.showKnowledge,b=void 0!==y&&y,E=e.showRandomType,k=void 0!==E&&E,C=e.difficultyValue,S=e.randomValue,x=(e.selectAll,e.className),w=e.showShixun,T=void 0!==w&&w,_=e.showItemType,O=void 0===_||_,A=e.onShixunChange,L=void 0===A?function(){}:A,D=e.onDirectionChange,R=void 0===D?function(){}:D,I=e.onTypeChange,N=void 0===I?function(){}:I,P=e.onDifficultyChange,M=void 0===P?function(){}:P,j=e.onKnowledgeChange,B=void 0===j?function(){}:j,F=e.onRandomChange,U=void 0===F?function(){}:F,G=Object(s.useState)(0),H=Object(a.a)(G,2),K=H[0],z=H[1],V=Object(s.useRef)(null),W=Object(s.useState)(0),Y=Object(a.a)(W,2),q=Y[0],X=Y[1],Q=Object(s.useRef)(null);Object(s.useEffect)((function(){var e;0!==n.length&&((null==V||null===(e=V.current)||void 0===e?void 0:e.clientHeight)>90?z(1):z(0));0===n.length&&z(0)}),[n]),Object(s.useEffect)((function(){var e,t;(console.log(0===f.length,"数量"),0!==f.length)&&(console.log(null==Q||null===(e=Q.current)||void 0===e?void 0:e.clientHeight,"高度"),(null==Q||null===(t=Q.current)||void 0===t?void 0:t.clientHeight)>90?X(1):X(0));0===f.length&&X(0)}),[f]);var J=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return o.a.createElement(r.a,{className:c.a.subMenu},e.map((function(e){return o.a.createElement(r.a.Item,{key:e.id},o.a.createElement("a",{className:"".concat(c.a.subItem," ").concat(g===e.id?c.a.subActive:""),onClick:function(){return R(t,e.id)}},e.name))})))};return o.a.createElement("aside",{className:x?"".concat(c.a.main," ").concat(x):c.a.main},o.a.createElement("div",{className:c.a.wrap},o.a.createElement("div",{className:c.a.content},o.a.createElement("span",{className:c.a.name},"方向:"),o.a.createElement("span",null,o.a.createElement("li",{className:"".concat(c.a.directionItem," ").concat(p?"":c.a.active," "),onClick:function(){return R(null)}},"全部")),o.a.createElement("div",{className:c.a.directionContentWrap,style:{overflow:"hidden",height:1===K?88:"auto"}},n.map((function(e){var t;return o.a.createElement(o.a.Fragment,{key:e.id},(null===(t=e.sub_disciplines)||void 0===t?void 0:t.length)>0?o.a.createElement(i.a,{placement:"bottomLeft",overlayStyle:{width:600},getPopupContainer:function(e){return e.parentNode},overlay:function(){return J(e.sub_disciplines,e.id)}},o.a.createElement("li",{className:"".concat(c.a.directionItem," ").concat(p===e.id?c.a.active:""," "),onClick:function(){return R(e.id)}},e.name)):o.a.createElement("li",{className:"".concat(c.a.directionItem," ").concat(p===e.id?c.a.active:""," "),onClick:function(){return R(e.id)}},e.name))}))),o.a.createElement("div",{className:c.a.directionContentWrap,ref:V,style:{height:"auto",position:"fixed",left:0,top:0,width:1024,visibility:"hidden"}},n.map((function(e){var t;return o.a.createElement(o.a.Fragment,{key:e.id},(null===(t=e.sub_disciplines)||void 0===t?void 0:t.length)>0?o.a.createElement(i.a,{placement:"bottomLeft",overlayStyle:{width:600},getPopupContainer:function(e){return e.parentNode},overlay:function(){return J(e.sub_disciplines,e.id)}},o.a.createElement("li",{className:"".concat(c.a.directionItem," ").concat(p===e.id?c.a.active:""," "),onClick:function(){return R(e.id)}},e.name)):o.a.createElement("li",{className:"".concat(c.a.directionItem," ").concat(p===e.id?c.a.active:""," "),onClick:function(){return R(e.id)}},e.name))}))),!!K&&o.a.createElement("div",{className:c.a.action},1===K&&o.a.createElement("span",{onClick:function(){return z(2)}},"展开",o.a.createElement("i",{className:"iconfont icon-xiala"})),2===K&&o.a.createElement("span",{onClick:function(){return z(1)}},"收起",o.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))),b&&o.a.createElement("div",{className:c.a.content},o.a.createElement("span",{className:c.a.name},"知识点:"),o.a.createElement("li",{className:"".concat(c.a.directionItem," ").concat(-1===m?c.a.active:""," "),onClick:function(){return B(-1)}},"我的"),o.a.createElement("div",{className:c.a.directionContentWrap,style:{overflow:"hidden",height:1===q?88:"auto"}},f.map((function(e){return o.a.createElement("li",{key:e.id,className:"".concat(c.a.directionItem," ").concat(m===e.id?c.a.active:""," "),onClick:function(){return B(e.id)}},e.name)}))),o.a.createElement("div",{ref:Q,className:c.a.directionContentWrap,style:{height:"auto",position:"fixed",left:0,top:0,width:1010,visibility:"hidden"}},f.map((function(e){return o.a.createElement("li",{key:e.id,className:"".concat(c.a.directionItem," ").concat(m===e.id?c.a.active:""," "),onClick:function(){return B(e.id)}},e.name)}))),!!q&&o.a.createElement("div",{className:c.a.action},1===q&&o.a.createElement("span",{onClick:function(){return X(2)}},"展开",o.a.createElement("i",{className:"iconfont icon-xiala"})),2===q&&o.a.createElement("span",{onClick:function(){return X(1)}},"收起",o.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))),O&&o.a.createElement("div",{className:c.a.content},o.a.createElement("span",{className:c.a.name},"题型:"),o.a.createElement("li",{className:"".concat(c.a.directionItem," ").concat(v?"":c.a.active," "),onClick:function(){return N(null)}},"全部"),o.a.createElement("div",{className:c.a.directionContentWrap},u.map((function(e){return o.a.createElement("li",{key:e.name,className:"".concat(c.a.directionItem," ").concat(v===e.value?c.a.active:""," "),onClick:function(){return N(e.value)}},e.name)})),T&&o.a.createElement("li",{key:"实训题",className:c.a.directionItem,onClick:function(){return L()}},"实训题"))),o.a.createElement("div",{className:c.a.content},o.a.createElement("span",{className:c.a.name},"难度:"),o.a.createElement("li",{className:"".concat(c.a.directionItem," ").concat(C?"":c.a.active," "),onClick:function(){return M(null)}},"全部"),o.a.createElement("div",{className:c.a.directionContentWrap},h.map((function(e){return o.a.createElement("li",{key:e.name,className:"".concat(c.a.directionItem," ").concat(C===e.value?c.a.active:""," "),onClick:function(){return M(e.value)}},e.name)})))),k&&o.a.createElement("div",{className:c.a.content},o.a.createElement("span",{className:c.a.name},"类型:"),o.a.createElement("li",{className:"".concat(c.a.directionItem," ").concat(S?"":c.a.active," "),onClick:function(){return U(null)}},"全部"),o.a.createElement("div",{className:c.a.directionContentWrap},d.map((function(e){return o.a.createElement("li",{key:e.name,className:"".concat(c.a.directionItem," ").concat(S===e.value?c.a.active:""," "),onClick:function(){return U(e.value)}},e.name)}))))))}},k3GJ:
|
|
|
/*!*******************************************************!*\
|
|
|
!*** ./node_modules/rc-tabs/es/index.js + 50 modules ***!
|
|
|
\*******************************************************/
|
|
|
/*! exports provided: TabPane, default */
|
|
|
/*! exports used: TabPane, default */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
|
|
|
/*! 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/@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/toConsumableArray.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/mini-store/esm/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/raf/index.js (<- Module is not an ECMAScript module) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-align/es/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-dropdown/es/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-resize-observer/es/index.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/addEventListener.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/canUseDom.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/contains.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/findDOMNode.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Portal.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/createChainedFunction.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMergedState.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/omit.js */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/raf.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-dom/index.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)) */
|
|
|
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */function(e,t,n){"use strict";n.d(t,"a",(function(){return Vt}));var i=n("rePB"),r=n("ODXe"),a=n("Ff2n"),s=n("VTBJ"),o=n("q1tI"),l=n("TSYQ"),c=n.n(l),u=n("Zm9Q"),h=n("6cGi"),d=n("KQm4"),f=n("xEkU"),p=n.n(f),g=n("t23M");function v(e){var t=Object(o.useRef)(),n=Object(o.useRef)(!1);return Object(o.useEffect)((function(){return function(){n.current=!0,p.a.cancel(t.current)}}),[]),function(){for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];n.current||(p.a.cancel(t.current),t.current=p()((function(){e.apply(void 0,r)})))}}var m=n("4IlW");var y=o.forwardRef((function(e,t){var n,r=e.prefixCls,a=e.id,s=e.active,l=e.rtl,u=e.tab,h=u.key,d=u.tab,f=u.disabled,p=u.closeIcon,g=e.tabBarGutter,v=e.tabPosition,y=e.closable,b=e.renderWrapper,E=e.removeAriaLabel,k=e.editable,C=e.onClick,S=e.onRemove,x=e.onFocus,w="".concat(r,"-tab");o.useEffect((function(){return S}),[]);var T={};"top"===v||"bottom"===v?T[l?"marginLeft":"marginRight"]=g:T.marginBottom=g;var _=k&&!1!==y&&!f;function O(e){f||C(e)}var A=o.createElement("div",{key:h,ref:t,className:c()(w,(n={},Object(i.a)(n,"".concat(w,"-with-remove"),_),Object(i.a)(n,"".concat(w,"-active"),s),Object(i.a)(n,"".concat(w,"-disabled"),f),n)),style:T,onClick:O},o.createElement("div",{role:"tab","aria-selected":s,id:a&&"".concat(a,"-tab-").concat(h),className:"".concat(w,"-btn"),"aria-controls":a&&"".concat(a,"-panel-").concat(h),"aria-disabled":f,tabIndex:f?null:0,onClick:function(e){e.stopPropagation(),O(e)},onKeyDown:function(e){[m.a.SPACE,m.a.ENTER].includes(e.which)&&(e.preventDefault(),O(e))},onFocus:x},d),_&&o.createElement("button",{type:"button","aria-label":E||"remove",tabIndex:0,className:"".concat(w,"-remove"),onClick:function(e){var t;e.stopPropagation(),(t=e).preventDefault(),t.stopPropagation(),k.onEdit("remove",{key:h,event:t})}},p||k.removeIcon||"×"));return b&&(A=b(A)),A})),b={width:0,height:0,left:0,top:0};var E={width:0,height:0,left:0,top:0,right:0};var k=n("wx14"),C=n("1OyB"),S=n("vuIU"),x=n("JX7q"),w=n("Ji7U"),T=n("LK+K"),_=n("I8Z2"),O=n("bT9E"),A=n("2GS6"),L=n("Gytx"),D=n.n(L),R=n("U8pU"),I=/iPhone/i,N=/iPod/i,P=/iPad/i,M=/\bAndroid(?:.+)Mobile\b/i,j=/Android/i,B=/\bAndroid(?:.+)SD4930UR\b/i,F=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,U=/Windows Phone/i,G=/\bWindows(?:.+)ARM\b/i,H=/BlackBerry/i,K=/BB10/i,z=/Opera Mini/i,V=/\b(CriOS|Chrome)(?:.+)Mobile/i,W=/Mobile(?:.+)Firefox\b/i;function Y(e,t){return e.test(t)}function q(e){var t=e||("undefined"!=typeof navigator?navigator.userAgent:""),n=(t||"").split("[FBAN");if(void 0!==n[1]){var i=n;t=Object(r.a)(i,1)[0]}if(void 0!==(n=t.split("Twitter"))[1]){var a=n;t=Object(r.a)(a,1)[0]}var s={apple:{phone:Y(I,t)&&!Y(U,t),ipod:Y(N,t),tablet:!Y(I,t)&&Y(P,t)&&!Y(U,t),device:(Y(I,t)||Y(N,t)||Y(P,t))&&!Y(U,t)},amazon:{phone:Y(B,t),tablet:!Y(B,t)&&Y(F,t),device:Y(B,t)||Y(F,t)},android:{phone:!Y(U,t)&&Y(B,t)||!Y(U,t)&&Y(M,t),tablet:!Y(U,t)&&!Y(B,t)&&!Y(M,t)&&(Y(F,t)||Y(j,t)),device:!Y(U,t)&&(Y(B,t)||Y(F,t)||Y(M,t)||Y(j,t))||Y(/\bokhttp\b/i,t)},windows:{phone:Y(U,t),tablet:Y(G,t),device:Y(U,t)||Y(G,t)},other:{blackberry:Y(H,t),blackberry10:Y(K,t),opera:Y(z,t),firefox:Y(W,t),chrome:Y(V,t),device:Y(H,t)||Y(K,t)||Y(z,t)||Y(W,t)||Y(V,t)},any:null,phone:null,tablet:null};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var X=Object(s.a)(Object(s.a)({},q()),{},{isMobile:q});function Q(){}function J(e,t,n){var i=t||"";return e.key||"".concat(i,"item_").concat(n)}function Z(e){return"".concat(e,"-menu-")}function $(e,t){var n=-1;o.Children.forEach(e,(function(e){n+=1,e&&e.type&&e.type.isMenuItemGroup?o.Children.forEach(e.props.children,(function(e){t(e,n+=1)})):t(e,n)}))}var ee=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],te=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e&&"function"==typeof e.getBoundingClientRect&&e.getBoundingClientRect().width;if(n){if(t){var i=getComputedStyle(e),r=i.marginLeft,a=i.marginRight;n+=+r.replace("px","")+ +a.replace("px","")}n=+n.toFixed(6)}return n||0},ne=function(e,t,n){e&&"object"===Object(R.a)(e.style)&&(e.style[t]=n)},ie=n("bdgK"),re=n("i8i4"),ae=n.n(re),se=n("wgJM"),oe=n("l4aY"),le=n("m+aA"),ce=n("c+Xe"),ue=n("zT1h"),he=n("QC+M");function de(e,t,n){return n?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}var fe=n("MNnm");function pe(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}var ge,ve,me,ye=(ge=Object(fe.a)(),ve="undefined"!=typeof window?window:{},me={animationend:pe("Animation","AnimationEnd"),transitionend:pe("Transition","TransitionEnd")},ge&&("AnimationEvent"in ve||delete me.animationend.animation,"TransitionEvent"in ve||delete me.transitionend.transition),me),be={};if(Object(fe.a)()){var Ee=document.createElement("div");be=Ee.style}var ke={};function Ce(e){if(ke[e])return ke[e];var t=ye[e];if(t)for(var n=Object.keys(t),i=n.length,r=0;r<i;r+=1){var a=n[r];if(Object.prototype.hasOwnProperty.call(t,a)&&a in be)return ke[e]=t[a],ke[e]}return""}var Se=Ce("animationend"),xe=Ce("transitionend"),we=!(!Se||!xe),Te=Se||"animationend",_e=xe||"transitionend";function Oe(e,t){return e?"object"===Object(R.a)(e)?e[t.replace(/-\w/g,(function(e){return e[1].toUpperCase()}))]:"".concat(e,"-").concat(t):null}function Ae(e){var t=Object(o.useRef)(!1),n=Object(o.useState)(e),i=Object(r.a)(n,2),a=i[0],s=i[1];return Object(o.useEffect)((function(){return function(){t.current=!0}}),[]),[a,function(e){t.current||s(e)}]}var Le=Object(fe.a)()?o.useLayoutEffect:o.useEffect,De=["prepare","start","active","end"];function Re(e){return"active"===e||"end"===e}var Ie=function(e,t){var n=o.useState("none"),i=Object(r.a)(n,2),a=i[0],s=i[1],l=function(){var e=o.useRef(null);function t(){se.a.cancel(e.current)}return o.useEffect((function(){return function(){t()}}),[]),[function n(i){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;t();var a=Object(se.a)((function(){r<=1?i({isCanceled:function(){return a!==e.current}}):n(i,r-1)}));e.current=a},t]}(),c=Object(r.a)(l,2),u=c[0],h=c[1];return Le((function(){if("none"!==a&&"end"!==a){var e=De.indexOf(a),n=De[e+1],i=t(a);!1===i?s(n):u((function(e){function t(){e.isCanceled()||s(n)}!0===i?t():Promise.resolve(i).then(t)}))}}),[e,a]),o.useEffect((function(){return function(){h()}}),[]),[function(){s("prepare")},a]};function Ne(e,t,n,a){var l=a.motionEnter,c=void 0===l||l,u=a.motionAppear,h=void 0===u||u,d=a.motionLeave,f=void 0===d||d,p=a.motionDeadline,g=a.motionLeaveImmediately,v=a.onAppearPrepare,m=a.onEnterPrepare,y=a.onLeavePrepare,b=a.onAppearStart,E=a.onEnterStart,k=a.onLeaveStart,C=a.onAppearActive,S=a.onEnterActive,x=a.onLeaveActive,w=a.onAppearEnd,T=a.onEnterEnd,_=a.onLeaveEnd,O=a.onVisibleChanged,A=Ae(),L=Object(r.a)(A,2),D=L[0],R=L[1],I=Ae("none"),N=Object(r.a)(I,2),P=N[0],M=N[1],j=Ae(null),B=Object(r.a)(j,2),F=B[0],U=B[1],G=Object(o.useRef)(!1),H=Object(o.useRef)(null),K=Object(o.useRef)(!1),z=Object(o.useRef)(null);function V(){return n()||z.current}var W=Object(o.useRef)(!1);function Y(e){var t,n=V();e&&!e.deadline&&e.target!==n||("appear"===P&&W.current?t=null==w?void 0:w(n,e):"enter"===P&&W.current?t=null==T?void 0:T(n,e):"leave"===P&&W.current&&(t=null==_?void 0:_(n,e)),!1===t||K.current||(M("none"),U(null)))}var q=function(e){var t=Object(o.useRef)(),n=Object(o.useRef)(e);n.current=e;var i=o.useCallback((function(e){n.current(e)}),[]);function r(e){e&&(e.removeEventListener(_e,i),e.removeEventListener(Te,i))}return o.useEffect((function(){return function(){r(t.current)}}),[]),[function(e){t.current&&t.current!==e&&r(t.current),e&&e!==t.current&&(e.addEventListener(_e,i),e.addEventListener(Te,i),t.current=e)},r]}(Y),X=Object(r.a)(q,1)[0],Q=o.useMemo((function(){var e,t,n;switch(P){case"appear":return e={},Object(i.a)(e,"prepare",v),Object(i.a)(e,"start",b),Object(i.a)(e,"active",C),e;case"enter":return t={},Object(i.a)(t,"prepare",m),Object(i.a)(t,"start",E),Object(i.a)(t,"active",S),t;case"leave":return n={},Object(i.a)(n,"prepare",y),Object(i.a)(n,"start",k),Object(i.a)(n,"active",x),n;default:return{}}}),[P]),J=Ie(P,(function(e){if("prepare"===e){var t=Q.prepare;return!!t&&t(V())}var n;ee in Q&&U((null===(n=Q[ee])||void 0===n?void 0:n.call(Q,V(),null))||null);return"active"===ee&&(X(V()),p>0&&(clearTimeout(H.current),H.current=setTimeout((function(){Y({deadline:!0})}),p))),!0})),Z=Object(r.a)(J,2),$=Z[0],ee=Z[1],te=Re(ee);W.current=te,Le((function(){R(t);var n,i=G.current;(G.current=!0,e)&&(!i&&t&&h&&(n="appear"),i&&t&&c&&(n="enter"),(i&&!t&&f||!i&&g&&!t&&f)&&(n="leave"),n&&(M(n),$()))}),[t]),Object(o.useEffect)((function(){("appear"===P&&!h||"enter"===P&&!c||"leave"===P&&!f)&&M("none")}),[h,c,f]),Object(o.useEffect)((function(){return function(){clearTimeout(H.current),K.current=!0}}),[]),Object(o.useEffect)((function(){void 0!==D&&"none"===P&&(null==O||O(D))}),[D,P]);var ne=F;return Q.prepare&&"start"===ee&&(ne=Object(s.a)({transition:"none"},ne)),[P,ee,ne,null!=D?D:t]}var Pe=function(e){Object(w.a)(n,e);var t=Object(T.a)(n);function n(){return Object(C.a)(this,n),t.apply(this,arguments)}return Object(S.a)(n,[{key:"render",value:function(){return this.props.children}}]),n}(o.Component);var Me=function(e){var t=e;function n(e){return!(!e.motionName||!t)}"object"===Object(R.a)(e)&&(t=e.transitionSupport);var a=o.forwardRef((function(e,t){var a=e.visible,l=void 0===a||a,u=e.removeOnLeave,h=void 0===u||u,d=e.forceRender,f=e.children,p=e.motionName,g=e.leavedClassName,v=e.eventProps,m=n(e),y=Object(o.useRef)(),b=Object(o.useRef)();var E=Ne(m,l,(function(){try{return Object(le.a)(y.current||b.current)}catch(e){return null}}),e),k=Object(r.a)(E,4),C=k[0],S=k[1],x=k[2],w=k[3],T=o.useRef(w);w&&(T.current=!0);var _=Object(o.useRef)(t);_.current=t;var O,A=o.useCallback((function(e){y.current=e,Object(ce.b)(_.current,e)}),[]),L=Object(s.a)(Object(s.a)({},v),{},{visible:l});if(f)if("none"!==C&&n(e)){var D,R;"prepare"===S?R="prepare":Re(S)?R="active":"start"===S&&(R="start"),O=f(Object(s.a)(Object(s.a)({},L),{},{className:c()(Oe(p,C),(D={},Object(i.a)(D,Oe(p,"".concat(C,"-").concat(R)),R),Object(i.a)(D,p,"string"==typeof p),D)),style:x}),A)}else O=w?f(Object(s.a)({},L),A):!h&&T.current?f(Object(s.a)(Object(s.a)({},L),{},{className:g}),A):d?f(Object(s.a)(Object(s.a)({},L),{},{style:{display:"none"}}),A):null;else O=null;return o.createElement(Pe,{ref:b},O)}));return a.displayName="CSSMotion",a}(we);function je(e){var t;return t=e&&"object"===Object(R.a)(e)&&"key"in e?e:{key:e},Object(s.a)(Object(s.a)({},t),{},{key:String(t.key)})}function Be(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(je)}function Fe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],i=0,r=t.length,a=Be(e),o=Be(t);a.forEach((function(e){for(var t=!1,a=i;a<r;a+=1){var l=o[a];if(l.key===e.key){i<a&&(n=n.concat(o.slice(i,a).map((function(e){return Object(s.a)(Object(s.a)({},e),{},{status:"add"})}))),i=a),n.push(Object(s.a)(Object(s.a)({},l),{},{status:"keep"})),i+=1,t=!0;break}}t||n.push(Object(s.a)(Object(s.a)({},e),{},{status:"remove"}))})),i<r&&(n=n.concat(o.slice(i).map((function(e){return Object(s.a)(Object(s.a)({},e),{},{status:"add"})}))));var l={};n.forEach((function(e){var t=e.key;l[t]=(l[t]||0)+1}));var c=Object.keys(l).filter((function(e){return l[e]>1}));return c.forEach((function(e){(n=n.filter((function(t){var n=t.key,i=t.status;return n!==e||"remove"!==i}))).forEach((function(t){t.key===e&&(t.status="keep")}))})),n}var Ue=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Me,n=function(e){Object(w.a)(i,e);var n=Object(T.a)(i);function i(){var e;return Object(C.a)(this,i),(e=n.apply(this,arguments)).state={keyEntities:[]},e.removeKey=function(t){e.setState((function(e){return{keyEntities:e.keyEntities.map((function(e){return e.key!==t?e:Object(s.a)(Object(s.a)({},e),{},{status:"removed"})}))}}))},e}return Object(S.a)(i,[{key:"render",value:function(){var e=this,n=this.state.keyEntities,i=this.props,r=i.component,s=i.children,l=i.onVisibleChanged,c=Object(a.a)(i,["component","children","onVisibleChanged"]),u=r||o.Fragment,h={};return Ue.forEach((function(e){h[e]=c[e],delete c[e]})),delete c.keys,o.createElement(u,c,n.map((function(n){var i=n.status,r=Object(a.a)(n,["status"]),c="add"===i||"keep"===i;return o.createElement(t,Object(k.a)({},h,{key:r.key,visible:c,eventProps:r,onVisibleChanged:function(t){null==l||l(t,{key:r.key}),t||e.removeKey(r.key)}}),s)})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.keys,i=t.keyEntities,r=Be(n);return{keyEntities:Fe(i,r).filter((function(e){var t=i.find((function(t){var n=t.key;return e.key===n}));return!t||"removed"!==t.status||"remove"!==e.status}))}}}]),i}(o.Component);n.defaultProps={component:"div"}}(we);var Ge=Me;function He(e){var t=e.prefixCls,n=e.motion,i=e.animation,r=e.transitionName;return n||(i?{motionName:"".concat(t,"-").concat(i)}:r?{motionName:r}:null)}function Ke(e){var t=e.prefixCls,n=e.visible,i=e.zIndex,r=e.mask,a=e.maskMotion,l=e.maskAnimation,u=e.maskTransitionName;if(!r)return null;var h={};return(a||u||l)&&(h=Object(s.a)({motionAppear:!0},He({motion:a,prefixCls:t,transitionName:u,animation:l}))),o.createElement(Ge,Object(k.a)({},h,{visible:n,removeOnLeave:!0}),(function(e){var n=e.className;return o.createElement("div",{style:{zIndex:i},className:c()("".concat(t,"-mask"),n)})}))}var ze=n("9mu1"),Ve=n("o0o1"),We=n.n(Ve),Ye=n("HaE+"),qe=["measure","align",null,"motion"],Xe=o.forwardRef((function(e,t){var n=e.visible,i=e.prefixCls,a=e.className,l=e.style,u=e.children,h=e.zIndex,d=e.stretch,f=e.destroyPopupOnHide,p=e.forceRender,g=e.align,v=e.point,m=e.getRootDomNode,y=e.getClassNameFromAlign,b=e.onAlign,E=e.onMouseEnter,C=e.onMouseLeave,S=e.onMouseDown,x=e.onTouchStart,w=Object(o.useRef)(),T=Object(o.useRef)(),_=Object(o.useState)(),O=Object(r.a)(_,2),A=O[0],L=O[1],D=function(e){var t=o.useState({width:0,height:0}),n=Object(r.a)(t,2),i=n[0],a=n[1];return[o.useMemo((function(){var t={};if(e){var n=i.width,r=i.height;-1!==e.indexOf("height")&&r?t.height=r:-1!==e.indexOf("minHeight")&&r&&(t.minHeight=r),-1!==e.indexOf("width")&&n?t.width=n:-1!==e.indexOf("minWidth")&&n&&(t.minWidth=n)}return t}),[e,i]),function(e){a({width:e.offsetWidth,height:e.offsetHeight})}]}(d),R=Object(r.a)(D,2),I=R[0],N=R[1];var P=function(e,t){var n=Object(o.useState)(null),i=Object(r.a)(n,2),a=i[0],s=i[1],l=Object(o.useRef)(),c=Object(o.useRef)(!1);function u(e){c.current||s(e)}function h(){se.a.cancel(l.current)}return Object(o.useEffect)((function(){u("measure")}),[e]),Object(o.useEffect)((function(){switch(a){case"measure":t()}a&&(l.current=Object(se.a)(Object(Ye.a)(We.a.mark((function e(){var t,n;return We.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=qe.indexOf(a),(n=qe[t+1])&&-1!==t&&u(n);case 3:case"end":return e.stop()}}),e)})))))}),[a]),Object(o.useEffect)((function(){return function(){c.current=!0,h()}}),[]),[a,function(e){h(),l.current=Object(se.a)((function(){u((function(e){switch(a){case"align":return"motion";case"motion":return"stable"}return e})),null==e||e()}))}]}(n,(function(){d&&N(m())})),M=Object(r.a)(P,2),j=M[0],B=M[1],F=Object(o.useRef)();function U(){var e;null===(e=w.current)||void 0===e||e.forceAlign()}function G(e,t){var n=y(t);A!==n&&L(n),"align"===j&&(A!==n?Promise.resolve().then((function(){U()})):B((function(){var e;null===(e=F.current)||void 0===e||e.call(F)})),null==b||b(e,t))}var H=Object(s.a)({},He(e));function K(){return new Promise((function(e){F.current=e}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(e){var t=H[e];H[e]=function(e,n){return B(),null==t?void 0:t(e,n)}})),o.useEffect((function(){H.motionName||"motion"!==j||B()}),[H.motionName,j]),o.useImperativeHandle(t,(function(){return{forceAlign:U,getElement:function(){return T.current}}}));var z=Object(s.a)(Object(s.a)({},I),{},{zIndex:h,opacity:"motion"!==j&&"stable"!==j&&n?0:void 0,pointerEvents:"stable"===j?void 0:"none"},l),V=!0;!(null==g?void 0:g.points)||"align"!==j&&"stable"!==j||(V=!1);var W=u;return o.Children.count(u)>1&&(W=o.createElement("div",{className:"".concat(i,"-content")},u)),o.createElement(Ge,Object(k.a)({visible:n,ref:T,leavedClassName:"".concat(i,"-hidden")},H,{onAppearPrepare:K,onEnterPrepare:K,removeOnLeave:f,forceRender:p}),(function(e,t){var n=e.className,r=e.style,l=c()(i,a,A,n);return o.createElement(ze.a,{target:v||m,key:"popup",ref:w,monitorWindowResize:!0,disabled:V,align:g,onAlign:G},o.createElement("div",{ref:t,className:l,onMouseEnter:E,onMouseLeave:C,onMouseDownCapture:S,onTouchStartCapture:x,style:Object(s.a)(Object(s.a)({},r),z)},W))}))}));Xe.displayName="PopupInner";var Qe=Xe,Je=o.forwardRef((function(e,t){var n=e.prefixCls,i=e.visible,r=e.zIndex,a=e.children,l=e.mobile,u=(l=void 0===l?{}:l).popupClassName,h=l.popupStyle,d=l.popupMotion,f=void 0===d?{}:d,p=l.popupRender,g=o.useRef();o.useImperativeHandle(t,(function(){return{forceAlign:function(){},getElement:function(){return g.current}}}));var v=Object(s.a)({zIndex:r},h),m=a;return o.Children.count(a)>1&&(m=o.createElement("div",{className:"".concat(n,"-content")},a)),p&&(m=p(m)),o.createElement(Ge,Object(k.a)({visible:i,ref:g,removeOnLeave:!0},f),(function(e,t){var i=e.className,r=e.style,a=c()(n,u,i);return o.createElement("div",{ref:t,className:a,style:Object(s.a)(Object(s.a)({},r),v)},m)}))}));Je.displayName="MobilePopupInner";var Ze=Je,$e=["visible","mobile"],et=o.forwardRef((function(e,t){var n=e.visible,i=e.mobile,l=Object(a.a)(e,$e),c=Object(o.useState)(n),u=Object(r.a)(c,2),h=u[0],d=u[1],f=Object(o.useState)(!1),p=Object(r.a)(f,2),g=p[0],v=p[1],m=Object(s.a)(Object(s.a)({},l),{},{visible:h});Object(o.useEffect)((function(){d(n),n&&i&&v(function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var e=navigator.userAgent||navigator.vendor||window.opera;return!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(null==e?void 0:e.substr(0,4)))}())}),[n,i]);var y=g?o.createElement(Ze,Object(k.a)({},m,{mobile:i,ref:t})):o.createElement(Qe,Object(k.a)({},m,{ref:t}));return o.createElement("div",null,o.createElement(Ke,m),y)}));et.displayName="Popup";var tt=et,nt=o.createContext(null);function it(){}function rt(){return""}function at(e){return e?e.ownerDocument:window.document}var st=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var ot,lt,ct=(ot=he.a,(lt=function(e){Object(w.a)(n,e);var t=Object(T.a)(n);function n(e){var i,r;return Object(C.a)(this,n),(i=t.call(this,e)).popupRef=o.createRef(),i.triggerRef=o.createRef(),i.attachId=void 0,i.clickOutsideHandler=void 0,i.touchOutsideHandler=void 0,i.contextMenuOutsideHandler1=void 0,i.contextMenuOutsideHandler2=void 0,i.mouseDownTimeout=void 0,i.focusTime=void 0,i.preClickTime=void 0,i.preTouchTime=void 0,i.delayTimer=void 0,i.hasPopupMouseDown=void 0,i.onMouseEnter=function(e){var t=i.props.mouseEnterDelay;i.fireEvents("onMouseEnter",e),i.delaySetPopupVisible(!0,t,t?null:e)},i.onMouseMove=function(e){i.fireEvents("onMouseMove",e),i.setPoint(e)},i.onMouseLeave=function(e){i.fireEvents("onMouseLeave",e),i.delaySetPopupVisible(!1,i.props.mouseLeaveDelay)},i.onPopupMouseEnter=function(){i.clearDelayTimer()},i.onPopupMouseLeave=function(e){var t;e.relatedTarget&&!e.relatedTarget.setTimeout&&Object(oe.a)(null===(t=i.popupRef.current)||void 0===t?void 0:t.getElement(),e.relatedTarget)||i.delaySetPopupVisible(!1,i.props.mouseLeaveDelay)},i.onFocus=function(e){i.fireEvents("onFocus",e),i.clearDelayTimer(),i.isFocusToShow()&&(i.focusTime=Date.now(),i.delaySetPopupVisible(!0,i.props.focusDelay))},i.onMouseDown=function(e){i.fireEvents("onMouseDown",e),i.preClickTime=Date.now()},i.onTouchStart=function(e){i.fireEvents("onTouchStart",e),i.preTouchTime=Date.now()},i.onBlur=function(e){i.fireEvents("onBlur",e),i.clearDelayTimer(),i.isBlurToHide()&&i.delaySetPopupVisible(!1,i.props.blurDelay)},i.onContextMenu=function(e){e.preventDefault(),i.fireEvents("onContextMenu",e),i.setPopupVisible(!0,e)},i.onContextMenuClose=function(){i.isContextMenuToShow()&&i.close()},i.onClick=function(e){if(i.fireEvents("onClick",e),i.focusTime){var t;if(i.preClickTime&&i.preTouchTime?t=Math.min(i.preClickTime,i.preTouchTime):i.preClickTime?t=i.preClickTime:i.preTouchTime&&(t=i.preTouchTime),Math.abs(t-i.focusTime)<20)return;i.focusTime=0}i.preClickTime=0,i.preTouchTime=0,i.isClickToShow()&&(i.isClickToHide()||i.isBlurToHide())&&e&&e.preventDefault&&e.preventDefault();var n=!i.state.popupVisible;(i.isClickToHide()&&!n||n&&i.isClickToShow())&&i.setPopupVisible(!i.state.popupVisible,e)},i.onPopupMouseDown=function(){var e;i.hasPopupMouseDown=!0,clearTimeout(i.mouseDownTimeout),i.mouseDownTimeout=window.setTimeout((function(){i.hasPopupMouseDown=!1}),0),i.context&&(e=i.context).onPopupMouseDown.apply(e,arguments)},i.onDocumentClick=function(e){if(!i.props.mask||i.props.maskClosable){var t=e.target,n=i.getRootDomNode(),r=i.getPopupDomNode();Object(oe.a)(n,t)&&!i.isContextMenuOnly()||Object(oe.a)(r,t)||i.hasPopupMouseDown||i.close()}},i.getRootDomNode=function(){var e=i.props.getTriggerDOMNode;if(e)return e(i.triggerRef.current);try{var t=Object(le.a)(i.triggerRef.current);if(t)return t}catch(e){}return ae.a.findDOMNode(Object(x.a)(i))},i.getPopupClassNameFromAlign=function(e){var t=[],n=i.props,r=n.popupPlacement,a=n.builtinPlacements,s=n.prefixCls,o=n.alignPoint,l=n.getPopupClassNameFromAlign;return r&&a&&t.push(function(e,t,n,i){for(var r=n.points,a=Object.keys(e),s=0;s<a.length;s+=1){var o=a[s];if(de(e[o].points,r,i))return"".concat(t,"-placement-").concat(o)}return""}(a,s,e,o)),l&&t.push(l(e)),t.join(" ")},i.getComponent=function(){var e=i.props,t=e.prefixCls,n=e.destroyPopupOnHide,r=e.popupClassName,a=e.onPopupAlign,s=e.popupMotion,l=e.popupAnimation,c=e.popupTransitionName,u=e.popupStyle,h=e.mask,d=e.maskAnimation,f=e.maskTransitionName,p=e.maskMotion,g=e.zIndex,v=e.popup,m=e.stretch,y=e.alignPoint,b=e.mobile,E=e.forceRender,C=i.state,S=C.popupVisible,x=C.point,w=i.getPopupAlign(),T={};return i.isMouseEnterToShow()&&(T.onMouseEnter=i.onPopupMouseEnter),i.isMouseLeaveToHide()&&(T.onMouseLeave=i.onPopupMouseLeave),T.onMouseDown=i.onPopupMouseDown,T.onTouchStart=i.onPopupMouseDown,o.createElement(tt,Object(k.a)({prefixCls:t,destroyPopupOnHide:n,visible:S,point:y&&x,className:r,align:w,onAlign:a,animation:l,getClassNameFromAlign:i.getPopupClassNameFromAlign},T,{stretch:m,getRootDomNode:i.getRootDomNode,style:u,mask:h,zIndex:g,transitionName:c,maskAnimation:d,maskTransitionName:f,maskMotion:p,ref:i.popupRef,motion:s,mobile:b,forceRender:E}),"function"==typeof v?v():v)},i.attachParent=function(e){se.a.cancel(i.attachId);var t,n=i.props,r=n.getPopupContainer,a=n.getDocument,s=i.getRootDomNode();r?(s||0===r.length)&&(t=r(s)):t=a(i.getRootDomNode()).body,t?t.appendChild(e):i.attachId=Object(se.a)((function(){i.attachParent(e)}))},i.getContainer=function(){var e=(0,i.props.getDocument)(i.getRootDomNode()).createElement("div");return e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",i.attachParent(e),e},i.setPoint=function(e){i.props.alignPoint&&e&&i.setState({point:{pageX:e.pageX,pageY:e.pageY}})},i.handlePortalUpdate=function(){i.state.prevPopupVisible!==i.state.popupVisible&&i.props.afterPopupVisibleChange(i.state.popupVisible)},i.triggerContextValue={onPopupMouseDown:i.onPopupMouseDown},r="popupVisible"in e?!!e.popupVisible:!!e.defaultPopupVisible,i.state={prevPopupVisible:r,popupVisible:r},st.forEach((function(e){i["fire".concat(e)]=function(t){i.fireEvents(e,t)}})),i}return Object(S.a)(n,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var e,t=this.props;if(this.state.popupVisible)return this.clickOutsideHandler||!this.isClickToHide()&&!this.isContextMenuToShow()||(e=t.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(ue.a)(e,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(e=e||t.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(ue.a)(e,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(e=e||t.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(ue.a)(e,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(ue.a)(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),se.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var e;return(null===(e=this.popupRef.current)||void 0===e?void 0:e.getElement())||null}},{key:"getPopupAlign",value:function(){var e=this.props,t=e.popupPlacement,n=e.popupAlign,i=e.builtinPlacements;return t&&i?function(e,t,n){var i=e[t]||{};return Object(s.a)(Object(s.a)({},i),n)}(i,t,n):n}},{key:"setPopupVisible",value:function(e,t){var n=this.props.alignPoint,i=this.state.popupVisible;this.clearDelayTimer(),i!==e&&("popupVisible"in this.props||this.setState({popupVisible:e,prevPopupVisible:i}),this.props.onPopupVisibleChange(e)),n&&t&&e&&this.setPoint(t)}},{key:"delaySetPopupVisible",value:function(e,t,n){var i=this,r=1e3*t;if(this.clearDelayTimer(),r){var a=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){i.setPopupVisible(e,a),i.clearDelayTimer()}),r)}else this.setPopupVisible(e,n)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(e){var t=this.props.children.props,n=this.props;return t[e]&&n[e]?this["fire".concat(e)]:t[e]||n[e]}},{key:"isClickToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isContextMenuOnly",value:function(){var e=this.props.action;return"contextMenu"===e||1===e.length&&"contextMenu"===e[0]}},{key:"isContextMenuToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("contextMenu")||-1!==n.indexOf("contextMenu")}},{key:"isClickToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("click")||-1!==n.indexOf("click")}},{key:"isMouseEnterToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseEnter")}},{key:"isMouseLeaveToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("hover")||-1!==n.indexOf("mouseLeave")}},{key:"isFocusToShow",value:function(){var e=this.props,t=e.action,n=e.showAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("focus")}},{key:"isBlurToHide",value:function(){var e=this.props,t=e.action,n=e.hideAction;return-1!==t.indexOf("focus")||-1!==n.indexOf("blur")}},{key:"forcePopupAlign",value:function(){var e;this.state.popupVisible&&(null===(e=this.popupRef.current)||void 0===e||e.forceAlign())}},{key:"fireEvents",value:function(e,t){var n=this.props.children.props[e];n&&n(t);var i=this.props[e];i&&i(t)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var e=this.state.popupVisible,t=this.props,n=t.children,i=t.forceRender,r=t.alignPoint,a=t.className,l=t.autoDestroy,u=o.Children.only(n),h={key:"trigger"};this.isContextMenuToShow()?h.onContextMenu=this.onContextMenu:h.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(h.onClick=this.onClick,h.onMouseDown=this.onMouseDown,h.onTouchStart=this.onTouchStart):(h.onClick=this.createTwoChains("onClick"),h.onMouseDown=this.createTwoChains("onMouseDown"),h.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(h.onMouseEnter=this.onMouseEnter,r&&(h.onMouseMove=this.onMouseMove)):h.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?h.onMouseLeave=this.onMouseLeave:h.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(h.onFocus=this.onFocus,h.onBlur=this.onBlur):(h.onFocus=this.createTwoChains("onFocus"),h.onBlur=this.createTwoChains("onBlur"));var d=c()(u&&u.props&&u.props.className,a);d&&(h.className=d);var f=Object(s.a)({},h);Object(ce.c)(u)&&(f.ref=Object(ce.a)(this.triggerRef,u.ref));var p,g=o.cloneElement(u,f);return(e||this.popupRef.current||i)&&(p=o.createElement(ot,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!e&&l&&(p=null),o.createElement(nt.Provider,{value:this.triggerContextValue},g,p)}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.popupVisible,i={};return void 0!==n&&t.popupVisible!==n&&(i.popupVisible=n,i.prevPopupVisible=t.popupVisible),i}}]),n}(o.Component)).contextType=nt,lt.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:rt,getDocument:at,onPopupVisibleChange:it,afterPopupVisibleChange:it,onPopupAlign:it,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},lt),ut={adjustX:1,adjustY:1},ht={topLeft:{points:["bl","tl"],overflow:ut,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:ut,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:ut,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:ut,offset:[4,0]}},dt={topLeft:{points:["bl","tl"],overflow:ut,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:ut,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:ut,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:ut,offset:[4,0]}},ft=0,pt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},gt=function(e,t,n){var r=Z(t),a=e.getState();e.setState({defaultActiveFirst:Object(s.a)(Object(s.a)({},a.defaultActiveFirst),{},Object(i.a)({},r,n))})},vt=function(e){Object(w.a)(n,e);var t=Object(T.a)(n);function n(e){var i;Object(C.a)(this,n),(i=t.call(this,e)).onDestroy=function(e){i.props.onDestroy(e)},i.onKeyDown=function(e){var t=e.keyCode,n=i.menuInstance,r=i.props.store,a=i.getVisible();if(t===m.a.ENTER)return i.onTitleClick(e),gt(r,i.props.eventKey,!0),!0;if(t===m.a.RIGHT)return a?n.onKeyDown(e):(i.triggerOpenChange(!0),gt(r,i.props.eventKey,!0)),!0;if(t===m.a.LEFT){var s;if(!a)return;return(s=n.onKeyDown(e))||(i.triggerOpenChange(!1),s=!0),s}return!a||t!==m.a.UP&&t!==m.a.DOWN?void 0:n.onKeyDown(e)},i.onOpenChange=function(e){i.props.onOpenChange(e)},i.onPopupVisibleChange=function(e){i.triggerOpenChange(e,e?"mouseenter":"mouseleave")},i.onMouseEnter=function(e){var t=i.props,n=t.eventKey,r=t.onMouseEnter,a=t.store;gt(a,i.props.eventKey,!1),r({key:n,domEvent:e})},i.onMouseLeave=function(e){var t=i.props,n=t.parentMenu,r=t.eventKey,a=t.onMouseLeave;n.subMenuInstance=Object(x.a)(i),a({key:r,domEvent:e})},i.onTitleMouseEnter=function(e){var t=i.props,n=t.eventKey,r=t.onItemHover,a=t.onTitleMouseEnter;r({key:n,hover:!0}),a({key:n,domEvent:e})},i.onTitleMouseLeave=function(e){var t=i.props,n=t.parentMenu,r=t.eventKey,a=t.onItemHover,s=t.onTitleMouseLeave;n.subMenuInstance=Object(x.a)(i),a({key:r,hover:!1}),s({key:r,domEvent:e})},i.onTitleClick=function(e){var t=Object(x.a)(i).props;t.onTitleClick({key:t.eventKey,domEvent:e}),"hover"!==t.triggerSubMenuAction&&(i.triggerOpenChange(!i.getVisible(),"click"),gt(t.store,i.props.eventKey,!1))},i.onSubMenuClick=function(e){"function"==typeof i.props.onClick&&i.props.onClick(i.addKeyPath(e))},i.onSelect=function(e){i.props.onSelect(e)},i.onDeselect=function(e){i.props.onDeselect(e)},i.getPrefixCls=function(){return"".concat(i.props.rootPrefixCls,"-submenu")},i.getActiveClassName=function(){return"".concat(i.getPrefixCls(),"-active")},i.getDisabledClassName=function(){return"".concat(i.getPrefixCls(),"-disabled")},i.getSelectedClassName=function(){return"".concat(i.getPrefixCls(),"-selected")},i.getOpenClassName=function(){return"".concat(i.props.rootPrefixCls,"-submenu-open")},i.getVisible=function(){return i.state.isOpen},i.getMode=function(){return i.state.mode},i.saveMenuInstance=function(e){i.menuInstance=e},i.addKeyPath=function(e){return Object(s.a)(Object(s.a)({},e),{},{keyPath:(e.keyPath||[]).concat(i.props.eventKey)})},i.triggerOpenChange=function(e,t){var n=i.props.eventKey,r=function(){i.onOpenChange({key:n,item:Object(x.a)(i),trigger:t,open:e})};"mouseenter"===t?i.mouseenterTimeout=setTimeout((function(){r()}),0):r()},i.isChildrenSelected=function(){var e={find:!1};return function e(t,n,i){t&&!i.find&&o.Children.forEach(t,(function(t){if(t){var r=t.type;if(!r||!(r.isSubMenu||r.isMenuItem||r.isMenuItemGroup))return;-1!==n.indexOf(t.key)?i.find=!0:t.props.children&&e(t.props.children,n,i)}}))}(i.props.children,i.props.selectedKeys,e),e.find},i.isInlineMode=function(){return"inline"===i.getMode()},i.adjustWidth=function(){if(i.subMenuTitle&&i.menuInstance){var e=re.findDOMNode(i.menuInstance);e.offsetWidth>=i.subMenuTitle.offsetWidth||(e.style.minWidth="".concat(i.subMenuTitle.offsetWidth,"px"))}},i.saveSubMenuTitle=function(e){i.subMenuTitle=e},i.getBaseProps=function(){var e=Object(x.a)(i).props,t=i.getMode();return{mode:"horizontal"===t?"vertical":t,visible:i.getVisible(),level:e.level+1,inlineIndent:e.inlineIndent,focusable:!1,onClick:i.onSubMenuClick,onSelect:i.onSelect,onDeselect:i.onDeselect,onDestroy:i.onDestroy,selectedKeys:e.selectedKeys,eventKey:"".concat(e.eventKey,"-menu-"),openKeys:e.openKeys,motion:e.motion,onOpenChange:i.onOpenChange,subMenuOpenDelay:e.subMenuOpenDelay,parentMenu:Object(x.a)(i),subMenuCloseDelay:e.subMenuCloseDelay,forceSubMenuRender:e.forceSubMenuRender,triggerSubMenuAction:e.triggerSubMenuAction,builtinPlacements:e.builtinPlacements,defaultActiveFirst:e.store.getState().defaultActiveFirst[Z(e.eventKey)],multiple:e.multiple,prefixCls:e.rootPrefixCls,id:i.internalMenuId,manualRef:i.saveMenuInstance,itemIcon:e.itemIcon,expandIcon:e.expandIcon,direction:e.direction}},i.getMotion=function(e,t){var n=Object(x.a)(i).haveRendered,r=i.props,a=r.motion,o=r.rootPrefixCls;return Object(s.a)(Object(s.a)({},a),{},{leavedClassName:"".concat(o,"-hidden"),removeOnLeave:!1,motionAppear:n||!t||"inline"!==e})};var r=e.store,a=e.eventKey,l=r.getState().defaultActiveFirst;i.isRootMenu=!1;var c=!1;return l&&(c=l[a]),gt(r,a,c),i.state={mode:e.mode,isOpen:e.isOpen},i}return Object(S.a)(n,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var e=this,t=this.props,n=t.mode,i=t.parentMenu,r=t.manualRef,a=t.isOpen,s=function(){e.setState({mode:n,isOpen:a})},o=a!==this.state.isOpen,l=n!==this.state.mode;(l||o)&&(se.a.cancel(this.updateStateRaf),l?this.updateStateRaf=Object(se.a)(s):s()),r&&r(this),"horizontal"===n&&(null==i?void 0:i.isRootMenu)&&a&&(this.minWidthTimeout=setTimeout((function(){return e.adjustWidth()}),0))}},{key:"componentWillUnmount",value:function(){var e=this.props,t=e.onDestroy,n=e.eventKey;t&&t(n),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),se.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(e,t){var n=this.getBaseProps();return o.createElement(Tt,Object(k.a)({},n,{id:this.internalMenuId,className:e,style:t}),this.props.children)}},{key:"renderChildren",value:function(){var e=this,t=this.getBaseProps(),n=t.mode,r=t.visible,a=t.forceSubMenuRender,s=t.direction,l=this.getMotion(n,r);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||r||a,!this.haveOpened)return o.createElement("div",null);var u=c()("".concat(t.prefixCls,"-sub"),Object(i.a)({},"".concat(t.prefixCls,"-rtl"),"rtl"===s));return this.isInlineMode()?o.createElement(Ge,Object(k.a)({visible:t.visible,forceRender:a},l),(function(t){var n=t.className,i=t.style,r=c()(u,n);return e.renderPopupMenu(r,i)})):this.renderPopupMenu(u)}},{key:"render",value:function(){var e,t,n,r=Object(s.a)({},this.props),a=this.getVisible(),l=this.getPrefixCls(),u=this.isInlineMode(),h=this.getMode(),d=c()(l,"".concat(l,"-").concat(h),(e={},Object(i.a)(e,r.className,!!r.className),Object(i.a)(e,this.getOpenClassName(),a),Object(i.a)(e,this.getActiveClassName(),r.active||a&&!u),Object(i.a)(e,this.getDisabledClassName(),r.disabled),Object(i.a)(e,this.getSelectedClassName(),this.isChildrenSelected()),e));this.internalMenuId||(r.eventKey?this.internalMenuId="".concat(r.eventKey,"$Menu"):(ft+=1,this.internalMenuId="$__$".concat(ft,"$Menu")));var f={},p={},g={};r.disabled||(f={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},p={onClick:this.onTitleClick},g={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var v={},m="rtl"===r.direction;u&&(m?v.paddingRight=r.inlineIndent*r.level:v.paddingLeft=r.inlineIndent*r.level);var y={};this.getVisible()&&(y={"aria-owns":this.internalMenuId});var b=null;"horizontal"!==h&&(b=this.props.expandIcon,"function"==typeof this.props.expandIcon&&(b=o.createElement(this.props.expandIcon,Object(s.a)({},this.props))));var E=o.createElement("div",Object(k.a)({ref:this.saveSubMenuTitle,style:v,className:"".concat(l,"-title"),role:"button"},g,p,{"aria-expanded":a},y,{"aria-haspopup":"true",title:"string"==typeof r.title?r.title:void 0}),r.title,b||o.createElement("i",{className:"".concat(l,"-arrow")})),C=this.renderChildren(),S=(null===(t=r.parentMenu)||void 0===t?void 0:t.isRootMenu)?r.parentMenu.props.getPopupContainer:function(e){return e.parentNode},x=pt[h],w=r.popupOffset?{offset:r.popupOffset}:{},T=c()((n={},Object(i.a)(n,r.popupClassName,r.popupClassName&&!u),Object(i.a)(n,"".concat(l,"-rtl"),m),n)),_=r.disabled,O=r.triggerSubMenuAction,A=r.subMenuOpenDelay,L=r.forceSubMenuRender,D=r.subMenuCloseDelay,R=r.builtinPlacements;ee.forEach((function(e){return delete r[e]})),delete r.onClick;var I=m?Object(s.a)(Object(s.a)({},dt),R):Object(s.a)(Object(s.a)({},ht),R);delete r.direction;var N=this.getBaseProps(),P=u?null:this.getMotion(N.mode,N.visible);return o.createElement("li",Object(k.a)({},r,f,{className:d,role:"menuitem"}),o.createElement(ct,{prefixCls:l,popupClassName:c()("".concat(l,"-popup"),T),getPopupContainer:S,builtinPlacements:I,popupPlacement:x,popupVisible:!u&&a,popupAlign:w,popup:u?null:C,action:_||u?[]:[O],mouseEnterDelay:A,mouseLeaveDelay:D,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:L,popupMotion:P},E),u?C:null)}}]),n}(o.Component);vt.defaultProps={onMouseEnter:Q,onMouseLeave:Q,onTitleMouseEnter:Q,onTitleMouseLeave:Q,onTitleClick:Q,manualRef:Q,mode:"vertical",title:""};var mt=Object(_.b)((function(e,t){var n=e.openKeys,i=e.activeKey,r=e.selectedKeys,a=t.eventKey,s=t.subMenuKey;return{isOpen:n.indexOf(a)>-1,active:i[s]===a,selectedKeys:r}}))(vt);mt.isSubMenu=!0;var yt=mt,bt=function(e){Object(w.a)(n,e);var t=Object(T.a)(n);function n(){var e;return Object(C.a)(this,n),(e=t.apply(this,arguments)).resizeObserver=null,e.mutationObserver=null,e.originalTotalWidth=0,e.overflowedItems=[],e.menuItemSizes=[],e.cancelFrameId=null,e.state={lastVisibleIndex:void 0},e.childRef=o.createRef(),e.getMenuItemNodes=function(){var t=e.props.prefixCls,n=e.childRef.current;return n?[].slice.call(n.children).filter((function(e){return e.className.split(" ").indexOf("".concat(t,"-overflowed-submenu"))<0})):[]},e.getOverflowedSubMenuItem=function(t,n,i){var r=e.props,l=r.overflowedIndicator,c=r.level,u=r.mode,h=r.prefixCls,d=r.theme;if(1!==c||"horizontal"!==u)return null;var f=e.props.children[0].props,p=(f.children,f.title,f.style),g=Object(a.a)(f,["children","title","style"]),v=Object(s.a)({},p),m="".concat(t,"-overflowed-indicator"),y="".concat(t,"-overflowed-indicator");0===n.length&&!0!==i?v=Object(s.a)(Object(s.a)({},v),{},{display:"none"}):i&&(v=Object(s.a)(Object(s.a)({},v),{},{visibility:"hidden",position:"absolute"}),m="".concat(m,"-placeholder"),y="".concat(y,"-placeholder"));var b=d?"".concat(h,"-").concat(d):"",E={};return ee.forEach((function(e){void 0!==g[e]&&(E[e]=g[e])})),o.createElement(yt,Object(k.a)({title:l,className:"".concat(h,"-overflowed-submenu"),popupClassName:b},E,{key:m,eventKey:y,disabled:!1,style:v}),n)},e.setChildrenWidthAndResize=function(){if("horizontal"===e.props.mode){var t=e.childRef.current;if(t){var n=t.children;if(n&&0!==n.length){var i=t.children[n.length-1];ne(i,"display","inline-block");var r=e.getMenuItemNodes(),a=r.filter((function(e){return e.className.split(" ").indexOf("menuitem-overflowed")>=0}));a.forEach((function(e){ne(e,"display","inline-block")})),e.menuItemSizes=r.map((function(e){return te(e,!0)})),a.forEach((function(e){ne(e,"display","none")})),e.overflowedIndicatorWidth=te(t.children[t.children.length-1],!0),e.originalTotalWidth=e.menuItemSizes.reduce((function(e,t){return e+t}),0),e.handleResize(),ne(i,"display","none")}}}},e.handleResize=function(){if("horizontal"===e.props.mode){var t=e.childRef.current;if(t){var n=te(t);e.overflowedItems=[];var i,r=0;e.originalTotalWidth>n+.5&&(i=-1,e.menuItemSizes.forEach((function(t){(r+=t)+e.overflowedIndicatorWidth<=n&&(i+=1)}))),e.setState({lastVisibleIndex:i})}}},e}return Object(S.a)(n,[{key:"componentDidMount",value:function(){var e=this;if(this.setChildrenWidthAndResize(),1===this.props.level&&"horizontal"===this.props.mode){var t=this.childRef.current;if(!t)return;this.resizeObserver=new ie.default((function(t){t.forEach((function(){var t=e.cancelFrameId;cancelAnimationFrame(t),e.cancelFrameId=requestAnimationFrame(e.setChildrenWidthAndResize)}))})),[].slice.call(t.children).concat(t).forEach((function(t){e.resizeObserver.observe(t)})),"undefined"!=typeof MutationObserver&&(this.mutationObserver=new MutationObserver((function(){e.resizeObserver.disconnect(),[].slice.call(t.children).concat(t).forEach((function(t){e.resizeObserver.observe(t)})),e.setChildrenWidthAndResize()})),this.mutationObserver.observe(t,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(e){var t=this,n=this.state.lastVisibleIndex;return(e||[]).reduce((function(i,r,a){var s=r;if("horizontal"===t.props.mode){var l=t.getOverflowedSubMenuItem(r.props.eventKey,[]);void 0!==n&&-1!==t.props.className.indexOf("".concat(t.props.prefixCls,"-root"))&&(a>n&&(s=o.cloneElement(r,{style:{display:"none"},eventKey:"".concat(r.props.eventKey,"-hidden"),className:"".concat("menuitem-overflowed")})),a===n+1&&(t.overflowedItems=e.slice(n+1).map((function(e){return o.cloneElement(e,{key:e.props.eventKey,mode:"vertical-left"})})),l=t.getOverflowedSubMenuItem(r.props.eventKey,t.overflowedItems)));var c=[].concat(Object(d.a)(i),[l,s]);return a===e.length-1&&c.push(t.getOverflowedSubMenuItem(r.props.eventKey,[],!0)),c}return[].concat(Object(d.a)(i),[s])}),[])}},{key:"render",value:function(){var e=this.props,t=(e.visible,e.prefixCls,e.overflowedIndicator,e.mode,e.level,e.tag),n=e.children,i=(e.theme,Object(a.a)(e,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"])),r=t;return o.createElement(r,Object(k.a)({ref:this.childRef},i),this.renderChildren(n))}}]),n}(o.Component);bt.defaultProps={tag:"div",className:""};var Et=bt;function kt(e,t,n){var r=e.getState();e.setState({activeKey:Object(s.a)(Object(s.a)({},r.activeKey),{},Object(i.a)({},t,n))})}function Ct(e){return e.eventKey||"0-menu-"}function St(e,t){var n,i=t,r=e.children,a=e.eventKey;if(i&&($(r,(function(e,t){e&&e.props&&!e.props.disabled&&i===J(e,a,t)&&(n=!0)})),n))return i;return i=null,e.defaultActiveFirst?($(r,(function(e,t){i||!e||e.props.disabled||(i=J(e,a,t))})),i):i}function xt(e){if(e){var t=this.instanceArray.indexOf(e);-1!==t?this.instanceArray[t]=e:this.instanceArray.push(e)}}var wt=function(e){Object(w.a)(n,e);var t=Object(T.a)(n);function n(e){var r;return Object(C.a)(this,n),(r=t.call(this,e)).onKeyDown=function(e,t){var n,i=e.keyCode;if(r.getFlatInstanceArray().forEach((function(t){t&&t.props.active&&t.onKeyDown&&(n=t.onKeyDown(e))})),n)return 1;var a=null;return i!==m.a.UP&&i!==m.a.DOWN||(a=r.step(i===m.a.UP?-1:1)),a?(e.preventDefault(),kt(r.props.store,Ct(r.props),a.props.eventKey),"function"==typeof t&&t(a),1):void 0},r.onItemHover=function(e){var t=e.key,n=e.hover;kt(r.props.store,Ct(r.props),n?t:null)},r.onDeselect=function(e){r.props.onDeselect(e)},r.onSelect=function(e){r.props.onSelect(e)},r.onClick=function(e){r.props.onClick(e)},r.onOpenChange=function(e){r.props.onOpenChange(e)},r.onDestroy=function(e){r.props.onDestroy(e)},r.getFlatInstanceArray=function(){return r.instanceArray},r.step=function(e){var t=r.getFlatInstanceArray(),n=r.props.store.getState().activeKey[Ct(r.props)],i=t.length;if(!i)return null;e<0&&(t=t.concat().reverse());var a=-1;if(t.every((function(e,t){return!e||e.props.eventKey!==n||(a=t,!1)})),r.props.defaultActiveFirst||-1===a||(s=t.slice(a,i-1)).length&&!s.every((function(e){return!!e.props.disabled}))){var s,o=(a+1)%i,l=o;do{var c=t[l];if(c&&!c.props.disabled)return c;l=(l+1)%i}while(l!==o);return null}},r.renderCommonMenuItem=function(e,t,n){var i=r.props.store.getState(),a=Object(x.a)(r).props,l=J(e,a.eventKey,t),c=e.props;if(!c||"string"==typeof e.type)return e;var u=l===i.activeKey,h=Object(s.a)(Object(s.a)({mode:c.mode||a.mode,level:a.level,inlineIndent:a.inlineIndent,renderMenuItem:r.renderMenuItem,rootPrefixCls:a.prefixCls,index:t,parentMenu:a.parentMenu,manualRef:c.disabled?void 0:Object(A.a)(e.ref,xt.bind(Object(x.a)(r))),eventKey:l,active:!c.disabled&&u,multiple:a.multiple,onClick:function(e){(c.onClick||Q)(e),r.onClick(e)},onItemHover:r.onItemHover,motion:a.motion,subMenuOpenDelay:a.subMenuOpenDelay,subMenuCloseDelay:a.subMenuCloseDelay,forceSubMenuRender:a.forceSubMenuRender,onOpenChange:r.onOpenChange,onDeselect:r.onDeselect,onSelect:r.onSelect,builtinPlacements:a.builtinPlacements,itemIcon:c.itemIcon||r.props.itemIcon,expandIcon:c.expandIcon||r.props.expandIcon},n),{},{direction:a.direction});return("inline"===a.mode||X.any)&&(h.triggerSubMenuAction="click"),o.cloneElement(e,Object(s.a)(Object(s.a)({},h),{},{key:l||t}))},r.renderMenuItem=function(e,t,n){if(!e)return null;var i=r.props.store.getState(),a={openKeys:i.openKeys,selectedKeys:i.selectedKeys,triggerSubMenuAction:r.props.triggerSubMenuAction,subMenuKey:n};return r.renderCommonMenuItem(e,t,a)},e.store.setState({activeKey:Object(s.a)(Object(s.a)({},e.store.getState().activeKey),{},Object(i.a)({},e.eventKey,St(e,e.activeKey)))}),r.instanceArray=[],r}return Object(S.a)(n,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(e){return this.props.visible||e.visible||this.props.className!==e.className||!D()(this.props.style,e.style)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n="activeKey"in t?t.activeKey:t.store.getState().activeKey[Ct(t)],i=St(t,n);if(i!==n)kt(t.store,Ct(t),i);else if("activeKey"in e){i!==St(e,e.activeKey)&&kt(t.store,Ct(t),i)}}},{key:"render",value:function(){var e=this,t=Object(k.a)({},this.props);this.instanceArray=[];var n={className:c()(t.prefixCls,t.className,"".concat(t.prefixCls,"-").concat(t.mode)),role:t.role||"menu"};t.id&&(n.id=t.id),t.focusable&&(n.tabIndex=0,n.onKeyDown=this.onKeyDown);var i=t.prefixCls,r=t.eventKey,a=t.visible,s=t.level,l=t.mode,h=t.overflowedIndicator,d=t.theme;return ee.forEach((function(e){return delete t[e]})),delete t.onClick,o.createElement(Et,Object(k.a)({},t,{prefixCls:i,mode:l,tag:"ul",level:s,theme:d,visible:a,overflowedIndicator:h},n),Object(u.a)(t.children).map((function(t,n){return e.renderMenuItem(t,n,r||"0-menu-")})))}}]),n}(o.Component);wt.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:Q};var Tt=Object(_.b)()(wt),_t=n("Kwbf");function Ot(e,t,n){var i=e.prefixCls,r=e.motion,a=e.defaultMotions,s=void 0===a?{}:a,o=e.openAnimation,l=e.openTransitionName,c=t.switchingModeFromInline;if(r)return r;if("object"===Object(R.a)(o)&&o)Object(_t.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if("string"==typeof o)return{motionName:"".concat(i,"-open-").concat(o)};if(l)return{motionName:l};var u=s[n];return u||(c?null:s.other)}var At=function(e){Object(w.a)(n,e);var t=Object(T.a)(n);function n(e){var i;Object(C.a)(this,n),(i=t.call(this,e)).onSelect=function(e){var t=Object(x.a)(i).props;if(t.selectable){var n=i.store.getState().selectedKeys,r=e.key;n=t.multiple?n.concat([r]):[r],"selectedKeys"in t||i.store.setState({selectedKeys:n}),t.onSelect(Object(s.a)(Object(s.a)({},e),{},{selectedKeys:n}))}},i.onClick=function(e){var t=i.getRealMenuMode(),n=Object(x.a)(i),r=n.store,a=n.props.onOpenChange;"inline"===t||"openKeys"in i.props||(r.setState({openKeys:[]}),a([])),i.props.onClick(e)},i.onKeyDown=function(e,t){i.innerMenu.getWrappedInstance().onKeyDown(e,t)},i.onOpenChange=function(e){var t=Object(x.a)(i).props,n=i.store.getState().openKeys.concat(),r=!1,a=function(e){var t=!1;if(e.open)(t=-1===n.indexOf(e.key))&&n.push(e.key);else{var i=n.indexOf(e.key);(t=-1!==i)&&n.splice(i,1)}r=r||t};Array.isArray(e)?e.forEach(a):a(e),r&&("openKeys"in i.props||i.store.setState({openKeys:n}),t.onOpenChange(n))},i.onDeselect=function(e){var t=Object(x.a)(i).props;if(t.selectable){var n=i.store.getState().selectedKeys.concat(),r=e.key,a=n.indexOf(r);-1!==a&&n.splice(a,1),"selectedKeys"in t||i.store.setState({selectedKeys:n}),t.onDeselect(Object(s.a)(Object(s.a)({},e),{},{selectedKeys:n}))}},i.onMouseEnter=function(e){i.restoreModeVerticalFromInline();var t=i.props.onMouseEnter;t&&t(e)},i.onTransitionEnd=function(e){var t="width"===e.propertyName&&e.target===e.currentTarget,n=e.target.className,r="[object SVGAnimatedString]"===Object.prototype.toString.call(n)?n.animVal:n,a="font-size"===e.propertyName&&r.indexOf("anticon")>=0;(t||a)&&i.restoreModeVerticalFromInline()},i.setInnerMenu=function(e){i.innerMenu=e},i.isRootMenu=!0;var r=e.defaultSelectedKeys,a=e.defaultOpenKeys;return"selectedKeys"in e&&(r=e.selectedKeys||[]),"openKeys"in e&&(a=e.openKeys||[]),i.store=Object(_.c)({selectedKeys:r,openKeys:a,activeKey:{"0-menu-":St(e,e.activeKey)}}),i.state={switchingModeFromInline:!1,prevProps:e,inlineOpenKeys:[],store:i.store},i}return Object(S.a)(n,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.siderCollapsed,i=t.inlineCollapsed,r=t.onOpenChange;(!e.inlineCollapsed&&i||!e.siderCollapsed&&n)&&r([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var e=this.props.collapsedWidth,t=this.store,n=this.prevOpenKeys;this.getInlineCollapsed()&&(0===e||"0"===e||"0px"===e)?(this.prevOpenKeys=t.getState().openKeys.concat(),this.store.setState({openKeys:[]})):n&&(this.store.setState({openKeys:n}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var e=this.props.mode,t=this.state.switchingModeFromInline,n=this.getInlineCollapsed();return t&&n?"inline":n?"vertical":e}},{key:"getInlineCollapsed",value:function(){var e=this.props,t=e.inlineCollapsed,n=e.siderCollapsed;return void 0!==n?n:t}},{key:"restoreModeVerticalFromInline",value:function(){this.state.switchingModeFromInline&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var e=Object(s.a)({},Object(O.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),t=this.getRealMenuMode();return e.className+=" ".concat(e.prefixCls,"-root"),"rtl"===e.direction&&(e.className+=" ".concat(e.prefixCls,"-rtl")),delete(e=Object(s.a)(Object(s.a)({},e),{},{mode:t,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Ot(this.props,this.state,t)})).openAnimation,delete e.openTransitionName,o.createElement(_.a,{store:this.store},o.createElement(Tt,Object(k.a)({},e,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevProps,i=t.store,r=i.getState(),a={},s={prevProps:e};return"inline"===n.mode&&"inline"!==e.mode&&(s.switchingModeFromInline=!0),"openKeys"in e?a.openKeys=e.openKeys||[]:((e.inlineCollapsed&&!n.inlineCollapsed||e.siderCollapsed&&!n.siderCollapsed)&&(s.switchingModeFromInline=!0,s.inlineOpenKeys=r.openKeys,a.openKeys=[]),(!e.inlineCollapsed&&n.inlineCollapsed||!e.siderCollapsed&&n.siderCollapsed)&&(a.openKeys=t.inlineOpenKeys,s.inlineOpenKeys=[])),Object.keys(a).length&&i.setState(a),s}}]),n}(o.Component);At.defaultProps={selectable:!0,onClick:Q,onSelect:Q,onOpenChange:Q,onDeselect:Q,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:o.createElement("span",null,"···")};var Lt=At,Dt=function(e){Object(w.a)(n,e);var t=Object(T.a)(n);function n(){var e;return Object(C.a)(this,n),(e=t.apply(this,arguments)).onKeyDown=function(t){if(t.keyCode===m.a.ENTER)return e.onClick(t),!0},e.onMouseLeave=function(t){var n=e.props,i=n.eventKey,r=n.onItemHover,a=n.onMouseLeave;r({key:i,hover:!1}),a({key:i,domEvent:t})},e.onMouseEnter=function(t){var n=e.props,i=n.eventKey,r=n.onItemHover,a=n.onMouseEnter;r({key:i,hover:!0}),a({key:i,domEvent:t})},e.onClick=function(t){var n=e.props,i=n.eventKey,r=n.multiple,a=n.onClick,s=n.onSelect,o=n.onDeselect,l=n.isSelected,c={key:i,keyPath:[i],item:Object(x.a)(e),domEvent:t};a(c),r?l?o(c):s(c):l||s(c)},e.saveNode=function(t){e.node=t},e}return Object(S.a)(n,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var e=this.props;e.onDestroy&&e.onDestroy(e.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var e,t=Object(s.a)({},this.props),n=c()(this.getPrefixCls(),t.className,(e={},Object(i.a)(e,this.getActiveClassName(),!t.disabled&&t.active),Object(i.a)(e,this.getSelectedClassName(),t.isSelected),Object(i.a)(e,this.getDisabledClassName(),t.disabled),e)),r=Object(s.a)(Object(s.a)({},t.attribute),{},{title:"string"==typeof t.title?t.title:void 0,className:n,role:t.role||"menuitem","aria-disabled":t.disabled});"option"===t.role?r=Object(s.a)(Object(s.a)({},r),{},{role:"option","aria-selected":t.isSelected}):null!==t.role&&"none"!==t.role||(r.role="none");var a={onClick:t.disabled?null:this.onClick,onMouseLeave:t.disabled?null:this.onMouseLeave,onMouseEnter:t.disabled?null:this.onMouseEnter},l=Object(s.a)({},t.style);"inline"===t.mode&&("rtl"===t.direction?l.paddingRight=t.inlineIndent*t.level:l.paddingLeft=t.inlineIndent*t.level),ee.forEach((function(e){return delete t[e]})),delete t.direction;var u=this.props.itemIcon;return"function"==typeof this.props.itemIcon&&(u=o.createElement(this.props.itemIcon,this.props)),o.createElement("li",Object(k.a)({},Object(O.a)(t,["onClick","onMouseEnter","onMouseLeave","onSelect"]),r,a,{style:l,ref:this.saveNode}),t.children,u)}}]),n}(o.Component);Dt.isMenuItem=!0,Dt.defaultProps={onSelect:Q,onMouseEnter:Q,onMouseLeave:Q,manualRef:Q};var Rt=Object(_.b)((function(e,t){var n=e.activeKey,i=e.selectedKeys,r=t.eventKey;return{active:n[t.subMenuKey]===r,isSelected:Array.isArray(i)?-1!==i.indexOf(r):i===r}}))(Dt),It=function(e){Object(w.a)(n,e);var t=Object(T.a)(n);function n(){var e;return Object(C.a)(this,n),(e=t.apply(this,arguments)).renderInnerMenuItem=function(t){var n=e.props;return(0,n.renderMenuItem)(t,n.index,e.props.subMenuKey)},e}return Object(S.a)(n,[{key:"render",value:function(){var e=Object(k.a)({},this.props),t=e.className,n=void 0===t?"":t,i=e.rootPrefixCls,r="".concat(i,"-item-group-title"),a="".concat(i,"-item-group-list"),s=e.title,l=e.children;return ee.forEach((function(t){return delete e[t]})),delete e.direction,o.createElement("li",Object(k.a)({},e,{onClick:function(e){return e.stopPropagation()},className:"".concat(n," ").concat(i,"-item-group")}),o.createElement("div",{className:r,title:"string"==typeof s?s:void 0},s),o.createElement("ul",{className:a},o.Children.map(l,this.renderInnerMenuItem)))}}]),n}(o.Component);It.isMenuItemGroup=!0,It.defaultProps={disabled:!0};var Nt=function(e){var t=e.className,n=e.rootPrefixCls,i=e.style;return o.createElement("li",{className:"".concat(t," ").concat(n,"-item-divider"),style:i})};Nt.defaultProps={disabled:!0,className:"",style:{}};var Pt=Lt,Mt=n("eDIo");var jt=o.forwardRef((function(e,t){var n=e.prefixCls,i=e.editable,r=e.locale,a=e.style;return i&&!1!==i.showAdd?o.createElement("button",{ref:t,type:"button",className:"".concat(n,"-nav-add"),style:a,"aria-label":(null==r?void 0:r.addAriaLabel)||"Add tab",onClick:function(e){i.onEdit("add",{event:e})}},i.addIcon||"+"):null}));var Bt=o.forwardRef((function(e,t){var n=e.prefixCls,a=e.id,s=e.tabs,l=e.locale,u=e.mobile,h=e.moreIcon,d=void 0===h?"More":h,f=e.moreTransitionName,p=e.style,g=e.className,v=e.editable,y=e.tabBarGutter,b=e.rtl,E=e.onTabClick,k=Object(o.useState)(!1),C=Object(r.a)(k,2),S=C[0],x=C[1],w=Object(o.useState)(null),T=Object(r.a)(w,2),_=T[0],O=T[1],A="".concat(a,"-more-popup"),L="".concat(n,"-dropdown"),D=null!==_?"".concat(A,"-").concat(_):null,R=null==l?void 0:l.dropdownAriaLabel,I=o.createElement(Pt,{onClick:function(e){var t=e.key,n=e.domEvent;E(t,n),x(!1)},id:A,tabIndex:-1,role:"listbox","aria-activedescendant":D,selectedKeys:[_],"aria-label":void 0!==R?R:"expanded dropdown"},s.map((function(e){return o.createElement(Rt,{key:e.key,id:"".concat(A,"-").concat(e.key),role:"option","aria-controls":a&&"".concat(a,"-panel-").concat(e.key),disabled:e.disabled},e.tab)})));function N(e){for(var t=s.filter((function(e){return!e.disabled})),n=t.findIndex((function(e){return e.key===_}))||0,i=t.length,r=0;r<i;r+=1){var a=t[n=(n+e+i)%i];if(!a.disabled)return void O(a.key)}}Object(o.useEffect)((function(){var e=document.getElementById(D);e&&e.scrollIntoView&&e.scrollIntoView(!1)}),[_]),Object(o.useEffect)((function(){S||O(null)}),[S]);var P=Object(i.a)({},b?"marginLeft":"marginRight",y);s.length||(P.visibility="hidden",P.order=1);var M=c()(Object(i.a)({},"".concat(L,"-rtl"),b)),j=u?null:o.createElement(Mt.a,{prefixCls:L,overlay:I,trigger:["hover"],visible:S,transitionName:f,onVisibleChange:x,overlayClassName:M,mouseEnterDelay:.1,mouseLeaveDelay:.1},o.createElement("button",{type:"button",className:"".concat(n,"-nav-more"),style:P,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":A,id:"".concat(a,"-more"),"aria-expanded":S,onKeyDown:function(e){var t=e.which;if(S)switch(t){case m.a.UP:N(-1),e.preventDefault();break;case m.a.DOWN:N(1),e.preventDefault();break;case m.a.ESC:x(!1);break;case m.a.SPACE:case m.a.ENTER:null!==_&&E(_,e)}else[m.a.DOWN,m.a.SPACE,m.a.ENTER].includes(t)&&(x(!0),e.preventDefault())}},d));return o.createElement("div",{className:c()("".concat(n,"-nav-operations"),g),style:p,ref:t},j,o.createElement(jt,{prefixCls:n,locale:l,editable:v}))})),Ft=Object(o.createContext)(null),Ut=Math.pow(.995,20);function Gt(e,t){var n=o.useRef(e),i=o.useState({}),a=Object(r.a)(i,2)[1];return[n.current,function(e){var i="function"==typeof e?e(n.current):e;i!==n.current&&t(i,n.current),n.current=i,a({})}]}var Ht=function(e){var t,n=e.position,i=e.prefixCls,r=e.extra;if(!r)return null;var a=r;return"right"===n&&(t=a.right||!a.left&&a||null),"left"===n&&(t=a.left||null),t?o.createElement("div",{className:"".concat(i,"-extra-content")},t):null};var Kt=o.forwardRef((function(e,t){var n,a,l=o.useContext(Ft),u=l.prefixCls,h=l.tabs,f=e.className,m=e.style,k=e.id,C=e.animated,S=e.activeKey,x=e.rtl,w=e.extra,T=e.editable,_=e.locale,O=e.tabPosition,A=e.tabBarGutter,L=e.children,D=e.onTabClick,R=e.onTabScroll,I=Object(o.useRef)(),N=Object(o.useRef)(),P=Object(o.useRef)(),M=Object(o.useRef)(),j=(a=Object(o.useRef)(new Map),[function(e){return a.current.has(e)||a.current.set(e,o.createRef()),a.current.get(e)},function(e){a.current.delete(e)}]),B=Object(r.a)(j,2),F=B[0],U=B[1],G="top"===O||"bottom"===O,H=Gt(0,(function(e,t){G&&R&&R({direction:e>t?"left":"right"})})),K=Object(r.a)(H,2),z=K[0],V=K[1],W=Gt(0,(function(e,t){!G&&R&&R({direction:e>t?"top":"bottom"})})),Y=Object(r.a)(W,2),q=Y[0],X=Y[1],Q=Object(o.useState)(0),J=Object(r.a)(Q,2),Z=J[0],$=J[1],ee=Object(o.useState)(0),te=Object(r.a)(ee,2),ne=te[0],ie=te[1],re=Object(o.useState)(0),ae=Object(r.a)(re,2),se=ae[0],oe=ae[1],le=Object(o.useState)(0),ce=Object(r.a)(le,2),ue=ce[0],he=ce[1],de=Object(o.useState)(null),fe=Object(r.a)(de,2),pe=fe[0],ge=fe[1],ve=Object(o.useState)(null),me=Object(r.a)(ve,2),ye=me[0],be=me[1],Ee=Object(o.useState)(0),ke=Object(r.a)(Ee,2),Ce=ke[0],Se=ke[1],xe=Object(o.useState)(0),we=Object(r.a)(xe,2),Te=we[0],_e=we[1],Oe=function(e){var t=Object(o.useRef)([]),n=Object(o.useState)({}),i=Object(r.a)(n,2)[1],a=Object(o.useRef)("function"==typeof e?e():e),s=v((function(){var e=a.current;t.current.forEach((function(t){e=t(e)})),t.current=[],a.current=e,i({})}));return[a.current,function(e){t.current.push(e),s()}]}(new Map),Ae=Object(r.a)(Oe,2),Le=Ae[0],De=Ae[1],Re=function(e,t,n){return Object(o.useMemo)((function(){for(var n,i=new Map,r=t.get(null===(n=e[0])||void 0===n?void 0:n.key)||b,a=r.left+r.width,o=0;o<e.length;o+=1){var l,c=e[o].key,u=t.get(c);if(!u)u=t.get(null===(l=e[o-1])||void 0===l?void 0:l.key)||b;var h=i.get(c)||Object(s.a)({},u);h.right=a-h.left-h.width,i.set(c,h)}return i}),[e.map((function(e){return e.key})).join("_"),t,n])}(h,Le,Z),Ie="".concat(u,"-nav-operations-hidden"),Ne=0,Pe=0;function Me(e){return e<Ne?[Ne,!1]:e>Pe?[Pe,!1]:[e,!0]}G?x?(Ne=0,Pe=Math.max(0,Z-pe)):(Ne=Math.min(0,pe-Z),Pe=0):(Ne=Math.min(0,ye-ne),Pe=0);var je=Object(o.useRef)(),Be=Object(o.useState)(),Fe=Object(r.a)(Be,2),Ue=Fe[0],Ge=Fe[1];function He(){Ge(Date.now())}function Ke(){window.clearTimeout(je.current)}function ze(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:S,t=Re.get(e);if(t)if(G){var n=z;x?t.right<z?n=t.right:t.right+t.width>z+pe&&(n=t.right+t.width-pe):t.left<-z?n=-t.left:t.left+t.width>-z+pe&&(n=-(t.left+t.width-pe)),X(0),V(Me(n)[0])}else{var i=q;t.top<-q?i=-t.top:t.top+t.height>-q+ye&&(i=-(t.top+t.height-ye)),V(0),X(Me(i)[0])}}!function(e,t){var n=Object(o.useState)(),i=Object(r.a)(n,2),a=i[0],s=i[1],l=Object(o.useState)(0),c=Object(r.a)(l,2),u=c[0],h=c[1],d=Object(o.useState)(0),f=Object(r.a)(d,2),p=f[0],g=f[1],v=Object(o.useState)(),m=Object(r.a)(v,2),y=m[0],b=m[1],E=Object(o.useRef)(),k=Object(o.useRef)(0),C=Object(o.useRef)(!1),S=Object(o.useRef)(),x=Object(o.useRef)(null);x.current={onTouchStart:function(e){var t=e.touches[0],n=t.screenX,i=t.screenY;s({x:n,y:i}),window.clearInterval(E.current)},onTouchMove:function(e){if(a){e.preventDefault();var n=e.touches[0],i=n.screenX,r=n.screenY;s({x:i,y:r});var o=i-a.x,l=r-a.y;t(o,l);var c=Date.now();h(c),g(c-u),b({x:o,y:l})}},onTouchEnd:function(){if(a&&(s(null),b(null),y)){var e=y.x/p,n=y.y/p,i=Math.abs(e),r=Math.abs(n);if(Math.max(i,r)<.1)return;var o=e,l=n;E.current=window.setInterval((function(){Math.abs(o)<.01&&Math.abs(l)<.01?window.clearInterval(E.current):t(20*(o*=Ut),20*(l*=Ut))}),20)}},onWheel:function(e){var n=e.deltaX,i=e.deltaY,r=0,a=Math.abs(n),s=Math.abs(i);a===s?r="x"===S.current?n:i:a>s?(r=n,S.current="x"):(r=i,S.current="y");var o=Date.now();o-k.current>100&&(C.current=!1),(t(-r,-r)||C.current)&&(e.preventDefault(),C.current=!0),k.current=o}},o.useEffect((function(){function t(e){x.current.onTouchMove(e)}function n(e){x.current.onTouchEnd(e)}return document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",n,{passive:!1}),e.current.addEventListener("touchstart",(function(e){x.current.onTouchStart(e)}),{passive:!1}),e.current.addEventListener("wheel",(function(e){x.current.onWheel(e)})),function(){document.removeEventListener("touchmove",t),document.removeEventListener("touchend",n)}}),[])}(I,(function(e,t){var n=!1;function i(e,t){e((function(e){var i=Me(e+t),a=Object(r.a)(i,2),s=a[0],o=a[1];return n=o,s}))}if(G){if(pe>=Z)return n;i(V,e)}else{if(ye>=ne)return n;i(X,t)}return Ke(),He(),n})),Object(o.useEffect)((function(){return Ke(),Ue&&(je.current=window.setTimeout((function(){Ge(0)}),100)),Ke}),[Ue]);var Ve=function(e,t,n,i,r){var a,s,l,c=r.tabs,u=r.tabPosition,h=r.rtl;["top","bottom"].includes(u)?(a="width",s=h?"right":"left",l=Math.abs(t.left)):(a="height",s="top",l=-t.top);var d=t[a],f=n[a],p=i[a],g=d;return f+p>d&&(g=d-p),Object(o.useMemo)((function(){if(!c.length)return[0,0];for(var t=c.length,n=t,i=0;i<t;i+=1){var r=e.get(c[i].key)||E;if(r[s]+r[a]>l+g){n=i-1;break}}for(var o=0,u=t-1;u>=0;u-=1){if((e.get(c[u].key)||E)[s]<l){o=u+1;break}}return[o,n]}),[e,l,g,u,c.map((function(e){return e.key})).join("_"),h])}(Re,{width:pe,height:ye,left:z,top:q},{width:se,height:ue},{width:Ce,height:Te},Object(s.a)(Object(s.a)({},e),{},{tabs:h})),We=Object(r.a)(Ve,2),Ye=We[0],qe=We[1],Xe=h.map((function(e){var t=e.key;return o.createElement(y,{id:k,prefixCls:u,key:t,rtl:x,tab:e,closable:e.closable,editable:T,active:t===S,tabPosition:O,tabBarGutter:A,renderWrapper:L,removeAriaLabel:null==_?void 0:_.removeAriaLabel,ref:F(t),onClick:function(e){D(t,e)},onRemove:function(){U(t)},onFocus:function(){ze(t),He(),x||(I.current.scrollLeft=0),I.current.scrollTop=0}})})),Qe=v((function(){var e,t,n,i,r,a,s,o,l,c=(null===(e=I.current)||void 0===e?void 0:e.offsetWidth)||0,u=(null===(t=I.current)||void 0===t?void 0:t.offsetHeight)||0,d=(null===(n=M.current)||void 0===n?void 0:n.offsetWidth)||0,f=(null===(i=M.current)||void 0===i?void 0:i.offsetHeight)||0,p=(null===(r=P.current)||void 0===r?void 0:r.offsetWidth)||0,g=(null===(a=P.current)||void 0===a?void 0:a.offsetHeight)||0;ge(c),be(u),Se(d),_e(f);var v=((null===(s=N.current)||void 0===s?void 0:s.offsetWidth)||0)-d,m=((null===(o=N.current)||void 0===o?void 0:o.offsetHeight)||0)-f;$(v),ie(m);var y=null===(l=P.current)||void 0===l?void 0:l.className.includes(Ie);oe(v-(y?0:p)),he(m-(y?0:g)),De((function(){var e=new Map;return h.forEach((function(t){var n=t.key,i=F(n).current;i&&e.set(n,{width:i.offsetWidth,height:i.offsetHeight,left:i.offsetLeft,top:i.offsetTop})})),e}))})),Je=h.slice(0,Ye),Ze=h.slice(qe+1),$e=[].concat(Object(d.a)(Je),Object(d.a)(Ze)),et=Object(o.useState)(),tt=Object(r.a)(et,2),nt=tt[0],it=tt[1],rt=Re.get(S),at=Object(o.useRef)();function st(){p.a.cancel(at.current)}Object(o.useEffect)((function(){var e={};return rt&&(G?(x?e.right=rt.right:e.left=rt.left,e.width=rt.width):(e.top=rt.top,e.height=rt.height)),st(),at.current=p()((function(){it(e)})),st}),[rt,G,x]),Object(o.useEffect)((function(){ze()}),[S,rt,Re,G]),Object(o.useEffect)((function(){Qe()}),[x,A,S,h.map((function(e){return e.key})).join("_")]);var ot,lt,ct,ut,ht=!!$e.length,dt="".concat(u,"-nav-wrap");return G?x?(lt=z>0,ot=z+pe<Z):(ot=z<0,lt=-z+pe<Z):(ct=q<0,ut=-q+ye<ne),o.createElement("div",{ref:t,role:"tablist",className:c()("".concat(u,"-nav"),f),style:m,onKeyDown:function(){He()}},o.createElement(Ht,{position:"left",extra:w,prefixCls:u}),o.createElement(g.a,{onResize:Qe},o.createElement("div",{className:c()(dt,(n={},Object(i.a)(n,"".concat(dt,"-ping-left"),ot),Object(i.a)(n,"".concat(dt,"-ping-right"),lt),Object(i.a)(n,"".concat(dt,"-ping-top"),ct),Object(i.a)(n,"".concat(dt,"-ping-bottom"),ut),n)),ref:I},o.createElement(g.a,{onResize:Qe},o.createElement("div",{ref:N,className:"".concat(u,"-nav-list"),style:{transform:"translate(".concat(z,"px, ").concat(q,"px)"),transition:Ue?"none":void 0}},Xe,o.createElement(jt,{ref:M,prefixCls:u,locale:_,editable:T,style:{visibility:ht?"hidden":null}}),o.createElement("div",{className:c()("".concat(u,"-ink-bar"),Object(i.a)({},"".concat(u,"-ink-bar-animated"),C.inkBar)),style:nt}))))),o.createElement(Bt,Object.assign({},e,{ref:P,prefixCls:u,tabs:$e,className:!ht&&Ie})),o.createElement(Ht,{position:"right",extra:w,prefixCls:u}))}));function zt(e){var t=e.id,n=e.activeKey,r=e.animated,a=e.tabPosition,s=e.rtl,l=e.destroyInactiveTabPane,u=o.useContext(Ft),h=u.prefixCls,d=u.tabs,f=r.tabPane,p=d.findIndex((function(e){return e.key===n}));return o.createElement("div",{className:c()("".concat(h,"-content-holder"))},o.createElement("div",{className:c()("".concat(h,"-content"),"".concat(h,"-content-").concat(a),Object(i.a)({},"".concat(h,"-content-animated"),f)),style:p&&f?Object(i.a)({},s?"marginRight":"marginLeft","-".concat(p,"00%")):null},d.map((function(e){return o.cloneElement(e.node,{key:e.key,prefixCls:h,tabKey:e.key,id:t,animated:f,active:e.key===n,destroyInactiveTabPane:l})}))))}function Vt(e){var t=e.prefixCls,n=e.forceRender,i=e.className,a=e.style,l=e.id,u=e.active,h=e.animated,d=e.destroyInactiveTabPane,f=e.tabKey,p=e.children,g=o.useState(n),v=Object(r.a)(g,2),m=v[0],y=v[1];o.useEffect((function(){u?y(!0):d&&y(!1)}),[u,d]);var b={};return u||(h?(b.visibility="hidden",b.height=0,b.overflowY="hidden"):b.display="none"),o.createElement("div",{id:l&&"".concat(l,"-panel-").concat(f),role:"tabpanel",tabIndex:u?0:-1,"aria-labelledby":l&&"".concat(l,"-tab-").concat(f),"aria-hidden":!u,style:Object(s.a)(Object(s.a)({},b),a),className:c()("".concat(t,"-tabpane"),u&&"".concat(t,"-tabpane-active"),i)},(u||m||n)&&p)}var Wt=0;var Yt=o.forwardRef((function(e,t){var n,l,d=e.id,f=e.prefixCls,p=void 0===f?"rc-tabs":f,g=e.className,v=e.children,m=e.direction,y=e.activeKey,b=e.defaultActiveKey,E=e.editable,k=e.animated,C=e.tabPosition,S=void 0===C?"top":C,x=e.tabBarGutter,w=e.tabBarStyle,T=e.tabBarExtraContent,_=e.locale,O=e.moreIcon,A=e.moreTransitionName,L=e.destroyInactiveTabPane,D=e.renderTabBar,R=e.onChange,I=e.onTabClick,N=e.onTabScroll,P=Object(a.a)(e,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),M=function(e){return Object(u.a)(e).map((function(e){if(o.isValidElement(e)){var t=void 0!==e.key?String(e.key):void 0;return Object(s.a)(Object(s.a)({key:t},e.props),{},{node:e})}return null})).filter((function(e){return e}))}(v),j="rtl"===m;l=!1===k?{inkBar:!1,tabPane:!1}:Object(s.a)({inkBar:!0,tabPane:!1},!0!==k?k:null);var B=Object(o.useState)(!1),F=Object(r.a)(B,2),U=F[0],G=F[1];Object(o.useEffect)((function(){var e;G((e=navigator.userAgent||navigator.vendor||window.opera,!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(e.substr(0,4)))))}),[]);var H=Object(h.a)((function(){var e;return null===(e=M[0])||void 0===e?void 0:e.key}),{value:y,defaultValue:b}),K=Object(r.a)(H,2),z=K[0],V=K[1],W=Object(o.useState)((function(){return M.findIndex((function(e){return e.key===z}))})),Y=Object(r.a)(W,2),q=Y[0],X=Y[1];Object(o.useEffect)((function(){var e,t=M.findIndex((function(e){return e.key===z}));-1===t&&(t=Math.max(0,Math.min(q,M.length-1)),V(null===(e=M[t])||void 0===e?void 0:e.key));X(t)}),[M.map((function(e){return e.key})).join("_"),z,q]);var Q=Object(h.a)(null,{value:d}),J=Object(r.a)(Q,2),Z=J[0],$=J[1],ee=S;U&&!["left","right"].includes(S)&&(ee="top"),Object(o.useEffect)((function(){d||($("rc-tabs-".concat(Wt)),Wt+=1)}),[]);var te,ne={id:Z,activeKey:z,animated:l,tabPosition:ee,rtl:j,mobile:U},ie=Object(s.a)(Object(s.a)({},ne),{},{editable:E,locale:_,moreIcon:O,moreTransitionName:A,tabBarGutter:x,onTabClick:function(e,t){null==I||I(e,t),V(e),null==R||R(e)},onTabScroll:N,extra:T,style:w,panes:v});return te=D?D(ie,Kt):o.createElement(Kt,Object.assign({},ie)),o.createElement(Ft.Provider,{value:{tabs:M,prefixCls:p}},o.createElement("div",Object.assign({ref:t,id:d,className:c()(p,"".concat(p,"-").concat(ee),(n={},Object(i.a)(n,"".concat(p,"-mobile"),U),Object(i.a)(n,"".concat(p,"-editable"),E),Object(i.a)(n,"".concat(p,"-rtl"),j),n),g)},P),te,o.createElement(zt,Object.assign({destroyInactiveTabPane:L},ne,{animated:l}))))}));Yt.TabPane=Vt;var qt=Yt;t.b=qt},mOS8:
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./src/assets/images/403Qrcode.png ***!
|
|
|
\*****************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports=n.p+"static/403Qrcode.6c17b6f4.png"},mgmH:
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/utils/export.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: ExportCourseInfo, ExportCourseActScore, ExportCourseMemberScores, ExportCourseAndOther, exportMoocrecord, ExportCourseTotalScore, ExportCourseWorkListScores, ExportCourseWorkListAppendix, ExportPollsScores, ExportAttendance, ExportVideoStudent, ExportCourseStudentsInfo, ExportProblemset, Exportcompetitions, ExportExerciseStudentScores, getDownFile, getecyears, getec_training_objectives, getec_graduation_requirements */
|
|
|
/*! exports used: ExportAttendance, ExportCourseActScore, ExportCourseAndOther, ExportCourseInfo, ExportCourseMemberScores, ExportCourseStudentsInfo, ExportCourseTotalScore, ExportCourseWorkListScores, ExportExerciseStudentScores, ExportPollsScores, ExportProblemset, ExportVideoStudent, Exportcompetitions, exportMoocrecord, getDownFile, getec_graduation_requirements, getec_training_objectives, getecyears */function(e,t,n){"use strict";n.d(t,"d",(function(){return p})),n.d(t,"b",(function(){return g})),n.d(t,"e",(function(){return v})),n.d(t,"c",(function(){return m})),n.d(t,"n",(function(){return y})),n.d(t,"g",(function(){return b})),n.d(t,"h",(function(){return E})),n.d(t,"j",(function(){return k})),n.d(t,"a",(function(){return C})),n.d(t,"l",(function(){return S})),n.d(t,"f",(function(){return x})),n.d(t,"k",(function(){return w})),n.d(t,"m",(function(){return T})),n.d(t,"i",(function(){return _})),n.d(t,"o",(function(){return O})),n.d(t,"r",(function(){return A})),n.d(t,"q",(function(){return L})),n.d(t,"p",(function(){return D}));n(/*! antd/es/message/style */"miYZ");var i=n(/*! antd/es/message */"tsqr"),r=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),a=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator */"9og8"),s=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator */"WmNS"),o=n.n(s),l=n(/*! @/service/classrooms */"oUNq"),c=n(/*! umi */"9kvl"),u=n(/*! ./util */"1vsH"),h=n(/*! ./env */"m3rI"),d=function(){Object(c.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"正在生成文件,请稍后..."}})},f=function(){Object(c.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}})},p=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d(),e.next=3,Object(l.s)(Object(r.a)({},t));case 3:if(0!==e.sent.status){e.next=7;break}return e.next=7,Object(u.u)("",Object(u.W)({url:h.a.API_SERVER+"/api/courses/".concat(t.coursesId,"/export_couser_info.json"),query:t}));case 7:f();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),g=function(){var e=Object(a.a)(o.a.mark((function e(t){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(l.q)(Object(r.a)({},t));case 2:if(0!==(n=e.sent).status){e.next=8;break}i.b.info("导出任务生成成功"),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_member_act_score")),e.next=13;break;case 8:if(-2!==n.status){e.next=12;break}return e.abrupt("return",n);case 12:-3===n.status&&(Object(c.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"导出提醒"}}),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_member_act_score")));case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=Object(a.a)(o.a.mark((function e(t){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(l.t)(Object(r.a)({},t));case 2:if(0!==(n=e.sent).status){e.next=8;break}i.b.info("导出任务生成成功"),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_total_score")),e.next=13;break;case 8:if(-2!==n.status){e.next=12;break}return e.abrupt("return",n);case 12:-3===n.status&&(Object(c.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"导出提醒"}}),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_total_score")));case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),m=function(){var e=Object(a.a)(o.a.mark((function e(t){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(l.r)(Object(r.a)({},t));case 2:if(0!==(n=e.sent).status){e.next=8;break}i.b.info("导出任务生成成功"),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_total_exercise_and_other")),e.next=13;break;case 8:if(-2!==n.status){e.next=12;break}return e.abrupt("return",n);case 12:-3===n.status&&(Object(c.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"导出提醒"}}),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=Object(a.a)(o.a.mark((function e(t){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(l.y)(Object(r.a)({},t));case 2:if(0!==(n=e.sent).status){e.next=8;break}i.b.info("导出任务生成成功"),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_total_exercise_and_other")),e.next=13;break;case 8:if(-2!==n.status){e.next=12;break}return e.abrupt("return",n);case 12:-3===n.status&&(Object(c.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"导出提醒"}}),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),b=function(){var e=Object(a.a)(o.a.mark((function e(t){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(l.u)(Object(r.a)({},t));case 2:if(0!==(n=e.sent).status){e.next=8;break}i.b.info("导出任务生成成功"),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_total_homework")),e.next=13;break;case 8:if(-2!==n.status){e.next=12;break}return e.abrupt("return",n);case 12:-3===n.status&&(Object(c.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"导出提醒"}}),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/course_total_homework")));case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),E=function(){var e=Object(a.a)(o.a.mark((function e(t,n){var a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(l.w)(Object(r.a)({},t));case 2:0===(a=e.sent).status?(i.b.info("导出任务生成成功"),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/").concat(n))):-3===a.status&&(Object(c.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"导出提醒"}}),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/").concat(n)));case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),k=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d(),e.next=3,Object(l.z)(Object(r.a)({},t));case 3:if(0!==e.sent.status){e.next=7;break}return e.next=7,Object(u.u)("",Object(u.W)({url:h.a.API_SERVER+"/api/polls/".concat(t.categoryId,"/commit_result.xlsx"),query:t}));case 7:f();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),C=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(u.t)("",Object(u.W)({url:h.a.API_SERVER+"/api/courses/".concat(t.coursesId,"/attendances/export_xlsx_data.xlsx"),query:t}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(u.t)("",Object(u.W)({url:h.a.API_SERVER+"/api/courses/".concat(t.coursesId,"/video_study_statics.xlsx"),query:t}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),x=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(u.t)("",Object(u.W)({url:h.a.API_SERVER+"/api/courses/".concat(t.coursesId,"/export_course_students_info.xlsx"),query:t}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),w=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(u.t)("",Object(u.W)({url:h.a.API_SERVER+"/api/item_banks/export.xlsx",query:t}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),T=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(u.t)("",Object(u.W)({url:h.a.API_SERVER+"/api/competitions/region_reports.xlsx",query:t}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),_=function(){var e=Object(a.a)(o.a.mark((function e(t){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(l.x)(Object(r.a)({},t));case 2:0===(n=e.sent).status?(i.b.info("导出任务生成成功"),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/exercise_score"))):-3===n.status&&(Object(c.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"导出提醒"}}),c.d.push("/classrooms/".concat(t.coursesId,"/exportlist/exercise_score")));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),O=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("----------","调用下载"),e.next=3,Object(u.t)("",Object(u.W)({url:h.a.API_SERVER+"/api/export_records/".concat(t.id,".xlsx"),query:t}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),A=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(u.t)("",Object(u.W)({url:h.a.API_SERVER+"/api/ec_major_schools/0/ec_years.xlsx",query:t}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),L=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(u.t)("",Object(u.W)({url:h.a.API_SERVER+"/api/ec_years/".concat(null==t?void 0:t.ec_year_id,"/ec_training_objectives.xlsx"),query:t}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),D=function(){var e=Object(a.a)(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(u.t)("",Object(u.W)({url:h.a.API_SERVER+"/api/ec_years/".concat(null==t?void 0:t.ec_year_id,"/ec_graduation_requirements.xlsx"),query:t}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},nSDg:
|
|
|
/*!**************************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/SelectShixuns/index.less?modules ***!
|
|
|
\**************************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={flex_box_center:"flex_box_center___2lqeg",flex_space_between:"flex_space_between___RuZ2s",flex_box_vertical_center:"flex_box_vertical_center___2AGHP",flex_box_center_end:"flex_box_center_end___FDazu",flex_box_column:"flex_box_column___1Yqjx",wrp:"wrp____lZAZ",drawer:"drawer___2XpEN",menu:"menu___fZQrG",actived:"actived___1Yg9q",actived2:"actived2___2KHN5",subTag:"subTag___3AbgU",directionName:"directionName___2Xp-L",menuDirection:"menuDirection___1ZMmo",listItem:"listItem___g9W0X",info:"info___1FHWU",title:"title___1VzwI",titleLeft:"titleLeft___yvqaz",titleRight:"titleRight___2Dqm5",search:"search___3pcQt",description:"description___3yQGh",menuCourse:"menuCourse___3iBFc",paginationWrap:"paginationWrap___KxpDN"}},p5ED:
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./src/components/PreviewAll/index.tsx ***!
|
|
|
\*********************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,n){"use strict";n(/*! antd/es/button/style */"+L6B");var i=n(/*! antd/es/button */"2/Rp"),r=(n(/*! antd/es/tooltip/style */"5Dmo"),n(/*! antd/es/tooltip */"3S7+")),a=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),s=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),o=n(/*! react */"q1tI"),l=n.n(o),c=n(/*! ./index.less?modules */"vHTk"),u=n.n(c),h=n(/*! @ant-design/icons */"yEEn"),d=n(/*! @/components/monaco-editor */"ZW9T"),f=n(/*! @/utils/util */"1vsH");t.a=function(e){var t=e.name,n=e.data,c=(e.theme,e.type),p=e.filename,g=e.monacoEditor,v=e.className,m=e.style,y=e.close,b=e.onClose,E=e.hasMask,k=Object(o.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),C=Object(s.a)(k,2),S=(C[0],C[1],Object(o.useState)("")),x=Object(s.a)(S,2),w=(x[0],x[1]),T=Object(o.useRef)();p&&(g.filename=p),Object(o.useEffect)((function(){var e,t,n=null===(e=document.cookie)||void 0===e||null===(t=e.replace(/\s/g,""))||void 0===t?void 0:t.split(";");null==n||n.map((function(e){var t=e.split("=");"_educoder_session"===t[0]&&w(t[1])}))}),[]);var _=function(){n.startsWith("http")||n.startsWith("/")?O():Object(f.x)(p||"educoder",n,p)},O=function(){Object(f.v)(p||t,n)};return console.log("data:",n,"fileanme:",p," name:",t),l.a.createElement("div",{style:Object(a.a)({},m||{}),className:"".concat(E&&u.a.bgBlack," ").concat(c?u.a.wrp:"hide")},y&&l.a.createElement("div",{className:u.a.close,ref:T},l.a.createElement(r.a,{title:"点击下载此文件",getPopupContainer:function(){return T.current}},l.a.createElement("span",{onClick:O},l.a.createElement("i",{className:"icon-quxiaozhiding"}))),l.a.createElement(r.a,{title:"关闭",getPopupContainer:function(){return T.current}},l.a.createElement("span",{className:"",onClick:b},l.a.createElement("i",{className:"icon-guanbi1"})))),l.a.createElement("div",{className:"".concat(u.a[v]," ").concat(v," ").concat(u.a.monaco," ").concat("txt"===c?"show":"hide")},"txt"===c&&l.a.createElement(d.b,g)),"audio"===c&&l.a.createElement("audio",{src:"".concat(null!=n&&n.startsWith("/")||(null==n?void 0:n.indexOf("https://"))>-1?n:"data:audio/mp3;base64,").concat(n),autoPlay:!0}),"video"===c&&l.a.createElement(l.a.Fragment,null,null!=n&&n.startsWith("/")?l.a.createElement("video",{controls:!0,src:"".concat(n),autoPlay:!0}):l.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(n),autoPlay:!0})),"html"===c&&l.a.createElement("iframe",{src:n+"&disposition=inline"}),"pdf"===c&&l.a.createElement("embed",{className:u.a.embed,src:n}),"image"===c&&l.a.createElement(l.a.Fragment,null,l.a.createElement("img",{src:"".concat(null!=n&&n.startsWith("/")||(null==n?void 0:n.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(n)})),"other"===c&&l.a.createElement("div",null,l.a.createElement(i.a,{type:"primary",size:"large",onClick:_},l.a.createElement(h.a,null),"点击下载")),("download"===c||"office"===c)&&l.a.createElement(i.a,{type:"primary",size:"large",onClick:_},l.a.createElement(h.a,null),"点击下载"))}},"rAM+":
|
|
|
/*!*******************************************************************************************************************!*\
|
|
|
!*** ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js ***!
|
|
|
\*******************************************************************************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var i=n(/*! @babel/runtime/helpers/esm/unsupportedIterableToArray */"Qw5x");function r(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=Object(i.a)(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){l=!0,s=e},f:function(){try{o||null==n.return||n.return()}finally{if(l)throw s}}}}},rCGY:
|
|
|
/*!***********************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/TeachGroup/index.less?modules ***!
|
|
|
\***********************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={groupWrap:"groupWrap___3dz2S",directionItem:"directionItem___2Jxzl",active:"active___2GpP3",directionContentWrap:"directionContentWrap___1_SmE",minWidth43:"minWidth43___32DTk",minWidth73:"minWidth73___e9DAK",minWidth60:"minWidth60___cP-g2",delete:"delete___1fhs4"}},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 n=/[&<>"']/,i=/[&<>"']/g,r=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g,s={"&":"&","<":"<",">":">",'"':""","'":"'"},o=e=>s[e];const l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function c(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 u=/(^|[^\[])\^/g;const h=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;const f={},p=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,v=/^([^:]+:\/*[^/]*)[\s\S]*$/;function m(e,t){f[" "+e]||(p.test(e)?f[" "+e]=e+"/":f[" "+e]=y(e,"/",!0));const n=-1===(e=f[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(g,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(v,"$1")+t:e+t}function y(e,t,n){const i=e.length;if(0===i)return"";let r=0;for(;r<i;){const a=e.charAt(i-r-1);if(a!==t||n){if(a===t||!n)break;r++}else r++}return e.substr(0,i-r)}e.exports={escape:function(e,t){if(t){if(n.test(e))return e.replace(i,o)}else if(r.test(e))return e.replace(a,o);return e},unescape:c,edit:function(e,t){e=e.source||e,t=t||"";const n={replace:(t,i)=>(i=(i=i.source||i).replace(u,"$1"),e=e.replace(t,i),n),getRegex:()=>new RegExp(e,t)};return n},cleanUrl:function(e,t,n){if(e){let e;try{e=decodeURIComponent(c(n)).replace(h,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!d.test(n)&&(n=m(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n},resolveUrl:m,noopTest:{exec:function(){}},merge:function(e){let t,n,i=1;for(;i<arguments.length;i++)for(n in t=arguments[i],t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},splitCells:function(e,t){const n=e.replace(/\|/g,(e,t,n)=>{let i=!1,r=t;for(;--r>=0&&"\\"===n[r];)i=!i;return i?"|":" |"}).split(/ \|/);let i=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n},rtrim:y,findClosingBracket:function(e,t){if(-1===e.indexOf(t[1]))return-1;const n=e.length;let i=0,r=0;for(;r<n;r++)if("\\"===e[r])r++;else if(e[r]===t[0])i++;else if(e[r]===t[1]&&(i--,i<0))return r;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")}}},sboe:
|
|
|
/*!*************************************************!*\
|
|
|
!*** ./node_modules/rc-tree/es/contextTypes.js ***!
|
|
|
\*************************************************/
|
|
|
/*! exports provided: TreeContext */
|
|
|
/*! exports used: TreeContext */function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var i=n(/*! react */"q1tI"),r=i.createContext(null)},spXi:
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./src/components/CustomTree/index.less?modules ***!
|
|
|
\******************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={flex_box_center:"flex_box_center___2B_Y7",flex_space_between:"flex_space_between___2olzC",flex_box_vertical_center:"flex_box_vertical_center___2Z4dV",flex_box_center_end:"flex_box_center_end___3FiwX",flex_box_column:"flex_box_column___8kyK-",customTree:"customTree___1KOYx",name:"name___3pqs4"}},t23M:
|
|
|
/*!*****************************************************!*\
|
|
|
!*** ./node_modules/rc-resize-observer/es/index.js ***!
|
|
|
\*****************************************************/
|
|
|
/*! exports provided: default */
|
|
|
/*! exports used: default */function(e,t,n){"use strict";var i=n(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),r=n(/*! @babel/runtime/helpers/esm/classCallCheck */"1OyB"),a=n(/*! @babel/runtime/helpers/esm/createClass */"vuIU"),s=n(/*! @babel/runtime/helpers/esm/inherits */"Ji7U"),o=n(/*! @babel/runtime/helpers/esm/createSuper */"LK+K"),l=n(/*! react */"q1tI"),c=n(/*! rc-util/es/Dom/findDOMNode */"m+aA"),u=n(/*! rc-util/es/Children/toArray */"Zm9Q"),h=n(/*! rc-util/es/warning */"Kwbf"),d=n(/*! rc-util/es/ref */"c+Xe"),f=n(/*! resize-observer-polyfill */"bdgK"),p=function(e){Object(s.a)(n,e);var t=Object(o.a)(n);function n(){var e;return Object(r.a)(this,n),(e=t.apply(this,arguments)).resizeObserver=null,e.childNode=null,e.currentElement=null,e.state={width:0,height:0,offsetHeight:0,offsetWidth:0},e.onResize=function(t){var n=e.props.onResize,r=t[0].target,a=r.getBoundingClientRect(),s=a.width,o=a.height,l=r.offsetWidth,c=r.offsetHeight,u=Math.floor(s),h=Math.floor(o);if(e.state.width!==u||e.state.height!==h||e.state.offsetWidth!==l||e.state.offsetHeight!==c){var d={width:u,height:h,offsetWidth:l,offsetHeight:c};e.setState(d),n&&Promise.resolve().then((function(){n(Object(i.a)(Object(i.a)({},d),{},{offsetWidth:l,offsetHeight:c}))}))}},e.setChildNode=function(t){e.childNode=t},e}return Object(a.a)(n,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){if(this.props.disabled)this.destroyObserver();else{var e=Object(c.a)(this.childNode||this);e!==this.currentElement&&(this.destroyObserver(),this.currentElement=e),!this.resizeObserver&&e&&(this.resizeObserver=new f.default(this.onResize),this.resizeObserver.observe(e))}}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var e=this.props.children,t=Object(u.a)(e);if(t.length>1)Object(h.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(0===t.length)return Object(h.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var n=t[0];if(l.isValidElement(n)&&Object(d.c)(n)){var i=n.ref;t[0]=l.cloneElement(n,{ref:Object(d.a)(i,this.setChildNode)})}return 1===t.length?t[0]:t.map((function(e,t){return!l.isValidElement(e)||"key"in e&&null!==e.key?e:l.cloneElement(e,{key:"".concat("rc-observer-key","-").concat(t)})}))}}]),n}(l.Component);p.displayName="ResizeObserver",t.a=p},tK3L:
|
|
|
/*!*************************************************!*\
|
|
|
!*** ./src/pages/Problemset/index.less?modules ***!
|
|
|
\*************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={flex_box_center:"flex_box_center___3uV00",flex_space_between:"flex_space_between___253zc",flex_box_vertical_center:"flex_box_vertical_center___3Nn4F",flex_box_center_end:"flex_box_center_end___3N00E",flex_box_column:"flex_box_column___wngbD",wrap:"wrap___1vIxE",title:"title___3EB7K",select:"select___3yoep",contentWrap:"contentWrap___2vBaG",tabsWrap:"tabsWrap___35WZr",searchWrap:"searchWrap___3zxJK",searchContent:"searchContent___1fqwB",search:"search___Qt6zp",batchWrap:"batchWrap___1QFBy",customTable:"customTable___4pmq7",row:"row___mgwpl",contentListWrap:"contentListWrap___sfO91",li:"li___2kFZ7",top:"top___2xOLA",bottom:"bottom___1-hPm",line:"line___2PBOX",actionLeftItem:"actionLeftItem___3mz5t",more:"more___Oo-pR",btnAdd:"btnAdd___3ROdW",btnCancel:"btnCancel___2N_Gt",cancelC:"cancelC___3SmK1",addC:"addC___3VFkF",actonBtn:"actonBtn___3j8EO",batch:"batch___1YJ8c",btns:"btns___33g-Q",btn:"btn___3yAUt",treeWarp:"treeWarp___27_L-",action:"action___2Ys8R"}},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,n){var i;"undefined"!=typeof window&&(i=function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./node_modules/eventemitter3/index.js ***!
|
|
|
\*********************************************/
|
|
|
/*! no static exports found */function(e,t,n){"use strict";var i=Object.prototype.hasOwnProperty,r="~";function a(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,i||e,a),l=r?r+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 c(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(r=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,s=new Array(a);i<a;i++)s[i]=n[i].fn;return s},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,s){var o=r?r+e:e;if(!this._events[o])return!1;var l,c,u=this._events[o],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,a),!0;case 6:return u.fn.call(u.context,t,n,i,a,s),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,i);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+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||i&&!s.once||n&&s.context!==n||l(this,a);else{for(var o=0,c=[],u=s.length;o<u;o++)(s[o].fn!==t||i&&!s[o].once||n&&s[o].context!==n)&&c.push(s[o]);c.length?this._events[a]=1===c.length?c[0]:c:l(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&l(this,t)):(this._events=new a,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,e.exports=c},"./node_modules/url-toolkit/src/url-toolkit.js":
|
|
|
/*!*****************************************************!*\
|
|
|
!*** ./node_modules/url-toolkit/src/url-toolkit.js ***!
|
|
|
\*****************************************************/
|
|
|
/*! no static exports found */function(e,t,n){var i,r,a,s,o;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,r=/^([^\/?#]*)([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var a=o.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return n.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=r.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var c={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(c.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var u=s.path,h=u.substring(0,u.lastIndexOf("/")+1)+a.path;c.path=o.normalizePath(h)}else c.path=s.path,a.params||(c.params=s.params,a.query||(c.query=s.query));return null===c.path&&(c.path=n.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(c)},parseURL:function(e){var t=i.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,n){function i(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n.oe=function(e){throw console.error(e),e};var i=n(n.s=ENTRY_MODULE);return i.default||i}function r(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,i){var a={};a[i]=[];var s=t.toString(),o=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return a;for(var l,c=o[1],u=new RegExp("(\\\\n|\\W)"+r(c)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");l=u.exec(s);)"dll-reference"!==l[3]&&a[i].push(l[3]);for(u=new RegExp("\\("+r(c)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");l=u.exec(s);)e[l[2]]||(a[i].push(l[1]),e[l[2]]=n(l[1]).m),a[l[2]]=a[l[2]]||[],a[l[2]].push(l[4]);for(var h,d=Object.keys(a),f=0;f<d.length;f++)for(var p=0;p<a[d[f]].length;p++)h=a[d[f]][p],isNaN(1*h)||(a[d[f]][p]=1*a[d[f]][p]);return a}function s(e){return Object.keys(e).reduce((function(t,n){return t||e[n].length>0}),!1)}e.exports=function(e,t){t=t||{};var r={main:n.m},o=t.all?{main:Object.keys(r.main)}:function(e,t){for(var n={main:[t]},i={main:[]},r={main:{}};s(n);)for(var o=Object.keys(n),l=0;l<o.length;l++){var c=o[l],u=n[c].pop();if(r[c]=r[c]||{},!r[c][u]&&e[c][u]){r[c][u]=!0,i[c]=i[c]||[],i[c].push(u);for(var h=a(e,e[c][u],c),d=Object.keys(h),f=0;f<d.length;f++)n[d[f]]=n[d[f]]||[],n[d[f]]=n[d[f]].concat(h[d[f]])}}return i}(r,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),r[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+e+" = ("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o[e].map((function(t){return JSON.stringify(t)+": "+r[e][t].toString()})).join(",")+"});\n"})),l=l+"new (("+i.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o.main.map((function(e){return JSON.stringify(e)+": "+r.main[e].toString()})).join(",")+"}))(self);";var c=new window.Blob([l],{type:"text/javascript"});if(t.bare)return c;var u=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(c),h=new window.Worker(u);return h.objectURL=u,h}},"./src/config.ts":
|
|
|
/*!***********************!*\
|
|
|
!*** ./src/config.ts ***!
|
|
|
\***********************/
|
|
|
/*! exports provided: hlsDefaultConfig, mergeConfig, enableStreamingMode */function(e,t,n){"use strict";n.r(t),n.d(t,"hlsDefaultConfig",(function(){return S})),n.d(t,"mergeConfig",(function(){return x})),n.d(t,"enableStreamingMode",(function(){return w}));var i=n(/*! ./controller/abr-controller */"./src/controller/abr-controller.ts"),r=n(/*! ./controller/audio-stream-controller */"./src/controller/audio-stream-controller.ts"),a=n(/*! ./controller/audio-track-controller */"./src/controller/audio-track-controller.ts"),s=n(/*! ./controller/subtitle-stream-controller */"./src/controller/subtitle-stream-controller.ts"),o=n(/*! ./controller/subtitle-track-controller */"./src/controller/subtitle-track-controller.ts"),l=n(/*! ./controller/buffer-controller */"./src/controller/buffer-controller.ts"),c=n(/*! ./controller/timeline-controller */"./src/controller/timeline-controller.ts"),u=n(/*! ./controller/cap-level-controller */"./src/controller/cap-level-controller.ts"),h=n(/*! ./controller/fps-controller */"./src/controller/fps-controller.ts"),d=n(/*! ./controller/eme-controller */"./src/controller/eme-controller.ts"),f=n(/*! ./controller/cmcd-controller */"./src/controller/cmcd-controller.ts"),p=n(/*! ./utils/xhr-loader */"./src/utils/xhr-loader.ts"),g=n(/*! ./utils/fetch-loader */"./src/utils/fetch-loader.ts"),v=n(/*! ./utils/cues */"./src/utils/cues.ts"),m=n(/*! ./utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts"),y=n(/*! ./utils/logger */"./src/utils/logger.ts");function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function E(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E(Object(n),!0).forEach((function(t){C(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=k(k({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:i.default,bufferController:l.default,capLevelController:u.default,fpsController:h.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:m.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},{cueHandler:v.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:c.TimelineController,audioStreamController:r.default,audioTrackController:a.default,emeController:d.default,cmcdController:f.default});function x(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,n){"use strict";n.r(t);var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../utils/ewma-bandwidth-estimator */"./src/utils/ewma-bandwidth-estimator.ts"),a=n(/*! ../events */"./src/events.ts"),s=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=n(/*! ../errors */"./src/errors.ts"),l=n(/*! ../types/loader */"./src/types/loader.ts"),c=n(/*! ../utils/logger */"./src/utils/logger.ts");function u(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var h=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 r.default(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var t,n,h,d=e.prototype;return d.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)},d.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)},d.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},d.onFragLoading=function(e,t){var n,i=t.frag;i.type===l.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=i,this.partCurrent=null!=(n=t.part)?n:null,this.timer=self.setInterval(this.onCheck,100)))},d.onLevelLoaded=function(e,t){var n=this.hls.config;t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD)},d._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,n=this.hls,r=n.autoLevelEnabled,o=n.config,l=n.media;if(e&&l){var u=t?t.stats:e.stats,h=t?t.duration:e.duration;if(u.aborted)return c.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);if(r&&!l.paused&&l.playbackRate&&l.readyState){var d=performance.now()-u.loading.start,f=Math.abs(l.playbackRate);if(!(d<=500*h/f)){var p=n.levels,g=n.minAutoLevel,v=p[e.level],m=u.total||Math.max(u.loaded,Math.round(h*v.maxBitrate/8)),y=Math.max(1,u.bwEstimate?u.bwEstimate/8:1e3*u.loaded/d),b=(m-u.loaded)/y,E=l.currentTime,k=(s.BufferHelper.bufferInfo(l,E,o.maxBufferHole).end-E)/f;if(!(k>=2*h/f||b<=k)){var C,S=Number.POSITIVE_INFINITY;for(C=e.level-1;C>g&&!((S=h*p[C].maxBitrate/(6.4*y))<k);C--);if(!(S>=b)){var x=this.bwEstimator.getEstimate();c.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 "+C+"\n Current BW estimate: "+(Object(i.isFiniteNumber)(x)?(x/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: "+S.toFixed(3)+" s\n Time to underbuffer: "+k.toFixed(3)+" s"),n.nextLoadLevel=C,this.bwEstimator.sample(d,u.loaded),this.clearTimer(),e.loader&&(this.fragCurrent=this.partCurrent=null,e.loader.abort()),n.trigger(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:u})}}}}}},d.onFragLoaded=function(e,t){var n=t.frag,r=t.part;if(n.type===l.PlaylistLevelType.MAIN&&Object(i.isFiniteNumber)(n.sn)){var s=r?r.stats:n.stats,o=r?r.duration:n.duration;if(this.clearTimer(),this.lastLoadedFragLevel=n.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var c=this.hls.levels[n.level],u=(c.loaded?c.loaded.bytes:0)+s.loaded,h=(c.loaded?c.loaded.duration:0)+o;c.loaded={bytes:u,duration:h},c.realBitrate=Math.round(8*u/h)}if(n.bitrateTest){var d={stats:s,frag:n,part:r,id:n.type};this.onFragBuffered(a.Events.FRAG_BUFFERED,d),n.bitrateTest=!1}}},d.onFragBuffered=function(e,t){var n=t.frag,i=t.part,r=i?i.stats:n.stats;if(!r.aborted&&n.type===l.PlaylistLevelType.MAIN&&"initSegment"!==n.sn){var a=r.parsing.end-r.loading.start;this.bwEstimator.sample(a,r.loaded),r.bwEstimate=this.bwEstimator.getEstimate(),n.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}},d.onError=function(e,t){switch(t.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},d.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},d.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,n=this.hls,i=n.maxAutoLevel,r=n.config,a=n.minAutoLevel,o=n.media,l=t?t.duration:e?e.duration:0,u=o?o.currentTime:0,h=o&&0!==o.playbackRate?Math.abs(o.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():r.abrEwmaDefaultEstimate,f=(s.BufferHelper.bufferInfo(o,u,r.maxBufferHole).end-u)/h,p=this.findBestLevel(d,a,i,f,r.abrBandWidthFactor,r.abrBandWidthUpFactor);if(p>=0)return p;c.logger.trace((f?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=l?Math.min(l,r.maxStarvationDelay):r.maxStarvationDelay,v=r.abrBandWidthFactor,m=r.abrBandWidthUpFactor;if(!f){var y=this.bitrateTestDelay;y&&(g=(l?Math.min(l,r.maxLoadingDelay):r.maxLoadingDelay)-y,c.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),v=m=1)}return p=this.findBestLevel(d,a,i,f+g,v,m),Math.max(p,0)},d.findBestLevel=function(e,t,n,i,r,a){for(var s,o=this.fragCurrent,l=this.partCurrent,u=this.lastLoadedFragLevel,h=this.hls.levels,d=h[u],f=!(null==d||null===(s=d.details)||void 0===s||!s.live),p=null==d?void 0:d.codecSet,g=l?l.duration:o?o.duration:0,v=n;v>=t;v--){var m=h[v];if(m&&(!p||m.codecSet===p)){var y=m.details,b=(l?null==y?void 0:y.partTarget:null==y?void 0:y.averagetargetduration)||g,E=void 0;E=v<=u?r*e:a*e;var k=h[v].maxBitrate,C=k*b/E;if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(E)+"/"+k+"/"+b+"/"+i+"/"+C),E>k&&(!C||f&&!this.bitrateTestDelay||C<i))return v}}return-1},t=e,(n=[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var n=this.getNextABRAutoLevel();return-1!==e&&(n=Math.min(e,n)),n},set:function(e){this._nextAutoLevel=e}}])&&u(t.prototype,n),h&&u(t,h),e}();t.default=h},"./src/controller/audio-stream-controller.ts":
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./src/controller/audio-stream-controller.ts ***!
|
|
|
\***************************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),a=n(/*! ../events */"./src/events.ts"),s=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=n(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),l=n(/*! ../types/level */"./src/types/level.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts"),u=n(/*! ../loader/fragment */"./src/loader/fragment.ts"),h=n(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts"),d=n(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),f=n(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),p=n(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),g=n(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),v=n(/*! ../errors */"./src/errors.ts"),m=n(/*! ../utils/logger */"./src/utils/logger.ts");function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}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,n;function E(t,n){var i;return(i=e.call(this,t,n,"[audio-stream-controller]")||this).videoBuffer=null,i.videoTrackCC=-1,i.waitingVideoCC=-1,i.audioSwitch=!1,i.trackId=-1,i.waitingData=null,i.mainDetails=null,i.bufferFlushed=!1,i._registerListeners(),i}n=e,(t=E).prototype=Object.create(n.prototype),t.prototype.constructor=t,b(t,n);var k=E.prototype;return k.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},k._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)},k._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)},k.onInitPtsFound=function(e,t){var n=t.frag,i=t.id,a=t.initPTS;if("main"===i){var s=n.cc;this.initPTS[n.cc]=a,this.log("InitPTS for cc: "+s+" found from main: "+a),this.videoTrackCC=s,this.state===r.State.WAITING_INIT_PTS&&this.tick()}},k.startLoad=function(e){if(!this.levels)return this.startPosition=e,void(this.state=r.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=r.State.IDLE):(this.loadedmetadata=!1,this.state=r.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},k.doTick=function(){switch(this.state){case r.State.IDLE:this.doTickIdle();break;case r.State.WAITING_TRACK:var t,n=this.levels,i=this.trackId,a=null==n||null===(t=n[i])||void 0===t?void 0:t.details;if(a){if(this.waitForCdnTuneIn(a))break;this.state=r.State.WAITING_INIT_PTS}break;case r.State.FRAG_LOADING_WAITING_RETRY:var o,l=performance.now(),c=this.retryDate;(!c||l>=c||null!==(o=this.media)&&void 0!==o&&o.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=r.State.IDLE);break;case r.State.WAITING_INIT_PTS:var u=this.waitingData;if(u){var h=u.frag,d=u.part,f=u.cache,g=u.complete;if(void 0!==this.initPTS[h.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=r.State.FRAG_LOADING;var v={frag:h,part:d,payload:f.flush(),networkDetails:null};this._handleFragmentLoadProgress(v),g&&e.prototype._handleFragmentLoadComplete.call(this,v)}else if(this.videoTrackCC!==this.waitingVideoCC)m.logger.log("Waiting fragment cc ("+h.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,h)<0&&(m.logger.log("Waiting fragment cc ("+h.cc+") @ "+h.start+" cancelled because another fragment at "+b.end+" is needed"),this.clearWaitingFragment())}}else this.state=r.State.IDLE}this.onTickEnd()},k.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=r.State.IDLE)},k.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}},k.doTickIdle=function(){var e,t,n=this.hls,i=this.levels,s=this.media,o=this.trackId,l=n.config;if(i&&i[o]&&(s||!this.startFragRequested&&l.startFragPrefetch)){var h=i[o].details;if(!h||h.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(h))this.state=r.State.WAITING_TRACK;else{this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,u.ElementaryStreamTypes.AUDIO,c.PlaylistLevelType.AUDIO));var d=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,c.PlaylistLevelType.AUDIO);if(null!==d){var f=d.len,p=this.getMaxBufferLength(),g=this.audioSwitch;if(!(f>=p)||g){if(!g&&this._streamEnded(d,h))return n.trigger(a.Events.BUFFER_EOS,{type:"audio"}),void(this.state=r.State.ENDED);var v=h.fragments[0].start,m=d.end;if(g){var y=this.getLoadPosition();m=y,h.PTSKnown&&y<v&&(d.end>v||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=v+.05)}var b=this.getNextFragment(m,h);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,h,m):this.loadKey(b,h):this.bufferFlushed=!0}}}}},k.getMaxBufferLength=function(){var t=e.prototype.getMaxBufferLength.call(this),n=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,c.PlaylistLevelType.MAIN);return null===n?t:Math.max(t,n.len)},k.onMediaDetaching=function(){this.videoBuffer=null,e.prototype.onMediaDetaching.call(this)},k.onAudioTracksUpdated=function(e,t){var n=t.audioTracks;this.resetTransmuxer(),this.levels=n.map((function(e){return new l.Level(e)}))},k.onAudioTrackSwitching=function(e,t){var n=!!t.url;this.trackId=t.id;var i=this.fragCurrent;null!=i&&i.loader&&i.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),n?this.setInterval(100):this.resetTransmuxer(),n?(this.audioSwitch=!0,this.state=r.State.IDLE):this.state=r.State.STOPPED,this.tick()},k.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},k.onLevelLoaded=function(e,t){this.mainDetails=t.details},k.onAudioTrackLoaded=function(e,t){var n,i=this.levels,a=t.details,s=t.id;if(i){this.log("Track "+s+" loaded ["+a.startSN+","+a.endSN+"],duration:"+a.totalduration);var o=i[s],l=0;if(a.live||null!==(n=o.details)&&void 0!==n&&n.live){var c=this.mainDetails;if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed||!c)return;!o.details&&a.hasProgramDateTime&&c.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(a,c),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!==r.State.WAITING_TRACK||this.waitForCdnTuneIn(a)||(this.state=r.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+s)},k._handleFragmentLoadProgress=function(e){var t,n=e.frag,i=e.part,a=e.payload,s=this.config,o=this.trackId,l=this.levels;if(l){var u=l[o];console.assert(u,"Audio track is defined on fragment load progress");var p=u.details;console.assert(p,"Audio track details are defined on fragment load progress");var g=s.defaultAudioCodec||u.audioCodec||"mp4a.40.2",v=this.transmuxer;v||(v=this.transmuxer=new d.default(this.hls,c.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var y=this.initPTS[n.cc],b=null===(t=n.initSegment)||void 0===t?void 0:t.data;if(void 0!==y){var E=i?i.index:-1,k=-1!==E,C=new f.ChunkMetadata(n.level,n.sn,n.stats.chunkCount,a.byteLength,E,k);v.push(a,b,g,"",n,i,p.totalduration,!1,C,y)}else m.logger.log("Unknown video PTS for cc "+n.cc+", waiting for video PTS before demuxing audio frag "+n.sn+" of ["+p.startSN+" ,"+p.endSN+"],track "+o),(this.waitingData=this.waitingData||{frag:n,part:i,cache:new h.default,complete:!1}).cache.push(new Uint8Array(a)),this.waitingVideoCC=this.videoTrackCC,this.state=r.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered")},k._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:e.prototype._handleFragmentLoadComplete.call(this,t)},k.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},k.onBufferCreated=function(e,t){var n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},k.onFragBuffered=function(e,t){var n=t.frag,i=t.part;n.type===c.PlaylistLevelType.AUDIO&&(this.fragContextChanged(n)?this.warn("Fragment "+n.sn+(i?" p: "+i.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==n.sn&&(this.fragPrevious=n,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(n,i)))},k.onError=function(t,n){switch(n.details){case v.ErrorDetails.FRAG_LOAD_ERROR:case v.ErrorDetails.FRAG_LOAD_TIMEOUT:case v.ErrorDetails.KEY_LOAD_ERROR:case v.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.AUDIO,n);break;case v.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case v.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==r.State.ERROR&&this.state!==r.State.STOPPED&&(this.state=n.fatal?r.State.ERROR:r.State.IDLE,this.warn(n.details+" while loading frag, switching to "+this.state+" state"));break;case v.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===n.parent&&(this.state===r.State.PARSING||this.state===r.State.PARSED)){var i=!0,a=this.getFwdBufferInfo(this.mediaBuffer,c.PlaylistLevelType.AUDIO);a&&a.len>.5&&(i=!this.reduceMaxBufferLength(a.len)),i&&(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()}}},k.onBufferFlushed=function(e,t){t.type===u.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},k._handleTransmuxComplete=function(e){var t,n="audio",i=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 c=l.frag,h=l.part,d=s.audio,f=s.text,p=s.id3,g=s.initSegment;if(!this.fragContextChanged(c)){if(this.state=r.State.PARSING,this.audioSwitch&&d&&this.completeAudioSwitch(),null!=g&&g.tracks&&(this._bufferInitSegment(g.tracks,c,o),i.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:c,id:n,tracks:g.tracks})),d){var v=d.startPTS,m=d.endPTS,b=d.startDTS,E=d.endDTS;h&&(h.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:v,endPTS:m,startDTS:b,endDTS:E}),c.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,v,m,b,E),this.bufferFragmentData(d,c,h,o)}if(null!=p&&null!==(t=p.samples)&&void 0!==t&&t.length){var k=y({frag:c,id:n},p);i.trigger(a.Events.FRAG_PARSING_METADATA,k)}if(f){var C=y({frag:c,id:n},f);i.trigger(a.Events.FRAG_PARSING_USERDATA,C)}}},k._bufferInitSegment=function(e,t,n){if(this.state===r.State.PARSING){e.video&&delete e.video;var i=e.audio;if(i){i.levelCodec=i.codec,i.id="audio",this.log("Init audio buffer, container:"+i.container+", codecs[parsed]=["+i.codec+"]"),this.hls.trigger(a.Events.BUFFER_CODECS,e);var s=i.initSegment;if(null!=s&&s.byteLength){var o={type:"audio",frag:t,part:null,chunkMeta:n,parent:t.type,data:s};this.hls.trigger(a.Events.BUFFER_APPENDING,o)}this.tick()}}},k.loadFragment=function(t,n,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):n.live&&!Object(i.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=r.State.WAITING_INIT_PTS):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,n,a)))},k.completeAudioSwitch=function(){var t=this.hls,n=this.media,i=this.trackId;n&&(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:i})},E}(r.default);t.default=E},"./src/controller/audio-track-controller.ts":
|
|
|
/*!**************************************************!*\
|
|
|
!*** ./src/controller/audio-track-controller.ts ***!
|
|
|
\**************************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ../events */"./src/events.ts"),r=n(/*! ../errors */"./src/errors.ts"),a=n(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),s=n(/*! ../types/loader */"./src/types/loader.ts");function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){var t,n;function a(t){var n;return(n=e.call(this,t,"[audio-track-controller]")||this).tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.trackName="",n.selectDefaultTrack=!0,n.registerListeners(),n}n=e,(t=a).prototype=Object.create(n.prototype),t.prototype.constructor=t,l(t,n);var c,u,h,d=a.prototype;return d.registerListeners=function(){var e=this.hls;e.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(i.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(i.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(i.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(i.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var e=this.hls;e.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(i.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(i.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(i.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(i.Events.ERROR,this.onError,this)},d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,e.prototype.destroy.call(this)},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},d.onManifestParsed=function(e,t){this.tracks=t.audioTracks||[]},d.onAudioTrackLoaded=function(e,t){var n=t.id,i=t.details,r=this.tracksInGroup[n];if(r){var a=r.details;r.details=t.details,this.log("audioTrack "+n+" loaded ["+i.startSN+"-"+i.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,t,a))}else this.warn("Invalid audio track id "+n)},d.onLevelLoading=function(e,t){this.switchLevel(t.level)},d.onLevelSwitching=function(e,t){this.switchLevel(t.level)},d.switchLevel=function(e){var t=this.hls.levels[e];if(null!=t&&t.audioGroupIds){var n=t.audioGroupIds[t.urlId];if(this.groupId!==n){this.groupId=n;var r=this.tracks.filter((function(e){return!n||e.groupId===n}));this.selectDefaultTrack&&!r.some((function(e){return e.default}))&&(this.selectDefaultTrack=!1),this.tracksInGroup=r;var a={audioTracks:r};this.log("Updating audio tracks, "+r.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(i.Events.AUDIO_TRACKS_UPDATED,a),this.selectInitialTrack()}}},d.onError=function(t,n){e.prototype.onError.call(this,t,n),!n.fatal&&n.context&&n.context.type===s.PlaylistContextType.AUDIO_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},d.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 n=t[this.trackId];this.log("Now switching to audio-track index "+e);var r=t[e],a=r.id,s=r.groupId,o=void 0===s?"":s,l=r.name,c=r.type,u=r.url;if(this.trackId=e,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(i.Events.AUDIO_TRACK_SWITCHING,{id:a,groupId:o,name:l,type:c,url:u}),!r.details||r.details.live){var h=this.switchParams(r.url,null==n?void 0:n.details);this.loadPlaylist(h)}}},d.selectInitialTrack=function(){var e=this.tracksInGroup;console.assert(e.length,"Initial audio track should be selected when tracks are known");var t=this.trackName,n=this.findTrackId(t)||this.findTrackId();-1!==n?this.setAudioTrack(n):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(i.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},d.findTrackId=function(e){for(var t=this.tracksInGroup,n=0;n<t.length;n++){var i=t[n];if((!this.selectDefaultTrack||i.default)&&(!e||e===i.name))return i.id}return-1},d.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var n=t.id,r=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: "+n),this.clearTimer(),this.hls.trigger(i.Events.AUDIO_TRACK_LOADING,{url:a,id:n,groupId:r,deliveryDirectives:e||null})}},c=a,(u=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}}])&&o(c.prototype,u),h&&o(c,h),a}(a.default);t.default=c},"./src/controller/base-playlist-controller.ts":
|
|
|
/*!****************************************************!*\
|
|
|
!*** ./src/controller/base-playlist-controller.ts ***!
|
|
|
\****************************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return l}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../types/level */"./src/types/level.ts"),a=n(/*! ./level-helper */"./src/controller/level-helper.ts"),s=n(/*! ../utils/logger */"./src/utils/logger.ts"),o=n(/*! ../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 n=null==t?void 0:t.renditionReports;if(n)for(var a=0;a<n.length;a++){var s=n[a],o=""+s.URI;if(o===e.substr(-o.length)){var l=parseInt(s["LAST-MSN"]),c=parseInt(s["LAST-PART"]);if(t&&this.hls.config.lowLatencyMode){var u=Math.min(t.age-t.partTarget,t.targetduration);void 0!==c&&u>t.partTarget&&(c+=1)}if(Object(i.isFiniteNumber)(l))return new r.HlsUrlParameters(l,Object(i.isFiniteNumber)(c)?c:void 0,r.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,n){var i=this,r=t.details,s=t.stats,o=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(r.advancedDateTime=Date.now()-o,r.live||null!=n&&n.live){if(r.reloaded(n),n&&this.log("live playlist "+e+" "+(r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:"MISSED")),n&&r.fragments.length>0&&Object(a.mergeDetails)(n,r),!this.canLoad||!r.live)return;var l,c=void 0,u=void 0;if(r.canBlockReload&&r.endSN&&r.advanced){var h=this.hls.config.lowLatencyMode,d=r.lastPartSn,f=r.endSN,p=r.lastPartIndex,g=d===f;-1!==p?(c=g?f+1:d,u=g?h?0:p:p+1):c=f+1;var v=r.age,m=v+r.ageHeader,y=Math.min(m-r.partTarget,1.5*r.targetduration);if(y>0){if(n&&y>n.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+n.tuneInGoal+" to: "+y+" with playlist age: "+r.age),y=0;else{var b=Math.floor(y/r.targetduration);c+=b,void 0!==u&&(u+=Math.round(y%r.targetduration/r.partTarget)),this.log("CDN Tune-in age: "+r.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+y+" skip sn "+b+" to part "+u)}r.tuneInGoal=y}if(l=this.getDeliveryDirectives(r,t.deliveryDirectives,c,u),h||!g)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(r,t.deliveryDirectives,c,u);var E=Object(a.computeReloadInterval)(r,s);void 0!==c&&r.canBlockReload&&(E-=r.partTarget||1),this.log("reload live playlist "+e+" in "+Math.round(E)+" ms"),this.timer=self.setTimeout((function(){return i.loadPlaylist(l)}),E)}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,n,i){var a=Object(r.getSkipValue)(e,n);return null!=t&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,a=r.HlsSkip.No),new r.HlsUrlParameters(n,i,a)},t.retryLoadingOrFail=function(e){var t,n=this,i=this.hls.config,r=this.retryCount<i.levelLoadingMaxRetry;if(r)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)*i.levelLoadingRetryDelay,i.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout((function(){return n.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 r},e}()},"./src/controller/base-stream-controller.ts":
|
|
|
/*!**************************************************!*\
|
|
|
!*** ./src/controller/base-stream-controller.ts ***!
|
|
|
\**************************************************/
|
|
|
/*! exports provided: State, default */function(e,t,n){"use strict";n.r(t),n.d(t,"State",(function(){return k})),n.d(t,"default",(function(){return C}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../task-loop */"./src/task-loop.ts"),a=n(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),s=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=n(/*! ../utils/logger */"./src/utils/logger.ts"),l=n(/*! ../events */"./src/events.ts"),c=n(/*! ../errors */"./src/errors.ts"),u=n(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),h=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),d=n(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),f=n(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),p=n(/*! ./level-helper */"./src/controller/level-helper.ts"),g=n(/*! ../loader/fragment-loader */"./src/loader/fragment-loader.ts"),v=n(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),m=n(/*! ../utils/time-ranges */"./src/utils/time-ranges.ts"),y=n(/*! ../types/loader */"./src/types/loader.ts");function b(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var k={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"},C=function(e){var t,n;function r(t,n,i){var r;return(r=e.call(this)||this).hls=void 0,r.fragPrevious=null,r.fragCurrent=null,r.fragmentTracker=void 0,r.transmuxer=null,r._state=k.STOPPED,r.media=void 0,r.mediaBuffer=void 0,r.config=void 0,r.bitrateTest=!1,r.lastCurrentTime=0,r.nextLoadPosition=0,r.startPosition=0,r.loadedmetadata=!1,r.fragLoadError=0,r.retryDate=0,r.levels=null,r.fragmentLoader=void 0,r.levelLastLoaded=null,r.startFragRequested=!1,r.decrypter=void 0,r.initPTS=[],r.onvseeking=null,r.onvended=null,r.logPrefix="",r.log=void 0,r.warn=void 0,r.logPrefix=i,r.log=o.logger.log.bind(o.logger,i+":"),r.warn=o.logger.warn.bind(o.logger,i+":"),r.hls=t,r.fragmentLoader=new g.default(t.config),r.fragmentTracker=n,r.config=t.config,r.decrypter=new v.default(t,t.config),t.on(l.Events.KEY_LOADED,r.onKeyLoaded,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,E(t,n);var C,S,x,w=r.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=k.STOPPED},w._streamEnded=function(e,t){var n=this.fragCurrent,i=this.fragmentTracker;if(!t.live&&n&&n.sn===t.endSN&&!e.nextStart){var r=i.getState(n);return r===a.FragmentState.PARTIAL||r===a.FragmentState.OK}return!1},w.onMediaAttached=function(e,t){var n=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),n.addEventListener("seeking",this.onvseeking),n.addEventListener("ended",this.onvended);var i=this.config;this.levels&&i.autoStartLoad&&this.state===k.STOPPED&&this.startLoad(i.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,n=this.media,r=this.mediaBuffer,a=this.state,o=n?n.currentTime:0,l=s.BufferHelper.bufferInfo(r||n,o,e.maxBufferHole);if(this.log("media seeking to "+(Object(i.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+a),a===k.ENDED)this.resetLoadingState();else if(t&&!l.len){var c=e.maxFragLookUpTolerance,u=t.start-c,h=o>t.start+t.duration+c;(o<u||h)&&(h&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.loader.abort()),this.resetLoadingState())}n&&(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===k.KEY_LOADING&&t.frag===this.fragCurrent&&this.levels){this.state=k.IDLE;var n=this.levels[t.frag.level].details;n&&this.loadFragment(t.frag,n,t.frag.start)}},w.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},w.onHandlerDestroyed=function(){this.state=k.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=k.KEY_LOADING,this.fragCurrent=e,this.hls.trigger(l.Events.KEY_LOADING,{frag:e})},w.loadFragment=function(e,t,n){this._loadFragForPlayback(e,t,n)},w._loadFragForPlayback=function(e,t,n){var i=this;this._doFragLoad(e,t,n,(function(t){if(i.fragContextChanged(e))return i.warn("Fragment "+e.sn+(t.part?" p: "+t.part.index:"")+" of level "+e.level+" was dropped during download."),void i.fragmentTracker.removeFragment(e);e.stats.chunkCount++,i._handleFragmentLoadProgress(t)})).then((function(t){if(t){i.fragLoadError=0;var n=i.state;if(!i.fragContextChanged(e))return"payload"in t&&(i.log("Loaded fragment "+e.sn+" of level "+e.level),i.hls.trigger(l.Events.FRAG_LOADED,t),i.state===k.BACKTRACKING)?(i.fragmentTracker.backtrack(e,t),void i.resetFragmentLoading(e)):void i._handleFragmentLoadComplete(t);(n===k.FRAG_LOADING||n===k.BACKTRACKING||!i.fragCurrent&&n===k.PARSING)&&(i.fragmentTracker.removeFragment(e),i.state=k.IDLE)}})).catch((function(t){i.warn(t),i.resetFragmentLoading(e)}))},w.flushMainBuffer=function(e,t,n){if(void 0===n&&(n=null),e-t){var i={startOffset:e,endOffset:t,type:n};this.fragLoadError=0,this.hls.trigger(l.Events.BUFFER_FLUSHING,i)}},w._loadInitSegment=function(e){var t=this;this._doFragLoad(e).then((function(n){if(!n||t.fragContextChanged(e)||!t.levels)throw new Error("init load aborted");return n})).then((function(n){var i=t.hls,r=n.payload,a=e.decryptdata;if(r&&r.byteLength>0&&a&&a.key&&a.iv&&"AES-128"===a.method){var s=self.performance.now();return t.decrypter.webCryptoDecrypt(new Uint8Array(r),a.key.buffer,a.iv.buffer).then((function(t){var r=self.performance.now();return i.trigger(l.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:s,tdecrypt:r}}),n.payload=t,n}))}return n})).then((function(n){var i=t.fragCurrent,r=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=k.IDLE,t.fragLoadError=0,e.data=new Uint8Array(n.payload),o.parsing.start=o.buffering.start=self.performance.now(),o.parsing.end=o.buffering.end=self.performance.now(),n.frag===i&&r.trigger(l.Events.FRAG_BUFFERED,{stats:o,frag:i,part:null,id:e.type}),t.tick()})).catch((function(n){t.warn(n),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 n=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+" "+m.default.toString(s.BufferHelper.getBuffered(n))),this.state=k.IDLE,this.tick()},w._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var n=e.frag,i=e.part,r=e.partsLoaded,a=!r||0===r.length||r.some((function(e){return!e})),s=new u.ChunkMetadata(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!a);t.flush(s)}},w._handleFragmentLoadProgress=function(e){},w._doFragLoad=function(e,t,n,r){var a=this;if(void 0===n&&(n=null),!this.levels)throw new Error("frag load aborted, missing levels");if(n=Math.max(e.start,n||0),this.config.lowLatencyMode&&t){var s=t.partList;if(s&&r){n>e.end&&t.fragmentHint&&(e=t.fragmentHint);var o=this.getNextPart(s,e,n);if(o>-1){var c=s[o];return this.log("Loading part sn: "+e.sn+" p: "+c.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(n.toFixed(3))),this.nextLoadPosition=c.start+c.duration,this.state=k.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:e,part:s[o],targetBufferTime:n}),this.doFragPartsLoad(e,s,o,r).catch((function(e){return a.handleFragLoadError(e)}))}if(!e.url||this.loadedEndOfParts(s,n))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(n.toFixed(3))),Object(i.isFiniteNumber)(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=k.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragmentLoader.load(e,r).catch((function(e){return a.handleFragLoadError(e)}))},w.doFragPartsLoad=function(e,t,n,i){var r=this;return new Promise((function(a,s){var o=[];!function n(c){var u=t[c];r.fragmentLoader.loadPart(e,u,i).then((function(i){o[u.index]=i;var s=i.part;r.hls.trigger(l.Events.FRAG_LOADED,i);var h=t[c+1];if(!h||h.fragment!==e)return a({frag:e,part:s,partsLoaded:o});n(c+1)})).catch(s)}(n)}))},w.handleFragLoadError=function(e){var t=e.data;return t&&t.details===c.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===k.PARSING){var n=t.frag,i=t.part,r=t.level,a=self.performance.now();n.stats.parsing.end=a,i&&(i.stats.parsing.end=a),this.updateLevelTiming(n,i,r,e.partial)}else this.fragCurrent||(this.state=k.IDLE)},w.getCurrentContext=function(e){var t=this.levels,n=e.level,i=e.sn,r=e.part;if(!t||!t[n])return this.warn("Levels object was unset while buffering fragment "+i+" of level "+n+". The current chunk will not be buffered."),null;var a=t[n],s=r>-1?Object(p.getPartWith)(a,i,r):null,o=s?s.fragment:Object(p.getFragmentWithSN)(a,i,this.fragCurrent);return o?{frag:o,part:s,level:a}:null},w.bufferFragmentData=function(e,t,n,i){if(e&&this.state===k.PARSING){var r=e.data1,a=e.data2,s=r;if(r&&a&&(s=Object(h.appendUint8Array)(r,a)),s&&s.length){var o={type:e.type,frag:t,part:n,chunkMeta:i,parent:t.type,data:s};this.hls.trigger(l.Events.BUFFER_APPENDING,o),e.dropped&&e.independent&&!n&&this.flushBufferGap(t)}}},w.flushBufferGap=function(e){var t=this.media;if(t)if(s.BufferHelper.isBuffered(t,t.currentTime)){var n=t.currentTime,i=s.BufferHelper.bufferInfo(t,n,0),r=e.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*r),o=Math.max(Math.min(e.start-a,i.end-a),n+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}else this.flushMainBuffer(0,e.start)},w.getFwdBufferInfo=function(e,t){var n=this.config,r=this.getLoadPosition();if(!Object(i.isFiniteNumber)(r))return null;var a=s.BufferHelper.bufferInfo(e,r,n.maxBufferHole);if(0===a.len&&void 0!==a.nextStart){var o=this.fragmentTracker.getBufferedFrag(r,t);if(o&&a.nextStart<o.end)return s.BufferHelper.bufferInfo(e,r,Math.max(a.nextStart,n.maxBufferHole))}return a},w.getMaxBufferLength=function(e){var t,n=this.config;return t=e?Math.max(8*n.maxBufferSize/e,n.maxBufferLength):n.maxBufferLength,Math.min(t,n.maxMaxBufferLength)},w.reduceMaxBufferLength=function(e){var t=this.config,n=e||t.maxBufferLength;return t.maxMaxBufferLength>=n&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},w.getNextFragment=function(e,t){var n,i,r=t.fragments,a=r.length;if(!a)return null;var s,o=this.config,l=r[0].start;if(t.live){var c=o.initialLiveManifestSize;if(a<c)return this.warn("Not enough fragments to start playback (have: "+a+", need: "+c+")"),null;t.PTSKnown||this.startFragRequested||-1!==this.startPosition||(s=this.getInitialLiveFragment(t,r),this.startPosition=s?this.hls.liveSyncPosition||s.start:e)}else e<=l&&(s=r[0]);if(!s){var u=o.lowLatencyMode?t.partEnd:t.fragmentEnd;s=this.getFragmentAtPosition(e,u,t)}return null===(n=s)||void 0===n||!n.initSegment||null!==(i=s)&&void 0!==i&&i.initSegment.data||this.bitrateTest||(s=s.initSegment),s},w.getNextPart=function(e,t,n){for(var i=-1,r=!1,a=!0,s=0,o=e.length;s<o;s++){var l=e[s];if(a=a&&!l.independent,i>-1&&n<l.start)break;var c=l.loaded;!c&&(r||l.independent||a)&&l.fragment===t&&(i=s),r=c}return i},w.loadedEndOfParts=function(e,t){var n=e[e.length-1];return n&&t>n.start&&n.loaded},w.getInitialLiveFragment=function(e,t){var n=this.fragPrevious,i=null;if(n){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+n.programDateTime),i=Object(f.findFragmentByPDT)(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){var r=n.sn+1;if(r>=e.startSN&&r<=e.endSN){var a=t[r-e.startSN];n.cc===a.cc&&(i=a,this.log("Live playlist, switching playlist, load frag with next SN: "+i.sn))}i||(i=Object(f.findFragWithCC)(t,n.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+i.sn)}}else{var s=this.hls.liveSyncPosition;null!==s&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i},w.getFragmentAtPosition=function(e,t,n){var i,r=this.config,s=this.fragPrevious,o=n.fragments,l=n.endSN,c=n.fragmentHint,u=r.maxFragLookUpTolerance,h=!!(r.lowLatencyMode&&n.partList&&c);if(h&&c&&!this.bitrateTest&&(o=o.concat(c),l=c.sn),e<t){var d=e>t-u?0:u;i=Object(f.findFragmentByPTS)(s,o,e,d)}else i=o[o.length-1];if(i){var p=i.sn-n.startSN,g=s&&i.level===s.level,v=o[p+1];if(this.fragmentTracker.getState(i)===a.FragmentState.BACKTRACKED){i=null;for(var m=p;o[m]&&this.fragmentTracker.getState(o[m])===a.FragmentState.BACKTRACKED;)i=s?o[m--]:o[--m];i||(i=v)}else s&&i.sn===s.sn&&!h&&g&&(i.sn<l&&this.fragmentTracker.getState(v)!==a.FragmentState.OK?(this.log("SN "+i.sn+" just loaded, load next one: "+v.sn),i=v):i=null)}return i},w.synchronizeToLiveEdge=function(e){var t=this.config,n=this.media;if(n){var i=this.hls.liveSyncPosition,r=n.currentTime,a=e.fragments[0].start,s=e.edge,o=r>=a-t.maxFragLookUpTolerance&&r<=s;if(null!==i&&n.duration>i&&(r<i||!o)){var l=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&n.readyState<4||r<s-l)&&(this.loadedmetadata||(this.nextLoadPosition=i),n.readyState&&(this.warn("Playback: "+r.toFixed(3)+" is located too far from the end of live sliding playlist: "+s+", reset currentTime to : "+i.toFixed(3)),n.currentTime=i))}}},w.alignPlaylists=function(e,t){var n=this.levels,r=this.levelLastLoaded,a=this.fragPrevious,s=null!==r?n[r]:null,o=e.fragments.length;if(!o)return this.warn("No fragments in live playlist"),0;var l=e.fragments[0].start,c=!t,u=e.alignedSliding&&Object(i.isFiniteNumber)(l);if(c||!u&&!l){Object(d.alignStream)(a,s,e);var h=e.fragments[0].start;return this.log("Live playlist sliding: "+h.toFixed(2)+" start-sn: "+(t?t.startSN:"na")+"->"+e.startSN+" prev-sn: "+(a?a.sn:"na")+" fragments: "+o),h}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 n=this.startPosition;if(n<t&&(n=-1),-1===n||-1===this.lastCurrentTime){var r=e.startTimeOffset;Object(i.isFiniteNumber)(r)?(n=t+r,r<0&&(n+=e.totalduration),n=Math.min(Math.max(t,n),t+e.totalduration),this.log("Start time offset "+r+" found in playlist, adjust startPosition to "+n),this.startPosition=n):e.live?n=this.hls.liveSyncPosition||t:this.startPosition=n=0,this.lastCurrentTime=n}this.nextLoadPosition=n},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=k.IDLE)},w.onFragmentOrKeyLoadError=function(e,t){if(!t.fatal){var n=t.frag;if(n&&n.type===e){var i=this.fragCurrent;console.assert(i&&n.sn===i.sn&&n.level===i.level&&n.urlId===i.urlId,"Frag load error must match current frag to retry");var r=this.config;if(this.fragLoadError+1<=r.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(n.level))return;var a=Math.min(Math.pow(2,this.fragLoadError)*r.fragLoadingRetryDelay,r.fragLoadingMaxRetryTimeout);this.warn("Fragment "+n.sn+" of "+e+" "+n.level+" failed to load, retrying in "+a+"ms"),this.retryDate=self.performance.now()+a,this.fragLoadError++,this.state=k.FRAG_LOADING_WAITING_RETRY}else t.levelRetry?(e===y.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=k.IDLE):(o.logger.error(t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.hls.stopLoad(),this.state=k.ERROR)}}},w.afterBufferFlushed=function(e,t,n){if(e){var i=s.BufferHelper.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===k.ENDED&&this.resetLoadingState()}},w.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=k.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,n,i){var r=this,a=n.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 c=o.endPTS-o.startPTS;if(c<=0)return r.warn("Could not parse fragment "+e.sn+" "+s+" duration reliably ("+c+") resetting transmuxer to fallback to playlist timing"),r.resetTransmuxer(),t||!1;var u=i?0:Object(p.updateFragPTSDTS)(a,e,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return r.hls.trigger(l.Events.LEVEL_PTS_UPDATED,{details:a,level:n,drift:u,type:s,frag:e,start:o.startPTS,end:o.endPTS}),!0}return t}),!1)?(this.state=k.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)},C=r,(S=[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}])&&b(C.prototype,S),x&&b(C,x),r}(r.default)},"./src/controller/buffer-controller.ts":
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./src/controller/buffer-controller.ts ***!
|
|
|
\*********************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return f}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../events */"./src/events.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! ../errors */"./src/errors.ts"),o=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=n(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),c=n(/*! ../loader/fragment */"./src/loader/fragment.ts"),u=n(/*! ./buffer-operation-queue */"./src/controller/buffer-operation-queue.ts"),h=Object(l.getMediaSource)(),d=/([ha]vc.)(?:\.[^.,]+)+/,f=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,n=t.media,i=t.mediaSource;a.logger.log("[buffer-controller]: Media source opened"),n&&(t.updateMediaElementDuration(),e.trigger(r.Events.MEDIA_ATTACHED,{media:n})),i&&i.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(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(r.Events.BUFFER_RESET,this.onBufferReset,this),e.on(r.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(r.Events.BUFFER_EOS,this.onBufferEos,this),e.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(r.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(r.Events.FRAG_PARSED,this.onFragParsed,this),e.on(r.Events.FRAG_CHANGED,this.onFragChanged,this)},t.unregisterListeners=function(){var e=this.hls;e.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(r.Events.BUFFER_RESET,this.onBufferReset,this),e.off(r.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(r.Events.BUFFER_EOS,this.onBufferEos,this),e.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(r.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(r.Events.FRAG_PARSED,this.onFragParsed,this),e.off(r.Events.FRAG_CHANGED,this.onFragChanged,this)},t._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new u.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},t.onManifestParsed=function(e,t){var n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.details=null,a.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},t.onMediaAttaching=function(e,t){var n=this.media=t.media;if(n&&h){var i=this.mediaSource=new h;i.addEventListener("sourceopen",this._onMediaSourceOpen),i.addEventListener("sourceended",this._onMediaSourceEnded),i.addEventListener("sourceclose",this._onMediaSourceClose),n.src=self.URL.createObjectURL(i),this._objectUrl=n.src}},t.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,n=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&&(n&&self.URL.revokeObjectURL(n),e.src===n?(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(r.Events.MEDIA_DETACHED,void 0)},t.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach((function(t){var n=e.sourceBuffer[t];try{n&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(n),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 n=this,i=this.getSourceBufferTypes().length;Object.keys(t).forEach((function(e){if(i){var r=n.tracks[e];if(r&&"function"==typeof r.buffer.changeType){var a=t[e],s=a.codec,o=a.levelCodec,l=a.container;if((r.levelCodec||r.codec).replace(d,"$1")!==(o||s).replace(d,"$1")){var c=l+";codecs="+(o||s);n.appendChangeType(e,c)}}}else n.pendingTracks[e]=t[e]})),i||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},t.appendChangeType=function(e,t){var n=this,i=this.operationQueue,r={execute:function(){var r=n.sourceBuffer[e];r&&(a.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),r.changeType(t)),i.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){a.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",t)}};i.append(r,e)},t.onBufferAppending=function(e,t){var n=this,i=this.hls,l=this.operationQueue,c=this.tracks,u=t.data,h=t.type,d=t.frag,f=t.part,p=t.chunkMeta,g=p.buffering[h],v=self.performance.now();g.start=v;var m=d.stats.buffering,y=f?f.stats.buffering:null;0===m.start&&(m.start=v),y&&0===y.start&&(y.start=v);var b=c.audio,E="audio"===h&&1===p.id&&"audio/mpeg"===(null==b?void 0:b.container),k={execute:function(){if(g.executeStart=self.performance.now(),E){var e=n.sourceBuffer[h];if(e){var t=d.start-e.timestampOffset;Math.abs(t)>=.1&&(a.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+t+") sn: "+d.sn+")"),e.timestampOffset=d.start)}}n.appendExecutor(u,h)},onStart:function(){},onComplete:function(){var e=self.performance.now();g.executeEnd=g.end=e,0===m.first&&(m.first=e),y&&0===y.first&&(y.first=e);var t=n.sourceBuffer,i={};for(var a in t)i[a]=o.BufferHelper.getBuffered(t[a]);n.appendError=0,n.hls.trigger(r.Events.BUFFER_APPENDED,{type:h,frag:d,part:f,chunkMeta:p,parent:d.type,timeRanges:i})},onError:function(e){a.logger.error("[buffer-controller]: Error encountered while trying to append to the "+h+" SourceBuffer",e);var t={type:s.ErrorTypes.MEDIA_ERROR,parent:d.type,details:s.ErrorDetails.BUFFER_APPEND_ERROR,err:e,fatal:!1};e.code===DOMException.QUOTA_EXCEEDED_ERR?t.details=s.ErrorDetails.BUFFER_FULL_ERROR:(n.appendError++,t.details=s.ErrorDetails.BUFFER_APPEND_ERROR,n.appendError>i.config.appendErrorMaxRetry&&(a.logger.error("[buffer-controller]: Failed "+i.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),i.trigger(r.Events.ERROR,t)}};l.append(k,h)},t.onBufferFlushing=function(e,t){var n=this,i=this.operationQueue,s=function(e){return{execute:n.removeExecutor.bind(n,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){n.hls.trigger(r.Events.BUFFER_FLUSHED,{type:e})},onError:function(t){a.logger.warn("[buffer-controller]: Failed to remove from "+e+" SourceBuffer",t)}}};t.type?i.append(s(t.type),t.type):this.getSourceBufferTypes().forEach((function(e){i.append(s(e),e)}))},t.onFragParsed=function(e,t){var n=this,i=t.frag,s=t.part,o=[],l=s?s.elementaryStreams:i.elementaryStreams;l[c.ElementaryStreamTypes.AUDIOVIDEO]?o.push("audiovideo"):(l[c.ElementaryStreamTypes.AUDIO]&&o.push("audio"),l[c.ElementaryStreamTypes.VIDEO]&&o.push("video")),0===o.length&&a.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+i.type+" level: "+i.level+" sn: "+i.sn),this.blockBuffers((function(){var e=self.performance.now();i.stats.buffering.end=e,s&&(s.stats.buffering.end=e);var t=s?s.stats:i.stats;n.hls.trigger(r.Events.FRAG_BUFFERED,{frag:i,part:s,stats:t,id:i.type})}),o)},t.onFragChanged=function(e,t){this.flushBackBuffer()},t.onBufferEos=function(e,t){var n=this;this.getSourceBufferTypes().reduce((function(e,i){var r=n.sourceBuffer[i];return t.type&&t.type!==i||r&&!r.ended&&(r.ended=!0,a.logger.log("[buffer-controller]: "+i+" sourceBuffer now EOS")),e&&!(r&&!r.ended)}),!0)&&this.blockBuffers((function(){var e=n.mediaSource;e&&"open"===e.readyState&&e.endOfStream()}))},t.onLevelUpdated=function(e,t){var n=t.details;n.fragments.length&&(this.details=n,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},t.flushBackBuffer=function(){var e=this.hls,t=this.details,n=this.media,a=this.sourceBuffer;if(n&&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(i.isFiniteNumber)(l)&&!(l<0)){var c=n.currentTime,u=t.levelTargetDuration,h=Math.max(l,u),d=Math.floor(c/u)*u-h;s.forEach((function(n){var i=a[n];if(i){var s=o.BufferHelper.getBuffered(i);s.length>0&&d>s.start(0)&&(e.trigger(r.Events.BACK_BUFFER_REACHED,{bufferEnd:d}),t.live&&e.trigger(r.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d}),e.trigger(r.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:n}))}}))}}}},t.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var e=this.details,t=this.hls,n=this.media,r=this.mediaSource,s=e.fragments[0].start+e.totalduration,o=n.duration,l=Object(i.isFiniteNumber)(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(a.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),r.duration=1/0,this.updateSeekableRange(e)):(s>l&&s>o||!Object(i.isFiniteNumber)(o))&&(a.logger.log("[buffer-controller]: Updating Media Source duration to "+s.toFixed(3)),r.duration=s)}},t.updateSeekableRange=function(e){var t=this.mediaSource,n=e.fragments;if(n.length&&e.live&&null!=t&&t.setLiveSeekableRange){var i=Math.max(0,n[0].start),r=Math.max(i,i+e.totalduration);t.setLiveSeekableRange(i,r)}},t.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,n=this.pendingTracks,i=Object.keys(n).length;if(i&&!e||2===i){this.createSourceBuffers(n),this.pendingTracks={};var a=this.getSourceBufferTypes();if(0===a.length)return void this.hls.trigger(r.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,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");var i=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 c=l.levelCodec||l.codec,u=l.container+";codecs="+c;a.logger.log("[buffer-controller]: creating sourceBuffer("+u+")");try{var h=t[o]=n.addSourceBuffer(u),d=o;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.tracks[o]={buffer:h,codec:c,container:l.container,levelCodec:l.levelCodec,id:l.id},i++}catch(e){a.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(r.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:u})}}i&&this.hls.trigger(r.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(r.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var n=this.operationQueue.current(e);n&&n.onError(t)},t.removeExecutor=function(e,t,n){var r=this.media,s=this.mediaSource,o=this.operationQueue,l=this.sourceBuffer[e];if(!r||!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 c=Object(i.isFiniteNumber)(r.duration)?r.duration:1/0,u=Object(i.isFiniteNumber)(s.duration)?s.duration:1/0,h=Math.max(0,t),d=Math.min(n,c,u);d>h?(a.logger.log("[buffer-controller]: Removing ["+h+","+d+"] from the "+e+" SourceBuffer"),console.assert(!l.updating,e+" sourceBuffer must not be updating"),l.remove(h,d)):o.shiftAndExecuteNext(e)},t.appendExecutor=function(e,t){var n=this.operationQueue,i=this.sourceBuffer[t];if(!i)return a.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void n.shiftAndExecuteNext(t);i.ended=!1,console.assert(!i.updating,t+" sourceBuffer must not be updating"),i.appendBuffer(e)},t.blockBuffers=function(e,t){var n=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 i=this.operationQueue,r=t.map((function(e){return i.appendBlocker(e)}));Promise.all(r).then((function(){e(),t.forEach((function(e){var t=n.sourceBuffer[e];t&&t.updating||i.shiftAndExecuteNext(e)}))}))},t.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},t.addBufferListener=function(e,t,n){var i=this.sourceBuffer[e];if(i){var r=n.bind(this,e);this.listeners[e].push({event:t,listener:r}),i.addEventListener(t,r)}},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,n){"use strict";n.r(t),n.d(t,"default",(function(){return r}));var i=n(/*! ../utils/logger */"./src/utils/logger.ts"),r=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 n=this.queues[t];n.push(e),1===n.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,n=new Promise((function(e){t=e})),i={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(i,e),n},t.executeNext=function(e){var t=this.buffers,n=this.queues,r=t[e],a=n[e];if(a.length){var s=a[0];try{s.execute()}catch(t){i.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),s.onError(t),r&&r.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,n){"use strict";n.r(t);var i=n(/*! ../events */"./src/events.ts");function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}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,n,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(i.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var e=this.hls;e.off(i.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},s.onFpsDropLevelCapping=function(t,n){e.isLevelAllowed(n.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(n.droppedLevel)},s.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null},s.onManifestParsed=function(e,t){var n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.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 n=this,i=this.hls.levels;if(!i.length)return-1;var r=i.filter((function(i,r){return e.isLevelAllowed(r,n.restrictedLevels)&&r<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(r,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 n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,t.width||t.height||(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.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,n){if(!e||!e.length)return-1;for(var i,r,a=e.length-1,s=0;s<e.length;s+=1){var o=e[s];if((o.width>=t||o.height>=n)&&(i=o,!(r=e[s+1])||i.width!==r.width||i.height!==r.height)){a=s;break}}return a},t=e,a=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],(n=[{key:"mediaWidth",get:function(){return this.getDimensions().width*e.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*e.contentScaleFactor}}])&&r(t.prototype,n),a&&r(t,a),e}();t.default=a},"./src/controller/cmcd-controller.ts":
|
|
|
/*!*******************************************!*\
|
|
|
!*** ./src/controller/cmcd-controller.ts ***!
|
|
|
\*******************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return d}));var i=n(/*! ../events */"./src/events.ts"),r=n(/*! ../types/cmcd */"./src/types/cmcd.ts"),a=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),s=n(/*! ../utils/logger */"./src/utils/logger.ts");function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function l(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);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)?u(e,t):void 0}}(e))||t&&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.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}var d=function(){function e(t){var n=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(){n.initialized&&(n.starved=!0),n.buffering=!0},this.onPlaying=function(){n.initialized||(n.initialized=!0),n.buffering=!1},this.applyPlaylistData=function(e){try{n.apply(e,{ot:r.CMCDObjectType.MANIFEST,su:!n.initialized})}catch(e){s.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var t=e.frag,i=n.hls.levels[t.level],a=n.getObjectType(t),o={d:1e3*t.duration,ot:a};a!==r.CMCDObjectType.VIDEO&&a!==r.CMCDObjectType.AUDIO&&a!=r.CMCDObjectType.MUXED||(o.br=i.bitrate/1e3,o.tb=n.getTopBandwidth(a),o.bl=n.getBufferLength(a)),n.apply(e,o)}catch(e){s.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=t;var i=this.config=t.config,a=i.cmcd;null!=a&&(i.pLoader=this.createPlaylistLoader(),i.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(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(i.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(i.Events.BUFFER_CREATED,this.onBufferCreated,this)},t.unregisterListeners=function(){var e=this.hls;e.off(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(i.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(i.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 n,i;this.audioBuffer=null===(n=t.tracks.audio)||void 0===n?void 0:n.buffer,this.videoBuffer=null===(i=t.tracks.video)||void 0===i?void 0:i.buffer},t.createData=function(){var e;return{v:r.CMCDVersion,sf:r.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,n){void 0===n&&(n={}),h(n,this.createData());var i=n.ot===r.CMCDObjectType.INIT||n.ot===r.CMCDObjectType.VIDEO||n.ot===r.CMCDObjectType.MUXED;if(this.starved&&i&&(n.bs=!0,n.su=!0,this.starved=!1),null==n.su&&(n.su=this.buffering),this.useHeaders){var a=e.toHeaders(n);if(!Object.keys(a).length)return;t.headers||(t.headers={}),h(t.headers,a)}else{var s=e.toQuery(n);if(!s)return;t.url=e.appendQueryToUri(t.url,s)}},t.getObjectType=function(e){var t=e.type;return"subtitle"===t?r.CMCDObjectType.TIMED_TEXT:"initSegment"===e.sn?r.CMCDObjectType.INIT:"audio"===t?r.CMCDObjectType.AUDIO:"main"===t?this.hls.audioTracks.length?r.CMCDObjectType.VIDEO:r.CMCDObjectType.MUXED:void 0},t.getTopBandwidth=function(e){for(var t,n=0,i=c(e===r.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels);!(t=i()).done;){var a=t.value;a.bitrate>n&&(n=a.bitrate)}return n>0?n:NaN},t.getBufferLength=function(e){var t=this.hls.media,n=e===r.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return n&&t?1e3*a.BufferHelper.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len:NaN},t.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,n=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new n(e)}var i=e.prototype;return i.destroy=function(){this.loader.destroy()},i.abort=function(){this.loader.abort()},i.load=function(e,n,i){t(e),this.loader.load(e,n,i)},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,n=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new n(e)}var i=e.prototype;return i.destroy=function(){this.loader.destroy()},i.abort=function(){this.loader.abort()},i.load=function(e,n,i){t(e),this.loader.load(e,n,i)},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,n=[],i=function(e){return!Number.isNaN(e)&&null!=e&&""!==e&&!1!==e},r=function(e){return Math.round(e)},a=function(e){return 100*r(e/100)},s={br:r,d:r,bl:a,dl:a,mtp:a,nor:function(e){return encodeURIComponent(e)},rtp:a,tb:r},o=c(Object.keys(e||{}).sort());!(t=o()).done;){var l=t.value,u=e[l];if(i(u)&&!("v"===l&&1===u||"pr"==l&&1===u)){var h=s[l];h&&(u=h(u));var d=typeof u,f=void 0;f="ot"===l||"sf"===l||"st"===l?l+"="+u:"boolean"===d?l:"number"===d?l+"="+u:l+"="+JSON.stringify(u),n.push(f)}}return n.join(",")},e.toHeaders=function(t){for(var n={},i=["Object","Request","Session","Status"],r=[{},{},{},{}],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];r[null!=a[l]?a[l]:1][l]=t[l]}for(var c=0;c<r.length;c++){var u=e.serialize(r[c]);u&&(n["CMCD-"+i[c]]=u)}return n},e.toQuery=function(t){return"CMCD="+encodeURIComponent(e.serialize(t))},e.appendQueryToUri=function(e,t){if(!t)return e;var n=e.includes("?")?"&":"?";return""+e+n+t},e}()},"./src/controller/eme-controller.ts":
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/controller/eme-controller.ts ***!
|
|
|
\******************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ../events */"./src/events.ts"),r=n(/*! ../errors */"./src/errors.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! ../utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts");function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}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,n,l,c=e.prototype;return c.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},c._registerListeners=function(){this.hls.on(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(i.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(i.Events.MANIFEST_PARSED,this.onManifestParsed,this)},c._unregisterListeners=function(){this.hls.off(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(i.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(i.Events.MANIFEST_PARSED,this.onManifestParsed,this)},c.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+'"')},c._attemptKeySystemAccess=function(e,t,n){var i=this,r=function(e,t,n,i){switch(e){case s.KeySystems.WIDEVINE:return function(e,t,n){var i={audioCapabilities:[],videoCapabilities:[]};return e.forEach((function(e){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+e+'"',robustness:n.audioRobustness||""})})),t.forEach((function(e){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"',robustness:n.videoRobustness||""})})),[i]}(t,n,i);default:throw new Error("Unknown key-system: "+e)}}(e,t,n,this._drmSystemOptions);a.logger.log("Requesting encrypted media key-system access");var o=this.requestMediaKeySystemAccess(e,r);this.mediaKeysPromise=o.then((function(t){return i._onMediaKeySystemAccessObtained(e,t)})),o.catch((function(t){a.logger.error('Failed to obtain key-system "'+e+'" access:',t)}))},c._onMediaKeySystemAccessObtained=function(e,t){var n=this;a.logger.log('Access for key-system "'+e+'" obtained');var i={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(i);var r=Promise.resolve().then((function(){return t.createMediaKeys()})).then((function(t){return i.mediaKeys=t,a.logger.log('Media-keys created for key-system "'+e+'"'),n._onMediaKeysCreated(),t}));return r.catch((function(e){a.logger.error("Failed to create media-keys:",e)})),r},c._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach((function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))}))},c._onNewMediaKeySession=function(e){var t=this;a.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",(function(n){t._onKeySessionMessage(e,n.message)}),!1)},c._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)}))},c.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(i.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var n=function(n){t._media&&(t._attemptSetMediaKeys(n),t._generateRequestWithPreferredKeySession(e.initDataType,e.initData))};this.mediaKeysPromise.then(n).catch(n)},c._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(i.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});a.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},c._generateRequestWithPreferredKeySession=function(e,t){var n=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(i.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.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(i.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.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(i.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.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),n.hls.trigger(i.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},c._createLicenseXhr=function(e,t,n){var i=new XMLHttpRequest;i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,e,t,n);var r=this._licenseXhrSetup;if(r)try{r.call(this.hls,i,e),r=void 0}catch(e){a.logger.error(e)}try{i.readyState||i.open("POST",e,!0),r&&r.call(this.hls,i,e)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return i},c._onLicenseRequestReadyStageChange=function(e,t,n,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(i.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var c=3-this._requestLicenseFailureCount+1;a.logger.warn("Retrying license request, "+c+" attempts left"),this._requestLicense(n,s)}}},c._generateLicenseRequestChallenge=function(e,t){switch(e.mediaKeySystemDomain){case s.KeySystems.WIDEVINE:return t}throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},c._requestLicense=function(e,t){a.logger.log("Requesting content license for key-system");var n=this._mediaKeysList[0];if(!n)return a.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(i.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var s=this.getLicenseServerUrl(n.mediaKeySystemDomain),o=this._createLicenseXhr(s,e,t);a.logger.log("Sending license request to URL: "+s);var l=this._generateLicenseRequestChallenge(n,e);o.send(l)}catch(e){a.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(i.Events.ERROR,{type:r.ErrorTypes.KEY_SYSTEM_ERROR,details:r.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},c.onMediaAttached=function(e,t){if(this._emeEnabled){var n=t.media;this._media=n,n.addEventListener("encrypted",this._onMediaEncrypted)}},c.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(){})))},c.onManifestParsed=function(e,t){if(this._emeEnabled){var n=t.levels.map((function(e){return e.audioCodec})).filter((function(e){return!!e})),i=t.levels.map((function(e){return e.videoCodec})).filter((function(e){return!!e}));this._attemptKeySystemAccess(s.KeySystems.WIDEVINE,n,i)}},t=e,(n=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&o(t.prototype,n),l&&o(t,l),e}();t.default=l},"./src/controller/fps-controller.ts":
|
|
|
/*!******************************************!*\
|
|
|
!*** ./src/controller/fps-controller.ts ***!
|
|
|
\******************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ../events */"./src/events.ts"),r=n(/*! ../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(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.unregisterListeners=function(){this.hls.off(i.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 n=this.hls.config;if(n.capLevelOnFPSDrop){var i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&"function"==typeof i.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}},t.checkFPS=function(e,t,n){var a=performance.now();if(t){if(this.lastTime){var s=a-this.lastTime,o=n-this.lastDroppedFrames,l=t-this.lastDecodedFrames,c=1e3*o/s,u=this.hls;if(u.trigger(i.Events.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:n}),c>0&&o>u.config.fpsDroppedMonitoringThreshold*l){var h=u.currentLevel;r.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(-1===u.autoLevelCapping||u.autoLevelCapping>=h)&&(h-=1,u.trigger(i.Events.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=n,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,n){"use strict";n.r(t),n.d(t,"findFragmentByPDT",(function(){return a})),n.d(t,"findFragmentByPTS",(function(){return s})),n.d(t,"fragmentWithinToleranceTest",(function(){return o})),n.d(t,"pdtWithinToleranceTest",(function(){return l})),n.d(t,"findFragWithCC",(function(){return c}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../utils/binary-search */"./src/utils/binary-search.ts");function a(e,t,n){if(null===t||!Array.isArray(e)||!e.length||!Object(i.isFiniteNumber)(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;n=n||0;for(var r=0;r<e.length;++r){var a=e[r];if(l(t,n,a))return a}return null}function s(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=0);var a=null;if(e?a=t[e.sn-t[0].sn+1]||null:0===n&&0===t[0].start&&(a=t[0]),a&&0===o(n,i,a))return a;var s=r.default.search(t,o.bind(null,n,i));return s||a}function o(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0);var i=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-i<=e?1:n.start-i>e&&n.start?-1:0}function l(e,t,n){var i=1e3*Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return(n.endProgramDateTime||0)-i>e}function c(e,t){return r.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,n){"use strict";n.r(t),n.d(t,"FragmentState",(function(){return i})),n.d(t,"FragmentTracker",(function(){return s}));var i,r=n(/*! ../events */"./src/events.ts"),a=n(/*! ../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"}(i||(i={}));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(r.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(r.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(r.Events.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(r.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(r.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(r.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 n=this.activeFragment,i=this.activeParts;if(!n)return null;if(i)for(var r=i.length;r--;){var s=i[r],o=s?s.end:n.appendedPTS;if(s.start<=e&&void 0!==o&&e<=o)return r>9&&(this.activeParts=i.slice(r-9)),s}else if(n.start<=e&&void 0!==n.appendedPTS&&e<=n.appendedPTS)return n}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){for(var n=this.fragments,i=Object.keys(n),r=i.length;r--;){var a=n[i[r]];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,n){var i=this;Object.keys(this.fragments).forEach((function(r){var a=i.fragments[r];if(a)if(a.buffered){var s=a.range[e];s&&s.time.some((function(e){var n=!i.isTimeBuffered(e.startPTS,e.endPTS,t);return n&&i.removeFragment(a.body),n}))}else a.body.type===n&&i.removeFragment(a.body)}))},t.detectPartialFragments=function(e){var t=this,n=this.timeRanges,i=e.frag,r=e.part;if(n&&"initSegment"!==i.sn){var a=l(i),s=this.fragments[a];s&&(Object.keys(n).forEach((function(e){var a=i.elementaryStreams[e];if(a){var o=n[e],l=null!==r||!0===a.partial;s.range[e]=t.getBufferedTimes(i,r,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),n=this.fragments[t];n&&(n.backtrack=n.loaded=null,n.buffered=!0)},t.getBufferedTimes=function(e,t,n,i){for(var r={time:[],partial:n},a=t?t.start:e.start,s=t?t.end:e.end,o=e.minEndPTS||s,l=e.maxStartPTS||a,c=0;c<i.length;c++){var u=i.start(c)-this.bufferPadding,h=i.end(c)+this.bufferPadding;if(l>=u&&o<=h){r.time.push({startPTS:Math.max(a,i.start(c)),endPTS:Math.min(s,i.end(c))});break}if(a<h&&s>u)r.partial=!0,r.time.push({startPTS:Math.max(a,i.start(c)),endPTS:Math.min(s,i.end(c))});else if(s<=u)break}return r},t.getPartialFragment=function(e){var t,n,i,r=null,a=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach((function(c){var u=l[c];u&&o(u)&&(n=u.body.start-s,i=u.body.end+s,e>=n&&e<=i&&(t=Math.min(e-n,i-e),a<=t&&(r=u.body,a=t)))})),r},t.getState=function(e){var t=l(e),n=this.fragments[t];return n?n.buffered?o(n)?i.PARTIAL:i.OK:n.backtrack?i.BACKTRACKED:i.APPENDING:i.NOT_LOADED},t.backtrack=function(e,t){var n=l(e),i=this.fragments[n];if(!i||i.backtrack)return null;var r=i.backtrack=t||i.loaded;return i.loaded=null,r},t.getBacktrackData=function(e){var t=l(e),n=this.fragments[t];if(n){var i,r=n.backtrack;if(null!=r&&null!==(i=r.payload)&&void 0!==i&&i.byteLength)return r;this.removeFragment(e)}return null},t.isTimeBuffered=function(e,t,n){for(var i,r,a=0;a<n.length;a++){if(i=n.start(a)-this.bufferPadding,r=n.end(a)+this.bufferPadding,e>=i&&t<=r)return!0;if(t<=i)return!1}return!1},t.onFragLoaded=function(e,t){var n=t.frag,i=t.part;if("initSegment"!==n.sn&&!n.bitrateTest&&!i){var r=l(n);this.fragments[r]={body:n,loaded:t,backtrack:null,buffered:!1,range:Object.create(null)}}},t.onBufferAppended=function(e,t){var n=this,i=t.frag,r=t.part,s=t.timeRanges;if(i.type===a.PlaylistLevelType.MAIN)if(this.activeFragment=i,r){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(r)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach((function(e){var t=s[e];if(n.detectEvictedFragments(e,t),!r)for(var a=0;a<t.length;a++)i.appendedPTS=Math.max(t.end(a),i.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,n){var i=this;Object.keys(this.fragments).forEach((function(r){var a=i.fragments[r];if(a&&a.buffered){var s=a.body;s.type===n&&s.start<t&&s.end>e&&i.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,n;return e.buffered&&((null===(t=e.range.video)||void 0===t?void 0:t.partial)||(null===(n=e.range.audio)||void 0===n?void 0:n.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,n){"use strict";n.r(t),n.d(t,"STALL_MINIMUM_DURATION_MS",(function(){return o})),n.d(t,"MAX_START_GAP_JUMP",(function(){return l})),n.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return c})),n.d(t,"SKIP_BUFFER_RANGE_START",(function(){return u})),n.d(t,"default",(function(){return h}));var i=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),r=n(/*! ../errors */"./src/errors.ts"),a=n(/*! ../events */"./src/events.ts"),s=n(/*! ../utils/logger */"./src/utils/logger.ts"),o=250,l=2,c=.1,u=.05,h=function(){function e(e,t,n,i){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=n,this.hls=i}var t=e.prototype;return t.destroy=function(){this.hls=this.fragmentTracker=this.media=null},t.poll=function(e){var t=this.config,n=this.media,r=this.stalled,a=n.currentTime,c=n.seeking,u=this.seeking&&!c,h=!this.seeking&&c;if(this.seeking=c,a===e){if((h||u)&&(this.stalled=null),!n.paused&&!n.ended&&0!==n.playbackRate&&i.BufferHelper.getBuffered(n).length){var d=i.BufferHelper.bufferInfo(n,a,0),f=d.len>0,p=d.nextStart||0;if(f||p){if(c){var g=d.len>l,v=!p||p-a>l&&!this.fragmentTracker.getPartialFragment(a);if(g||v)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var m,y=Math.max(p,d.start||0)-a,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,E=(null==b||null===(m=b.details)||void 0===m?void 0:m.live)?2*b.details.targetduration:l;if(y>0&&y<=E)return void this._trySkipBufferHole(null)}var k=self.performance.now();if(null!==r){var C=k-r;!c&&C>=o&&this._reportStall(d.len);var S=i.BufferHelper.bufferInfo(n,a,t.maxBufferHole);this._tryFixBufferStall(S,C)}else this.stalled=k}}}else if(this.moved=!0,null!==r){if(this.stallReported){var x=self.performance.now()-r;s.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(x)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var n=this.config,i=this.fragmentTracker,r=this.media.currentTime,a=i.getPartialFragment(r);a&&this._trySkipBufferHole(a)||e.len>n.maxBufferHole&&t>1e3*n.highBufferWatchdogPeriod&&(s.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,n=this.media;this.stallReported||(this.stallReported=!0,s.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(a.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,n=this.hls,o=this.media,l=o.currentTime,h=0,d=i.BufferHelper.getBuffered(o),f=0;f<d.length;f++){var p=d.start(f);if(l+t.maxBufferHole>=h&&l<p){var g=Math.max(p+u,o.currentTime+c);return s.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+g),this.moved=!0,this.stalled=null,o.currentTime=g,e&&n.trigger(a.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+g,frag:e}),g}h=d.end(f)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,n=this.media,i=n.currentTime,o=(this.nudgeRetry||0)+1;if(this.nudgeRetry=o,o<e.nudgeMaxRetry){var l=i+o*e.nudgeOffset;s.logger.warn("Nudging 'currentTime' from "+i+" to "+l),n.currentTime=l,t.trigger(a.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else s.logger.error("Playhead still not moving while enough data buffered @"+i+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(a.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.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,n){"use strict";n.r(t);var i=n(/*! ../events */"./src/events.ts"),r=n(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),a=n(/*! ../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(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(i.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},t._unregisterListeners=function(){var e=this.hls;e.off(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(i.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},t.onMediaAttached=function(e,t){this.media=t.media},t.onMediaDetaching=function(){this.id3Track&&(Object(r.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 n=e[t];if("metadata"===n.kind&&"id3"===n.label)return Object(r.sendAddTrackEvent)(n,this.media),n}return this.media.addTextTrack("metadata","id3")}},t.onFragParsingMetadata=function(e,t){if(this.media){var n=t.frag,i=t.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var r=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<i.length;s++){var o=a.getID3Frames(i[s].data);if(o){var l=i[s].pts,c=s<i.length-1?i[s+1].pts:n.end;c-l<=0&&(c=l+.25);for(var u=0;u<o.length;u++){var h=o[u];if(!a.isTimeStampFrame(h)){var d=new r(l,c,"");d.value=h,this.id3Track.addCue(d)}}}}}},t.onBufferFlushing=function(e,t){var n=t.startOffset,i=t.endOffset,a=t.type;if(!a||"audio"===a){var s=this.id3Track;s&&Object(r.removeCuesInRange)(s,n,i)}},e}();t.default=s},"./src/controller/latency-controller.ts":
|
|
|
/*!**********************************************!*\
|
|
|
!*** ./src/controller/latency-controller.ts ***!
|
|
|
\**********************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return o}));var i=n(/*! ../errors */"./src/errors.ts"),r=n(/*! ../events */"./src/events.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts");function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}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,n,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(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(r.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(r.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(r.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(r.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(r.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 n=t.details;this.levelDetails=n,n.advanced&&this.timeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},l.onError=function(e,t){t.details===i.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 n=this.computeLatency();if(null!==n){this._latency=n;var i=this.config,r=i.lowLatencyMode,a=i.maxLiveSyncPlaybackRate;if(r&&1!==a){var s=this.targetLatency;if(null!==s){var o=n-s,l=o<Math.min(this.maxLatency,s+t.targetduration);if(t.live&&l&&o>.05&&this.forwardBufferLength>1){var c=Math.min(2,Math.max(1,a)),u=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,u))}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,(n=[{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,n=e.partHoldBack,i=e.targetduration,r=this.config,a=r.liveSyncDuration,s=r.liveSyncDurationCount,o=r.lowLatencyMode,l=this.hls.userConfig,c=o&&n||t;(l.liveSyncDuration||l.liveSyncDurationCount||0===c)&&(c=void 0!==a?a:s*i);var u=i;return c+Math.min(1*this.stallCount,u)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,n=this.levelDetails;if(null===e||null===t||null===n)return null;var i=n.edge,r=e-t-this.edgeStalled,a=i-n.totalduration,s=i-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(a,r),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 n=e.buffered.length;return n?e.buffered.end(n-1):t.edge-this.currentTime}}])&&s(t.prototype,n),o&&s(t,o),e}()},"./src/controller/level-controller.ts":
|
|
|
/*!********************************************!*\
|
|
|
!*** ./src/controller/level-controller.ts ***!
|
|
|
\********************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return p}));var i=n(/*! ../types/level */"./src/types/level.ts"),r=n(/*! ../events */"./src/events.ts"),a=n(/*! ../errors */"./src/errors.ts"),s=n(/*! ../utils/codecs */"./src/utils/codecs.ts"),o=n(/*! ./level-helper */"./src/controller/level-helper.ts"),l=n(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts");function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function h(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var f=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=function(e){var t,n;function l(t){var n;return(n=e.call(this,t,"[level-controller]")||this)._levels=[],n._firstLevel=-1,n._startLevel=void 0,n.currentLevelIndex=-1,n.manualLevelIndex=-1,n.onParsedComplete=void 0,n._registerListeners(),n}n=e,(t=l).prototype=Object.create(n.prototype),t.prototype.constructor=t,d(t,n);var p,g,v,m=l.prototype;return m._registerListeners=function(){var e=this.hls;e.on(r.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(r.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(r.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(r.Events.ERROR,this.onError,this)},m._unregisterListeners=function(){var e=this.hls;e.off(r.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(r.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(r.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(r.Events.ERROR,this.onError,this)},m.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,e.prototype.destroy.call(this)},m.startLoad=function(){this._levels.forEach((function(e){e.loadError=0})),e.prototype.startLoad.call(this)},m.onManifestLoaded=function(e,t){var n,l,c=[],u=[],h=[],d={},p=!1,g=!1,v=!1;if(t.levels.forEach((function(e){var t=e.attrs;p=p||!(!e.width||!e.height),g=g||!!e.videoCodec,v=v||!!e.audioCodec,f&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0);var n=e.bitrate+"-"+e.attrs.RESOLUTION+"-"+e.attrs.CODECS;(l=d[n])?l.url.push(e.url):(l=new i.Level(e),d[n]=l,c.push(l)),t&&(t.AUDIO&&Object(o.addGroupId)(l,"audio",t.AUDIO),t.SUBTITLES&&Object(o.addGroupId)(l,"text",t.SUBTITLES))})),(p||g)&&v&&(c=c.filter((function(e){var t=e.videoCodec,n=e.width,i=e.height;return!!t||!(!n||!i)}))),c=c.filter((function(e){var t=e.audioCodec,n=e.videoCodec;return(!t||Object(s.isCodecSupportedInMp4)(t,"audio"))&&(!n||Object(s.isCodecSupportedInMp4)(n,"video"))})),t.audioTracks&&(u=t.audioTracks.filter((function(e){return!e.audioCodec||Object(s.isCodecSupportedInMp4)(e.audioCodec,"audio")})),Object(o.assignTrackIdsByGroup)(u)),t.subtitles&&(h=t.subtitles,Object(o.assignTrackIdsByGroup)(h)),c.length>0){n=c[0].bitrate,c.sort((function(e,t){return e.bitrate-t.bitrate})),this._levels=c;for(var m=0;m<c.length;m++)if(c[m].bitrate===n){this._firstLevel=m,this.log("manifest loaded, "+c.length+" level(s) found, first bitrate: "+n);break}var y=v&&!g,b={levels:c,audioTracks:u,subtitleTracks:h,firstLevel:this._firstLevel,stats:t.stats,audio:v,video:g,altAudio:!y&&u.some((function(e){return!!e.url}))};this.hls.trigger(r.Events.MANIFEST_PARSED,b),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(r.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"})},m.onError=function(t,n){if(e.prototype.onError.call(this,t,n),!n.fatal){var i=n.context,r=this._levels[this.currentLevelIndex];if(i&&(i.type===c.PlaylistContextType.AUDIO_TRACK&&r.audioGroupIds&&i.groupId===r.audioGroupIds[r.urlId]||i.type===c.PlaylistContextType.SUBTITLE_TRACK&&r.textGroupIds&&i.groupId===r.textGroupIds[r.urlId]))this.redundantFailover(this.currentLevelIndex);else{var s,o=!1,l=!0;switch(n.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(n.frag){var u=this._levels[n.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=n.frag.level)):s=n.frag.level}break;case a.ErrorDetails.LEVEL_LOAD_ERROR:case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:i&&(i.deliveryDirectives&&(l=!1),s=i.level),o=!0;break;case a.ErrorDetails.REMUX_ALLOC_ERROR:s=n.level,o=!0}void 0!==s&&this.recoverLevel(n,s,o,l)}}},m.recoverLevel=function(e,t,n,i){var r=e.details,a=this._levels[t];if(a.loadError++,n){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}if(i){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(r+": switch to "+o),e.levelRetry=!0,this.hls.nextAutoLevel=o)}}},m.redundantFailover=function(e){var t=this._levels[e],n=t.url.length;if(n>1){var i=(t.urlId+1)%n;this.warn("Switching to redundant URL-id "+i),this._levels.forEach((function(e){e.urlId=i})),this.level=e}},m.onFragLoaded=function(e,t){var n=t.frag;if(void 0!==n&&n.type===c.PlaylistLevelType.MAIN){var i=this._levels[n.level];void 0!==i&&(i.fragmentError=0,i.loadError=0)}},m.onLevelLoaded=function(e,t){var n,i,r=t.level,a=t.details,s=this._levels[r];if(!s)return this.warn("Invalid level index "+r),void(null!==(i=t.deliveryDirectives)&&void 0!==i&&i.skip&&(a.deltaUpdateFailed=!0));r===this.currentLevelIndex?(0===s.fragmentError&&(s.loadError=0,this.retryCount=0),this.playlistLoaded(r,t,s.details)):null!==(n=t.deliveryDirectives)&&void 0!==n&&n.skip&&(a.deltaUpdateFailed=!0)},m.onAudioTrackSwitched=function(e,t){var n=this.hls.levels[this.currentLevelIndex];if(n&&n.audioGroupIds){for(var i=-1,r=this.hls.audioTracks[t.id].groupId,a=0;a<n.audioGroupIds.length;a++)if(n.audioGroupIds[a]===r){i=a;break}i!==n.urlId&&(n.urlId=i,this.startLoad())}},m.loadPlaylist=function(e){var t=this.currentLevelIndex,n=this._levels[t];if(this.canLoad&&n&&n.url.length>0){var i=n.urlId,a=n.url[i];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 "+i+" "+a),this.clearTimer(),this.hls.trigger(r.Events.LEVEL_LOADING,{url:a,level:t,id:i,deliveryDirectives:e||null})}},m.removeLevel=function(e,t){var n=function(e,n){return n!==t},i=this._levels.filter((function(i,r){return r!==e||i.url.length>1&&void 0!==t&&(i.url=i.url.filter(n),i.audioGroupIds&&(i.audioGroupIds=i.audioGroupIds.filter(n)),i.textGroupIds&&(i.textGroupIds=i.textGroupIds.filter(n)),i.urlId=0,!0)})).map((function(e,t){var n=e.details;return null!=n&&n.fragments&&n.fragments.forEach((function(e){e.level=t})),e}));this._levels=i,this.hls.trigger(r.Events.LEVELS_UPDATED,{levels:i})},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,n=this._levels;if(0!==n.length&&(this.currentLevelIndex!==e||null===(t=n[e])||void 0===t||!t.details)){if(e<0||e>=n.length){var i=e<0;if(this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:i,reason:"invalid level idx"}),i)return;e=Math.min(e,n.length-1)}this.clearTimer();var s=this.currentLevelIndex,o=n[s],l=n[e];this.log("switching to level "+e+" from "+s),this.currentLevelIndex=e;var c=u({},l,{level:e,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete c._urlId,this.hls.trigger(r.Events.LEVEL_SWITCHING,c);var h=l.details;if(!h||h.live){var d=this.switchParams(l.uri,null==o?void 0:o.details);this.loadPlaylist(d)}}}},{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)}}])&&h(p.prototype,g),v&&h(p,v),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,n){"use strict";n.r(t),n.d(t,"addGroupId",(function(){return a})),n.d(t,"assignTrackIdsByGroup",(function(){return s})),n.d(t,"updatePTS",(function(){return o})),n.d(t,"updateFragPTSDTS",(function(){return c})),n.d(t,"mergeDetails",(function(){return u})),n.d(t,"mapPartIntersection",(function(){return h})),n.d(t,"mapFragmentIntersection",(function(){return d})),n.d(t,"adjustSliding",(function(){return f})),n.d(t,"addSliding",(function(){return p})),n.d(t,"computeReloadInterval",(function(){return g})),n.d(t,"getFragmentWithSN",(function(){return v})),n.d(t,"getPartWith",(function(){return m}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../utils/logger */"./src/utils/logger.ts");function a(e,t,n){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(n);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(n)}}function s(e){var t={};e.forEach((function(e){var n=e.groupId||"";e.id=t[n]=t[n]||0,t[n]++}))}function o(e,t,n){l(e[t],e[n])}function l(e,t){var n=t.startPTS;if(Object(i.isFiniteNumber)(n)){var r,a=0;t.sn>e.sn?(a=n-e.start,r=e):(a=e.start-n,r=t),r.duration!==a&&(r.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 c(e,t,n,a,s,o){a-n<=0&&(r.logger.warn("Fragment should have a positive duration",t),a=n+t.duration,o=s+t.duration);var c=n,u=a,h=t.startPTS,d=t.endPTS;if(Object(i.isFiniteNumber)(h)){var f=Math.abs(h-n);Object(i.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(f,t.deltaPTS):t.deltaPTS=f,c=Math.max(n,h),n=Math.min(n,h),s=Math.min(s,t.startDTS),u=Math.min(a,d),a=Math.max(a,d),o=Math.max(o,t.endDTS)}t.duration=a-n;var p=n-t.start;t.appendedPTS=a,t.start=t.startPTS=n,t.maxStartPTS=c,t.startDTS=s,t.endPTS=a,t.minEndPTS=u,t.endDTS=o;var g,v=t.sn;if(!e||v<e.startSN||v>e.endSN)return 0;var m=v-e.startSN,y=e.fragments;for(y[m]=t,g=m;g>0;g--)l(y[g],y[g-1]);for(g=m;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 u(e,t){for(var n=null,a=e.fragments,s=a.length-1;s>=0;s--){var o=a[s].initSegment;if(o){n=o;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var l,u=0;if(d(e,t,(function(e,r){e.relurl&&(u=e.cc-r.cc),Object(i.isFiniteNumber)(e.startPTS)&&Object(i.isFiniteNumber)(e.endPTS)&&(r.start=r.startPTS=e.startPTS,r.startDTS=e.startDTS,r.appendedPTS=e.appendedPTS,r.maxStartPTS=e.maxStartPTS,r.endPTS=e.endPTS,r.endDTS=e.endDTS,r.minEndPTS=e.minEndPTS,r.duration=e.endPTS-e.startPTS,r.duration&&(l=r),t.PTSKnown=t.alignedSliding=!0),r.elementaryStreams=e.elementaryStreams,r.loader=e.loader,r.stats=e.stats,r.urlId=e.urlId,e.initSegment&&(r.initSegment=e.initSegment,n=e.initSegment)})),n&&(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((function(e){var t;e.initSegment&&e.initSegment.relurl!==(null===(t=n)||void 0===t?void 0:t.relurl)||(e.initSegment=n)})),t.skippedSegments&&(t.deltaUpdateFailed=t.fragments.some((function(e){return!e})),t.deltaUpdateFailed)){r.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(u){r.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<g.length;v++)g[v].cc+=u}t.skippedSegments&&(t.startCC=t.fragments[0].cc),h(e.partList,t.partList,(function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),l?c(t,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS):f(e,t),g.length&&(t.totalduration=t.edge-g[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;var m=t.advancedDateTime;if(t.advanced&&m){var y=t.edge;t.driftStart||(t.driftStartTime=m,t.driftStart=y),t.driftEndTime=m,t.driftEnd=y}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function h(e,t,n){if(e&&t)for(var i=0,r=0,a=e.length;r<=a;r++){var s=e[r],o=t[r+i];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?n(s,o):i--}}function d(e,t,n){for(var i=t.skippedSegments,r=Math.max(e.startSN,t.startSN)-t.startSN,a=(e.fragmentHint?1:0)+(i?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,c=r;c<=a;c++){var u=l[s+c],h=o[c];i&&!h&&c<i&&(h=t.fragments[c]=u),u&&h&&n(u,h)}}function f(e,t){var n=t.startSN+t.skippedSegments-e.startSN,i=e.fragments;n<0||n>=i.length||p(t,i[n].start)}function p(e,t){if(t){for(var n=e.fragments,i=e.skippedSegments;i<n.length;i++)n[i].start+=t;e.fragmentHint&&(e.fragmentHint.start+=t)}}function g(e,t){var n,i=1e3*e.levelTargetDuration,r=i/2,a=e.age,s=a>0&&a<3*i,o=t.loading.end-t.loading.start,l=e.availabilityDelay;if(!1===e.updated)if(s){var c=333*e.misses;n=Math.max(Math.min(r,2*o),c),e.availabilityDelay=(e.availabilityDelay||0)+n}else n=r;else s?(l=Math.min(l||i/2,a),e.availabilityDelay=l,n=l+i-a):n=i-o;return Math.round(n)}function v(e,t,n){if(!e||!e.details)return null;var i=e.details,r=i.fragments[t-i.startSN];return r||((r=i.fragmentHint)&&r.sn===t?r:t<i.startSN&&n&&n.sn===t?n:null)}function m(e,t,n){if(!e||!e.details)return null;var i=e.details.partList;if(i)for(var r=i.length;r--;){var a=i[r];if(a.index===n&&a.fragment.sn===t)return a}return null}},"./src/controller/stream-controller.ts":
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./src/controller/stream-controller.ts ***!
|
|
|
\*********************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return y}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),a=n(/*! ../is-supported */"./src/is-supported.ts"),s=n(/*! ../events */"./src/events.ts"),o=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=n(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts"),u=n(/*! ../loader/fragment */"./src/loader/fragment.ts"),h=n(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),d=n(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),f=n(/*! ./gap-controller */"./src/controller/gap-controller.ts"),p=n(/*! ../errors */"./src/errors.ts"),g=n(/*! ../utils/logger */"./src/utils/logger.ts");function v(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e){var t,n;function y(t,n){var i;return(i=e.call(this,t,n,"[stream-controller]")||this).audioCodecSwap=!1,i.gapController=null,i.level=-1,i._forceStartLoad=!1,i.altAudio=!1,i.audioOnly=!1,i.fragPlaying=null,i.onvplaying=null,i.onvseeked=null,i.fragLastKbps=0,i.stalled=!1,i.couldBacktrack=!1,i.audioCodecSwitch=!1,i.videoBuffer=null,i._registerListeners(),i}n=e,(t=y).prototype=Object.create(n.prototype),t.prototype.constructor=t,m(t,n);var b,E,k,C=y.prototype;return C._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)},C._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)},C.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},C.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var i=n.startLevel;-1===i&&(n.config.testBandwidth?(i=0,this.bitrateTest=!0):i=n.nextAutoLevel),this.level=n.nextLoadLevel=i,this.loadedmetadata=!1}t>0&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=r.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=r.State.STOPPED},C.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.call(this)},C.doTick=function(){switch(this.state){case r.State.IDLE:this.doTickIdle();break;case r.State.WAITING_LEVEL:var e,t=this.levels,n=this.level,i=null==t||null===(e=t[n])||void 0===e?void 0:e.details;if(i&&(!i.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(i))break;this.state=r.State.IDLE;break}break;case r.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=r.State.IDLE)}this.onTickEnd()},C.onTickEnd=function(){e.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},C.doTickIdle=function(){var e,t,n=this.hls,i=this.levelLastLoaded,a=this.levels,o=this.media,h=n.config,d=n.nextLoadLevel;if(null!==i&&(o||!this.startFragRequested&&h.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&a&&a[d]){var f=a[d];this.level=n.nextLoadLevel=d;var p=f.details;if(!p||this.state===r.State.WAITING_LEVEL||p.live&&this.levelLastLoaded!==d)this.state=r.State.WAITING_LEVEL;else{var g=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:o,c.PlaylistLevelType.MAIN);if(null!==g&&!(g.len>=this.getMaxBufferLength(f.maxBitrate))){if(this._streamEnded(g,p)){var v={};return this.altAudio&&(v.type="video"),this.hls.trigger(s.Events.BUFFER_EOS,v),void(this.state=r.State.ENDED)}var m=g.end,y=this.getNextFragment(m,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>m){var E=this.audioOnly&&!this.altAudio?u.ElementaryStreamTypes.AUDIO:u.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(o,E,c.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,m):this.loadKey(y,p))}}}},C.loadFragment=function(t,n,i){var r,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,n,i)):a===l.FragmentState.APPENDING?this.reduceMaxBufferLength(t.duration)&&this.fragmentTracker.removeFragment(t):0===(null===(r=this.media)||void 0===r?void 0:r.buffered.length)&&this.fragmentTracker.removeAllFragments()},C.getAppendedFrag=function(e){var t=this.fragmentTracker.getAppendedFrag(e,c.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},C.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,c.PlaylistLevelType.MAIN)},C.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},C.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},C.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var n,i=this.getAppendedFrag(t.currentTime);if(i&&i.start>1&&this.flushMainBuffer(0,i.start-1),!t.paused&&e){var r=e[this.hls.nextLoadLevel],a=this.fragLastKbps;n=a&&this.fragCurrent?this.fragCurrent.duration*r.maxBitrate/(1e3*a)+1:0}else n=0;var s=this.getBufferedFrag(t.currentTime+n);if(s){var o=this.followingBufferedFrag(s);if(o){this.abortCurrentFrag();var l=o.maxStartPTS?o.maxStartPTS:o.start,c=o.duration,u=Math.max(s.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,.5*c),.75*c));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}},C.abortCurrentFrag=function(){var e=this.fragCurrent;this.fragCurrent=null,null!=e&&e.loader&&e.loader.abort(),this.state===r.State.KEY_LOADING&&(this.state=r.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},C.flushMainBuffer=function(t,n){e.prototype.flushMainBuffer.call(this,t,n,this.altAudio?"video":null)},C.onMediaAttached=function(t,n){e.prototype.onMediaAttached.call(this,t,n);var i=n.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new f.default(this.config,i,this.fragmentTracker,this.hls)},C.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)},C.onMediaPlaying=function(){this.tick()},C.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:null;Object(i.isFiniteNumber)(t)&&this.log("Media seeked to "+t.toFixed(3)),this.tick()},C.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},C.onManifestParsed=function(e,t){var n,i=!1,r=!1;t.levels.forEach((function(e){(n=e.audioCodec)&&(-1!==n.indexOf("mp4a.40.2")&&(i=!0),-1!==n.indexOf("mp4a.40.5")&&(r=!0))})),this.audioCodecSwitch=i&&r&&!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},C.onLevelLoading=function(e,t){var n=this.levels;if(n&&this.state===r.State.IDLE){var i=n[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(i.details))&&(this.state=r.State.WAITING_LEVEL)}},C.onLevelLoaded=function(e,t){var n,i=this.levels,a=t.level,o=t.details,l=o.totalduration;if(i){this.log("Level "+a+" loaded ["+o.startSN+","+o.endSN+"], cc ["+o.startCC+", "+o.endCC+"] duration:"+l);var c=this.fragCurrent;!c||this.state!==r.State.FRAG_LOADING&&this.state!==r.State.FRAG_LOADING_WAITING_RETRY||c.level!==t.level&&c.loader&&(this.state=r.State.IDLE,c.loader.abort());var u=i[a],h=0;if(o.live||null!==(n=u.details)&&void 0!==n&&n.live){if(o.fragments[0]||(o.deltaUpdateFailed=!0),o.deltaUpdateFailed)return;h=this.alignPlaylists(o,u.details)}if(u.details=o,this.levelLastLoaded=a,this.hls.trigger(s.Events.LEVEL_UPDATED,{details:o,level:a}),this.state===r.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=r.State.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,h),this.tick()}else this.warn("Levels were reset while loading level "+a)},C._handleFragmentLoadProgress=function(e){var t,n=e.frag,i=e.part,r=e.payload,a=this.levels;if(a){var s=a[n.level],o=s.details;if(o){var l=s.videoCodec,u=o.PTSKnown||!o.live,f=null===(t=n.initSegment)||void 0===t?void 0:t.data,p=this._getAudioCodec(s),g=this.transmuxer=this.transmuxer||new h.default(this.hls,c.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),v=i?i.index:-1,m=-1!==v,y=new d.ChunkMetadata(n.level,n.sn,n.stats.chunkCount,r.byteLength,v,m),b=this.initPTS[n.cc];g.push(r,f,p,l,n,i,o.totalduration,u,y,b)}else this.warn("Dropping fragment "+n.sn+" of level "+n.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered")},C.onAudioTrackSwitching=function(e,t){var n=this.altAudio,i=!!t.url,r=t.id;if(!i){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;n&&o.trigger(s.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),o.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:r})}},C.onAudioTrackSwitched=function(e,t){var n=t.id,i=!!this.hls.audioTracks[n].url;if(i){var r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=i,this.tick()},C.onBufferCreated=function(e,t){var n,i,r=t.tracks,a=!1;for(var s in r){var o=r[s];if("main"===o.id){if(i=s,n=o,"video"===s){var l=r[s];l&&(this.videoBuffer=l.buffer)}}else a=!0}a&&n?(this.log("Alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media},C.onFragBuffered=function(e,t){var n=t.frag,i=t.part;if(!n||n.type===c.PlaylistLevelType.MAIN){if(this.fragContextChanged(n))return this.warn("Fragment "+n.sn+(i?" p: "+i.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===r.State.PARSED&&(this.state=r.State.IDLE));var a=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),"initSegment"!==n.sn&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}},C.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(c.PlaylistLevelType.MAIN,t);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==r.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=r.State.ERROR):t.levelRetry||this.state!==r.State.WAITING_LEVEL||(this.state=r.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if("main"===t.parent&&(this.state===r.State.PARSING||this.state===r.State.PARSED)){var n=!0,i=this.getFwdBufferInfo(this.media,c.PlaylistLevelType.MAIN);i&&i.len>.5&&(n=!this.reduceMaxBufferLength(i.len)),n&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}},C.checkBuffer=function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){var n=o.BufferHelper.getBuffered(e);!this.loadedmetadata&&n.length?(this.loadedmetadata=!0,this.seekToStartPos()):t.poll(this.lastCurrentTime),this.lastCurrentTime=e.currentTime}},C.onFragLoadEmergencyAborted=function(){this.state=r.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},C.onBufferFlushed=function(e,t){var n=t.type;if(n!==u.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var i=(n===u.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,n,c.PlaylistLevelType.MAIN)}},C.onLevelsUpdated=function(e,t){this.levels=t.levels},C.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.seekToStartPos=function(){var e=this.media,t=e.currentTime,n=this.startPosition;if(n>=0&&t<n){if(e.seeking)return void g.logger.log("could not seek to "+n+", already seeking at "+t);var i=o.BufferHelper.getBuffered(e),r=(i.length?i.start(0):0)-n;r>0&&(r<this.config.maxBufferHole||r<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+r+" to match buffer start"),n+=r,this.startPosition=n),this.log("seek to target start position "+n+" from current time "+t),e.currentTime=n}},C._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},C._loadBitrateTestFrag=function(e){var t=this;this._doFragLoad(e).then((function(n){var i=t.hls;if(n&&!i.nextLoadLevel&&!t.fragContextChanged(e)){t.fragLoadError=0,t.state=r.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(),i.trigger(s.Events.FRAG_LOADED,n)}}))},C._handleTransmuxComplete=function(e){var t,n="main",a=this.hls,o=e.remuxResult,l=e.chunkMeta,c=this.getCurrentContext(l);if(!c)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 h=c.frag,d=c.part,f=c.level,p=o.video,g=o.text,v=o.id3,m=o.initSegment,y=this.altAudio?void 0:o.audio;if(!this.fragContextChanged(h)){if(this.state=r.State.PARSING,m){m.tracks&&(this._bufferInitSegment(f,m.tracks,h,l),a.trigger(s.Events.FRAG_PARSING_INIT_SEGMENT,{frag:h,id:n,tracks:m.tracks}));var b=m.initPTS,E=m.timescale;Object(i.isFiniteNumber)(b)&&(this.initPTS[h.cc]=b,a.trigger(s.Events.INIT_PTS_FOUND,{frag:h,id:n,initPTS:b,timescale:E}))}if(p&&!1!==o.independent){if(f.details){var k=p.startPTS,C=p.endPTS,S=p.startDTS,x=p.endDTS;if(d)d.elementaryStreams[p.type]={startPTS:k,endPTS:C,startDTS:S,endDTS:x};else if(p.firstKeyFrame&&p.independent&&(this.couldBacktrack=!0),p.dropped&&p.independent){if(this.getLoadPosition()+this.config.maxBufferHole<k)return void this.backtrack(h);h.setElementaryStreamInfo(p.type,h.start,C,h.start,x,!0)}h.setElementaryStreamInfo(p.type,k,C,S,x),this.bufferFragmentData(p,h,d,l)}}else if(!1===o.independent)return void this.backtrack(h);if(y){var w=y.startPTS,T=y.endPTS,_=y.startDTS,O=y.endDTS;d&&(d.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:w,endPTS:T,startDTS:_,endDTS:O}),h.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,w,T,_,O),this.bufferFragmentData(y,h,d,l)}if(null!=v&&null!==(t=v.samples)&&void 0!==t&&t.length){var A={frag:h,id:n,samples:v.samples};a.trigger(s.Events.FRAG_PARSING_METADATA,A)}if(g){var L={frag:h,id:n,samples:g.samples};a.trigger(s.Events.FRAG_PARSING_USERDATA,L)}}},C._bufferInitSegment=function(e,t,n,i){var a=this;if(this.state===r.State.PARSING){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var o=t.audio,l=t.video,c=t.audiovideo;if(o){var u=e.audioCodec,h=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(u&&(u=-1!==u.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==o.metadata.channelCount&&-1===h.indexOf("firefox")&&(u="mp4a.40.5")),-1!==h.indexOf("android")&&"audio/mpeg"!==o.container&&(u="mp4a.40.2",this.log("Android: force audio codec to "+u)),e.audioCodec&&e.audioCodec!==u&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+u+'"'),o.levelCodec=u,o.id="main",this.log("Init audio buffer, container:"+o.container+", codecs[selected/level/parsed]=["+(u||"")+"/"+(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+"]")),c&&this.log("Init audiovideo buffer, container:"+c.container+", codecs[level/parsed]=["+(e.attrs.CODECS||"")+"/"+c.codec+"]"),this.hls.trigger(s.Events.BUFFER_CODECS,t),Object.keys(t).forEach((function(e){var r=t[e].initSegment;null!=r&&r.byteLength&&a.hls.trigger(s.Events.BUFFER_APPENDING,{type:e,data:r,frag:n,part:null,chunkMeta:i,parent:n.type})})),this.tick()}},C.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=r.State.BACKTRACKING},C.checkFragmentChanged=function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var n=e.currentTime;if(o.BufferHelper.isBuffered(e,n)?t=this.getAppendedFrag(n):o.BufferHelper.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){var i=this.fragPlaying,r=t.level;i&&t.sn===i.sn&&i.level===r&&t.urlId===i.urlId||(this.hls.trigger(s.Events.FRAG_CHANGED,{frag:t}),i&&i.level===r||this.hls.trigger(s.Events.LEVEL_SWITCHED,{level:r}),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}}])&&v(b.prototype,E),k&&v(b,k),y}(r.default)},"./src/controller/subtitle-stream-controller.ts":
|
|
|
/*!******************************************************!*\
|
|
|
!*** ./src/controller/subtitle-stream-controller.ts ***!
|
|
|
\******************************************************/
|
|
|
/*! exports provided: SubtitleStreamController */function(e,t,n){"use strict";n.r(t),n.d(t,"SubtitleStreamController",(function(){return g}));var i=n(/*! ../events */"./src/events.ts"),r=n(/*! ../utils/logger */"./src/utils/logger.ts"),a=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),s=n(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),o=n(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),l=n(/*! ./level-helper */"./src/controller/level-helper.ts"),c=n(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),u=n(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),h=n(/*! ../types/loader */"./src/types/loader.ts"),d=n(/*! ../types/level */"./src/types/level.ts");function f(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var g=function(e){var t,n;function g(t,n){var i;return(i=e.call(this,t,n,"[subtitle-stream-controller]")||this).levels=[],i.currentTrackId=-1,i.tracksBuffered=[],i.mainDetails=null,i._registerListeners(),i}n=e,(t=g).prototype=Object.create(n.prototype),t.prototype.constructor=t,p(t,n);var v,m,y,b=g.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var e=this.hls;e.on(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(i.Events.ERROR,this.onError,this),e.on(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(i.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(i.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(i.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b._unregisterListeners=function(){var e=this.hls;e.off(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(i.Events.ERROR,this.onError,this),e.off(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(i.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(i.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(i.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b.startLoad=function(){this.stopLoad(),this.state=u.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 n=t.frag,i=t.success;if(this.fragPrevious=n,this.state=u.State.IDLE,i){var r=this.tracksBuffered[this.currentTrackId];if(r){for(var a,s=n.start,o=0;o<r.length;o++)if(s>=r[o].start&&s<=r[o].end){a=r[o];break}var l=n.start+n.duration;a?a.end=l:(a={start:s,end:l},r.push(a)),this.fragmentTracker.fragBuffered(n)}}},b.onBufferFlushing=function(e,t){var n=t.startOffset,i=t.endOffset;if(0===n&&i!==Number.POSITIVE_INFINITY){var r=this.currentTrackId,a=this.levels;if(!a.length||!a[r]||!a[r].details)return;var s=i-a[r].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(n,s,h.PlaylistLevelType.SUBTITLE)}},b.onError=function(e,t){var n,i=t.frag;i&&i.type===h.PlaylistLevelType.SUBTITLE&&(null!==(n=this.fragCurrent)&&void 0!==n&&n.loader&&this.fragCurrent.loader.abort(),this.state=u.State.IDLE)},b.onSubtitleTracksUpdated=function(e,t){var n=this,i=t.subtitleTracks;this.tracksBuffered=[],this.levels=i.map((function(e){return new d.Level(e)})),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach((function(e){n.tracksBuffered[e.id]=[]})),this.mediaBuffer=null},b.onSubtitleTrackSwitch=function(e,t){if(this.currentTrackId=t.id,this.levels.length&&-1!==this.currentTrackId){var n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.setInterval(500)}else this.clearInterval()},b.onSubtitleTrackLoaded=function(e,t){var n,i=t.details,r=t.id,a=this.currentTrackId,c=this.levels;if(c.length){var h=c[a];if(!(r>=c.length||r!==a)&&h){if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||null!==(n=h.details)&&void 0!==n&&n.live){var d=this.mainDetails;if(i.deltaUpdateFailed||!d)return;var f=d.fragments[0];h.details?0===this.alignPlaylists(i,h.details)&&f&&Object(l.addSliding)(i,f.start):i.hasProgramDateTime&&d.hasProgramDateTime?Object(o.alignMediaPlaylistByPDT)(i,d):f&&Object(l.addSliding)(i,f.start)}h.details=i,this.levelLastLoaded=r,this.tick(),i.live&&!this.fragCurrent&&this.media&&this.state===u.State.IDLE&&(Object(s.findFragmentByPTS)(null,i.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0))}}},b._handleFragmentLoadComplete=function(e){var t=e.frag,n=e.payload,r=t.decryptdata,a=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&r&&r.key&&r.iv&&"AES-128"===r.method){var s=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(n),r.key.buffer,r.iv.buffer).then((function(e){var n=performance.now();a.trigger(i.Events.FRAG_DECRYPTED,{frag:t,payload:e,stats:{tstart:s,tdecrypt:n}})}))}},b.doTick=function(){if(this.media){if(this.state===u.State.IDLE){var e,t=this.currentTrackId,n=this.levels;if(!n.length||!n[t]||!n[t].details)return;var o=n[t].details,l=o.targetduration,h=this.config,d=this.media,f=a.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,d.currentTime-l,h.maxBufferHole),p=f.end;if(f.len>this.getMaxBufferLength()+l)return;console.assert(o,"Subtitle track details are defined on idle subtitle stream controller tick");var g,v=o.fragments,m=v.length,y=o.edge,b=this.fragPrevious;if(p<y){var E=h.maxFragLookUpTolerance;b&&o.hasProgramDateTime&&(g=Object(s.findFragmentByPDT)(v,b.endProgramDateTime,E)),g||!(g=Object(s.findFragmentByPTS)(b,v,p,E))&&b&&b.start<v[0].start&&(g=v[0])}else g=v[m-1];null!==(e=g)&&void 0!==e&&e.encrypted?(r.logger.log("Loading key for "+g.sn),this.state=u.State.KEY_LOADING,this.hls.trigger(i.Events.KEY_LOADING,{frag:g})):g&&this.fragmentTracker.getState(g)===c.FragmentState.NOT_LOADED&&this.loadFragment(g,o,p)}}else this.state=u.State.IDLE},b.loadFragment=function(t,n,i){this.fragCurrent=t,e.prototype.loadFragment.call(this,t,n,i)},v=g,(m=[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}])&&f(v.prototype,m),y&&f(v,y),g}(u.default)},"./src/controller/subtitle-track-controller.ts":
|
|
|
/*!*****************************************************!*\
|
|
|
!*** ./src/controller/subtitle-track-controller.ts ***!
|
|
|
\*****************************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ../events */"./src/events.ts"),r=n(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),a=n(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),s=n(/*! ../types/loader */"./src/types/loader.ts");function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){var t,n;function a(t){var n;return(n=e.call(this,t,"[subtitle-track-controller]")||this).media=null,n.tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.selectDefaultTrack=!0,n.queuedDefaultTrack=-1,n.trackChangeListener=function(){return n.onTextTracksChanged()},n.asyncPollTrackChange=function(){return n.pollTrackChange(0)},n.useTextTrackPolling=!1,n.subtitlePollingInterval=-1,n.subtitleDisplay=!0,n.registerListeners(),n}n=e,(t=a).prototype=Object.create(n.prototype),t.prototype.constructor=t,l(t,n);var c,h,d,f=a.prototype;return f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,e.prototype.destroy.call(this)},f.registerListeners=function(){var e=this.hls;e.on(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(i.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(i.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(i.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(i.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var e=this.hls;e.off(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(i.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(i.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(i.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(i.Events.ERROR,this.onError,this)},f.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))},f.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},f.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),u(this.media.textTracks).forEach((function(e){Object(r.clearCurrentCues)(e)})),this.subtitleTrack=-1,this.media=null)},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},f.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},f.onSubtitleTrackLoaded=function(e,t){var n=t.id,i=t.details,r=this.trackId,a=this.tracksInGroup[r];if(a){var s=a.details;a.details=t.details,this.log("subtitle track "+n+" loaded ["+i.startSN+"-"+i.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,t,s))}else this.warn("Invalid subtitle track id "+n)},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.textGroupIds){var n=t.textGroupIds[t.urlId];if(this.groupId!==n){var r=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,a=this.tracks.filter((function(e){return!n||e.groupId===n}));this.tracksInGroup=a;var s=this.findTrackId(null==r?void 0:r.name)||this.findTrackId();this.groupId=n;var o={subtitleTracks:a};this.log("Updating subtitle tracks, "+a.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(i.Events.SUBTITLE_TRACKS_UPDATED,o),-1!==s&&this.setSubtitleTrack(s,r)}}},f.findTrackId=function(e){for(var t=this.tracksInGroup,n=0;n<t.length;n++){var i=t[n];if((!this.selectDefaultTrack||i.default)&&(!e||e===i.name))return i.id}return-1},f.onError=function(t,n){e.prototype.onError.call(this,t,n),!n.fatal&&n.context&&n.context.type===s.PlaylistContextType.SUBTITLE_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},f.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var n=t.id,r=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 "+n),this.hls.trigger(i.Events.SUBTITLE_TRACK_LOADING,{url:a,id:n,groupId:r,deliveryDirectives:e||null})}},f.toggleTrackModes=function(e){var t=this,n=this.media,i=this.subtitleDisplay,r=this.trackId;if(n){var a=u(n.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[r];o&&(o.mode="disabled")}var l=s[e];l&&(l.mode=i?"showing":"hidden")}},f.setSubtitleTrack=function(e,t){var n,r=this.tracksInGroup;if(this.media){if(this.trackId!==e&&this.toggleTrackModes(e),!(this.trackId===e&&(-1===e||null!==(n=r[e])&&void 0!==n&&n.details)||e<-1||e>=r.length)){this.clearTimer();var a=r[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,c=a.name,u=a.type,h=a.url;this.hls.trigger(i.Events.SUBTITLE_TRACK_SWITCH,{id:s,groupId:l,name:c,type:u,url:h});var d=this.switchParams(a.url,null==t?void 0:t.details);this.loadPlaylist(d)}else this.hls.trigger(i.Events.SUBTITLE_TRACK_SWITCH,{id:e})}}else this.queuedDefaultTrack=e},f.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=u(this.media.textTracks),n=0;n<t.length;n++)if("hidden"===t[n].mode)e=n;else if("showing"===t[n].mode){e=n;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)}},c=a,(h=[{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(c.prototype,h),d&&o(c,d),a}(a.default);function u(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];"subtitles"===i.kind&&i.label&&t.push(e[n])}return t}t.default=c},"./src/controller/timeline-controller.ts":
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./src/controller/timeline-controller.ts ***!
|
|
|
\***********************************************/
|
|
|
/*! exports provided: TimelineController */function(e,t,n){"use strict";n.r(t),n.d(t,"TimelineController",(function(){return d}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../events */"./src/events.ts"),a=n(/*! ../utils/cea-608-parser */"./src/utils/cea-608-parser.ts"),s=n(/*! ../utils/output-filter */"./src/utils/output-filter.ts"),o=n(/*! ../utils/webvtt-parser */"./src/utils/webvtt-parser.ts"),l=n(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),c=n(/*! ../utils/imsc1-ttml-parser */"./src/utils/imsc1-ttml-parser.ts"),u=n(/*! ../types/loader */"./src/types/loader.ts"),h=n(/*! ../utils/logger */"./src/utils/logger.ts"),d=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"),n=new s.default(this,"textTrack2"),i=new s.default(this,"textTrack3"),o=new s.default(this,"textTrack4");this.cea608Parser1=new a.default(1,t,n),this.cea608Parser2=new a.default(3,i,o)}e.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(r.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(r.Events.FRAG_LOADING,this.onFragLoading,this),e.on(r.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(r.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(r.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(r.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(r.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=e.prototype;return t.destroy=function(){var e=this.hls;e.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(r.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(r.Events.FRAG_LOADING,this.onFragLoading,this),e.off(r.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(r.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(r.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(r.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(r.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},t.addCues=function(e,t,n,i,a){for(var s,o,l,c,u=!1,h=a.length;h--;){var d=a[h],f=(s=d[0],o=d[1],l=t,c=n,Math.min(o,c)-Math.max(s,l));if(f>=0&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],n),u=!0,f/(n-t)>.5))return}if(u||a.push([t,n]),this.config.renderTextTracksNatively){var p=this.captionsTracks[e];this.Cues.newCue(p,t,n,i)}else{var g=this.Cues.newCue(null,t,n,i);this.hls.trigger(r.Events.CUES_PARSED,{type:"captions",cues:g,track:e})}},t.onInitPtsFound=function(e,t){var n=this,i=t.frag,a=t.id,s=t.initPTS,o=t.timescale,l=this.unparsedVttFrags;"main"===a&&(this.initPTS[i.cc]=s,this.timescale[i.cc]=o),l.length&&(this.unparsedVttFrags=[],l.forEach((function(e){n.onFragLoaded(r.Events.FRAG_LOADED,e)})))},t.getExistingTrack=function(e){var t=this.media;if(t)for(var n=0;n<t.textTracks.length;n++){var i=t.textTracks[n];if(i[e])return i}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,n=this.captionsTracks,i=this.media,r=t[e],a=r.label,s=r.languageCode,o=this.getExistingTrack(e);if(o)n[e]=o,Object(l.clearCurrentCues)(n[e]),Object(l.sendAddTrackEvent)(n[e],i);else{var c=this.createTextTrack("captions",a,s);c&&(c[e]=!0,n[e]=c)}}},t.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var n={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(r.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}}},t.createTextTrack=function(e,t,n){var i=this.media;if(i)return i.addTextTrack(e,t,n)},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 n=0;n<t.length;n++)Object(l.clearCurrentCues)(t[n])}},t.onSubtitleTracksUpdated=function(e,t){var n=this;this.textTracks=[];var i=t.subtitleTracks||[],a=i.some((function(e){return e.textCodec===c.IMSC1_CODEC}));if(this.config.enableWebVTT||a&&this.config.enableIMSC1){var s=this.tracks&&i&&this.tracks.length===i.length;if(this.tracks=i||[],this.config.renderTextTracksNatively){var o=this.media?this.media.textTracks:[];this.tracks.forEach((function(e,t){var i;if(t<o.length){for(var r=null,a=0;a<o.length;a++)if(f(o[a],e)){r=o[a];break}r&&(i=r)}i?Object(l.clearCurrentCues)(i):(i=n.createTextTrack("subtitles",e.name,e.lang))&&(i.mode="disabled"),i&&(i.groupId=e.groupId,n.textTracks.push(i))}))}else if(!s&&this.tracks&&this.tracks.length){var u=this.tracks.map((function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}));this.hls.trigger(r.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:u})}}},t.onManifestLoaded=function(e,t){var n=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(t){var i="textTrack"+t[1],r=n.captionsProperties[i];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)}}))},t.onFragLoading=function(e,t){var n=this.cea608Parser1,i=this.cea608Parser2,r=this.lastSn,a=this.lastPartIndex;if(this.enabled&&n&&i&&t.frag.type===u.PlaylistLevelType.MAIN){var s,o,l=t.frag.sn,c=null!=(s=null==t||null===(o=t.part)||void 0===o?void 0:o.index)?s:-1;l===r+1||l===r&&c===a+1||(n.reset(),i.reset()),this.lastSn=l,this.lastPartIndex=c}},t.onFragLoaded=function(e,t){var n=t.frag,a=t.payload,s=this.initPTS,o=this.unparsedVttFrags;if(n.type===u.PlaylistLevelType.SUBTITLE)if(a.byteLength){if(!Object(i.isFiniteNumber)(s[n.cc]))return o.push(t),void(s.length&&this.hls.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Missing initial subtitle PTS")}));var l=n.decryptdata;if(null==l||null==l.key||"AES-128"!==l.method){var h=this.tracks[n.level],d=this.vttCCs;d[n.cc]||(d[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),h&&h.textCodec===c.IMSC1_CODEC?this._parseIMSC1(n,a):this._parseVTTs(n,a,d)}}else this.hls.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})},t._parseIMSC1=function(e,t){var n=this,i=this.hls;Object(c.parseIMSC1)(t,this.initPTS[e.cc],this.timescale[e.cc],(function(t){n._appendCues(t,e.level),i.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){h.logger.log("Failed to parse IMSC1: "+t),i.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))},t._parseVTTs=function(e,t,n){var i=this,a=this.hls;Object(o.parseWebVTT)(t,this.initPTS[e.cc],this.timescale[e.cc],n,e.cc,e.start,(function(t){i._appendCues(t,e.level),a.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(n){i._fallbackToIMSC1(e,t),h.logger.log("Failed to parse VTT cue: "+n),a.trigger(r.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})}))},t._fallbackToIMSC1=function(e,t){var n=this,i=this.tracks[e.level];i.textCodec||Object(c.parseIMSC1)(t,this.initPTS[e.cc],this.timescale[e.cc],(function(){i.textCodec=c.IMSC1_CODEC,n._parseIMSC1(e,t)}),(function(){i.textCodec="wvtt"}))},t._appendCues=function(e,t){var n=this.hls;if(this.config.renderTextTracksNatively){var i=this.textTracks[t];if("disabled"===i.mode)return;e.forEach((function(e){return Object(l.addCueToTrack)(i,e)}))}else{var a=this.tracks[t].default?"default":"subtitles"+t;n.trigger(r.Events.CUES_PARSED,{type:"subtitles",cues:e,track:a})}},t.onFragDecrypted=function(e,t){var n=t.frag;if(n.type===u.PlaylistLevelType.SUBTITLE){if(!Object(i.isFiniteNumber)(this.initPTS[n.cc]))return void this.unparsedVttFrags.push(t);this.onFragLoaded(r.Events.FRAG_LOADED,t)}},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){var n=this.cea608Parser1,i=this.cea608Parser2;if(this.enabled&&n&&i)for(var r=0;r<t.samples.length;r++){var a=t.samples[r].bytes;if(a){var s=this.extractCea608Data(a);n.addData(t.samples[r].pts,s[0]),i.addData(t.samples[r].pts,s[1])}}},t.onBufferFlushing=function(e,t){var n=t.startOffset,i=t.endOffset,r=t.endOffsetSubtitles,a=t.type,s=this.media;if(s&&!(s.currentTime<i)){if(!a||"video"===a){var o=this.captionsTracks;Object.keys(o).forEach((function(e){return Object(l.removeCuesInRange)(o[e],n,i)}))}if(this.config.renderTextTracksNatively&&0===n&&void 0!==r){var c=this.textTracks;Object.keys(c).forEach((function(e){return Object(l.removeCuesInRange)(c[e],n,r)}))}}},t.extractCea608Data=function(e){for(var t=31&e[0],n=2,i=[[],[]],r=0;r<t;r++){var a=e[n++],s=127&e[n++],o=127&e[n++],l=3&a;0===s&&0===o||0!=(4&a)&&(0!==l&&1!==l||(i[l].push(s),i[l].push(o)))}return i},e}();function f(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,n){"use strict";n.r(t),n.d(t,"default",(function(){return i}));var i=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,n){"use strict";n.r(t),n.d(t,"removePadding",(function(){return r})),n.d(t,"default",(function(){return a}));var i=n(/*! ../utils/typed-array */"./src/utils/typed-array.ts");function r(e){var t=e.byteLength,n=t&&new DataView(e.buffer).getUint8(t-1);return n?Object(i.sliceUint8)(e,0,t-n):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),n=new Uint32Array(4),i=0;i<4;i++)n[i]=t.getUint32(4*i);return n},t.initTable=function(){var e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],r=n[1],a=n[2],s=n[3],o=this.invSubMix,l=o[0],c=o[1],u=o[2],h=o[3],d=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)d[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,e[f]=v,t[v]=f;var m=d[f],y=d[m],b=d[y],E=257*d[v]^16843008*v;i[f]=E<<24|E>>>8,r[f]=E<<16|E>>>16,a[f]=E<<8|E>>>24,s[f]=E,E=16843009*b^65537*y^257*m^16843008*f,l[v]=E<<24|E>>>8,c[v]=E<<16|E>>>16,u[v]=E<<8|E>>>24,h[v]=E,f?(f=m^d[d[d[b^m]]],p^=d[d[p]]):f=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),n=!0,i=0;i<t.length&&n;)n=t[i]===this.key[i],i++;if(!n){this.key=t;var r=this.keySize=t.length;if(4!==r&&6!==r&&8!==r)throw new Error("Invalid aes key size="+r);var a,s,o,l,c=this.ksRows=4*(r+6+1),u=this.keySchedule=new Uint32Array(c),h=this.invKeySchedule=new Uint32Array(c),d=this.sBox,f=this.rcon,p=this.invSubMix,g=p[0],v=p[1],m=p[2],y=p[3];for(a=0;a<c;a++)a<r?o=u[a]=t[a]:(l=o,a%r==0?(l=d[(l=l<<8|l>>>24)>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l],l^=f[a/r|0]<<24):r>6&&a%r==4&&(l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l]),u[a]=o=(u[a-r]^l)>>>0);for(s=0;s<c;s++)a=c-s,l=3&s?u[a]:u[a-4],h[s]=s<4||a<=4?l:g[d[l>>>24]]^v[d[l>>>16&255]]^m[d[l>>>8&255]]^y[d[255&l]],h[s]=h[s]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,n){for(var i,r,a,s,o,l,c,u,h,d,f,p,g,v,m=this.keySize+6,y=this.invKeySchedule,b=this.invSBox,E=this.invSubMix,k=E[0],C=E[1],S=E[2],x=E[3],w=this.uint8ArrayToUint32Array_(n),T=w[0],_=w[1],O=w[2],A=w[3],L=new Int32Array(e),D=new Int32Array(L.length),R=this.networkToHostOrderSwap;t<L.length;){for(h=R(L[t]),d=R(L[t+1]),f=R(L[t+2]),p=R(L[t+3]),o=h^y[0],l=p^y[1],c=f^y[2],u=d^y[3],g=4,v=1;v<m;v++)i=k[o>>>24]^C[l>>16&255]^S[c>>8&255]^x[255&u]^y[g],r=k[l>>>24]^C[c>>16&255]^S[u>>8&255]^x[255&o]^y[g+1],a=k[c>>>24]^C[u>>16&255]^S[o>>8&255]^x[255&l]^y[g+2],s=k[u>>>24]^C[o>>16&255]^S[l>>8&255]^x[255&c]^y[g+3],o=i,l=r,c=a,u=s,g+=4;i=b[o>>>24]<<24^b[l>>16&255]<<16^b[c>>8&255]<<8^b[255&u]^y[g],r=b[l>>>24]<<24^b[c>>16&255]<<16^b[u>>8&255]<<8^b[255&o]^y[g+1],a=b[c>>>24]<<24^b[u>>16&255]<<16^b[o>>8&255]<<8^b[255&l]^y[g+2],s=b[u>>>24]<<24^b[o>>16&255]<<16^b[l>>8&255]<<8^b[255&c]^y[g+3],D[t]=R(i^T),D[t+1]=R(s^_),D[t+2]=R(a^O),D[t+3]=R(r^A),T=h,_=d,O=f,A=p,t+=4}return D.buffer},e}()},"./src/crypt/decrypter.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/crypt/decrypter.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return c}));var i=n(/*! ./aes-crypto */"./src/crypt/aes-crypto.ts"),r=n(/*! ./fast-aes-key */"./src/crypt/fast-aes-key.ts"),a=n(/*! ./aes-decryptor */"./src/crypt/aes-decryptor.ts"),s=n(/*! ../utils/logger */"./src/utils/logger.ts"),o=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=n(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),c=function(){function e(e,t,n){var i=(void 0===n?{}:n).removePKCS7Padding,r=void 0===i||i;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=r,r)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,n,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(e),t,n);var r=this.flush();r&&i(r.buffer)}else this.webCryptoDecrypt(new Uint8Array(e),t,n).then(i)},t.softwareDecrypt=function(e,t,n){var i=this.currentIV,r=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(e=Object(o.appendUint8Array)(s,e),this.remainderData=null);var c=this.getValidChunk(e);if(!c.length)return null;i&&(n=i);var u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new a.default),u.expandKey(t);var h=r;return this.currentResult=u.decrypt(c.buffer,0,n),this.currentIV=Object(l.sliceUint8)(c,-16).buffer,h||null},t.webCryptoDecrypt=function(e,t,n){var a=this,s=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new r.default(s,t)),this.fastAesKey.expandKey().then((function(t){return s?new i.default(s,n).decrypt(e.buffer,t):Promise.reject(new Error("web crypto not initialized"))})).catch((function(i){return a.onWebCryptoError(i,e,t,n)}))},t.onWebCryptoError=function(e,t,n,i){return s.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",e),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(t,n,i)},t.getValidChunk=function(e){var t=e,n=e.length-e.length%16;return n!==e.length&&(t=Object(l.sliceUint8)(e,0,n),this.remainderData=Object(l.sliceUint8)(e,n)),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,n){"use strict";n.r(t),n.d(t,"default",(function(){return i}));var i=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,n){"use strict";n.r(t);var i=n(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),r=n(/*! ./adts */"./src/demux/adts.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! ../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,n;function i(t,n){var i;return(i=e.call(this)||this).observer=void 0,i.config=void 0,i.observer=t,i.config=n,i}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,o(t,n);var l=i.prototype;return l.resetInitSegment=function(t,n,i){e.prototype.resetInitSegment.call(this,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}},i.probe=function(e){if(!e)return!1;for(var t=(s.getID3Data(e,0)||[]).length,n=e.length;t<n;t++)if(r.probe(e,t))return a.logger.log("ADTS sync word found !"),!0;return!1},l.canParse=function(e,t){return r.canParse(e,t)},l.appendFrame=function(e,t,n){r.initTrackConfig(e,this.observer,t,n,e.manifestCodec);var i=r.appendFrame(e,t,n,this.initPTS,this.frameIndex);if(i&&0===i.missing)return i},i}(i.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,n){"use strict";n.r(t),n.d(t,"getAudioConfig",(function(){return s})),n.d(t,"isHeaderPattern",(function(){return o})),n.d(t,"getHeaderLength",(function(){return l})),n.d(t,"getFullFrameLength",(function(){return c})),n.d(t,"canGetFrameLength",(function(){return u})),n.d(t,"isHeader",(function(){return h})),n.d(t,"canParse",(function(){return d})),n.d(t,"probe",(function(){return f})),n.d(t,"initTrackConfig",(function(){return p})),n.d(t,"getFrameDuration",(function(){return g})),n.d(t,"parseFrameHeader",(function(){return v})),n.d(t,"appendFrame",(function(){return m}));var i=n(/*! ../utils/logger */"./src/utils/logger.ts"),r=n(/*! ../errors */"./src/errors.ts"),a=n(/*! ../events */"./src/events.ts");function s(e,t,n,s){var o,l,c,u,h=navigator.userAgent.toLowerCase(),d=s,f=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=1+((192&t[n+2])>>>6);var p=(60&t[n+2])>>>2;if(!(p>f.length-1))return c=(1&t[n+2])<<2,c|=(192&t[n+3])>>>6,i.logger.log("manifest codec:"+s+", ADTS type:"+o+", samplingIndex:"+p),/firefox/i.test(h)?p>=6?(o=5,u=new Array(4),l=p-3):(o=2,u=new Array(2),l=p):-1!==h.indexOf("android")?(o=2,u=new Array(2),l=p):(o=5,u=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===c||/vivaldi/i.test(h))||!s&&1===c)&&(o=2,u=new Array(2)),l=p)),u[0]=o<<3,u[0]|=(14&p)>>1,u[1]|=(1&p)<<7,u[1]|=c<<3,5===o&&(u[1]|=(14&l)>>1,u[2]=(1&l)<<7,u[2]|=8,u[3]=0),{config:u,samplerate:f[p],channelCount:c,codec:"mp4a.40."+o,manifestCodec:d};e.trigger(a.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.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 c(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function u(e,t){return t+5<e.length}function h(e,t){return t+1<e.length&&o(e,t)}function d(e,t){return u(e,t)&&o(e,t)&&c(e,t)<=e.length-t}function f(e,t){if(h(e,t)){var n=l(e,t);if(t+n>=e.length)return!1;var i=c(e,t);if(i<=n)return!1;var r=t+i;return r===e.length||h(e,r)}return!1}function p(e,t,n,r,a){if(!e.samplerate){var o=s(t,n,r,a);if(!o)return;e.config=o.config,e.samplerate=o.samplerate,e.channelCount=o.channelCount,e.codec=o.codec,e.manifestCodec=o.manifestCodec,i.logger.log("parsed codec:"+e.codec+", rate:"+o.samplerate+", channels:"+o.channelCount)}}function g(e){return 9216e4/e}function v(e,t,n,i,r){var a=l(e,t),s=c(e,t);if((s-=a)>0)return{headerLength:a,frameLength:s,stamp:n+i*r}}function m(e,t,n,i,r){var a=v(t,n,i,r,g(e.samplerate));if(a){var s,o=a.frameLength,l=a.headerLength,c=a.stamp,u=l+o,h=Math.max(0,n+u-t.length);h?(s=new Uint8Array(u-l)).set(t.subarray(n+l,t.length),0):s=t.subarray(n+l,n+u);var d={unit:s,pts:c};return h||e.samples.push(d),{sample:d,length:u,missing:h}}}},"./src/demux/base-audio-demuxer.ts":
|
|
|
/*!*****************************************!*\
|
|
|
!*** ./src/demux/base-audio-demuxer.ts ***!
|
|
|
\*****************************************/
|
|
|
/*! exports provided: initPTSFn, default */function(e,t,n){"use strict";n.r(t),n.d(t,"initPTSFn",(function(){return c}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../demux/id3 */"./src/demux/id3.ts"),a=n(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),s=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),o=n(/*! ../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,n){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,n){},t.demux=function(e,t){this.cachedData&&(e=Object(s.appendUint8Array)(this.cachedData,e),this.cachedData=null);var n,i,l=r.getID3Data(e,0),u=l?l.length:0,h=this._audioTrack,d=this._id3Track,f=l?r.getTimeStamp(l):void 0,p=e.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=c(f,t)),l&&l.length>0&&d.samples.push({pts:this.initPTS,dts:this.initPTS,data:l}),i=this.initPTS;u<p;){if(this.canParse(e,u)){var g=this.appendFrame(h,e,u);g?(this.frameIndex++,i=g.sample.pts,n=u+=g.length):u=p}else r.canParse(e,u)?(l=r.getID3Data(e,u),d.samples.push({pts:i,dts:i,data:l}),n=u+=l.length):u++;if(u===p&&n!==p){var v=Object(o.sliceUint8)(e,n);this.cachedData?this.cachedData=Object(s.appendUint8Array)(this.cachedData,v):this.cachedData=v}}return{audioTrack:h,avcTrack:Object(a.dummyTrack)(),id3Track:d,textTrack:Object(a.dummyTrack)()}},t.demuxSampleAes=function(e,t,n){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}(),c=function(e,t){return Object(i.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,n){"use strict";n.r(t),n.d(t,"default",(function(){return i}));var i=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,n=this.dataLength;return t.length?(e=1===t.length?t[0]:function(e,t){for(var n=new Uint8Array(t),i=0,r=0;r<e.length;r++){var a=e[r];n.set(a,i),i+=a.length}return n}(t,n),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,n){"use strict";function i(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}n.r(t),n.d(t,"dummyTrack",(function(){return i}))},"./src/demux/exp-golomb.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/exp-golomb.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ../utils/logger */"./src/utils/logger.ts"),r=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,n=e.byteLength-t,i=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");i.set(e.subarray(n,n+r)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r},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),n=this.word>>>32-t;return e>32&&i.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?n<<t|this.readBits(t):n},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,n=8,i=0;i<e;i++)0!==n&&(n=(t+this.readEG()+256)%256),t=0===n?t:n},t.readSPS=function(){var e,t,n,i=0,r=0,a=0,s=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();var g=o();if(l(5),h(3),o(),f(),100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g){var v=c();if(3===v&&h(1),f(),f(),h(1),u())for(t=3!==v?8:12,n=0;n<t;n++)u()&&p(n<6?16:64)}f();var m=c();if(0===m)c();else if(1===m)for(h(1),d(),d(),e=c(),n=0;n<e;n++)d();f(),h(1);var y=c(),b=c(),E=l(1);0===E&&h(1),h(1),u()&&(i=c(),r=c(),a=c(),s=c());var k=[1,1];if(u()&&u())switch(o()){case 1:k=[1,1];break;case 2:k=[12,11];break;case 3:k=[10,11];break;case 4:k=[16,11];break;case 5:k=[40,33];break;case 6:k=[24,11];break;case 7:k=[20,11];break;case 8:k=[32,11];break;case 9:k=[80,33];break;case 10:k=[18,11];break;case 11:k=[15,11];break;case 12:k=[64,33];break;case 13:k=[160,99];break;case 14:k=[4,3];break;case 15:k=[3,2];break;case 16:k=[2,1];break;case 255:k=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(y+1)-2*i-2*r),height:(2-E)*(b+1)*16-(E?2:4)*(a+s),pixelRatio:k}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}();t.default=r},"./src/demux/id3.ts":
|
|
|
/*!**************************!*\
|
|
|
!*** ./src/demux/id3.ts ***!
|
|
|
\**************************/
|
|
|
/*! exports provided: isHeader, isFooter, getID3Data, canParse, getTimeStamp, isTimeStampFrame, getID3Frames, decodeFrame, utf8ArrayToStr, testables */function(e,t,n){"use strict";n.r(t),n.d(t,"isHeader",(function(){return r})),n.d(t,"isFooter",(function(){return a})),n.d(t,"getID3Data",(function(){return s})),n.d(t,"canParse",(function(){return l})),n.d(t,"getTimeStamp",(function(){return c})),n.d(t,"isTimeStampFrame",(function(){return u})),n.d(t,"getID3Frames",(function(){return d})),n.d(t,"decodeFrame",(function(){return f})),n.d(t,"utf8ArrayToStr",(function(){return y})),n.d(t,"testables",(function(){return b}));var i,r=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 n=t,i=0;r(e,t);)i+=10,i+=o(e,t+6),a(e,t+10)&&(i+=10),t+=i;if(i>0)return e.subarray(n,n+i)},o=function(e,t){var n=0;return n=(127&e[t])<<21,n|=(127&e[t+1])<<14,n|=(127&e[t+2])<<7,n|=127&e[t+3]},l=function(e,t){return r(e,t)&&o(e,t+6)+10<=e.length-t},c=function(e){for(var t=d(e),n=0;n<t.length;n++){var i=t[n];if(u(i))return m(i)}},u=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},h=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),n=o(e,4);return{type:t,size:n,data:e.subarray(10,10+n)}},d=function(e){for(var t=0,n=[];r(e,t);){for(var i=o(e,t+6),s=(t+=10)+i;t+8<s;){var l=h(e.subarray(t)),c=f(l);c&&n.push(c),t+=l.size+10}a(e,t)&&(t+=10)}return n},f=function(e){return"PRIV"===e.type?p(e):"W"===e.type[0]?v(e):g(e)},p=function(e){if(!(e.size<2)){var t=y(e.data,!0),n=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:n.buffer}}},g=function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,n=y(e.data.subarray(t),!0);t+=n.length+1;var i=y(e.data.subarray(t));return{key:e.type,info:n,data:i}}var r=y(e.data.subarray(1));return{key:e.type,data:r}}},v=function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,n=y(e.data.subarray(t),!0);t+=n.length+1;var i=y(e.data.subarray(t));return{key:e.type,info:n,data:i}}var r=y(e.data);return{key:e.type,data:r}},m=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),n=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,n&&(i+=47721858.84),Math.round(i)}},y=function(e,t){void 0===t&&(t=!1);var n=E();if(n){var i=n.decode(e);if(t){var r=i.indexOf("\0");return-1!==r?i.substring(0,r):i}return i.replace(/\0/g,"")}for(var a,s,o,l=e.length,c="",u=0;u<l;){if(0===(a=e[u++])&&t)return c;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(a);break;case 12:case 13:s=e[u++],c+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=e[u++],o=e[u++],c+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&o)<<0)}}return c},b={decodeTextFrame:g};function E(){return i||void 0===self.TextDecoder||(i=new self.TextDecoder("utf-8")),i}},"./src/demux/mp3demuxer.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/mp3demuxer.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),r=n(/*! ../demux/id3 */"./src/demux/id3.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! ./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,n;function i(){return e.apply(this,arguments)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,o(t,n);var l=i.prototype;return l.resetInitSegment=function(t,n,i){e.prototype.resetInitSegment.call(this,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}},i.probe=function(e){if(!e)return!1;for(var t=(r.getID3Data(e,0)||[]).length,n=e.length;t<n;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,n){if(null!==this.initPTS)return s.appendFrame(e,t,n,this.initPTS,this.frameIndex)},i}(i.default);l.minProbeByteLength=4,t.default=l},"./src/demux/mp4demuxer.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/mp4demuxer.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),r=n(/*! ./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(i.findBox)({data:e,start:0,end:Math.min(e.length,16384)},["moof"]).length>0},t.demux=function(e){var t=e,n=Object(r.dummyTrack)();if(this.config.progressive){this.remainderData&&(t=Object(i.appendUint8Array)(this.remainderData,e));var a=Object(i.segmentValidRange)(t);this.remainderData=a.remainder,n.samples=a.valid||new Uint8Array}else n.samples=t;return{audioTrack:Object(r.dummyTrack)(),avcTrack:n,id3Track:Object(r.dummyTrack)(),textTrack:Object(r.dummyTrack)()}},t.flush=function(){var e=Object(r.dummyTrack)();return e.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(r.dummyTrack)(),avcTrack:e,id3Track:Object(r.dummyTrack)(),textTrack:Object(r.dummyTrack)()}},t.demuxSampleAes=function(e,t,n){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,n){"use strict";n.r(t),n.d(t,"appendFrame",(function(){return l})),n.d(t,"parseHeader",(function(){return c})),n.d(t,"isHeaderPattern",(function(){return u})),n.d(t,"isHeader",(function(){return h})),n.d(t,"canParse",(function(){return d})),n.d(t,"probe",(function(){return f}));var i=null,r=[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,n,i,r){if(!(n+24>t.length)){var a=c(t,n);if(a&&n+a.frameLength<=t.length){var s=i+r*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:t.subarray(n,n+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 c(e,t){var n=e[t+1]>>3&3,l=e[t+1]>>1&3,c=e[t+2]>>4&15,u=e[t+2]>>2&3;if(1!==n&&0!==c&&15!==c&&3!==u){var h=e[t+2]>>1&1,d=e[t+3]>>6,f=1e3*r[14*(3===n?3-l:3===l?3:4)+c-1],p=a[3*(3===n?0:2===n?1:2)+u],g=3===d?1:2,v=s[n][l],m=o[l],y=8*v*m,b=Math.floor(v*f/p+h)*m;if(null===i){var E=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);i=E?parseInt(E[1]):0}return!!i&&i<=87&&2===l&&f>=224e3&&0===d&&(e[t+3]=128|e[t+3]),{sampleRate:p,channelCount:g,frameLength:b,samplesPerFrame:y}}}function u(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function h(e,t){return t+1<e.length&&u(e,t)}function d(e,t){return u(e,t)&&4<=e.length-t}function f(e,t){if(t+1<e.length&&u(e,t)){var n=c(e,t),i=4;null!=n&&n.frameLength&&(i=n.frameLength);var r=t+i;return r===e.length||h(e,r)}return!1}},"./src/demux/sample-aes.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/sample-aes.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),r=n(/*! ./tsdemuxer */"./src/demux/tsdemuxer.ts"),a=function(){function e(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new i.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,n,i){var r=e[t].unit,a=r.subarray(16,r.length-r.length%16),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),o=this;this.decryptBuffer(s,(function(a){var s=new Uint8Array(a);r.set(s,16),i||o.decryptAacSamples(e,t+1,n)}))},t.decryptAacSamples=function(e,t,n){for(;;t++){if(t>=e.length)return void n();if(!(e[t].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(e,t,n,i),!i)return}}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,n=new Int8Array(t),i=0,r=32;r<=e.length-16;r+=160,i+=16)n.set(e.subarray(r,r+16),i);return n},t.getAvcDecryptedUnit=function(e,t){for(var n=new Uint8Array(t),i=0,r=32;r<=e.length-16;r+=160,i+=16)e.set(n.subarray(i,i+16),r);return e},t.decryptAvcSample=function(e,t,n,i,a,s){var o=Object(r.discardEPB)(a.data),l=this.getAvcEncryptedData(o),c=this;this.decryptBuffer(l.buffer,(function(r){a.data=c.getAvcDecryptedUnit(o,r),s||c.decryptAvcSamples(e,t,n+1,i)}))},t.decryptAvcSamples=function(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length)return void i();for(var r=e[t].units;!(n>=r.length);n++){var a=r[n];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(e,t,n,i,a,s),!s)return}}}},e}();t.default=a},"./src/demux/transmuxer-interface.ts":
|
|
|
/*!*******************************************!*\
|
|
|
!*** ./src/demux/transmuxer-interface.ts ***!
|
|
|
\*******************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return h}));var i=n(/*! webworkify-webpack */"./node_modules/webworkify-webpack/index.js"),r=n(/*! ../events */"./src/events.ts"),a=n(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),s=n(/*! ../utils/logger */"./src/utils/logger.ts"),o=n(/*! ../errors */"./src/errors.ts"),l=n(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),c=n(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),u=Object(l.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function e(e,t,n,l){var h=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=n,this.onFlush=l;var d=e.config,f=function(t,n){(n=n||{}).frag=h.frag,n.id=h.id,e.trigger(t,n)};this.observer=new c.EventEmitter,this.observer.on(r.Events.FRAG_DECRYPTED,f),this.observer.on(r.Events.ERROR,f);var p={mp4:u.isTypeSupported("video/mp4"),mpeg:u.isTypeSupported("audio/mpeg"),mp3:u.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(d.enableWorker&&"undefined"!=typeof Worker){var v;s.logger.log("demuxing in webworker");try{v=this.worker=i(/*! ../demux/transmuxer-worker.ts */"./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),v.addEventListener("message",this.onwmsg),v.onerror=function(t){e.trigger(r.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+")")})},v.postMessage({cmd:"init",typeSupported:p,vendor:g,id:t,config:JSON.stringify(d)})}catch(e){s.logger.warn("Error in worker:",e),s.logger.error("Error while initializing DemuxerWorker, fallback to inline"),v&&self.URL.revokeObjectURL(v.objectURL),this.transmuxer=new a.default(this.observer,p,d,g,t),this.worker=null}}else this.transmuxer=new a.default(this.observer,p,d,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 n=this.observer;n&&n.removeAllListeners(),this.observer=null},t.push=function(e,t,n,i,r,o,l,c,u,h){var d=this;u.transmuxing.start=self.performance.now();var f=this.transmuxer,p=this.worker,g=o?o.start:r.start,v=r.decryptdata,m=this.frag,y=!(m&&r.cc===m.cc),b=!(m&&u.level===m.level),E=m?u.sn-m.sn:-1,k=this.part?u.part-this.part.index:1,C=!b&&(1===E||0===E&&1===k),S=self.performance.now();(b||E||0===r.stats.parsing.start)&&(r.stats.parsing.start=S),!o||!k&&C||(o.stats.parsing.start=S);var x=new a.TransmuxState(y,C,c,b,g);if(!C||y){s.logger.log("[transmuxer-interface, "+r.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+"\n discontinuity: "+y+"\n trackSwitch: "+b+"\n contiguous: "+C+"\n accurateTimeOffset: "+c+"\n timeOffset: "+g);var w=new a.TransmuxConfig(n,i,t,l,h);this.configureTransmuxer(w)}if(this.frag=r,this.part=o,p)p.postMessage({cmd:"demux",data:e,decryptdata:v,chunkMeta:u,state:x},e instanceof ArrayBuffer?[e]:[]);else if(f){var T=f.push(e,v,u,x);Object(a.isPromise)(T)?T.then((function(e){d.handleTransmuxComplete(e)})):this.handleTransmuxComplete(T)}},t.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var n=this.transmuxer,i=this.worker;if(i)i.postMessage({cmd:"flush",chunkMeta:e});else if(n){var r=n.flush(e);Object(a.isPromise)(r)?r.then((function(n){t.handleFlushResult(n,e)})):this.handleFlushResult(r,e)}},t.handleFlushResult=function(e,t){var n=this;e.forEach((function(e){n.handleTransmuxComplete(e)})),this.onFlush(t)},t.onWorkerMessage=function(e){var t=e.data,n=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,n.trigger(t.event,t.data)}},t.configureTransmuxer=function(e){var t=this.worker,n=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):n&&n.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,n){"use strict";n.r(t),n.d(t,"default",(function(){return o}));var i=n(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),r=n(/*! ../events */"./src/events.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");function o(e){var t=new s.EventEmitter,n=function(t,n){e.postMessage({event:t,data:n})};t.on(r.Events.FRAG_DECRYPTED,n),t.on(r.Events.ERROR,n),e.addEventListener("message",(function(r){var s=r.data;switch(s.cmd){case"init":var o=JSON.parse(s.config);e.transmuxer=new i.default(t,s.typeSupported,o,s.vendor,s.id),Object(a.enableLogs)(o.debug),n("init",null);break;case"configure":e.transmuxer.configure(s.config);break;case"demux":var c=e.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(i.isPromise)(c)?c.then((function(t){l(e,t)})):l(e,c);break;case"flush":var h=s.chunkMeta,d=e.transmuxer.flush(h);Object(i.isPromise)(d)?d.then((function(t){u(e,t,h)})):u(e,d,h)}}))}function l(e,t){if((n=t.remuxResult).audio||n.video||n.text||n.id3||n.initSegment){var n,i=[],r=t.remuxResult,a=r.audio,s=r.video;a&&c(i,a),s&&c(i,s),e.postMessage({event:"transmuxComplete",data:t},i)}}function c(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function u(e,t,n){t.forEach((function(t){l(e,t)})),e.postMessage({event:"flush",data:n})}},"./src/demux/transmuxer.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/demux/transmuxer.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default, isPromise, TransmuxConfig, TransmuxState */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return y})),n.d(t,"isPromise",(function(){return E})),n.d(t,"TransmuxConfig",(function(){return k})),n.d(t,"TransmuxState",(function(){return C}));var i,r=n(/*! ../events */"./src/events.ts"),a=n(/*! ../errors */"./src/errors.ts"),s=n(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),o=n(/*! ../demux/aacdemuxer */"./src/demux/aacdemuxer.ts"),l=n(/*! ../demux/mp4demuxer */"./src/demux/mp4demuxer.ts"),c=n(/*! ../demux/tsdemuxer */"./src/demux/tsdemuxer.ts"),u=n(/*! ../demux/mp3demuxer */"./src/demux/mp3demuxer.ts"),h=n(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),d=n(/*! ../remux/passthrough-remuxer */"./src/remux/passthrough-remuxer.ts"),f=n(/*! ./chunk-cache */"./src/demux/chunk-cache.ts"),p=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),g=n(/*! ../utils/logger */"./src/utils/logger.ts");try{i=self.performance.now.bind(self.performance)}catch(e){g.logger.debug("Unable to use Performance API on this environment"),i=self.Date.now}var v=[{demux:c.default,remux:h.default},{demux:l.default,remux:d.default},{demux:o.default,remux:h.default},{demux:u.default,remux:h.default}],m=1024;v.forEach((function(e){var t=e.demux;m=Math.max(m,t.minProbeByteLength)}));var y=function(){function e(e,t,n,i,r){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 f.default,this.observer=e,this.typeSupported=t,this.config=n,this.vendor=i,this.id=r}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,n,r){var a=this,s=n.transmuxing;s.executeStart=i();var o=new Uint8Array(e),l=this.cache,c=this.config,u=this.currentTransmuxState,h=this.transmuxConfig;r&&(this.currentTransmuxState=r);var d=function(e,t){var n=null;return e.byteLength>0&&null!=t&&null!=t.key&&null!==t.iv&&null!=t.method&&(n=t),n}(o,t);if(d&&"AES-128"===d.method){var f=this.getDecrypter();if(!c.enableSoftwareAES)return this.decryptionPromise=f.webCryptoDecrypt(o,d.key.buffer,d.iv.buffer).then((function(e){var t=a.push(e,null,n);return a.decryptionPromise=null,t})),this.decryptionPromise;var g=f.softwareDecrypt(o,d.key.buffer,d.iv.buffer);if(!g)return s.executeEnd=i(),b(n);o=new Uint8Array(g)}var v=r||u,m=v.contiguous,y=v.discontinuity,E=v.trackSwitch,k=v.accurateTimeOffset,C=v.timeOffset,S=h.audioCodec,x=h.videoCodec,w=h.defaultInitPts,T=h.duration,_=h.initSegmentData;if((y||E)&&this.resetInitSegment(_,S,x,T),y&&this.resetInitialTimestamp(w),m||this.resetContiguity(),this.needsProbing(o,y,E)){if(l.dataLength){var O=l.flush();o=Object(p.appendUint8Array)(O,o)}this.configureTransmuxer(o,h)}var A=this.transmux(o,d,C,k,n),L=this.currentTransmuxState;return L.contiguous=!0,L.discontinuity=!1,L.trackSwitch=!1,s.executeEnd=i(),A},t.flush=function(e){var t=this,n=e.transmuxing;n.executeStart=i();var s=this.decrypter,o=this.cache,l=this.currentTransmuxState,c=this.decryptionPromise;if(c)return c.then((function(){return t.flush(e)}));var u=[],h=l.timeOffset;if(s){var d=s.flush();d&&u.push(this.push(d,null,e))}var f=o.dataLength;o.reset();var p=this.demuxer,g=this.remuxer;if(!p||!g)return f>=m&&this.observer.emit(r.Events.ERROR,r.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),n.executeEnd=i(),[b(e)];var v=p.flush(h);return E(v)?v.then((function(n){return t.flushRemux(u,n,e),u})):(this.flushRemux(u,v,e),u)},t.flushRemux=function(e,t,n){var r=t.audioTrack,a=t.avcTrack,s=t.id3Track,o=t.textTrack,l=this.currentTransmuxState,c=l.accurateTimeOffset,u=l.timeOffset;g.logger.log("[transmuxer.ts]: Flushed fragment "+n.sn+(n.part>-1?" p: "+n.part:"")+" of level "+n.level);var h=this.remuxer.remux(r,a,s,o,u,c,!0,this.id);e.push({remuxResult:h,chunkMeta:n}),n.transmuxing.executeEnd=i()},t.resetInitialTimestamp=function(e){var t=this.demuxer,n=this.remuxer;t&&n&&(t.resetTimeStamp(e),n.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,n,i){var r=this.demuxer,a=this.remuxer;r&&a&&(r.resetInitSegment(t,n,i),a.resetInitSegment(e,t,n))},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,n,i,r){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,n,i,r):this.transmuxUnencrypted(e,n,i,r)},t.transmuxUnencrypted=function(e,t,n,i){var r=this.demuxer.demux(e,t,!1,!this.config.progressive),a=r.audioTrack,s=r.avcTrack,o=r.id3Track,l=r.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,l,t,n,!1,this.id),chunkMeta:i}},t.transmuxSampleAes=function(e,t,n,i,r){var a=this;return this.demuxer.demuxSampleAes(e,t,n).then((function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.avcTrack,e.id3Track,e.textTrack,n,i,!1,a.id),chunkMeta:r}}))},t.configureTransmuxer=function(e,t){for(var n,i=this.config,r=this.observer,a=this.typeSupported,s=this.vendor,o=t.audioCodec,c=t.defaultInitPts,u=t.duration,h=t.initSegmentData,f=t.videoCodec,p=0,m=v.length;p<m;p++)if(v[p].demux.probe(e)){n=v[p];break}n||(g.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),n={demux:l.default,remux:d.default});var y=this.demuxer,b=this.remuxer,E=n.remux,k=n.demux;b&&b instanceof E||(this.remuxer=new E(r,i,a,s)),y&&y instanceof k||(this.demuxer=new k(r,i,a),this.probe=k.probe),this.resetInitSegment(h,o,f,u),this.resetInitialTimestamp(c)},t.needsProbing=function(e,t,n){return!this.demuxer||!this.remuxer||t||n},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 k=function(e,t,n,i,r){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=n,this.duration=i,this.defaultInitPts=r},C=function(e,t,n,i,r){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=n,this.trackSwitch=i,this.timeOffset=r}},"./src/demux/tsdemuxer.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/demux/tsdemuxer.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: discardEPB, default */function(e,t,n){"use strict";n.r(t),n.d(t,"discardEPB",(function(){return E}));var i=n(/*! ./adts */"./src/demux/adts.ts"),r=n(/*! ./mpegaudio */"./src/demux/mpegaudio.ts"),a=n(/*! ./exp-golomb */"./src/demux/exp-golomb.ts"),s=n(/*! ./id3 */"./src/demux/id3.ts"),o=n(/*! ./sample-aes */"./src/demux/sample-aes.ts"),l=n(/*! ../events */"./src/events.ts"),c=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),u=n(/*! ../utils/logger */"./src/utils/logger.ts"),h=n(/*! ../errors */"./src/errors.ts"),d={video:1,audio:2,id3:3,text:4},f=function(){function e(e,t,n){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=n}e.probe=function(t){var n=e.syncOffset(t);return!(n<0||(n&&u.logger.warn("MPEG2-TS detected but first sync word found @ offset "+n+", junk ahead ?"),0))},e.syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),n=0;n<t;){if(71===e[n]&&71===e[n+188]&&71===e[n+376])return n;n++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:d[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,n,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=e.createTrack("video",i),this._audioTrack=e.createTrack("audio",i),this._id3Track=e.createTrack("id3",i),this._txtTrack=e.createTrack("text",i),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=t,this.videoCodec=n,this._duration=i},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,n=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},t.demux=function(t,n,i,r){var a;void 0===i&&(i=!1),void 0===r&&(r=!1),i||(this.sampleAes=null);var s=this._avcTrack,o=this._audioTrack,d=this._id3Track,f=s.pid,p=s.pesData,y=o.pid,b=d.pid,E=o.pesData,k=d.pesData,C=!1,S=this.pmtParsed,x=this._pmtId,w=t.length;if(this.remainderData&&(w=(t=Object(c.appendUint8Array)(this.remainderData,t)).length,this.remainderData=null),w<188&&!r)return this.remainderData=t,{audioTrack:o,avcTrack:s,id3Track:d,textTrack:this._txtTrack};var T=Math.max(0,e.syncOffset(t));(w-=(w+T)%188)<t.byteLength&&!r&&(this.remainderData=new Uint8Array(t.buffer,w,t.buffer.byteLength-w));for(var _=T;_<w;_+=188)if(71===t[_]){var O=!!(64&t[_+1]),A=((31&t[_+1])<<8)+t[_+2],L=void 0;if((48&t[_+3])>>4>1){if((L=_+5+t[_+4])===_+188)continue}else L=_+4;switch(A){case f:O&&(p&&(a=m(p))&&this.parseAVCPES(a,!1),p={data:[],size:0}),p&&(p.data.push(t.subarray(L,_+188)),p.size+=_+188-L);break;case y:O&&(E&&(a=m(E))&&(o.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),E={data:[],size:0}),E&&(E.data.push(t.subarray(L,_+188)),E.size+=_+188-L);break;case b:O&&(k&&(a=m(k))&&this.parseID3PES(a),k={data:[],size:0}),k&&(k.data.push(t.subarray(L,_+188)),k.size+=_+188-L);break;case 0:O&&(L+=t[L]+1),x=this._pmtId=g(t,L);break;case x:O&&(L+=t[L]+1);var D=v(t,L,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,i);(f=D.avc)>0&&(s.pid=f),(y=D.audio)>0&&(o.pid=y,o.isAAC=D.isAAC),(b=D.id3)>0&&(d.pid=b),C&&!S&&(u.logger.log("reparse from beginning"),C=!1,_=T-188),S=this.pmtParsed=!0;break;case 17:case 8191:break;default:C=!0}}else this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s.pesData=p,o.pesData=E,d.pesData=k;var R={audioTrack:o,avcTrack:s,id3Track:d,textTrack:this._txtTrack};return r&&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,n=e.audioTrack,i=e.avcTrack,r=e.id3Track,a=i.pesData,s=n.pesData,o=r.pesData;a&&(t=m(a))?(this.parseAVCPES(t,!0),i.pesData=null):i.pesData=a,s&&(t=m(s))?(n.isAAC?this.parseAACPES(t):this.parseMPEGPES(t),n.pesData=null):(null!=s&&s.size&&u.logger.log("last AAC PES packet truncated,might overlap between fragments"),n.pesData=s),o&&(t=m(o))?(this.parseID3PES(t),r.pesData=null):r.pesData=o},t.demuxSampleAes=function(e,t,n){var i=this.demux(e,n,!0,!this.config.progressive),r=this.sampleAes=new o.default(this.observer,this.config,t);return this.decrypt(i,r)},t.decrypt=function(e,t){return new Promise((function(n){var i=e.audioTrack,r=e.avcTrack;i.samples&&i.isAAC?t.decryptAacSamples(i.samples,0,(function(){r.samples?t.decryptAvcSamples(r.samples,0,0,(function(){n(e)})):n(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(function(){n(e)}))}))},t.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},t.parseAVCPES=function(e,t){var n,i=this,r=this._avcTrack,o=this.parseAVCNALu(e.data),l=this.avcSample,c=!1;e.data=null,l&&o.length&&!r.audFound&&(y(l,r),l=this.avcSample=p(!1,e.pts,e.dts,"")),o.forEach((function(t){switch(t.type){case 1:n=!0,l||(l=i.avcSample=p(!0,e.pts,e.dts,"")),l.frame=!0;var o=t.data;if(c&&o.length>4){var u=new a.default(o).readSliceType();2!==u&&4!==u&&7!==u&&9!==u||(l.key=!0)}break;case 5:n=!0,l||(l=i.avcSample=p(!0,e.pts,e.dts,"")),l.key=!0,l.frame=!0;break;case 6:n=!0;var h=new a.default(E(t.data));h.readUByte();for(var d=0,f=0,g=!1,v=0;!g&&h.bytesAvailable>1;){d=0;do{d+=v=h.readUByte()}while(255===v);f=0;do{f+=v=h.readUByte()}while(255===v);if(4===d&&0!==h.bytesAvailable){if(g=!0,181===h.readUByte()&&49===h.readUShort()&&1195456820===h.readUInt()&&3===h.readUByte()){for(var m=h.readUByte(),k=31&m,C=[m,h.readUByte()],S=0;S<k;S++)C.push(h.readUByte()),C.push(h.readUByte()),C.push(h.readUByte());b(i._txtTrack.samples,{type:3,pts:e.pts,bytes:C})}}else if(5===d&&0!==h.bytesAvailable){if(g=!0,f>16){for(var x=[],w=0;w<16;w++)x.push(h.readUByte().toString(16)),3!==w&&5!==w&&7!==w&&9!==w||x.push("-");for(var T=f-16,_=new Uint8Array(T),O=0;O<T;O++)_[O]=h.readUByte();b(i._txtTrack.samples,{pts:e.pts,payloadType:d,uuid:x.join(""),userData:Object(s.utf8ArrayToStr)(_),userDataBytes:_})}}else if(f<h.bytesAvailable)for(var A=0;A<f;A++)h.readUByte()}break;case 7:if(n=!0,c=!0,!r.sps){var L=new a.default(t.data).readSPS();r.width=L.width,r.height=L.height,r.pixelRatio=L.pixelRatio,r.sps=[t.data],r.duration=i._duration;for(var D=t.data.subarray(1,4),R="avc1.",I=0;I<3;I++){var N=D[I].toString(16);N.length<2&&(N="0"+N),R+=N}r.codec=R}break;case 8:n=!0,r.pps||(r.pps=[t.data]);break;case 9:n=!1,r.audFound=!0,l&&y(l,r),l=i.avcSample=p(!1,e.pts,e.dts,"");break;case 12:n=!1;break;default:n=!1,l&&(l.debug+="unknown NAL "+t.type+" ")}l&&n&&l.units.push(t)})),t&&l&&(y(l,r),this.avcSample=null)},t.getLastNalUnit=function(){var e,t,n=this.avcSample;if(!n||0===n.units.length){var i=this._avcTrack.samples;n=i[i.length-1]}if(null!==(e=n)&&void 0!==e&&e.units){var r=n.units;t=r[r.length-1]}return t},t.parseAVCNALu=function(e){var t,n,i=e.byteLength,r=this._avcTrack,a=r.naluState||0,s=a,o=[],l=0,c=-1,u=0;for(-1===a&&(c=0,u=31&e[0],a=0,l=1);l<i;)if(t=e[l++],a)if(1!==a)if(t)if(1===t){if(c>=0){var h={data:e.subarray(c,l-a-1),type:u};o.push(h)}else{var d=this.getLastNalUnit();if(d&&(s&&l<=4-s&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-s)),(n=l-a-1)>0)){var f=new Uint8Array(d.data.byteLength+n);f.set(d.data,0),f.set(e.subarray(0,n),d.data.byteLength),d.data=f,d.state=0}}l<i?(c=l,u=31&e[l],a=0):a=-1}else a=0;else a=3;else a=t?0:2;else a=t?0:1;if(c>=0&&a>=0){var p={data:e.subarray(c,i),type:u,state:a};o.push(p)}if(0===o.length){var g=this.getLastNalUnit();if(g){var v=new Uint8Array(g.data.byteLength+e.byteLength);v.set(g.data,0),v.set(e,g.data.byteLength),g.data=v}}return r.naluState=a,o},t.parseAACPES=function(e){var t,n,r,a,s,o=0,c=this._audioTrack,d=this.aacOverFlow,f=e.data;if(d){this.aacOverFlow=null;var p=d.sample.unit.byteLength,g=Math.min(d.missing,p),v=p-g;d.sample.unit.set(f.subarray(0,g),v),c.samples.push(d.sample),o=d.missing}for(t=o,n=f.length;t<n-1&&!i.isHeader(f,t);t++);if(t===o||(t<n-1?(r="AAC PES did not start with ADTS header,offset:"+t,a=!1):(r="no ADTS header found in AAC PES",a=!0),u.logger.warn("parsing error:"+r),this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:a,reason:r}),!a)){if(i.initTrackConfig(c,this.observer,f,t,this.audioCodec),void 0!==e.pts)s=e.pts;else{if(!d)return void u.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var m=i.getFrameDuration(c.samplerate);s=d.sample.pts+m}for(var y=0;t<n;){if(i.isHeader(f,t)){if(t+5<n){var b=i.appendFrame(c,f,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,n=t.length,i=0,a=0,s=e.pts;if(void 0!==s)for(;a<n;)if(r.isHeader(t,a)){var o=r.appendFrame(this._audioTrack,t,a,s,i);if(!o)break;a+=o.length,i++}else a++;else u.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},t.parseID3PES=function(e){void 0!==e.pts?this._id3Track.samples.push(e):u.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},e}();function p(e,t,n,i){return{key:e,frame:!1,pts:t,dts:n,units:[],debug:i,length:0}}function g(e,t){return(31&e[t+10])<<8|e[t+11]}function v(e,t,n,i){var r={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(!i){u.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===r.audio&&(r.audio=s);break;case 21:-1===r.id3&&(r.id3=s);break;case 219:if(!i){u.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===r.avc&&(r.avc=s);break;case 3:case 4:n?-1===r.audio&&(r.audio=s,r.isAAC=!1):u.logger.log("MPEG audio found, not supported in this browser");break;case 36:u.logger.warn("Unsupported HEVC stream type found")}t+=5+((15&e[t+3])<<8|e[t+4])}return r}function m(e){var t,n,i,r,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((n=(t[4]<<8)+t[5])&&n>e.size-6)return null;var c=t[7];192&c&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&c?r-(a=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(u.logger.warn(Math.round((r-a)/9e4)+"s delta between PTS and DTS, align them"),r=a):a=r);var h=(i=t[8])+9;if(e.size<=h)return null;e.size-=h;for(var d=new Uint8Array(e.size),f=0,p=o.length;f<p;f++){var g=(t=o[f]).byteLength;if(h){if(h>g){h-=g;continue}t=t.subarray(h),g-=h,h=0}d.set(t,s),s+=g}return n&&(n-=i+3),{data:d,pts:r,dts:a,len:n}}return null}function y(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var n=t.samples,i=n.length;if(!i)return void t.dropped++;var r=n[i-1];e.pts=r.pts,e.dts=r.dts}t.samples.push(e)}e.debug.length&&u.logger.log(e.pts+"/"+e.dts+":"+e.debug)}function b(e,t){var n=e.length;if(n>0){if(t.pts>=e[n-1].pts)e.push(t);else for(var i=n-1;i>=0;i--)if(t.pts<e[i].pts){e.splice(i,0,t);break}}else e.push(t)}function E(e){for(var t=e.byteLength,n=[],i=1;i<t-2;)0===e[i]&&0===e[i+1]&&3===e[i+2]?(n.push(i+2),i+=2):i++;if(0===n.length)return e;var r=t-n.length,a=new Uint8Array(r),s=0;for(i=0;i<r;s++,i++)s===n[0]&&(s++,n.shift()),a[i]=e[s];return a}f.minProbeByteLength=188,t.default=f},"./src/errors.ts":
|
|
|
/*!***********************!*\
|
|
|
!*** ./src/errors.ts ***!
|
|
|
\***********************/
|
|
|
/*! exports provided: ErrorTypes, ErrorDetails */function(e,t,n){"use strict";var i,r;n.r(t),n.d(t,"ErrorTypes",(function(){return i})),n.d(t,"ErrorDetails",(function(){return r})),function(e){e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError"}(i||(i={})),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"}(r||(r={}))},"./src/events.ts":
|
|
|
/*!***********************!*\
|
|
|
!*** ./src/events.ts ***!
|
|
|
\***********************/
|
|
|
/*! exports provided: Events */function(e,t,n){"use strict";var i;n.r(t),n.d(t,"Events",(function(){return i})),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"}(i||(i={}))},"./src/hls.ts":
|
|
|
/*!********************!*\
|
|
|
!*** ./src/hls.ts ***!
|
|
|
\********************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return y}));var i=n(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),r=n(/*! ./loader/playlist-loader */"./src/loader/playlist-loader.ts"),a=n(/*! ./loader/key-loader */"./src/loader/key-loader.ts"),s=n(/*! ./controller/id3-track-controller */"./src/controller/id3-track-controller.ts"),o=n(/*! ./controller/latency-controller */"./src/controller/latency-controller.ts"),l=n(/*! ./controller/level-controller */"./src/controller/level-controller.ts"),c=n(/*! ./controller/fragment-tracker */"./src/controller/fragment-tracker.ts"),u=n(/*! ./controller/stream-controller */"./src/controller/stream-controller.ts"),h=n(/*! ./is-supported */"./src/is-supported.ts"),d=n(/*! ./utils/logger */"./src/utils/logger.ts"),f=n(/*! ./config */"./src/config.ts"),p=n(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),g=n(/*! ./events */"./src/events.ts"),v=n(/*! ./errors */"./src/errors.ts");function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}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 n=this.config=Object(f.mergeConfig)(e.DefaultConfig,t);this.userConfig=t,Object(d.enableLogs)(n.debug),this._autoLevelCapping=-1,n.progressive&&Object(f.enableStreamingMode)(n);var i=n.abrController,h=n.bufferController,g=n.capLevelController,v=n.fpsController,m=this.abrController=new i(this),y=this.bufferController=new h(this),b=this.capLevelController=new g(this),E=new v(this),k=new r.default(this),C=new a.default(this),S=new s.default(this),x=this.levelController=new l.default(this),w=new c.FragmentTracker(this),T=this.streamController=new u.default(this,w);b.setStreamController(T),E.setStreamController(T);var _=[x,T];this.networkControllers=_;var O=[k,C,m,y,b,E,S,w];this.audioTrackController=this.createController(n.audioTrackController,null,_),this.createController(n.audioStreamController,w,_),this.subtitleTrackController=this.createController(n.subtitleTrackController,null,_),this.createController(n.subtitleStreamController,w,_),this.createController(n.timelineController,null,O),this.emeController=this.createController(n.emeController,null,O),this.cmcdController=this.createController(n.cmcdController,null,O),this.latencyController=this.createController(o.default,null,O),this.coreComponents=O}e.isSupported=function(){return Object(h.isSupported)()};var t,n,y,b=e.prototype;return b.createController=function(e,t,n){if(e){var i=t?new e(this,t):new e(this);return n&&n.push(i),i}return null},b.on=function(e,t,n){void 0===n&&(n=this),this._emitter.on(e,t,n)},b.once=function(e,t,n){void 0===n&&(n=this),this._emitter.once(e,t,n)},b.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},b.off=function(e,t,n,i){void 0===n&&(n=this),this._emitter.off(e,t,n,i)},b.listeners=function(e){return this._emitter.listeners(e)},b.emit=function(e,t,n){return this._emitter.emit(e,t,n)},b.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){d.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:v.ErrorTypes.OTHER_ERROR,details:v.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,error:t})}return!1},b.listenerCount=function(e){return this._emitter.listenerCount(e)},b.destroy=function(){d.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){d.logger.log("attachMedia"),this._media=e,this.trigger(g.Events.MEDIA_ATTACHING,{media:e})},b.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(g.Events.MEDIA_DETACHING,void 0),this._media=null},b.loadSource=function(e){this.stopLoad();var t=this.media,n=this.url,r=this.url=i.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});d.logger.log("loadSource:"+r),t&&n&&n!==r&&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),d.logger.log("startLoad("+e+")"),this.networkControllers.forEach((function(t){t.startLoad(e)}))},b.stopLoad=function(){d.logger.log("stopLoad"),this.networkControllers.forEach((function(e){e.stopLoad()}))},b.swapAudioCodec=function(){d.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},b.recoverMediaError=function(){d.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 v.ErrorTypes}},{key:"ErrorDetails",get:function(){return v.ErrorDetails}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:f.hlsDefaultConfig},set:function(t){e.defaultConfig=t}}],(n=[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){d.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){d.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){d.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){d.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){d.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&&(d.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 n=e.length,i=0;i<n;i++)if(e[i].maxBitrate>t)return i;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}}])&&m(t.prototype,n),y&&m(t,y),e}();y.defaultConfig=void 0},"./src/is-supported.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/is-supported.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: isSupported, changeTypeSupported */function(e,t,n){"use strict";n.r(t),n.d(t,"isSupported",(function(){return a})),n.d(t,"changeTypeSupported",(function(){return s}));var i=n(/*! ./utils/mediasource-helper */"./src/utils/mediasource-helper.ts");function r(){return self.SourceBuffer||self.WebKitSourceBuffer}function a(){var e=Object(i.getMediaSource)();if(!e)return!1;var t=r(),n=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!!n&&!!a}function s(){var e,t=r();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,n){"use strict";n.r(t),n.d(t,"default",(function(){return h})),n.d(t,"LoadError",(function(){return f}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../errors */"./src/errors.ts");function a(e){var t="function"==typeof Map?new Map:void 0;return(a=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,i)}function i(){return s(e,arguments,c(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),l(i,e)})(e)}function s(e,t,n){return(s=o()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&l(r,n.prototype),r}).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 c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=Math.pow(2,17),h=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 n=this,i=e.url;if(!i)return Promise.reject(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(i?"part list":"url")));this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(i,l){n.loader&&n.loader.destroy();var c=n.loader=e.loader=s?new s(a):new o(a),h=d(e),p={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:u};e.stats=c.stats,c.load(h,p,{onSuccess:function(t,r,a,s){n.resetLoader(e,c),i({frag:e,part:null,payload:t.data,networkDetails:s})},onError:function(t,i,a){n.resetLoader(e,c),l(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t,networkDetails:a}))},onAbort:function(t,i,a){n.resetLoader(e,c),l(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:a}))},onTimeout:function(t,i,a){n.resetLoader(e,c),l(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:a}))},onProgress:function(n,i,r,a){t&&t({frag:e,part:null,payload:r,networkDetails:a})}})}))},t.loadPart=function(e,t,n){var i=this;this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(l,c){i.loader&&i.loader.destroy();var h=i.loader=e.loader=s?new s(a):new o(a),p=d(e,t),g={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:u};t.stats=h.stats,h.load(p,g,{onSuccess:function(r,a,s,o){i.resetLoader(e,h),i.updateStatsFromPart(e,t);var c={frag:e,part:t,payload:r.data,networkDetails:o};n(c),l(c)},onError:function(n,a,s){i.resetLoader(e,h),c(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:n,networkDetails:s}))},onAbort:function(n,a,s){e.stats.aborted=t.stats.aborted,i.resetLoader(e,h),c(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:s}))},onTimeout:function(n,a,s){i.resetLoader(e,h),c(new f({type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:s}))}})}))},t.updateStatsFromPart=function(e,t){var n=e.stats,i=t.stats,r=i.total;if(n.loaded+=i.loaded,r){var a=Math.round(e.duration/t.duration),s=Math.min(Math.round(n.loaded/r),a),o=(a-s)*Math.round(n.loaded/s);n.total=n.loaded+o}else n.total=Math.max(n.loaded,n.total);var l=n.loading,c=i.loading;l.start?l.first+=c.first-c.start:(l.start=c.start,l.first=c.first),l.end=c.end},t.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},e}();function d(e,t){void 0===t&&(t=null);var n=t||e,r={frag:e,part:t,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},a=n.byteRangeStartOffset,s=n.byteRangeEndOffset;return Object(i.isFiniteNumber)(a)&&Object(i.isFiniteNumber)(s)&&(r.rangeStart=a,r.rangeEnd=s),r}var f=function(e){var t,n;function i(t){for(var n,i=arguments.length,r=new Array(i>1?i-1:0),a=1;a<i;a++)r[a-1]=arguments[a];return(n=e.call.apply(e,[this].concat(r))||this).data=void 0,n.data=t,n}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,l(t,n),i}(a(Error))},"./src/loader/fragment.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/loader/fragment.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: ElementaryStreamTypes, BaseSegment, Fragment, Part */function(e,t,n){"use strict";n.r(t),n.d(t,"ElementaryStreamTypes",(function(){return i})),n.d(t,"BaseSegment",(function(){return f})),n.d(t,"Fragment",(function(){return p})),n.d(t,"Part",(function(){return g}));var i,r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),a=n(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),s=n(/*! ../utils/logger */"./src/utils/logger.ts"),o=n(/*! ./level-key */"./src/loader/level-key.ts"),l=n(/*! ./load-stats */"./src/loader/load-stats.ts");function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function d(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}!function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"}(i||(i={}));var f=function(){function e(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[i.AUDIO]=null,t[i.VIDEO]=null,t[i.AUDIOVIDEO]=null,t),this.baseurl=e}return e.prototype.setByteRange=function(e,t){var n=e.split("@",2),i=[];1===n.length?i[0]=t?t.byteRangeEndOffset:0:i[0]=parseInt(n[1]),i[1]=parseInt(n[0])+i[0],this._byteRange=i},d(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,n){var i;return(i=e.call(this,n)||this)._decryptdata=null,i.rawProgramDateTime=null,i.programDateTime=null,i.tagList=[],i.duration=0,i.sn=0,i.levelkey=void 0,i.type=void 0,i.loader=null,i.level=-1,i.cc=0,i.startPTS=void 0,i.endPTS=void 0,i.appendedPTS=void 0,i.startDTS=void 0,i.endDTS=void 0,i.start=0,i.deltaPTS=void 0,i.maxStartPTS=void 0,i.minEndPTS=void 0,i.stats=new l.LoadStats,i.urlId=0,i.data=void 0,i.bitrateTest=!1,i.title=null,i.initSegment=null,i.type=t,i}c(t,e);var n=t.prototype;return n.createInitializationVector=function(e){for(var t=new Uint8Array(16),n=12;n<16;n++)t[n]=e>>8*(15-n)&255;return t},n.setDecryptDataFromLevelKey=function(e,t){var n=e;return"AES-128"===(null==e?void 0:e.method)&&e.uri&&!e.iv&&((n=o.LevelKey.fromURI(e.uri)).method=e.method,n.iv=this.createInitializationVector(t),n.keyFormat="identity"),n},n.setElementaryStreamInfo=function(e,t,n,i,r,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,n),o.startDTS=Math.min(o.startDTS,i),o.endDTS=Math.max(o.endDTS,r)):s[e]={startPTS:t,endPTS:n,startDTS:i,endDTS:r,partial:a}},n.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[i.AUDIO]=null,e[i.VIDEO]=null,e[i.AUDIOVIDEO]=null},d(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(r.isFiniteNumber)(this.programDateTime))return null;var e=Object(r.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}(f),g=function(e){function t(t,n,i,r,a){var s;(s=e.call(this,i)||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=n,s.index=r;var o=t.enumeratedString("BYTERANGE");return o&&s.setByteRange(o,a),a&&(s.fragOffset=a.fragOffset+a.duration),s}return c(t,e),d(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}(f)},"./src/loader/key-loader.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/loader/key-loader.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return s}));var i=n(/*! ../events */"./src/events.ts"),r=n(/*! ../errors */"./src/errors.ts"),a=n(/*! ../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(i.Events.KEY_LOADING,this.onKeyLoading,this)},t._unregisterListeners=function(){this.hls.off(i.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 n=t.frag,r=n.type,s=this.loaders[r];if(n.decryptdata){var o=n.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:"+r),s.abort()),!o)return void a.logger.warn("key uri is falsy");var c=l.loader,u=n.loader=this.loaders[r]=new c(l);this.decrypturl=o,this.decryptkey=null;var h={url:o,frag:n,responseType:"arraybuffer"},d={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(h,d,f)}else this.decryptkey&&(n.decryptdata.key=this.decryptkey,this.hls.trigger(i.Events.KEY_LOADED,{frag:n}))}else a.logger.warn("Missing decryption data on fragment in onKeyLoading")},t.loadsuccess=function(e,t,n){var r=n.frag;r.decryptdata?(this.decryptkey=r.decryptdata.key=new Uint8Array(e.data),r.loader=null,delete this.loaders[r.type],this.hls.trigger(i.Events.KEY_LOADED,{frag:r})):a.logger.error("after key load, decryptdata unset")},t.loaderror=function(e,t){var n=t.frag,a=n.loader;a&&a.abort(),delete this.loaders[n.type],this.hls.trigger(i.Events.ERROR,{type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:n,response:e})},t.loadtimeout=function(e,t){var n=t.frag,a=n.loader;a&&a.abort(),delete this.loaders[n.type],this.hls.trigger(i.Events.ERROR,{type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:n})},e}()},"./src/loader/level-details.ts":
|
|
|
/*!*************************************!*\
|
|
|
!*** ./src/loader/level-details.ts ***!
|
|
|
\*************************************/
|
|
|
/*! exports provided: LevelDetails */function(e,t,n){"use strict";n.r(t),n.d(t,"LevelDetails",(function(){return a}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts");function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}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,n,a;return e.prototype.reloaded=function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t,this.advanced=this.endSN>e.endSN||t>0||0===t&&n>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay},t=e,(n=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(i.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}}])&&r(t.prototype,n),a&&r(t,a),e}()},"./src/loader/level-key.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/loader/level-key.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: LevelKey */function(e,t,n){"use strict";n.r(t),n.d(t,"LevelKey",(function(){return a}));var i=n(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js");function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}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(i.buildAbsoluteURL)(e,t,{alwaysNormalize:!0}):e}var t,n,a;return e.fromURL=function(t,n){return new e(t,n)},e.fromURI=function(t){return new e(t)},t=e,(n=[{key:"uri",get:function(){return this._uri}}])&&r(t.prototype,n),a&&r(t,a),e}()},"./src/loader/load-stats.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/loader/load-stats.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: LoadStats */function(e,t,n){"use strict";n.r(t),n.d(t,"LoadStats",(function(){return i}));var i=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,n){"use strict";n.r(t),n.d(t,"default",(function(){return v}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),a=n(/*! ./fragment */"./src/loader/fragment.ts"),s=n(/*! ./level-details */"./src/loader/level-details.ts"),o=n(/*! ./level-key */"./src/loader/level-key.ts"),l=n(/*! ../utils/attr-list */"./src/utils/attr-list.ts"),c=n(/*! ../utils/logger */"./src/utils/logger.ts"),u=n(/*! ../utils/codecs */"./src/utils/codecs.ts"),h=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,d=/#EXT-X-MEDIA:(.*)/g,f=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,v=function(){function e(){}return e.findGroup=function(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(i.id===t)return i}},e.convertAVC1ToAVCOTI=function(e){var t=e.split(".");if(t.length>2){var n=t.shift()+".";return n+=parseInt(t.shift()).toString(16),n+=("000"+parseInt(t.shift()).toString(16)).substr(-4)}return e},e.resolve=function(e,t){return r.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,n){var i,r=[],a={},s=!1;for(h.lastIndex=0;null!=(i=h.exec(t));)if(i[1]){var o=new l.AttrList(i[1]),c={attrs:o,bitrate:o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),name:o.NAME,url:e.resolve(i[2],n)},u=o.decimalResolution("RESOLUTION");u&&(c.width=u.width,c.height=u.height),m((o.CODECS||"").split(/[ ,]+/).filter((function(e){return e})),c),c.videoCodec&&-1!==c.videoCodec.indexOf("avc1")&&(c.videoCodec=e.convertAVC1ToAVCOTI(c.videoCodec)),r.push(c)}else if(i[3]){var d=new l.AttrList(i[3]);d["DATA-ID"]&&(s=!0,a[d["DATA-ID"]]=d)}return{levels:r,sessionData:s?a:null}},e.parseMasterPlaylistMedia=function(t,n,i,r){var a;void 0===r&&(r=[]);var s=[],o=0;for(d.lastIndex=0;null!==(a=d.exec(t));){var c=new l.AttrList(a[1]);if(c.TYPE===i){var u={attrs:c,bitrate:0,id:o++,groupId:c["GROUP-ID"],instreamId:c["INSTREAM-ID"],name:c.NAME||c.LANGUAGE||"",type:i,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:c.LANGUAGE,url:c.URI?e.resolve(c.URI,n):""};if(r.length){var h=e.findGroup(r,u.groupId)||r[0];y(u,h,"audioCodec"),y(u,h,"textCodec")}s.push(u)}}return s},e.parseLevelPlaylist=function(e,t,n,u,h){var d,v,m,y=new s.LevelDetails(t),E=y.fragments,k=null,C=0,S=0,x=0,w=0,T=null,_=new a.Fragment(u,t),O=-1,A=!1;for(f.lastIndex=0,y.m3u8=e;null!==(d=f.exec(e));){A&&(A=!1,(_=new a.Fragment(u,t)).start=x,_.sn=C,_.cc=w,_.level=n,k&&(_.initSegment=k,_.rawProgramDateTime=k.rawProgramDateTime));var L=d[1];if(L){_.duration=parseFloat(L);var D=(" "+d[2]).slice(1);_.title=D||null,_.tagList.push(D?["INF",L,D]:["INF",L])}else if(d[3])Object(i.isFiniteNumber)(_.duration)&&(_.start=x,m&&(_.levelkey=m),_.sn=C,_.level=n,_.cc=w,_.urlId=h,E.push(_),_.relurl=(" "+d[3]).slice(1),b(_,T),T=_,x+=_.duration,C++,S=0,A=!0);else if(d[4]){var R=(" "+d[4]).slice(1);T?_.setByteRange(R,T):_.setByteRange(R)}else if(d[5])_.rawProgramDateTime=(" "+d[5]).slice(1),_.tagList.push(["PROGRAM-DATE-TIME",_.rawProgramDateTime]),-1===O&&(O=E.length);else{if(!(d=d[0].match(p))){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(v=1;v<d.length&&void 0===d[v];v++);var I=(" "+d[v]).slice(1),N=(" "+d[v+1]).slice(1),P=d[v+2]?(" "+d[v+2]).slice(1):"";switch(I){case"PLAYLIST-TYPE":y.type=N.toUpperCase();break;case"MEDIA-SEQUENCE":C=y.startSN=parseInt(N);break;case"SKIP":var M=new l.AttrList(N),j=M.decimalInteger("SKIPPED-SEGMENTS");if(Object(i.isFiniteNumber)(j)){y.skippedSegments=j;for(var B=j;B--;)E.unshift(null);C+=j}var F=M.enumeratedString("RECENTLY-REMOVED-DATERANGES");F&&(y.recentlyRemovedDateranges=F.split("\t"));break;case"TARGETDURATION":y.targetduration=parseFloat(N);break;case"VERSION":y.version=parseInt(N);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(N||P)&&_.tagList.push(P?[N,P]:[N]);break;case"DIS":w++;case"GAP":_.tagList.push([I]);break;case"BITRATE":_.tagList.push([I,N]);break;case"DISCONTINUITY-SEQ":w=parseInt(N);break;case"KEY":var U,G=new l.AttrList(N),H=G.enumeratedString("METHOD"),K=G.URI,z=G.hexadecimalInteger("IV"),V=G.enumeratedString("KEYFORMATVERSIONS"),W=G.enumeratedString("KEYID"),Y=null!=(U=G.enumeratedString("KEYFORMAT"))?U:"identity";if(["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(Y)>-1){c.logger.warn("Keyformat "+Y+" is not supported from the manifest");continue}if("identity"!==Y)continue;H&&(m=o.LevelKey.fromURL(t,K),K&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(H)>=0&&(m.method=H,m.keyFormat=Y,W&&(m.keyID=W),V&&(m.keyFormatVersions=V),m.iv=z));break;case"START":var q=new l.AttrList(N).decimalFloatingPoint("TIME-OFFSET");Object(i.isFiniteNumber)(q)&&(y.startTimeOffset=q);break;case"MAP":var X=new l.AttrList(N);_.relurl=X.URI,X.BYTERANGE&&_.setByteRange(X.BYTERANGE),_.level=n,_.sn="initSegment",m&&(_.levelkey=m),_.initSegment=null,k=_,A=!0;break;case"SERVER-CONTROL":var Q=new l.AttrList(N);y.canBlockReload=Q.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Q.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Q.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Q.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Q.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var J=new l.AttrList(N);y.partTarget=J.decimalFloatingPoint("PART-TARGET");break;case"PART":var Z=y.partList;Z||(Z=y.partList=[]);var $=S>0?Z[Z.length-1]:void 0,ee=S++,te=new a.Part(new l.AttrList(N),_,t,ee,$);Z.push(te),_.duration+=te.duration;break;case"PRELOAD-HINT":var ne=new l.AttrList(N);y.preloadHint=ne;break;case"RENDITION-REPORT":var ie=new l.AttrList(N);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ie);break;default:c.logger.warn("line parsed but not handled: "+d)}}}T&&!T.relurl?(E.pop(),x-=T.duration,y.partList&&(y.fragmentHint=T)):y.partList&&(b(_,T),_.cc=w,y.fragmentHint=_);var re=E.length,ae=E[0],se=E[re-1];if((x+=y.skippedSegments*y.targetduration)>0&&re&&se){y.averagetargetduration=x/re;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!=(n=null===(i=r.parseURL(t))||void 0===i?void 0:i.path)?n:""));var t,n,i}))&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(_=new a.Fragment(u,t)).relurl=se.relurl,_.level=n,_.sn="initSegment",ae.initSegment=_,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(x+=y.fragmentHint.duration),y.totalduration=x,y.endCC=w,O>0&&function(e,t){for(var n=e[t],i=t;i--;){var r=e[i];if(!r)return;r.programDateTime=n.programDateTime-1e3*r.duration,n=r}}(E,O),y},e}();function m(e,t){["video","audio","text"].forEach((function(n){var i=e.filter((function(e){return Object(u.isCodecType)(e,n)}));if(i.length){var r=i.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}));t[n+"Codec"]=r.length>0?r[0]:i[0],e=e.filter((function(e){return-1===i.indexOf(e)}))}})),t.unknownCodecs=e}function y(e,t,n){var i=t[n];i&&(e[n]=i)}function b(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Object(i.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,n){"use strict";n.r(t);var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../events */"./src/events.ts"),a=n(/*! ../errors */"./src/errors.ts"),s=n(/*! ../utils/logger */"./src/utils/logger.ts"),o=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=n(/*! ./m3u8-parser */"./src/loader/m3u8-parser.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts"),u=n(/*! ../utils/attr-list */"./src/utils/attr-list.ts");function h(e,t){var n=e.url;return void 0!==n&&0!==n.indexOf("data:")||(n=t.url),n}var d=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(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(r.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(r.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(r.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(r.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.createInternalLoader=function(e){var t=this.hls.config,n=t.pLoader,i=t.loader,r=new(n||i)(t);return e.loader=r,this.loaders[e.type]=r,r},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 n=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:c.PlaylistContextType.MANIFEST,url:n,deliveryDirectives:null})},t.onLevelLoading=function(e,t){var n=t.id,i=t.level,r=t.url,a=t.deliveryDirectives;this.load({id:n,groupId:null,level:i,responseType:"text",type:c.PlaylistContextType.LEVEL,url:r,deliveryDirectives:a})},t.onAudioTrackLoading=function(e,t){var n=t.id,i=t.groupId,r=t.url,a=t.deliveryDirectives;this.load({id:n,groupId:i,level:null,responseType:"text",type:c.PlaylistContextType.AUDIO_TRACK,url:r,deliveryDirectives:a})},t.onSubtitleTrackLoading=function(e,t){var n=t.id,i=t.groupId,r=t.url,a=t.deliveryDirectives;this.load({id:n,groupId:i,level:null,responseType:"text",type:c.PlaylistContextType.SUBTITLE_TRACK,url:r,deliveryDirectives:a})},t.load=function(e){var t,n,i,r,a,o,l=this.hls.config,u=this.getInternalLoader(e);if(u){var h=u.context;if(h&&h.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),u.abort()}switch(e.type){case c.PlaylistContextType.MANIFEST:n=l.manifestLoadingMaxRetry,i=l.manifestLoadingTimeOut,r=l.manifestLoadingRetryDelay,a=l.manifestLoadingMaxRetryTimeout;break;case c.PlaylistContextType.LEVEL:case c.PlaylistContextType.AUDIO_TRACK:case c.PlaylistContextType.SUBTITLE_TRACK:n=0,i=l.levelLoadingTimeOut;break;default:n=l.levelLoadingMaxRetry,i=l.levelLoadingTimeOut,r=l.levelLoadingRetryDelay,a=l.levelLoadingMaxRetryTimeout}if(u=this.createInternalLoader(e),null!==(t=e.deliveryDirectives)&&void 0!==t&&t.part&&(e.type===c.PlaylistContextType.LEVEL&&null!==e.level?o=this.hls.levels[e.level].details:e.type===c.PlaylistContextType.AUDIO_TRACK&&null!==e.id?o=this.hls.audioTracks[e.id].details:e.type===c.PlaylistContextType.SUBTITLE_TRACK&&null!==e.id&&(o=this.hls.subtitleTracks[e.id].details),o)){var d=o.partTarget,f=o.targetduration;d&&f&&(i=Math.min(1e3*Math.max(3*d,.8*f),i))}var p={timeout:i,maxRetry:n,retryDelay:r,maxRetryDelay:a,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(e,p,g)},t.loadsuccess=function(e,t,n,i){if(void 0===i&&(i=null),n.isSidxRequest)return this.handleSidxRequest(e,n),void this.handlePlaylistLoaded(e,t,n,i);this.resetInternalLoader(n.type);var r=e.data;0===r.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),r.indexOf("#EXTINF:")>0||r.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,n,i):this.handleMasterPlaylist(e,t,n,i)):this.handleManifestParsingError(e,n,"no EXTM3U delimiter",i)},t.loaderror=function(e,t,n){void 0===n&&(n=null),this.handleNetworkError(t,n,!1,e)},t.loadtimeout=function(e,t,n){void 0===n&&(n=null),this.handleNetworkError(t,n,!0)},t.handleMasterPlaylist=function(e,t,n,i){var a=this.hls,o=e.data,c=h(e,n),d=l.default.parseMasterPlaylist(o,c),f=d.levels,p=d.sessionData;if(f.length){var g=f.map((function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),v=f.map((function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),m=l.default.parseMasterPlaylistMedia(o,c,"AUDIO",g),y=l.default.parseMasterPlaylistMedia(o,c,"SUBTITLES",v),b=l.default.parseMasterPlaylistMedia(o,c,"CLOSED-CAPTIONS");m.length&&(m.some((function(e){return!e.url}))||!f[0].audioCodec||f[0].attrs.AUDIO||(s.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new u.AttrList({}),bitrate:0,url:""}))),a.trigger(r.Events.MANIFEST_LOADED,{levels:f,audioTracks:m,subtitles:y,captions:b,url:c,stats:t,networkDetails:i,sessionData:p})}else this.handleManifestParsingError(e,n,"no level found in manifest",i)},t.handleTrackOrLevelPlaylist=function(e,t,n,s){var o=this.hls,d=n.id,f=n.level,p=n.type,g=h(e,n),v=Object(i.isFiniteNumber)(d)?d:0,m=Object(i.isFiniteNumber)(f)?f:v,y=function(e){switch(e.type){case c.PlaylistContextType.AUDIO_TRACK:return c.PlaylistLevelType.AUDIO;case c.PlaylistContextType.SUBTITLE_TRACK:return c.PlaylistLevelType.SUBTITLE;default:return c.PlaylistLevelType.MAIN}}(n),b=l.default.parseLevelPlaylist(e.data,g,m,y,v);if(b.fragments.length){if(p===c.PlaylistContextType.MANIFEST){var E={attrs:new u.AttrList({}),bitrate:0,details:b,name:"",url:g};o.trigger(r.Events.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:g,stats:t,networkDetails:s,sessionData:null})}if(t.parsing.end=performance.now(),b.needSidxRanges){var k,C=null===(k=b.fragments[0].initSegment)||void 0===k?void 0:k.url;this.load({url:C,isSidxRequest:!0,type:p,level:f,levelDetails:b,id:d,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})}else n.levelDetails=b,this.handlePlaylistLoaded(e,t,n,s)}else o.trigger(r.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 n.level?n.level:void 0})},t.handleSidxRequest=function(e,t){var n=Object(o.parseSegmentIndex)(new Uint8Array(e.data));if(n){var i=n.references,r=t.levelDetails;i.forEach((function(e,t){var i=e.info,a=r.fragments[t];0===a.byteRange.length&&a.setByteRange(String(1+i.end-i.start)+"@"+String(i.start)),a.initSegment&&a.initSegment.setByteRange(String(n.moovEndOffset)+"@0")}))}},t.handleManifestParsingError=function(e,t,n,i){this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===c.PlaylistContextType.MANIFEST,url:e.url,reason:n,response:e,context:t,networkDetails:i})},t.handleNetworkError=function(e,t,n,i){void 0===n&&(n=!1),s.logger.warn("[playlist-loader]: A network "+(n?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var o=a.ErrorDetails.UNKNOWN,l=!1,u=this.getInternalLoader(e);switch(e.type){case c.PlaylistContextType.MANIFEST:o=n?a.ErrorDetails.MANIFEST_LOAD_TIMEOUT:a.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case c.PlaylistContextType.LEVEL:o=n?a.ErrorDetails.LEVEL_LOAD_TIMEOUT:a.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.AUDIO_TRACK:o=n?a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.SUBTITLE_TRACK:o=n?a.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:a.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(e.type);var h={type:a.ErrorTypes.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:u,context:e,networkDetails:t};i&&(h.response=i),this.hls.trigger(r.Events.ERROR,h)},t.handlePlaylistLoaded=function(e,t,n,i){var a=n.type,s=n.level,o=n.id,l=n.groupId,u=n.loader,h=n.levelDetails,d=n.deliveryDirectives;if(null!=h&&h.targetduration){if(u)switch(h.live&&(u.getCacheAge&&(h.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(h.ageHeader)||(h.ageHeader=0)),a){case c.PlaylistContextType.MANIFEST:case c.PlaylistContextType.LEVEL:this.hls.trigger(r.Events.LEVEL_LOADED,{details:h,level:s||0,id:o||0,stats:t,networkDetails:i,deliveryDirectives:d});break;case c.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(r.Events.AUDIO_TRACK_LOADED,{details:h,id:o||0,groupId:l||"",stats:t,networkDetails:i,deliveryDirectives:d});break;case c.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(r.Events.SUBTITLE_TRACK_LOADED,{details:h,id:o||0,groupId:l||"",stats:t,networkDetails:i,deliveryDirectives:d})}}else this.handleManifestParsingError(e,n,"invalid target duration",i)},e}();t.default=d},"./src/polyfills/number.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/polyfills/number.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */function(e,t,n){"use strict";n.r(t),n.d(t,"isFiniteNumber",(function(){return i})),n.d(t,"MAX_SAFE_INTEGER",(function(){return r}));var i=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},r=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/remux/aac-helper.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=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=i},"./src/remux/mp4-generator.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/remux/mp4-generator.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=Math.pow(2,32)-1,r=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 n=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]),i=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:n,audio:i};var r=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,r))},e.box=function(e){for(var t=8,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];for(var a=i.length,s=a;a--;)t+=i[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(i[a],t),t+=i[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,n){n*=t;var r=Math.floor(n/(i+1)),a=Math.floor(n%(i+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,r>>24,r>>16&255,r>>8&255,255&r,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,n,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,n))},e.moov=function(t){for(var n=t.length,i=[];n--;)i[n]=e.trak(t[n]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))},e.mvex=function(t){for(var n=t.length,i=[];n--;)i[n]=e.trex(t[n]);return e.box.apply(null,[e.types.mvex].concat(i))},e.mvhd=function(t,n){n*=t;var r=Math.floor(n/(i+1)),a=Math.floor(n%(i+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,r>>24,r>>16&255,r>>8&255,255&r,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 n,i,r=t.samples||[],a=new Uint8Array(4+r.length);for(n=0;n<r.length;n++)i=r[n].flags,a[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.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 n,i,r,a=[],s=[];for(n=0;n<t.sps.length;n++)r=(i=t.sps[n]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(i));for(n=0;n<t.pps.length;n++)r=(i=t.pps[n]).byteLength,s.push(r>>>8&255),s.push(255&r),s=s.concat(Array.prototype.slice.call(i));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,c=t.height,u=t.pixelRatio[0],h=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,c>>8&255,255&c,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([u>>24,u>>16&255,u>>8&255,255&u,h>>24,h>>16&255,h>>8&255,255&h])))},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 n=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,n>>8&255,255&n,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var n=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,n>>8&255,255&n,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 n=t.id,r=t.duration*t.timescale,a=t.width,s=t.height,o=Math.floor(r/(i+1)),l=Math.floor(r%(i+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,n>>24&255,n>>16&255,n>>8&255,255&n,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,n){var r=e.sdtp(t),a=t.id,s=Math.floor(n/(i+1)),o=Math.floor(n%(i+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,r.length+16+20+8+16+8+8),r)},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 n=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,n){var i,r,a,s,o,l,c=t.samples||[],u=c.length,h=12+16*u,d=new Uint8Array(h);for(n+=8+h,d.set([0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0),i=0;i<u;i++)a=(r=c[i]).duration,s=r.size,o=r.flags,l=r.cts,d.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*i);return e.box(e.types.trun,d)},e.initSegment=function(t){e.types||e.init();var n=e.moov(t),i=new Uint8Array(e.FTYP.byteLength+n.byteLength);return i.set(e.FTYP),i.set(n,e.FTYP.byteLength),i},e}();r.types=void 0,r.HDLR_TYPES=void 0,r.STTS=void 0,r.STSC=void 0,r.STCO=void 0,r.STSZ=void 0,r.VMHD=void 0,r.SMHD=void 0,r.STSD=void 0,r.FTYP=void 0,r.DINF=void 0,t.default=r},"./src/remux/mp4-remuxer.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/remux/mp4-remuxer.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: default, normalizePts */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return g})),n.d(t,"normalizePts",(function(){return v}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ./aac-helper */"./src/remux/aac-helper.ts"),a=n(/*! ./mp4-generator */"./src/remux/mp4-generator.ts"),s=n(/*! ../events */"./src/events.ts"),o=n(/*! ../errors */"./src/errors.ts"),l=n(/*! ../utils/logger */"./src/utils/logger.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts"),u=n(/*! ../utils/timescale-conversion */"./src/utils/timescale-conversion.ts");function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}var d=null,f=null,p=!1,g=function(){function e(e,t,n,i){if(void 0===i&&(i=""),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=n,this.ISGenerated=!1,null===d){var r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);d=r?parseInt(r[1]):0}if(null===f){var a=navigator.userAgent.match(/Safari\/(\d+)/i);f=a?parseInt(a[1]):0}p=!!d&&d<75||!!f&&f<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,n=e.reduce((function(e,n){var i=n.pts-e;return i<-4294967296?(t=!0,v(e,n.pts)):i>0?e:n.pts}),e[0].pts);return t&&l.logger.debug("PTS rollover detected"),n},t.remux=function(e,t,n,i,r,a,s,o){var u,h,d,f,p,g,m=r,y=r,b=e.pid>-1,E=t.pid>-1,k=t.samples.length,C=e.samples.length>0,S=k>1;if((!b||C)&&(!E||S)||this.ISGenerated||s){this.ISGenerated||(d=this.generateIS(e,t,r));var x=this.isVideoContiguous,w=-1;if(S&&(w=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!x&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,w>0){l.logger.warn("[mp4-remuxer]: Dropped "+w+" out of "+k+" video samples due to a missing keyframe");var T=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(w),t.dropped+=w,y+=(t.samples[0].pts-T)/(t.timescale||9e4)}else-1===w&&(l.logger.warn("[mp4-remuxer]: No keyframe found out of "+k+" video samples"),g=!1);if(this.ISGenerated){if(C&&S){var _=this.getVideoStartPts(t.samples),O=(v(e.samples[0].pts,_)-_)/t.inputTimeScale;m+=Math.max(0,O),y+=Math.max(0,-O)}if(C){if(e.samplerate||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(e,t,r)),h=this.remuxAudio(e,m,this.isAudioContiguous,a,E||S||o===c.PlaylistLevelType.AUDIO?y:void 0),S){var A=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(e,t,r)),u=this.remuxVideo(t,y,x,A)}}else S&&(u=this.remuxVideo(t,y,x,0));u&&(u.firstKeyFrame=w,u.independent=-1!==w)}}return this.ISGenerated&&(n.samples.length&&(p=this.remuxID3(n,r)),i.samples.length&&(f=this.remuxText(i,r))),{audio:h,video:u,initSegment:d,independent:g,text:f,id3:p}},t.generateIS=function(e,t,n){var r,s,o,l=e.samples,c=t.samples,u=this.typeSupported,h={},d=!Object(i.isFiniteNumber)(this._initPTS),f="audio/mp4";if(d&&(r=s=1/0),e.config&&l.length&&(e.timescale=e.samplerate,e.isAAC||(u.mpeg?(f="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3")),h.audio={id:"audio",container:f,codec:e.codec,initSegment:!e.isAAC&&u.mpeg?new Uint8Array(0):a.default.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(o=e.inputTimeScale,r=s=l[0].pts-Math.round(o*n))),t.sps&&t.pps&&c.length&&(t.timescale=t.inputTimeScale,h.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:a.default.initSegment([t]),metadata:{width:t.width,height:t.height}},d)){o=t.inputTimeScale;var p=this.getVideoStartPts(c),g=Math.round(o*n);s=Math.min(s,v(c[0].dts,p)-g),r=Math.min(r,p-g)}if(Object.keys(h).length)return this.ISGenerated=!0,d&&(this._initPTS=r,this._initDTS=s),{tracks:h,initPTS:r,timescale:o}},t.remuxVideo=function(e,t,n,i){var r,c,f,g=e.inputTimeScale,y=e.samples,b=[],E=y.length,k=this._initPTS,C=this.nextAvcDts,S=8,x=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY,T=0,_=!1;n&&null!==C||(C=t*g-(y[0].pts-v(y[0].dts,y[0].pts)));for(var O=0;O<E;O++){var A=y[O];A.pts=v(A.pts-k,C),A.dts=v(A.dts-k,C),A.dts>A.pts&&(T=Math.max(Math.min(T,A.pts-A.dts),-18e3)),A.dts<y[O>0?O-1:O].dts&&(_=!0)}_&&y.sort((function(e,t){var n=e.dts-t.dts,i=e.pts-t.pts;return n||i})),c=y[0].dts,f=y[y.length-1].dts;var L=Math.round((f-c)/(E-1));if(T<0){if(T<-2*L){l.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(u.toMsFromMpegTsClock)(-L,!0)+" ms");for(var D=T,R=0;R<E;R++)y[R].dts=D=Math.max(D,y[R].pts-L),y[R].pts=Math.max(D,y[R].pts)}else{l.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(u.toMsFromMpegTsClock)(T,!0)+" ms to overcome this issue");for(var I=0;I<E;I++)y[I].dts=y[I].dts+T}c=y[0].dts}if(n){var N=c-C,P=N>L;if(P||N<-1){P?l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(N,!0)+" ms ("+N+"dts) hole between fragments detected, filling it"):l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(-N,!0)+" ms ("+N+"dts) overlapping between fragments detected"),c=C;var M=y[0].pts-N;y[0].dts=c,y[0].pts=M,l.logger.log("Video: First PTS/DTS adjusted: "+Object(u.toMsFromMpegTsClock)(M,!0)+"/"+Object(u.toMsFromMpegTsClock)(c,!0)+", delta: "+Object(u.toMsFromMpegTsClock)(N,!0)+" ms")}}p&&(c=Math.max(0,c));for(var j=0,B=0,F=0;F<E;F++){for(var U=y[F],G=U.units,H=G.length,K=0,z=0;z<H;z++)K+=G[z].data.length;B+=K,j+=H,U.length=K,U.dts=Math.max(U.dts,c),U.pts=Math.max(U.pts,U.dts,0),x=Math.min(U.pts,x),w=Math.max(U.pts,w)}f=y[E-1].dts;var V,W=B+4*j+8;try{V=new Uint8Array(W)}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:W,reason:"fail allocating video mdat "+W})}var Y=new DataView(V.buffer);Y.setUint32(0,W),V.set(a.default.types.mdat,4);for(var q=0;q<E;q++){for(var X=y[q],Q=X.units,J=0,Z=0,$=Q.length;Z<$;Z++){var ee=Q[Z],te=ee.data,ne=ee.data.byteLength;Y.setUint32(S,ne),S+=4,V.set(te,S),S+=ne,J+=4+ne}if(q<E-1)r=y[q+1].dts-X.dts;else{var ie=this.config,re=X.dts-y[q>0?q-1:q].dts;if(ie.stretchShortVideoTrack&&null!==this.nextAudioPts){var ae=Math.floor(ie.maxBufferHole*g),se=(i?x+i*g:this.nextAudioPts)-X.pts;se>ae?((r=se-re)<0&&(r=re),l.logger.log("[mp4-remuxer]: It is approximately "+se/90+" ms to the next segment; using duration "+r/90+" ms for the last video frame.")):r=re}else r=re}var oe=Math.round(X.pts-X.dts);b.push(new m(X.key,r,J,oe))}if(b.length&&d&&d<70){var le=b[0].flags;le.dependsOn=2,le.isNonSync=0}console.assert(void 0!==r,"mp4SampleDuration must be computed"),this.nextAvcDts=C=f+r,this.isVideoContiguous=!0;var ce={data1:a.default.moof(e.sequenceNumber++,c,h({},e,{samples:b})),data2:V,startPTS:x/g,endPTS:(w+r)/g,startDTS:c/g,endDTS:C/g,type:"video",hasAudio:!1,hasVideo:!0,nb:b.length,dropped:e.dropped};return e.samples=[],e.dropped=0,console.assert(V.length,"MDAT length must not be zero"),ce},t.remuxAudio=function(e,t,n,i,c){var u=e.inputTimeScale,d=u/(e.samplerate?e.samplerate:u),f=e.isAAC?1024:1152,p=f*d,g=this._initPTS,y=!e.isAAC&&this.typeSupported.mpeg,b=[],E=e.samples,k=y?0:8,C=this.nextAudioPts||-1,S=t*u;if(this.isAudioContiguous=n=n||E.length&&C>0&&(i&&Math.abs(S-C)<9e3||Math.abs(v(E[0].pts-g,S)-C)<20*p),E.forEach((function(e){e.pts=v(e.pts-g,S)})),!n||C<0){if(!(E=E.filter((function(e){return e.pts>=0}))).length)return;C=0===c?0:i?Math.max(0,S):E[0].pts}if(e.isAAC)for(var x=void 0!==c,w=this.config.maxAudioFramesDrift,T=0,_=C;T<E.length;T++){var O=E[T],A=O.pts,L=A-_,D=Math.abs(1e3*L/u);if(L<=-w*p&&x)0===T&&(l.logger.warn("Audio frame @ "+(A/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*L/u)+" ms."),this.nextAudioPts=C=_=A);else if(L>=w*p&&D<1e4&&x){var R=Math.round(L/p);(_=A-R*p)<0&&(R--,_+=p),0===T&&(this.nextAudioPts=C=_),l.logger.warn("[mp4-remuxer]: Injecting "+R+" audio frame @ "+(_/u).toFixed(3)+"s due to "+Math.round(1e3*L/u)+" ms gap.");for(var I=0;I<R;I++){var N=Math.max(_,0),P=r.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);P||(l.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),P=O.unit.subarray()),E.splice(T,0,{unit:P,pts:N}),_+=p,T++}}O.pts=_,_+=p}for(var M,j=null,B=null,F=0,U=E.length;U--;)F+=E[U].unit.byteLength;for(var G=0,H=E.length;G<H;G++){var K=E[G],z=K.unit,V=K.pts;if(null!==B)b[G-1].duration=Math.round((V-B)/d);else{if(n&&e.isAAC&&(V=C),j=V,!(F>0))return;F+=k;try{M=new Uint8Array(F)}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:F,reason:"fail allocating audio mdat "+F})}y||(new DataView(M.buffer).setUint32(0,F),M.set(a.default.types.mdat,4))}M.set(z,k);var W=z.byteLength;k+=W,b.push(new m(!0,f,W,0)),B=V}var Y=b.length;if(Y){var q=b[b.length-1];this.nextAudioPts=C=B+d*q.duration;var X=y?new Uint8Array(0):a.default.moof(e.sequenceNumber++,j/d,h({},e,{samples:b}));e.samples=[];var Q=j/u,J=C/u,Z={data1:X,data2:M,startPTS:Q,endPTS:J,startDTS:Q,endDTS:J,type:"audio",hasAudio:!0,hasVideo:!1,nb:Y};return this.isAudioContiguous=!0,console.assert(M.length,"MDAT length must not be zero"),Z}},t.remuxEmptyAudio=function(e,t,n,i){var a=e.inputTimeScale,s=a/(e.samplerate?e.samplerate:a),o=this.nextAudioPts,c=(null!==o?o:i.startDTS*a)+this._initDTS,u=i.endDTS*a+this._initDTS,h=1024*s,d=Math.ceil((u-c)/h),f=r.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(l.logger.warn("[mp4-remuxer]: remux empty Audio"),f){for(var p=[],g=0;g<d;g++){var v=c+g*h;p.push({unit:f,pts:v,dts:v})}return e.samples=p,this.remuxAudio(e,t,n,!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 n=e.samples.length;if(n){for(var i=e.inputTimeScale,r=this._initPTS,a=this._initDTS,s=0;s<n;s++){var o=e.samples[s];o.pts=v(o.pts-r,t*i)/i,o.dts=v(o.dts-a,t*i)/i}var l=e.samples;return e.samples=[],{samples:l}}},t.remuxText=function(e,t){var n=e.samples.length;if(n){for(var i=e.inputTimeScale,r=this._initPTS,a=0;a<n;a++){var s=e.samples[a];s.pts=v(s.pts-r,t*i)/i}e.samples.sort((function(e,t){return e.pts-t.pts}));var o=e.samples;return e.samples=[],{samples:o}}},e}();function v(e,t){var n;if(null===t)return e;for(n=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=n;return e}var m=function(e,t,n,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=n,this.cts=i,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,n){"use strict";n.r(t);var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),a=n(/*! ../loader/fragment */"./src/loader/fragment.ts"),s=n(/*! ../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,n){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(e),this.emitInitSegment=!0},t.generateInitSegment=function(e){var t=this.audioCodec,n=this.videoCodec;if(!e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var i=this.initData=Object(r.parseInitSegment)(e);t||(t=c(i.audio,a.ElementaryStreamTypes.AUDIO)),n||(n=c(i.video,a.ElementaryStreamTypes.VIDEO));var o={};i.audio&&i.video?o.audiovideo={container:"video/mp4",codec:t+","+n,initSegment:e,id:"main"}:i.audio?o.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?o.video={container:"video/mp4",codec:n,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,n,a,o){var c=this.initPTS,u=this.lastEndDTS,h={audio:void 0,video:void 0,text:a,id3:n,initSegment:void 0};Object(i.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var d=t.samples;if(!d||!d.length)return h;var f={initPTS:void 0,timescale:1},p=this.initData;if(p&&p.length||(this.generateInitSegment(d),p=this.initData),!p||!p.length)return s.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(i.isFiniteNumber)(c)||(this.initPTS=f.initPTS=c=l(p,d,u));var g=Object(r.getDuration)(d,p),v=u,m=g+v;Object(r.offsetStartDTS)(p,d,c),g>0?this.lastEndDTS=m:(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 k={data1:d,startPTS:v,startDTS:v,endPTS:m,endDTS:m,type:E,hasAudio:y,hasVideo:b,nb:1,dropped:0};return h.audio="audio"===k.type?k:void 0,h.video="audio"!==k.type?k:void 0,h.text=a,h.id3=n,h.initSegment=f,h},e}(),l=function(e,t,n){return Object(r.getStartDTS)(e,t)-n};function c(e,t){var n=null==e?void 0:e.codec;return n&&n.length>4?n:"hvc1"===n?"hvc1.1.c.L120.90":"av01"===n?"av01.0.04M.08":"avc1"===n||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,n){"use strict";n.r(t),n.d(t,"default",(function(){return i}));var i=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,n){"use strict";n.r(t),n.d(t,"CMCDVersion",(function(){return s})),n.d(t,"CMCDObjectType",(function(){return i})),n.d(t,"CMCDStreamingFormat",(function(){return r})),n.d(t,"CMCDStreamType",(function(){return a}));var i,r,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"}(i||(i={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(r||(r={})),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,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var r;function a(e,t){var n=e.canSkipUntil,i=e.canSkipDateRanges,a=e.endSN;return n&&(void 0!==t?t-a:0)<n?i?r.v2:r.Yes:r.No}n.r(t),n.d(t,"HlsSkip",(function(){return r})),n.d(t,"getSkipValue",(function(){return a})),n.d(t,"HlsUrlParameters",(function(){return s})),n.d(t,"Level",(function(){return o})),function(e){e.No="",e.Yes="YES",e.v2="v2"}(r||(r={}));var s=function(){function e(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}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,n,r;return t=e,(n=[{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)}}])&&i(t.prototype,n),r&&i(t,r),e}()},"./src/types/loader.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/types/loader.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: PlaylistContextType, PlaylistLevelType */function(e,t,n){"use strict";var i,r;n.r(t),n.d(t,"PlaylistContextType",(function(){return i})),n.d(t,"PlaylistLevelType",(function(){return r})),function(e){e.MANIFEST="manifest",e.LEVEL="level",e.AUDIO_TRACK="audioTrack",e.SUBTITLE_TRACK="subtitleTrack"}(i||(i={})),function(e){e.MAIN="main",e.AUDIO="audio",e.SUBTITLE="subtitle"}(r||(r={}))},"./src/types/transmuxer.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/types/transmuxer.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: ChunkMetadata */function(e,t,n){"use strict";n.r(t),n.d(t,"ChunkMetadata",(function(){return i}));var i=function(e,t,n,i,r,a){void 0===i&&(i=0),void 0===r&&(r=-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=n,this.size=i,this.part=r,this.partial=a}},"./src/utils/attr-list.ts":
|
|
|
/*!********************************!*\
|
|
|
!*** ./src/utils/attr-list.ts ***!
|
|
|
\********************************/
|
|
|
/*! exports provided: AttrList */function(e,t,n){"use strict";n.r(t),n.d(t,"AttrList",(function(){return a}));var i=/^(\d+)x(\d+)$/,r=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,a=function(){function e(t){for(var n in"string"==typeof t&&(t=e.parseAttrList(t)),t)t.hasOwnProperty(n)&&(this[n]=t[n])}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 n=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(2*i,2*i+2),16);return n}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 n=this[e];return n?parseFloat(n):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=i.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,n={};for(r.lastIndex=0;null!==(t=r.exec(e));){var i=t[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),n[t[1]]=i}return n},e}()},"./src/utils/binary-search.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/utils/binary-search.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),t.default={search:function(e,t){for(var n=0,i=e.length-1,r=null,a=null;n<=i;){var s=t(a=e[r=(n+i)/2|0]);if(s>0)n=r+1;else{if(!(s<0))return a;i=r-1}}return null}}},"./src/utils/buffer-helper.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/utils/buffer-helper.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: BufferHelper */function(e,t,n){"use strict";n.r(t),n.d(t,"BufferHelper",(function(){return a}));var i=n(/*! ./logger */"./src/utils/logger.ts"),r={length:0,start:function(){return 0},end:function(){return 0}},a=function(){function e(){}return e.isBuffered=function(t,n){try{if(t)for(var i=e.getBuffered(t),r=0;r<i.length;r++)if(n>=i.start(r)&&n<=i.end(r))return!0}catch(e){}return!1},e.bufferInfo=function(t,n,i){try{if(t){var r,a=e.getBuffered(t),s=[];for(r=0;r<a.length;r++)s.push({start:a.start(r),end:a.end(r)});return this.bufferedInfo(s,n,i)}}catch(e){}return{len:0,start:n,end:n,nextStart:void 0}},e.bufferedInfo=function(e,t,n){t=Math.max(0,t),e.sort((function(e,t){var n=e.start-t.start;return n||t.end-e.end}));var i=[];if(n)for(var r=0;r<e.length;r++){var a=i.length;if(a){var s=i[a-1].end;e[r].start-s<n?e[r].end>s&&(i[a-1].end=e[r].end):i.push(e[r])}else i.push(e[r])}else i=e;for(var o,l=0,c=t,u=t,h=0;h<i.length;h++){var d=i[h].start,f=i[h].end;if(t+n>=d&&t<f)c=d,l=(u=f)-t;else if(t+n<d){o=d;break}}return{len:l,start:c||0,end:u||0,nextStart:o}},e.getBuffered=function(e){try{return e.buffered}catch(e){return i.logger.log("failed to get media.buffered",e),r}},e}()},"./src/utils/cea-608-parser.ts":
|
|
|
/*!*************************************!*\
|
|
|
!*** ./src/utils/cea-608-parser.ts ***!
|
|
|
\*************************************/
|
|
|
/*! exports provided: Row, CaptionScreen, default */function(e,t,n){"use strict";n.r(t),n.d(t,"Row",(function(){return v})),n.d(t,"CaptionScreen",(function(){return m}));var i,r=n(/*! ../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},c={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},u={25:2,26:4,29:6,30:8,31:10,27:13,28:15},h=["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"}(i||(i={}));var d=function(){function e(){this.time=null,this.verboseLevel=i.ERROR}return e.prototype.log=function(e,t){this.verboseLevel>=e&&r.logger.log(this.time+" ["+e+"] "+t)},e}(),f=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].toString(16));return t},p=function(){function e(e,t,n,i,r){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=n||!1,this.background=i||"black",this.flash=r||!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"],n=0;n<t.length;n++){var i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}},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,n,i,r,a){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new p(t,n,i,r,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}(),v=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,n=0;n<100;n++)if(!this.chars[n].equals(e.chars[n])){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(i.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(this.logger.log(i.DEBUG,"Too large cursor position "+this.pos),this.pos=100)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var n=this.pos+1;n<t+1;n++)this.chars[n].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(i.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,n=0;n<100;n++){var i=this.chars[n].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),m=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 v(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,n=0;n<15;n++)if(!this.rows[n].equals(e.rows[n])){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(i.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){this.logger.log(i.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 n=0;n<15;n++)this.rows[n].clear();var r=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var s=a.rows[r].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[r+l])}}this.currRow=t;var c=this.rows[this.currRow];if(null!==e.indent){var u=e.indent,h=Math.max(u-1,0);c.setCursor(e.indent),e.color=c.chars[h].penState.foreground}var d={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(d)},t.setBkgData=function(e){this.logger.log(i.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(i.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(i.INFO,"Rolling up")}else this.logger.log(i.DEBUG,"roll_up but nrRollUpRows not set yet")},t.getDisplayText=function(e){e=e||!1;for(var t=[],n="",i=-1,r=0;r<15;r++){var a=this.rows[r].getTextString();a&&(i=r+1,e?t.push("Row "+i+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n},t.getTextAndFormat=function(){return this.rows},e}(),y=function(){function e(e,t,n){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 m(n),this.nonDisplayedMemory=new m(n),this.lastOutputScreen=new m(n),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}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(i.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 n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(i.INFO,n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(i.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},t.ccRCL=function(){this.logger.log(i.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.ccBS=function(){this.logger.log(i.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(i.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.ccRU=function(e){this.logger.log(i.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},t.ccFON=function(){this.logger.log(i.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.ccRDC=function(){this.logger.log(i.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.ccTR=function(){this.logger.log(i.INFO,"TR"),this.setMode("MODE_TEXT")},t.ccRTD=function(){this.logger.log(i.INFO,"RTD"),this.setMode("MODE_TEXT")},t.ccEDM=function(){this.logger.log(i.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.ccCR=function(){this.logger.log(i.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.ccENM=function(){this.logger.log(i.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.ccEOC=function(){if(this.logger.log(i.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(i.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},t.ccTO=function(e){this.logger.log(i.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 n=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}this.logger.log(i.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,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var i=new d;this.channels=[null,new y(e,t,i),new y(e+1,n,i)],this.cmdHistory={a:null,b:null},this.logger=i}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 n,r,a,s=!1;this.logger.time=e;for(var o=0;o<t.length;o+=2)if(r=127&t[o],a=127&t[o+1],0!==r||0!==a){if(this.logger.log(i.DATA,"["+f([t[o],t[o+1]])+"] -> ("+f([r,a])+")"),(n=this.parseCmd(r,a))||(n=this.parseMidrow(r,a)),n||(n=this.parsePAC(r,a)),n||(n=this.parseBackgroundAttributes(r,a)),!n&&(s=this.parseChars(r,a))){var l=this.currentChannel;l&&l>0?this.channels[l].insertChars(s):this.logger.log(i.WARNING,"No channel found yet. TEXT-MODE?")}n||s||this.logger.log(i.WARNING,"Couldn't parse cleaned data "+f([r,a])+" orig: "+f([t[o],t[o+1]]))}},t.parseCmd=function(e,t){var n=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(k(e,t,n))return E(null,null,n),this.logger.log(i.DEBUG,"Repeated command ("+f([e,t])+") is dropped"),!0;var r=20===e||21===e||23===e?1:2,a=this.channels[r];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,n),this.currentChannel=r,!0},t.parseMidrow=function(e,t){var n=0;if((17===e||25===e)&&t>=32&&t<=47){if((n=17===e?1:2)!==this.currentChannel)return this.logger.log(i.ERROR,"Mismatch channel in midrow parsing"),!1;var r=this.channels[n];return!!r&&(r.ccMIDROW(t),this.logger.log(i.DEBUG,"MIDROW ("+f([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var n,i=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(k(e,t,i))return E(null,null,i),!0;var r=e<=23?1:2;n=t>=64&&t<=95?1===r?o[e]:c[e]:1===r?l[e]:u[e];var a=this.channels[r];return!!a&&(a.setPAC(this.interpretPAC(n,t)),E(e,t,i),this.currentChannel=r,!0)},t.interpretPAC=function(e,t){var n,i={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,i.underline=1==(1&n),n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((n-16)/2),i},t.parseChars=function(e,t){var n,r,a=null,o=null;if(e>=25?(n=2,o=e-8):(n=1,o=e),o>=17&&o<=19?(r=17===o?t+80:18===o?t+112:t+144,this.logger.log(i.INFO,"Special char '"+s(r)+"' in channel "+n),a=[r]):e>=32&&e<=127&&(a=0===t?[e]:[e,t]),a){var l=f(a);this.logger.log(i.DEBUG,"Char codes = "+l.join(",")),E(e,t,this.cmdHistory)}return a},t.parseBackgroundAttributes=function(e,t){var n;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var i={};16===e||24===e?(n=Math.floor((t-32)/2),i.background=h[n],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));var r=e<=23?1:2;return this.channels[r].setBkgData(i),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 n=this.channels[t];n&&n.cueSplitAtTime(e)}},e}();function E(e,t,n){n.a=e,n.b=t}function k(e,t,n){return n.a===e&&n.b===t}t.default=b},"./src/utils/codecs.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/utils/codecs.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: isCodecType, isCodecSupportedInMp4 */function(e,t,n){"use strict";n.r(t),n.d(t,"isCodecType",(function(){return r})),n.d(t,"isCodecSupportedInMp4",(function(){return a}));var i={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 r(e,t){var n=i[t];return!!n&&!0===n[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,n){"use strict";n.r(t);var i=n(/*! ./vttparser */"./src/utils/vttparser.ts"),r=n(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts"),a=n(/*! ./texttrack-utils */"./src/utils/texttrack-utils.ts"),s=/\s/,o={newCue:function(e,t,n,o){for(var l,c,u,h,d,f=[],p=self.VTTCue||self.TextTrackCue,g=0;g<o.rows.length;g++)if(u=!0,h=0,d="",!(l=o.rows[g]).isEmpty()){for(var v=0;v<l.chars.length;v++)s.test(l.chars[v].uchar)&&u?h++:(d+=l.chars[v].uchar,u=!1);l.cueStartTime=t,t===n&&(n+=1e-4),h>=16?h--:h++;var m=Object(i.fixLineBreaks)(d.trim()),y=Object(r.generateCueId)(t,n,m);e&&e.cues&&e.cues.getCueById(y)||((c=new p(t,n,m)).id=y,c.line=g+1,c.align="left",c.position=10+Math.min(80,10*Math.floor(8*h/32)),f.push(c))}return e&&f.length&&(f.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})),f.forEach((function(t){return Object(a.addCueToTrack)(e,t)}))),f}};t.default=o},"./src/utils/discontinuities.ts":
|
|
|
/*!**************************************!*\
|
|
|
!*** ./src/utils/discontinuities.ts ***!
|
|
|
\**************************************/
|
|
|
/*! exports provided: findFirstFragWithCC, shouldAlignOnDiscontinuities, findDiscontinuousReferenceFrag, adjustSlidingStart, alignStream, alignPDT, alignFragmentByPDTDelta, alignMediaPlaylistByPDT */function(e,t,n){"use strict";n.r(t),n.d(t,"findFirstFragWithCC",(function(){return s})),n.d(t,"shouldAlignOnDiscontinuities",(function(){return o})),n.d(t,"findDiscontinuousReferenceFrag",(function(){return l})),n.d(t,"adjustSlidingStart",(function(){return u})),n.d(t,"alignStream",(function(){return h})),n.d(t,"alignPDT",(function(){return d})),n.d(t,"alignFragmentByPDTDelta",(function(){return f})),n.d(t,"alignMediaPlaylistByPDT",(function(){return p}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ./logger */"./src/utils/logger.ts"),a=n(/*! ../controller/level-helper */"./src/controller/level-helper.ts");function s(e,t){for(var n=null,i=0,r=e.length;i<r;i++){var a=e[i];if(a&&a.cc===t){n=a;break}}return n}function o(e,t,n){return!(!t.details||!(n.endCC>n.startCC||e&&e.cc<n.startCC))}function l(e,t){var n=e.fragments,i=t.fragments;if(i.length&&n.length){var a=s(n,i[0].cc);if(a&&(!a||a.startPTS))return a;r.logger.log("No frag in previous level to align on")}else r.logger.log("No fragments to align")}function c(e,t){if(e){var n=e.start+t;e.start=e.startPTS=n,e.endPTS=n+e.duration}}function u(e,t){for(var n=t.fragments,i=0,r=n.length;i<r;i++)c(n[i],e);t.fragmentHint&&c(t.fragmentHint,e),t.alignedSliding=!0}function h(e,t,n){t&&(function(e,t,n){if(o(e,n,t)){var a=l(n.details,t);a&&Object(i.isFiniteNumber)(a.start)&&(r.logger.log("Adjusting PTS using last level due to CC increase within current level "+t.url),u(a.start,t))}}(e,n,t),!n.alignedSliding&&t.details&&d(n,t.details),n.alignedSliding||!t.details||n.skippedSegments||Object(a.adjustSliding)(t.details,n))}function d(e,t){if(t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime){var n=t.fragments[0].programDateTime,a=e.fragments[0].programDateTime,s=(a-n)/1e3+t.fragments[0].start;s&&Object(i.isFiniteNumber)(s)&&(r.logger.log("Adjusting PTS using programDateTime delta "+(a-n)+"ms, sliding:"+s.toFixed(3)+" "+e.url+" "),u(s,e))}}function f(e,t){var n=e.programDateTime;if(n){var i=(n-t)/1e3;e.start=e.startPTS=i,e.endPTS=i+e.duration}}function p(e,t){if(t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime){var n=t.fragments[0].programDateTime-1e3*t.fragments[0].start;e.fragments.forEach((function(e){f(e,n)})),e.fragmentHint&&f(e.fragmentHint,n),e.alignedSliding=!0}}},"./src/utils/ewma-bandwidth-estimator.ts":
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./src/utils/ewma-bandwidth-estimator.ts ***!
|
|
|
\***********************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ../utils/ewma */"./src/utils/ewma.ts"),r=function(){function e(e,t,n){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new i.default(e),this.fast_=new i.default(t)}var t=e.prototype;return t.update=function(e,t){var n=this.slow_,r=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new i.default(e,n.getEstimate(),n.getTotalWeight())),this.fast_.halfLife!==t&&(this.fast_=new i.default(t,r.getEstimate(),r.getTotalWeight()))},t.sample=function(e,t){var n=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/n;this.fast_.sample(n,i),this.slow_.sample(n,i)},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=r},"./src/utils/ewma.ts":
|
|
|
/*!***************************!*\
|
|
|
!*** ./src/utils/ewma.ts ***!
|
|
|
\***************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=function(){function e(e,t,n){void 0===t&&(t=0),void 0===n&&(n=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_=n}var t=e.prototype;return t.sample=function(e,t){var n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*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=i},"./src/utils/fetch-loader.ts":
|
|
|
/*!***********************************!*\
|
|
|
!*** ./src/utils/fetch-loader.ts ***!
|
|
|
\***********************************/
|
|
|
/*! exports provided: fetchSupported, default */function(e,t,n){"use strict";n.r(t),n.d(t,"fetchSupported",(function(){return d}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),a=n(/*! ../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||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;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,i)}function i(){return o(e,arguments,u(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),c(i,e)})(e)}function o(e,t,n){return(o=l()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&c(r,n.prototype),r}).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 c(e,t){return(c=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)}function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function d(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}var f=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 r.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,n){var r=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 n={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(h({},e.headers))};return e.rangeEnd&&n.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),n}(e,this.controller.signal),o=n.onProgress,l="arraybuffer"===e.responseType,c=l?"byteLength":"length";this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout((function(){r.abortInternal(),n.onTimeout(a,e,r.response)}),t.timeout),self.fetch(this.request).then((function(n){if(r.response=r.loader=n,!n.ok){var s=n.status,c=n.statusText;throw new g(c||"fetch, bad network response",s,n)}return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(n.headers.get("Content-Length")||"0"),o&&Object(i.isFiniteNumber)(t.highWaterMark)?r.loadProgressively(n,a,e,t.highWaterMark,o):l?n.arrayBuffer():n.text()})).then((function(s){var l=r.response;self.clearTimeout(r.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first),a.loaded=a.total=s[c];var u={url:l.url,data:s};o&&!Object(i.isFiniteNumber)(t.highWaterMark)&&o(a,e,s,l),n.onSuccess(u,a,e,l)})).catch((function(t){if(self.clearTimeout(r.requestTimeout),!a.aborted){var i=t.code||0;n.onError({code:i,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,n,i,r){void 0===i&&(i=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&&r(t,n,s.flush(),e),Promise.resolve(new ArrayBuffer(0));var l=o.value,c=l.length;return t.loaded+=c,c<i||s.dataLength?(s.push(l),s.dataLength>=i&&r(t,n,s.flush(),e)):r(t,n,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,n;function i(t,n,i){var r;return(r=e.call(this,t)||this).code=void 0,r.details=void 0,r.code=n,r.details=i,r}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,c(t,n),i}(s(Error));t.default=f},"./src/utils/imsc1-ttml-parser.ts":
|
|
|
/*!****************************************!*\
|
|
|
!*** ./src/utils/imsc1-ttml-parser.ts ***!
|
|
|
\****************************************/
|
|
|
/*! exports provided: IMSC1_CODEC, parseIMSC1 */function(e,t,n){"use strict";n.r(t),n.d(t,"IMSC1_CODEC",(function(){return u})),n.d(t,"parseIMSC1",(function(){return p}));var i=n(/*! ./mp4-tools */"./src/utils/mp4-tools.ts"),r=n(/*! ./vttparser */"./src/utils/vttparser.ts"),a=n(/*! ./vttcue */"./src/utils/vttcue.ts"),s=n(/*! ../demux/id3 */"./src/demux/id3.ts"),o=n(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),l=n(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts");function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}var u="stpp.ttml.im1t",h=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,d=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,f={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(e,t,n,r,u){var h=Object(i.findBox)(new Uint8Array(e),["mdat"]);if(0!==h.length){var d=h[0],p=Object(s.utf8ArrayToStr)(new Uint8Array(e,d.start,d.end-d.start)),E=Object(o.toTimescaleFromScale)(t,1,n);try{r(function(e,t){var n=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");var i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(i).reduce((function(e,t){return e[t]=n.getAttribute("ttp:"+t)||i[t],e}),{}),s="preserve"!==n.getAttribute("xml:space"),o=v(g(n,"styling","style")),u=v(g(n,"layout","region")),h=g(n,"body","[begin]");return[].map.call(h,(function(e){var n=function e(t,n){return[].slice.call(t.childNodes).reduce((function(t,i,r){var a;return"br"===i.nodeName&&r?t+"\n":null!==(a=i.childNodes)&&void 0!==a&&a.length?e(i,n):n?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent}),"")}(e,s);if(!n||!e.hasAttribute("begin"))return null;var i=b(e.getAttribute("begin"),r),h=b(e.getAttribute("dur"),r),d=b(e.getAttribute("end"),r);if(null===i)throw y(e);if(null===d){if(null===h)throw y(e);d=i+h}var p=new a.default(i-t,d-t,n);p.id=Object(l.generateCueId)(p.startTime,p.endTime,p.text);var g=u[e.getAttribute("region")],v=o[e.getAttribute("style")];p.position=10,p.size=80;var E=function(e,t){var n="http://www.w3.org/ns/ttml#styling";return["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((function(i,r){var a=m(t,n,r)||m(e,n,r);return a&&(i[r]=a),i}),{})}(g,v),k=E.textAlign;if(k){var C=f[k];C&&(p.lineAlign=C),p.align=k}return c(p,E),p})).filter((function(e){return null!==e}))}(p,E))}catch(e){u(e)}}else u(new Error("Could not parse IMSC1 mdat"))}function g(e,t,n){var i=e.getElementsByTagName(t)[0];return i?[].slice.call(i.querySelectorAll(n)):[]}function v(e){return e.reduce((function(e,t){var n=t.getAttribute("xml:id");return n&&(e[n]=t),e}),{})}function m(e,t,n){return e.hasAttributeNS(t,n)?e.getAttributeNS(t,n):null}function y(e){return new Error("Could not parse ttml timestamp "+e)}function b(e,t){if(!e)return null;var n=Object(r.parseTimeStamp)(e);return null===n&&(h.test(e)?n=function(e,t){var n=h.exec(e),i=(0|n[4])+(0|n[5])/t.subFrameRate;return 3600*(0|n[1])+60*(0|n[2])+(0|n[3])+i/t.frameRate}(e,t):d.test(e)&&(n=function(e,t){var n=d.exec(e),i=Number(n[1]);switch(n[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/t.frameRate;case"t":return i/t.tickRate}return i}(e,t))),n}},"./src/utils/logger.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/utils/logger.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: enableLogs, logger */function(e,t,n){"use strict";n.r(t),n.d(t,"enableLogs",(function(){return o})),n.d(t,"logger",(function(){return l}));var i=function(){},r={trace:i,debug:i,log:i,warn:i,info:i,error:i},a=r;function s(e){var t=self.console[e];return t?t.bind(self.console,"["+e+"] >"):i}function o(e){if(self.console&&!0===e||"object"==typeof e){!function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];n.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=r}}else a=r}var l=r},"./src/utils/mediakeys-helper.ts":
|
|
|
/*!***************************************!*\
|
|
|
!*** ./src/utils/mediakeys-helper.ts ***!
|
|
|
\***************************************/
|
|
|
/*! exports provided: KeySystems, requestMediaKeySystemAccess */function(e,t,n){"use strict";var i;n.r(t),n.d(t,"KeySystems",(function(){return i})),n.d(t,"requestMediaKeySystemAccess",(function(){return r})),function(e){e.WIDEVINE="com.widevine.alpha",e.PLAYREADY="com.microsoft.playready"}(i||(i={}));var r="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,n){"use strict";function i(){return self.MediaSource||self.WebKitMediaSource}n.r(t),n.d(t,"getMediaSource",(function(){return i}))},"./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,n){"use strict";n.r(t),n.d(t,"bin2str",(function(){return o})),n.d(t,"readUint16",(function(){return l})),n.d(t,"readUint32",(function(){return c})),n.d(t,"writeUint32",(function(){return u})),n.d(t,"findBox",(function(){return h})),n.d(t,"parseSegmentIndex",(function(){return d})),n.d(t,"parseInitSegment",(function(){return f})),n.d(t,"getStartDTS",(function(){return p})),n.d(t,"getDuration",(function(){return g})),n.d(t,"computeRawDurationFromSamples",(function(){return v})),n.d(t,"offsetStartDTS",(function(){return m})),n.d(t,"segmentValidRange",(function(){return y})),n.d(t,"appendUint8Array",(function(){return b}));var i=n(/*! ./typed-array */"./src/utils/typed-array.ts"),r=n(/*! ../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 n=e[t]<<8|e[t+1];return n<0?65536+n:n}function c(e,t){"data"in e&&(t+=e.start,e=e.data);var n=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return n<0?4294967296+n:n}function u(e,t,n){"data"in e&&(t+=e.start,e=e.data),e[t]=n>>24,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n}function h(e,t){var n,i,r,a=[];if(!t.length)return a;"data"in e?(n=e.data,i=e.start,r=e.end):(i=0,r=(n=e).byteLength);for(var l=i;l<r;){var u=c(n,l),d=u>1?l+u:r;if(o(n.subarray(l+4,l+8))===t[0])if(1===t.length)a.push({data:n,start:l+8,end:d});else{var f=h({data:n,start:l+8,end:d},t.slice(1));f.length&&s.apply(a,f)}l=d}return a}function d(e){var t=h(e,["moov"])[0],n=t?t.end:null,i=h(e,["sidx"]);if(!i||!i[0])return null;var r=[],a=i[0],s=a.data[0],o=0===s?8:16,u=c(a,o);o+=4,o+=0===s?8:16,o+=2;var d=a.end+0,f=l(a,o);o+=2;for(var p=0;p<f;p++){var g=o,v=c(a,g);g+=4;var m=2147483647&v;if(1==(2147483648&v)>>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;var y=c(a,g);g+=4,r.push({referenceSize:m,subsegmentDuration:y,info:{duration:y/u,start:d,end:d+m-1}}),d+=m,o=g+=4}return{earliestPresentationTime:0,timescale:u,version:s,referencesCount:f,references:r,moovEndOffset:n}}function f(e){for(var t=[],n=h(e,["moov","trak"]),i=0;i<n.length;i++){var a=n[i],s=h(a,["tkhd"])[0];if(s){var l=s.data[s.start],u=0===l?12:20,d=c(s,u),f=h(a,["mdia","mdhd"])[0];if(f){var p=c(f,u=0===(l=f.data[f.start])?12:20),g=h(a,["mdia","hdlr"])[0];if(g){var v=o(g.data.subarray(g.start+8,g.start+12)),m={soun:r.ElementaryStreamTypes.AUDIO,vide:r.ElementaryStreamTypes.VIDEO}[v];if(m){var y=h(a,["mdia","minf","stbl","stsd"])[0],b=void 0;y&&(b=o(y.data.subarray(y.start+12,y.start+16))),t[d]={timescale:p,type:m},t[m]={timescale:p,id:d,codec:b}}}}}}return h(e,["moov","mvex","trex"]).forEach((function(e){var n=c(e,4),i=t[n];i&&(i.default={duration:c(e,12),flags:c(e,20)})})),t}function p(e,t){return h(t,["moof","traf"]).reduce((function(t,n){var i=h(n,["tfdt"])[0],r=i.data[i.start],a=h(n,["tfhd"]).reduce((function(t,n){var a=c(n,4),s=e[a];if(s){var o=c(i,4);1===r&&(o*=Math.pow(2,32),o+=c(i,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 n=0,i=0,a=0,s=h(e,["moof","traf"]),o=0;o<s.length;o++){var l=s[o],u=h(l,["tfhd"])[0],f=t[c(u,4)];if(f){var p=f.default,g=c(u,0)|(null==p?void 0:p.flags),m=null==p?void 0:p.duration;8&g&&(m=c(u,2&g?12:8));for(var y=f.timescale||9e4,b=h(l,["trun"]),E=0;E<b.length;E++)n=m?m*c(b[E],4):v(b[E]),f.type===r.ElementaryStreamTypes.VIDEO?i+=n/y:f.type===r.ElementaryStreamTypes.AUDIO&&(a+=n/y)}}if(0===i&&0===a){var k=d(e);if(null!=k&&k.references)return k.references.reduce((function(e,t){return e+t.info.duration||0}),0)}return i||a}function v(e){var t=c(e,0),n=8;1&t&&(n+=4),4&t&&(n+=4);for(var i=0,r=c(e,4),a=0;a<r;a++)256&t&&(i+=c(e,n),n+=4),512&t&&(n+=4),1024&t&&(n+=4),2048&t&&(n+=4);return i}function m(e,t,n){h(t,["moof","traf"]).forEach((function(t){h(t,["tfhd"]).forEach((function(i){var r=c(i,4),s=e[r];if(s){var o=s.timescale||9e4;h(t,["tfdt"]).forEach((function(e){var t=e.data[e.start],i=c(e,4);if(0===t)u(e,4,i-n*o);else{i*=Math.pow(2,32),i+=c(e,8),i-=n*o,i=Math.max(i,0);var r=Math.floor(i/(a+1)),s=Math.floor(i%(a+1));u(e,4,r),u(e,8,s)}}))}}))}))}function y(e){var t={valid:null,remainder:null},n=h(e,["moof"]);if(!n)return t;if(n.length<2)return t.remainder=e,t;var r=n[n.length-1];return t.valid=Object(i.sliceUint8)(e,0,r.start-8),t.remainder=Object(i.sliceUint8)(e,r.start-8),t}function b(e,t){var n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}},"./src/utils/output-filter.ts":
|
|
|
/*!************************************!*\
|
|
|
!*** ./src/utils/output-filter.ts ***!
|
|
|
\************************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return i}));var i=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,n){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,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,n){"use strict";n.r(t),n.d(t,"sendAddTrackEvent",(function(){return r})),n.d(t,"addCueToTrack",(function(){return a})),n.d(t,"clearCurrentCues",(function(){return s})),n.d(t,"removeCuesInRange",(function(){return o})),n.d(t,"getCuesInRange",(function(){return l}));var i=n(/*! ./logger */"./src/utils/logger.ts");function r(e,t){var n;try{n=new Event("addtrack")}catch(e){(n=document.createEvent("Event")).initEvent("addtrack",!1,!1)}n.track=e,t.dispatchEvent(n)}function a(e,t){var n=e.mode;if("disabled"===n&&(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(n){i.logger.debug("[texttrack-utils]: "+n);var r=new self.TextTrackCue(t.startTime,t.endTime,t.text);r.id=t.id,e.addCue(r)}"disabled"===n&&(e.mode=n)}function s(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var n=e.cues.length;n--;)e.removeCue(e.cues[n]);"disabled"===t&&(e.mode=t)}function o(e,t,n){var i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var r=l(e.cues,t,n),a=0;a<r.length;a++)e.removeCue(r[a]);"disabled"===i&&(e.mode=i)}function l(e,t,n){var i=[],r=function(e,t){if(t<e[0].startTime)return 0;var n=e.length-1;if(t>e[n].endTime)return-1;for(var i=0,r=n;i<=r;){var a=Math.floor((r+i)/2);if(t<e[a].startTime)r=a-1;else{if(!(t>e[a].startTime&&i<n))return a;i=a+1}}return e[i].startTime-t<t-e[r].startTime?i:r}(e,t);if(r>-1)for(var a=r,s=e.length;a<s;a++){var o=e[a];if(o.startTime>=t&&o.endTime<=n)i.push(o);else if(o.startTime>n)return i}return i}},"./src/utils/time-ranges.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/utils/time-ranges.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t),t.default={toString:function(e){for(var t="",n=e.length,i=0;i<n;i++)t+="["+e.start(i).toFixed(3)+","+e.end(i).toFixed(3)+"]";return t}}},"./src/utils/timescale-conversion.ts":
|
|
|
/*!*******************************************!*\
|
|
|
!*** ./src/utils/timescale-conversion.ts ***!
|
|
|
\*******************************************/
|
|
|
/*! exports provided: toTimescaleFromBase, toTimescaleFromScale, toMsFromMpegTsClock, toMpegTsClockFromTimescale */function(e,t,n){"use strict";function i(e,t,n,i){void 0===n&&(n=1),void 0===i&&(i=!1);var r=e*t*n;return i?Math.round(r):r}function r(e,t,n,r){return void 0===n&&(n=1),void 0===r&&(r=!1),i(e,t,1/n,r)}function a(e,t){return void 0===t&&(t=!1),i(e,1e3,1/9e4,t)}function s(e,t){return void 0===t&&(t=1),i(e,9e4,1/t)}n.r(t),n.d(t,"toTimescaleFromBase",(function(){return i})),n.d(t,"toTimescaleFromScale",(function(){return r})),n.d(t,"toMsFromMpegTsClock",(function(){return a})),n.d(t,"toMpegTsClockFromTimescale",(function(){return s}))},"./src/utils/typed-array.ts":
|
|
|
/*!**********************************!*\
|
|
|
!*** ./src/utils/typed-array.ts ***!
|
|
|
\**********************************/
|
|
|
/*! exports provided: sliceUint8 */function(e,t,n){"use strict";function i(e,t,n){return Uint8Array.prototype.slice?e.slice(t,n):new Uint8Array(Array.prototype.slice.call(e,t,n))}n.r(t),n.d(t,"sliceUint8",(function(){return i}))},"./src/utils/vttcue.ts":
|
|
|
/*!*****************************!*\
|
|
|
!*** ./src/utils/vttcue.ts ***!
|
|
|
\*****************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.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 n(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;var n=t.toLowerCase();return!!~e.indexOf(n)&&n}function i(e){return n(t,e)}function r(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(var r=1;r<arguments.length;r++){var a=arguments[r];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 c="",u=!1,h=t,d=a,f=s,p=null,g="",v=!0,m="auto",y="start",b=50,E="middle",k=50,C="middle";Object.defineProperty(o,"id",r({},l,{get:function(){return c},set:function(e){c=""+e}})),Object.defineProperty(o,"pauseOnExit",r({},l,{get:function(){return u},set:function(e){u=!!e}})),Object.defineProperty(o,"startTime",r({},l,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",r({},l,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",r({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",r({},l,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",r({},l,{get:function(){return g},set:function(t){var i=function(t){return n(e,t)}(t);if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");g=i,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",r({},l,{get:function(){return v},set:function(e){v=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",r({},l,{get:function(){return m},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");m=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",r({},l,{get:function(){return y},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",r({},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",r({},l,{get:function(){return E},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",r({},l,{get:function(){return k},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");k=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",r({},l,{get:function(){return C},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");C=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,n){"use strict";n.r(t),n.d(t,"parseTimeStamp",(function(){return a})),n.d(t,"fixLineBreaks",(function(){return h})),n.d(t,"VTTParser",(function(){return d}));var i=n(/*! ./vttcue */"./src/utils/vttcue.ts"),r=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,n,i){return 3600*(0|e)+60*(0|t)+(0|n)+parseFloat(i||0)}var n=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?t(n[2],n[3],0,n[4]):t(n[1],n[2],n[3],n[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,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,n){for(var i=0;i<n.length;++i)if(t===n[i]){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 n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1},e}();function o(e,t,n,i){var r=i?e.split(i):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(n);2===s.length&&t(s[0],s[1])}}var l=new i.default(0,0,""),c="middle"===l.align?"middle":"center";function u(e,t,n){var i=e;function r(){var t=a(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function u(){e=e.replace(/^\s+/,"")}if(u(),t.startTime=r(),u(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.substr(3),u(),t.endTime=r(),u(),function(e,t){var i=new s;o(e,(function(e,t){var r;switch(e){case"region":for(var a=n.length-1;a>=0;a--)if(n[a].id===t){i.set(e,n[a].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),i.integer(e,r[0]),i.percent(e,r[0])&&i.set("snapToLines",!1),i.alt(e,r[0],["auto"]),2===r.length&&i.alt("lineAlign",r[1],["start",c,"end"]);break;case"position":r=t.split(","),i.percent(e,r[0]),2===r.length&&i.alt("positionAlign",r[1],["start",c,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",c,"end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var r=i.get("line","auto");"auto"===r&&-1===l.line&&(r=-1),t.line=r,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",c);var a=i.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 h(e){return e.replace(/<br(?: \/)?>/gi,"\n")}var d=function(){function e(){this.state="INITIAL",this.buffer="",this.decoder=new r,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 n(){var e=t.buffer,n=0;for(e=h(e);n<e.length&&"\r"!==e[n]&&"\n"!==e[n];)++n;var i=e.substr(0,n);return"\r"===e[n]&&++n,"\n"===e[n]&&++n,t.buffer=e.substr(n),i}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(r=n()).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:r=n(),t.state){case"HEADER":/:/.test(r)?o(r,(function(e,t){}),/:/):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new i.default(0,0,""),t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{u(r,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var l=-1!==r.indexOf("--\x3e");if(!r||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+=r;continue;case"BADCUE":r||(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,n){"use strict";n.r(t),n.d(t,"generateCueId",(function(){return h})),n.d(t,"parseWebVTT",(function(){return d}));var i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),r=n(/*! ./vttparser */"./src/utils/vttparser.ts"),a=n(/*! ../demux/id3 */"./src/demux/id3.ts"),s=n(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),o=n(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),l=/\r\n|\n\r|\n|\r/g,c=function(e,t,n){return void 0===n&&(n=0),e.substr(n,t.length)===t},u=function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return(t>>>0).toString()};function h(e,t,n){return u(e.toString())+u(t.toString())+u(n)}function d(e,t,n,u,d,f,p,g){var v,m=new r.VTTParser,y=Object(a.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(l,"\n").split("\n"),b=[],E=Object(s.toMpegTsClockFromTimescale)(t,n),k="00:00.000",C=0,S=0,x=!0,w=!1;m.oncue=function(e){var t=u[d],n=u.ccOffset,i=(C-E)/9e4;if(null!=t&&t.new&&(void 0!==S?n=u.ccOffset=t.start:function(e,t,n){var i=e[t],r=e[i.prevCC];if(!r||!r.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;null!==(a=r)&&void 0!==a&&a.new;){var a;e.ccOffset+=i.start-r.start,i.new=!1,r=e[(i=r).prevCC]}e.presentationOffset=n}(u,d,i)),i&&(n=i-u.presentationOffset),w){var r=e.endTime-e.startTime,a=Object(o.normalizePts)(9e4*(e.startTime+n-S),9e4*f)/9e4;e.startTime=a,e.endTime=a+r}var s=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(s)),e.id||(e.id=h(e.startTime,e.endTime,s)),e.endTime>0&&b.push(e)},m.onparsingerror=function(e){v=e},m.onflush=function(){v?g(v):p(b)},y.forEach((function(e){if(x){if(c(e,"X-TIMESTAMP-MAP=")){x=!1,w=!0,e.substr(16).split(",").forEach((function(e){c(e,"LOCAL:")?k=e.substr(6):c(e,"MPEGTS:")&&(C=parseInt(e.substr(7)))}));try{S=function(e){var t=parseInt(e.substr(-3)),n=parseInt(e.substr(-6,2)),r=parseInt(e.substr(-9,2)),a=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(i.isFiniteNumber)(t)&&Object(i.isFiniteNumber)(n)&&Object(i.isFiniteNumber)(r)&&Object(i.isFiniteNumber)(a)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*n,t+=6e4*r,t+=36e5*a}(k)/1e3}catch(e){w=!1,v=e}return}""===e&&(x=!1)}m.parse(e+"\n")})),m.flush()}},"./src/utils/xhr-loader.ts":
|
|
|
/*!*********************************!*\
|
|
|
!*** ./src/utils/xhr-loader.ts ***!
|
|
|
\*********************************/
|
|
|
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! ../utils/logger */"./src/utils/logger.ts"),r=n(/*! ../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 r.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,n){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=n,this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e=this.config,t=this.context;if(e){var n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0;var r=this.xhrSetup;try{if(r)try{r(n,t.url)}catch(e){n.open("GET",t.url,!0),r(n,t.url)}n.readyState||n.open("GET",t.url,!0);var a=this.context.headers;if(a)for(var s in a)n.setRequestHeader(s,a[s])}catch(e){return void this.callbacks.onError({code:n.status,text:e.message},t,n)}t.rangeEnd&&n.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),n.onreadystatechange=this.readystatechange.bind(this),n.onprogress=this.loadprogress.bind(this),n.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),n.send()}},t.readystatechange=function(){var e=this.context,t=this.loader,n=this.stats;if(e&&t){var r=t.readyState,a=this.config;if(!n.aborted&&r>=2)if(self.clearTimeout(this.requestTimeout),0===n.loading.first&&(n.loading.first=Math.max(self.performance.now(),n.loading.start)),4===r){t.onreadystatechange=null,t.onprogress=null;var s=t.status;if(s>=200&&s<300){var o,l;if(n.loading.end=Math.max(self.performance.now(),n.loading.first),l="arraybuffer"===e.responseType?(o=t.response).byteLength:(o=t.responseText).length,n.loaded=n.total=l,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(n,e,o,t),!this.callbacks)return;var u={url:t.responseURL,data:o};this.callbacks.onSuccess(u,n,e,t)}else n.retry>=a.maxRetry||s>=400&&s<499?(i.logger.error(s+" while loading "+e.url),this.callbacks.onError({code:s,text:t.statusText},e,t)):(i.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),n.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},t.loadtimeout=function(){i.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=i())},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,n){e.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},w2Yr:
|
|
|
/*!***********************************************!*\
|
|
|
!*** ./src/assets/images/classModalclose.png ***!
|
|
|
\***********************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACj9JREFUeF7t3duOJMURxvHK1/Hddu+jeEdYRka2sBGWDwIjDMJiwQIBlg3yQSDAAoFsGVgepar7avdxOq1ma7SzPV1dec7IjD+3ZGZVfBE/cmaYgxn4hwRIYDEBQzYkQALLCQCE6SCBCwkAhPEgAYAwAyQQlgA3SFhu7FKSAECUNJoywxIASFhu7FKSAECUNJoywxIASFhu7FKSAECUNJoywxIASFhu7FKSAECUNJoywxIASFhu7FKSAECUNJoywxIASFhu7FKSAECUNJoywxIASFhu7FKSAECUNJoywxIASFhu7FKSAECUNJoywxIASFhu7FKSgFgg2+323jRND5T0gTIjE9hsNle73e67yGNubRcJZLvdHgu9NwzDFUhSt7y/867nxRjzk3Ecv0lZoTggN3Bc1wmSlB3v7KzTebHWPrvb7f6bqkxRQM7gAEmqTnd4ztK8GGOeG8fx6xQliwFyAQdIUnS6szPW5sVa+4vdbvdlbNkigKwVe6NIPtyK7XgH+z3m5ZfTNP07puTqQDyK5SaJ6XQne33nxVr7wm63+yy0/KpAfIvlJgltcx/7Iubl19M0fRKSQjUgEcVyk4R0uvE9sfNijPntOI7/8o2hCpDYYrlJfNvc9vqE8/L7aZr+4ZNGcSAJi+Um8el0o2tTz4sx5uVxHD9yjaMokNTFcpO4trnNdRnn5ZVpmv7mkkoxIBmL5SZx6XRja3LPizHmj+M4/mUtliJAchfLTbLW5rb+fcF5eX2apvcvpZMdSMFiuUnacnD2bUvPizHmT+M4vrsUXVYgpYvlJmlbSMV5uT9N05/PpZcNyPHnOYZhSP79+R4jwLeleIRVe2lFHMfSHx4Oh6v9fv/oNIdsQI4PAkntsWvj+VJxHNPLCgQkbQxozbeUjKMIEJDUHD/Zz5aOoxgQkMge1Bpv1wKOokBAUmMMZT6zFRzFgYBE5sCWfKuWcFQBApKS4yjrWa3hqAYEJLIGt8TbtIijKhCQlBhLGc9oFUd1ICCRMcA536JlHCKAgCTneNY9u3UcYoCApO4g53h6DzhEAQFJjjGtc2YvOMQBAUmdgU751J5wiAQCkpTjWvas3nCIBQKSsoOd4mk94hANBCQpxrbMGb3iEA8EJGUGPOYpPeNoAghIYsY3797ecTQDBCR5Bz3kdA04mgICkpAxzrNHC47mgIAkz8D7nKoJR5NAQOIzzmnXasPRLBCQpB18l9M04mgaCEhcxjrNGq04mgcCkjQALp2iGUcXQECSD4l2HN0AAUl6JOB4nGn2Xz2avnXLJ/K7gNOkDY4nOXYFhJskHgg4ns6wOyAgCUcCjtvZdQkEJP5IwHE+s26BgMQdCTiWs+oaCEjWkYDjckbdAwHJxa/6Hf9E3vFP5dX4Z/HPntV4maVnqgACktvt5+ZwY6gGCEieDAQ43HAcV6kCApIf/rAqH1a5+9AHRDMScHjImJequ0GuI9L2bSng8Meh8kOsmzFpQQKOMBzqgWj4cAsc4TgAMmfX600CjjgcALmRX29IwBGPAyAnGfaCBBxpcADkTI6tIwFHOhwAWciyVSTgSIsDIBfybA0JONLjAMhKpq0gAUceHABxyFU6EnA4NDFiidpvNfHJTCoScPh0MWwtQBxzk4YEHI6Ni1wGEI8ApSABh0fTIpcCxDNAAUge8GOynk2LWA6QgPAEIAl46+gtTfwMeXSVJwcAJDBRZUhU4uDLvIE4rrcpQaIWB0AigRy3d45ENQ6AJADSMRL1OACSCEiHSMAxzwafpIPkNAFw3EgEIAmBdHCTgIMv8yYWcea4Rj9xB8eZXnKDZPLSGBJwLMwBQDIBaejDLXBcmAGAZATSABJwrPQfIJmBCEYCDofeA8QhpBRLhH1OAg7HpgLEMagUy4QgAYdHMwHiEVaKpZV/2Gmw1r692+3eSlGLhjMAUrDLtXFclwoS96YDxD2rqJVScIDEr40A8csraLU0HCBxbyNA3LMKWikVB0jc2gkQt5yCVknHAZL1tgJkPaOgFa3gAMnl9gIkaPwvb2oNB0iW+wmQxEBaxQGS84MAkIRAWscBktvDAJBEQHrBAZKnBwIgCYD0hgMkT4YCIJFAesUBkscJACQCSO84QAKQYB5acGhHwg0SQEQbDs1IAOIJpDKOh9ba740x9z1fO9lybd8qDxCP0amN43A4XO33+0ebzeYtkHg0LmIpQBzDk4Lj+nVB4ti4yGUAcQhQGg6QODQt0RKArAQpFQdIEglYOQYgFwKSjgMk+ZEAZCHjVnCAJC8SgJzJtzUcIMmHBCAn2baKAyR5kADkRq6t4wBJeiQAmTPtBQdI0iIByOM/5fzdMAz30kbrfFq235XL/0x07sHiQvVAesXBTRKP43iCaiC94wBJPBK1QLTgAEkcEpVAtOEASTgSdUC04gBJGBJVQLTjAIk/EjVAwPH0cPAlYDcsKoCA4/wwgGQdSfdAwHF5CEByOZ+ugYBj/b+QxxUgWc6pWyDgcMPBJ+4KbxBw+OEAiaIbBBxhOEByPreuPsQCRxwOkNzOrxsg4EiDAyRP59gFEHCkxQGSJ3k2DwQceXCA5HECTQMBR14cIGkYCDjK4NCOpMkbBBxlcWhG0hwQcNTBoRVJU0DAUReHRiTNAAGHDBzakDQBBByycGhCIh4IOGTi0IJENBBwyMahAYlYIOBoA0fvSEQCAUdbOHpGIg4IONrE0SsSUUDA0TaOHpGIAQKOPnD0hkQEEHD0haMnJNWBgKNPHL0gqQoEHH3j6AFJNSDg0IGjdSRVgIBDF46WkRQHAg6dOFpFUhQIOHTjaBFJMSDgAMfNBFr5hdlFgIADHOcSaAFJdiDgAMelBKQjyQoEHOBwSUAykmxANpvNlTHmW5eAMqx5eDgcrvb7/aMMZ3NkhgQqI1mcl2xAjhnevXv3GWvt/zLkeelIcBQOPNXjKiG5OC9ZgRyD22w2PzXG/CdViCvngKNQ0LkeUxjJ6rxkBzLfJD+z1n6VK9T53NViMz+f4xMlUAiJ07wUATLfJD83xnyRKMPTY5yKzfRsjs2QQGYkzvNSDMgxw+12+/wwDJ8nztO52MTP5bjMCWRC4jUvRYHMN8mvjDGfJsrWq9hEz+SYggkkRuI9L8WBzDfJi8MwfByZs3exkc9je6UEEiEJmpcqQOZP3H9jrf1nYOZBxQY+i20CEohEEjwv1YDMN8nvhmH4u2f+wcV6PoflwhIIRBI1L1WBzDfJS9baDx17EVWs4zNYJjgBTyTR81IdyHyT/GEYhr+u9CW6WMF959U8EnBEkmReRACZb5JXrbUfLOSUpFiPHrBUeAIrSJLNixgg803y2jAM7530JlmxwnvO63kmsIAk6byIAjLfJG9Ya9+Zs0parGf+LG8ggRMkyedFHJD5JnlzGIYrvmW9gQkV8Iozkh/nmBeRQI6Z37lz50f8PIeA6WvkFXLNi1ggjfSF1+w8AYB03mDKi0sAIHH5sbvzBADSeYMpLy4BgMTlx+7OE/g/UNl3UIyjBOAAAAAASUVORK5CYII="},xlxt:
|
|
|
/*!******************************************************************************!*\
|
|
|
!*** ./src/pages/Problemset/components/ExportFolderModal/index.less?modules ***!
|
|
|
\******************************************************************************/
|
|
|
/*! no static exports found */
|
|
|
/*! exports used: default */
|
|
|
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,n){e.exports={flex_box_center:"flex_box_center___1qaRn",flex_space_between:"flex_space_between___3tOTR",flex_box_vertical_center:"flex_box_vertical_center___2XsRs",flex_box_center_end:"flex_box_center_end___3O9De",flex_box_column:"flex_box_column___3bx6a",exportModal:"exportModal___29rdj"}}}]); |