You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
330 lines
916 KiB
330 lines
916 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[190,5,7,8,10],{"+vTd":function(Pt,Ye,K){Pt.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":function(Pt,Ye,K){Pt.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":function(Pt,Ye,K){Pt.exports=K.p+"static/Authorize.cc9c212f.png"},"6+eU":function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return o});var Ee=K("wx14"),j=K("rePB"),O=K("VTBJ"),N=K("1OyB"),E=K("vuIU"),R=K("Ji7U"),I=K("LK+K"),L=K("q1tI"),T=K.n(L),P=K("TSYQ"),b=K.n(P),S=function(h){var a,r="".concat(h.rootPrefixCls,"-item"),e=b()(r,"".concat(r,"-").concat(h.page),(a={},Object(j.a)(a,"".concat(r,"-active"),h.active),Object(j.a)(a,h.className,!!h.className),Object(j.a)(a,"".concat(r,"-disabled"),!h.page),a)),i=function(){h.onClick(h.page)},g=function(y){h.onKeyPress(y,h.onClick,h.page)};return T.a.createElement("li",{title:h.showTitle?h.page:null,className:e,onClick:i,onKeyPress:g,tabIndex:"0"},h.itemRender(h.page,"page",T.a.createElement("a",{rel:"nofollow"},h.page)))},w=S,C={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},x=function(m){Object(R.a)(a,m);var h=Object(I.a)(a);function a(){var r;Object(N.a)(this,a);for(var e=arguments.length,i=new Array(e),g=0;g<e;g++)i[g]=arguments[g];return r=h.call.apply(h,[this].concat(i)),r.state={goInputText:""},r.buildOptionText=function(f){return"".concat(f," ").concat(r.props.locale.items_per_page)},r.changeSize=function(f){r.props.changeSize(Number(f))},r.handleChange=function(f){r.setState({goInputText:f.target.value})},r.handleBlur=function(f){var y=r.props,t=y.goButton,A=y.quickGo,U=y.rootPrefixCls,B=r.state.goInputText;if(t||B==="")return;if(f.relatedTarget&&(f.relatedTarget.className.indexOf("".concat(U,"-prev"))>=0||f.relatedTarget.className.indexOf("".concat(U,"-next"))>=0))return;r.setState({goInputText:""}),A(r.getValidValue())},r.go=function(f){var y=r.state.goInputText;if(y==="")return;(f.keyCode===C.ENTER||f.type==="click")&&(r.setState({goInputText:""}),r.props.quickGo(r.getValidValue()))},r}return Object(E.a)(a,[{key:"getValidValue",value:function(){var e=this.state,i=e.goInputText,g=e.current;return!i||isNaN(i)?g:Number(i)}},{key:"getPageSizeOptions",value:function(){var e=this.props,i=e.pageSize,g=e.pageSizeOptions;return g.some(function(f){return f.toString()===i.toString()})?g:g.concat([i.toString()]).sort(function(f,y){var t=isNaN(Number(f))?0:Number(f),A=isNaN(Number(y))?0:Number(y);return t-A})}},{key:"render",value:function(){var e=this,i=this.props,g=i.pageSize,f=i.locale,y=i.rootPrefixCls,t=i.changeSize,A=i.quickGo,U=i.goButton,B=i.selectComponentClass,G=i.buildOptionText,J=i.selectPrefixCls,F=i.disabled,q=this.state.goInputText,re="".concat(y,"-options"),ae=B,ve=null,de=null,Z=null;if(!t&&!A)return null;var ee=this.getPageSizeOptions();if(t&&ae){var pe=ee.map(function(Q,V){return T.a.createElement(ae.Option,{key:V,value:Q.toString()},(G||e.buildOptionText)(Q))});ve=T.a.createElement(ae,{disabled:F,prefixCls:J,showSearch:!1,className:"".concat(re,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(g||ee[0]).toString(),onChange:this.changeSize,getPopupContainer:function(V){return V.parentNode}},pe)}return A&&(U&&(Z=typeof U=="boolean"?T.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:F,className:"".concat(re,"-quick-jumper-button")},f.jump_to_confirm):T.a.createElement("span",{onClick:this.go,onKeyUp:this.go},U)),de=T.a.createElement("div",{className:"".concat(re,"-quick-jumper")},f.jump_to,T.a.createElement("input",{disabled:F,type:"text",value:q,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),f.page,Z)),T.a.createElement("li",{className:"".concat(re)},ve,de)}}]),a}(T.a.Component);x.defaultProps={pageSizeOptions:["10","20","50","100"]};var _=x,p=K("N2Kk");function n(){}function u(m){return typeof m=="number"&&isFinite(m)&&Math.floor(m)===m}function l(m,h,a){return a}function v(m,h,a){var r=typeof m=="undefined"?h.pageSize:m;return Math.floor((a.total-1)/r)+1}var d=function(m){Object(R.a)(a,m);var h=Object(I.a)(a);function a(r){var e;Object(N.a)(this,a),e=h.call(this,r),e.getJumpPrevPage=function(){return Math.max(1,e.state.current-(e.props.showLessItems?3:5))},e.getJumpNextPage=function(){return Math.min(v(void 0,e.state,e.props),e.state.current+(e.props.showLessItems?3:5))},e.getItemIcon=function(t,A){var U=e.props.prefixCls,B=t||T.a.createElement("button",{type:"button","aria-label":A,className:"".concat(U,"-item-link")});return typeof t=="function"&&(B=T.a.createElement(t,Object(O.a)({},e.props))),B},e.savePaginationNode=function(t){e.paginationNode=t},e.isValid=function(t){return u(t)&&t!==e.state.current},e.shouldDisplayQuickJumper=function(){var t=e.props,A=t.showQuickJumper,U=t.pageSize,B=t.total;return B<=U?!1:A},e.handleKeyDown=function(t){(t.keyCode===C.ARROW_UP||t.keyCode===C.ARROW_DOWN)&&t.preventDefault()},e.handleKeyUp=function(t){var A=e.getValidValue(t),U=e.state.currentInputValue;A!==U&&e.setState({currentInputValue:A}),t.keyCode===C.ENTER?e.handleChange(A):t.keyCode===C.ARROW_UP?e.handleChange(A-1):t.keyCode===C.ARROW_DOWN&&e.handleChange(A+1)},e.changePageSize=function(t){var A=e.state.current,U=v(t,e.state,e.props);A=A>U?U:A,U===0&&(A=e.state.current),typeof t=="number"&&("pageSize"in e.props||e.setState({pageSize:t}),"current"in e.props||e.setState({current:A,currentInputValue:A})),e.props.onShowSizeChange(A,t),"onChange"in e.props&&e.props.onChange&&e.props.onChange(A,t)},e.handleChange=function(t){var A=e.props.disabled,U=t;if(e.isValid(U)&&!A){var B=v(void 0,e.state,e.props);U>B?U=B:U<1&&(U=1),"current"in e.props||e.setState({current:U,currentInputValue:U});var G=e.state.pageSize;return e.props.onChange(U,G),U}return e.state.current},e.prev=function(){e.hasPrev()&&e.handleChange(e.state.current-1)},e.next=function(){e.hasNext()&&e.handleChange(e.state.current+1)},e.jumpPrev=function(){e.handleChange(e.getJumpPrevPage())},e.jumpNext=function(){e.handleChange(e.getJumpNextPage())},e.hasPrev=function(){return e.state.current>1},e.hasNext=function(){return e.state.current<v(void 0,e.state,e.props)},e.runIfEnter=function(t,A){if(t.key==="Enter"||t.charCode===13){for(var U=arguments.length,B=new Array(U>2?U-2:0),G=2;G<U;G++)B[G-2]=arguments[G];A.apply(void 0,B)}},e.runIfEnterPrev=function(t){e.runIfEnter(t,e.prev)},e.runIfEnterNext=function(t){e.runIfEnter(t,e.next)},e.runIfEnterJumpPrev=function(t){e.runIfEnter(t,e.jumpPrev)},e.runIfEnterJumpNext=function(t){e.runIfEnter(t,e.jumpNext)},e.handleGoTO=function(t){(t.keyCode===C.ENTER||t.type==="click")&&e.handleChange(e.state.currentInputValue)};var i=r.onChange!==n,g="current"in r;g&&!i&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var f=r.defaultCurrent;"current"in r&&(f=r.current);var y=r.defaultPageSize;return"pageSize"in r&&(y=r.pageSize),f=Math.min(f,v(y,void 0,r)),e.state={current:f,currentInputValue:f,pageSize:y},e}return Object(E.a)(a,[{key:"componentDidUpdate",value:function(e,i){var g=this.props.prefixCls;if(i.current!==this.state.current&&this.paginationNode){var f=this.paginationNode.querySelector(".".concat(g,"-item-").concat(i.current));f&&document.activeElement===f&&f.blur()}}},{key:"getValidValue",value:function(e){var i=e.target.value,g=v(void 0,this.state,this.props),f=this.state.currentInputValue,y;return i===""?y=i:isNaN(Number(i))?y=f:i>=g?y=g:y=Number(i),y}},{key:"getShowSizeChanger",value:function(){var e=this.props,i=e.showSizeChanger,g=e.total,f=e.totalBoundaryShowSizeChanger;return typeof i!="undefined"?i:g>f}},{key:"renderPrev",value:function(e){var i=this.props,g=i.prevIcon,f=i.itemRender,y=f(e,"prev",this.getItemIcon(g,"prev page")),t=!this.hasPrev();return Object(L.isValidElement)(y)?Object(L.cloneElement)(y,{disabled:t}):y}},{key:"renderNext",value:function(e){var i=this.props,g=i.nextIcon,f=i.itemRender,y=f(e,"next",this.getItemIcon(g,"next page")),t=!this.hasNext();return Object(L.isValidElement)(y)?Object(L.cloneElement)(y,{disabled:t}):y}},{key:"render",value:function(){var e=this,i=this.props,g=i.prefixCls,f=i.className,y=i.style,t=i.disabled,A=i.hideOnSinglePage,U=i.total,B=i.locale,G=i.showQuickJumper,J=i.showLessItems,F=i.showTitle,q=i.showTotal,re=i.simple,ae=i.itemRender,ve=i.showPrevNextJumpers,de=i.jumpPrevIcon,Z=i.jumpNextIcon,ee=i.selectComponentClass,pe=i.selectPrefixCls,Q=i.pageSizeOptions,V=this.state,Ce=V.current,De=V.pageSize,Ne=V.currentInputValue;if(A===!0&&U<=De)return null;var we=v(void 0,this.state,this.props),ke=[],Se=null,Ae=null,je=null,Be=null,Ke=null,Ue=G&&G.goButton,xe=J?1:2,Ge=Ce-1>0?Ce-1:0,qe=Ce+1<we?Ce+1:we,lt=Object.keys(this.props).reduce(function(X,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(X[$]=e.props[$]),X},{});if(re)return Ue&&(typeof Ue=="boolean"?Ke=T.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},B.jump_to_confirm):Ke=T.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Ue),Ke=T.a.createElement("li",{title:F?"".concat(B.jump_to).concat(Ce,"/").concat(we):null,className:"".concat(g,"-simple-pager")},Ke)),T.a.createElement("ul",Object(Ee.a)({className:b()(g,"".concat(g,"-simple"),Object(j.a)({},"".concat(g,"-disabled"),t),f),style:y,ref:this.savePaginationNode},lt),T.a.createElement("li",{title:F?B.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:b()("".concat(g,"-prev"),Object(j.a)({},"".concat(g,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Ge)),T.a.createElement("li",{title:F?"".concat(Ce,"/").concat(we):null,className:"".concat(g,"-simple-pager")},T.a.createElement("input",{type:"text",value:Ne,disabled:t,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),T.a.createElement("span",{className:"".concat(g,"-slash")},"/"),we),T.a.createElement("li",{title:F?B.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:b()("".concat(g,"-next"),Object(j.a)({},"".concat(g,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(qe)),Ke);if(we<=3+xe*2){var ot={locale:B,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:F,itemRender:ae};we||ke.push(T.a.createElement(w,Object(Ee.a)({},ot,{key:"noPager",page:we,className:"".concat(g,"-disabled")})));for(var bt=1;bt<=we;bt+=1){var ht=Ce===bt;ke.push(T.a.createElement(w,Object(Ee.a)({},ot,{key:bt,page:bt,active:ht})))}}else{var ut=J?B.prev_3:B.prev_5,Ze=J?B.next_3:B.next_5;ve&&(Se=T.a.createElement("li",{title:F?ut:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:b()("".concat(g,"-jump-prev"),Object(j.a)({},"".concat(g,"-jump-prev-custom-icon"),!!de))},ae(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(de,"prev page"))),Ae=T.a.createElement("li",{title:F?Ze:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:b()("".concat(g,"-jump-next"),Object(j.a)({},"".concat(g,"-jump-next-custom-icon"),!!Z))},ae(this.getJumpNextPage(),"jump-next",this.getItemIcon(Z,"next page")))),Be=T.a.createElement(w,{locale:B,last:!0,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:we,page:we,active:!1,showTitle:F,itemRender:ae}),je=T.a.createElement(w,{locale:B,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:F,itemRender:ae});var Et=Math.max(1,Ce-xe),St=Math.min(Ce+xe,we);Ce-1<=xe&&(St=1+xe*2),we-Ce<=xe&&(Et=we-xe*2);for(var He=Et;He<=St;He+=1){var it=Ce===He;ke.push(T.a.createElement(w,{locale:B,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:He,page:He,active:it,showTitle:F,itemRender:ae}))}Ce-1>=xe*2&&Ce!==1+2&&(ke[0]=Object(L.cloneElement)(ke[0],{className:"".concat(g,"-item-after-jump-prev")}),ke.unshift(Se)),we-Ce>=xe*2&&Ce!==we-2&&(ke[ke.length-1]=Object(L.cloneElement)(ke[ke.length-1],{className:"".concat(g,"-item-before-jump-next")}),ke.push(Ae)),Et!==1&&ke.unshift(je),St!==we&&ke.push(Be)}var ye=null;q&&(ye=T.a.createElement("li",{className:"".concat(g,"-total-text")},q(U,[U===0?0:(Ce-1)*De+1,Ce*De>U?U:Ce*De])));var he=!this.hasPrev()||!we,fe=!this.hasNext()||!we;return T.a.createElement("ul",Object(Ee.a)({className:b()(g,f,Object(j.a)({},"".concat(g,"-disabled"),t)),style:y,unselectable:"unselectable",ref:this.savePaginationNode},lt),ye,T.a.createElement("li",{title:F?B.prev_page:null,onClick:this.prev,tabIndex:he?null:0,onKeyPress:this.runIfEnterPrev,className:b()("".concat(g,"-prev"),Object(j.a)({},"".concat(g,"-disabled"),he)),"aria-disabled":he},this.renderPrev(Ge)),ke,T.a.createElement("li",{title:F?B.next_page:null,onClick:this.next,tabIndex:fe?null:0,onKeyPress:this.runIfEnterNext,className:b()("".concat(g,"-next"),Object(j.a)({},"".concat(g,"-disabled"),fe)),"aria-disabled":fe},this.renderNext(qe)),T.a.createElement(_,{disabled:t,locale:B,rootPrefixCls:g,selectComponentClass:ee,selectPrefixCls:pe,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Ce,pageSize:De,pageSizeOptions:Q,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ue}))}}],[{key:"getDerivedStateFromProps",value:function(e,i){var g={};if("current"in e&&(g.current=e.current,e.current!==i.current&&(g.currentInputValue=g.current)),"pageSize"in e&&e.pageSize!==i.pageSize){var f=i.current,y=v(e.pageSize,i,e);f=f>y?y:f,"current"in e||(g.current=f,g.currentInputValue=f),g.pageSize=e.pageSize}return g}}]),a}(T.a.Component);d.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:n,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:n,locale:p.a,style:{},itemRender:l,totalBoundaryShowSizeChanger:50};var o=d},"815F":function(Pt,Ye,K){"use strict";K.d(Ye,"e",function(){return I}),K.d(Ye,"c",function(){return T}),K.d(Ye,"d",function(){return P}),K.d(Ye,"a",function(){return S}),K.d(Ye,"f",function(){return w}),K.d(Ye,"b",function(){return C});var Ee=K("KQm4"),j=K("VTBJ"),O=K("Ff2n"),N=K("Zm9Q"),E=K("Kwbf"),R=K("OZM5");function I(x,_){return x!=null?x:_}function L(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],_=new Map;function p(n){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(n||[]).forEach(function(l){var v=l.key,d=l.children;Object(E.a)(v!=null,"Tree node must have a certain key: [".concat(u).concat(v,"]"));var o=String(v);Object(E.a)(!_.has(o)||v===null||v===void 0,"Same 'key' exist in the Tree: ".concat(o)),_.set(o,!0),p(d,"".concat(u).concat(o," > "))})}p(x)}function T(x){function _(p){var n=Object(N.a)(p);return n.map(function(u){if(!Object(R.i)(u))return Object(E.a)(!u,"Tree/TreeNode can only accept TreeNode as children."),null;var l=u.key,v=u.props,d=v.children,o=Object(O.a)(v,["children"]),m=Object(j.a)({key:l},o),h=_(d);return h.length&&(m.children=h),m}).filter(function(u){return u})}return _(x)}function P(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],p=new Set(_===!0?[]:_),n=[];function u(l){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return l.map(function(d,o){var m=Object(R.h)(v?v.pos:"0",o),h=I(d.key,m),a=Object(j.a)(Object(j.a)({},d),{},{parent:v,pos:m,children:null,data:d,isStart:[].concat(Object(Ee.a)(v?v.isStart:[]),[o===0]),isEnd:[].concat(Object(Ee.a)(v?v.isEnd:[]),[o===l.length-1])});return n.push(a),_===!0||p.has(h)?a.children=u(d.children||[],a):a.children=[],a})}return u(x),n}function b(x,_,p){var n;p?typeof p=="string"?n=function(v){return v[p]}:typeof p=="function"&&(n=function(v){return p(v)}):n=function(v,d){return I(v.key,d)};function u(l,v,d){var o=l?l.children:x,m=l?Object(R.h)(d.pos,v):"0";if(l){var h=n(l,m),a={node:l,index:v,pos:m,key:h,parentPos:d.node?d.pos:null,level:d.level+1};_(a)}o&&o.forEach(function(r,e){u(r,e,{node:l,pos:m,level:d?d.level+1:-1})})}u(null)}function S(x){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=_.initWrapper,n=_.processEntity,u=_.onProcessFinished,l=arguments.length>2?arguments[2]:void 0,v={},d={},o={posEntities:v,keyEntities:d};return p&&(o=p(o)||o),b(x,function(m){var h=m.node,a=m.index,r=m.pos,e=m.key,i=m.parentPos,g=m.level,f={node:h,index:a,key:e,pos:r,level:g},y=I(e,r);v[r]=f,d[y]=f,f.parent=v[i],f.parent&&(f.parent.children=f.parent.children||[],f.parent.children.push(f)),n&&n(f,o)},l),u&&u(o),o}function w(x,_){var p=_.expandedKeys,n=_.selectedKeys,u=_.loadedKeys,l=_.loadingKeys,v=_.checkedKeys,d=_.halfCheckedKeys,o=_.dragOverNodeKey,m=_.dropPosition,h=_.keyEntities,a=h[x],r={eventKey:x,expanded:p.indexOf(x)!==-1,selected:n.indexOf(x)!==-1,loaded:u.indexOf(x)!==-1,loading:l.indexOf(x)!==-1,checked:v.indexOf(x)!==-1,halfChecked:d.indexOf(x)!==-1,pos:String(a?a.pos:""),dragOver:o===x&&m===0,dragOverGapTop:o===x&&m===-1,dragOverGapBottom:o===x&&m===1};return r}function C(x){var _=x.data,p=x.expanded,n=x.selected,u=x.checked,l=x.loaded,v=x.loading,d=x.halfChecked,o=x.dragOver,m=x.dragOverGapTop,h=x.dragOverGapBottom,a=x.pos,r=x.active,e=Object(j.a)(Object(j.a)({},_),{},{expanded:p,selected:n,checked:u,loaded:l,loading:v,halfChecked:d,dragOver:o,dragOverGapTop:m,dragOverGapBottom:h,pos:a,active:r});return"props"in e||Object.defineProperty(e,"props",{get:function(){return Object(E.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),x}}),e}},"8hTe":function(Pt,Ye,K){Pt.exports={button:"button___1wy9m"}},"9Bee":function(Pt,Ye,K){"use strict";var Ee=K("DYRE"),j=K("zeV3"),O=K("+L6B"),N=K("2/Rp"),E=K("k1fw"),R=K("9og8"),I=K("tJVT"),L=K("WmNS"),T=K.n(L),P=K("q1tI"),b=K.n(P),S=K("vg9a"),w=K("DlQD"),C=K.n(w),x=K("rUJ1");function _(M,s){var c=M.match(/^(\s+)(?:```)/);if(c===null)return s;var D=c[1];return s.split(`
|
|
`).map(function(W){var k=W.match(/^\s+/);if(k===null)return W;var ce=Object(I.a)(k,1),ze=ce[0];return ze.length>=D.length?W.slice(D.length):W}).join(`
|
|
`)}var p=[],n=["<ul>"],u=new C.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function v(){p.length=0,n=["<ul>"]}var d={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function o(M,s,c,D){if(s>=M.length||M[s].level<=c)return s;var W=M[s];D.push("<li><a href='#"+W.anchor+"'>"+W.text+"</a>"),s++;var k=[];return s=o(M,s,W.level,k),k.length>0&&(D.push("<ul>"),k.forEach(function(ce){D.push(ce)}),D.push("</ul>")),D.push("</li>"),s=o(M,s,c,D),s}function m(){return o(p,0,0,n),n.push("</ul>"),n.join("")}var h={heading:function(s){var c=l.exec(s);if(c)return{type:"heading",raw:c[0],depth:c[1].length,text:c[2]}},fences:function(s){var c=this.rules.block.fences.exec(s);if(c){var D=c[0],W=_(D,c[3]||""),k=c[2]?c[2].trim():c[2];if(["latex","katex","math"].indexOf(k)>=0){var ce=e(),ze=W;W=ce,i[ce]={type:"block",expression:ze}}return{type:"code",raw:D,lang:k,text:W}}}},a=/(?:\${2})([^\n`]+?)(?:\${2})/gi,r=0,e=function(){return"__special_katext_id_".concat(r++,"__")},i={};function g(){return i}function f(){r=0,i={}}function y(M){return M=M.replace(a,function(s,c){var D=e();return i[D]={type:"inline",expression:c},D}),M}var t=u.listitem;u.listitem=function(M){return t(y(M))};var A=u.paragraph;u.paragraph=function(M){return A(y(M))};var U=u.tablecell;u.tablecell=function(M,s){return U(y(M),s)},u.code=function(M,s,c){var D=(s||"").match(/\S*/)[0];return D?["latex","katex","math"].indexOf(D)>=0?"<p class='editormd-tex'>".concat(M,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(c?M:Object(x.escape)(M,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(c?M:Object(x.escape)(M,!0))+"</code></pre>"},u.heading=function(M,s,c){var D=this.options.headerPrefix+c.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return p.push({anchor:D,level:s,text:M}),"<h"+s+' id="'+D+'">'+M+"</h"+s+">"},C.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),C.a.use({tokenizer:h,renderer:u});var B=C.a,G=K("SJMd"),J=K("ulZh"),F=K.n(J),q=K("m3rI"),re=K("Oy/b"),ae=K("p5ED"),ve=K("ErOA");/*! *****************************************************************************
|
|
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.
|
|
***************************************************************************** */var de=function(M,s){return(de=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,D){c.__proto__=D}||function(c,D){for(var W in D)Object.prototype.hasOwnProperty.call(D,W)&&(c[W]=D[W])})(M,s)};function Z(M,s){function c(){this.constructor=M}de(M,s),M.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function ee(M,s,c,D){return new(c||(c=Promise))(function(W,k){function ce(Nt){try{gt(D.next(Nt))}catch(Xe){k(Xe)}}function ze(Nt){try{gt(D.throw(Nt))}catch(Xe){k(Xe)}}function gt(Nt){var Xe;Nt.done?W(Nt.value):(Xe=Nt.value,Xe instanceof c?Xe:new c(function(Jt){Jt(Xe)})).then(ce,ze)}gt((D=D.apply(M,s||[])).next())})}function pe(M,s){var c,D,W,k,ce={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return k={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function ze(gt){return function(Nt){return function(Xe){if(c)throw new TypeError("Generator is already executing.");for(;ce;)try{if(c=1,D&&(W=2&Xe[0]?D.return:Xe[0]?D.throw||((W=D.return)&&W.call(D),0):D.next)&&!(W=W.call(D,Xe[1])).done)return W;switch(D=0,W&&(Xe=[2&Xe[0],W.value]),Xe[0]){case 0:case 1:W=Xe;break;case 4:return ce.label++,{value:Xe[1],done:!1};case 5:ce.label++,D=Xe[1],Xe=[0];continue;case 7:Xe=ce.ops.pop(),ce.trys.pop();continue;default:if(!(W=ce.trys,(W=W.length>0&&W[W.length-1])||Xe[0]!==6&&Xe[0]!==2)){ce=0;continue}if(Xe[0]===3&&(!W||Xe[1]>W[0]&&Xe[1]<W[3])){ce.label=Xe[1];break}if(Xe[0]===6&&ce.label<W[1]){ce.label=W[1],W=Xe;break}if(W&&ce.label<W[2]){ce.label=W[2],ce.ops.push(Xe);break}W[2]&&ce.ops.pop(),ce.trys.pop();continue}Xe=s.call(M,ce)}catch(Jt){Xe=[6,Jt],D=0}finally{c=W=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([gt,Nt])}}}function Q(){for(var M=0,s=0,c=arguments.length;s<c;s++)M+=arguments[s].length;var D=Array(M),W=0;for(s=0;s<c;s++)for(var k=arguments[s],ce=0,ze=k.length;ce<ze;ce++,W++)D[W]=k[ce];return D}var V=function(){function M(){}return M.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},M.setAttributes=function(s,c){for(var D=0,W=c;D<W.length;D++){var k=W[D],ce=k[0],ze=k[1];s.setAttribute(ce,ze)}},M.createRect=function(s,c,D){var W=document.createElementNS("http://www.w3.org/2000/svg","rect");return W.setAttribute("width",s.toString()),W.setAttribute("height",c.toString()),D&&M.setAttributes(W,D),W},M.createLine=function(s,c,D,W,k){var ce=document.createElementNS("http://www.w3.org/2000/svg","line");return ce.setAttribute("x1",s.toString()),ce.setAttribute("y1",c.toString()),ce.setAttribute("x2",D.toString()),ce.setAttribute("y2",W.toString()),k&&M.setAttributes(ce,k),ce},M.createPolygon=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",s),c&&M.setAttributes(D,c),D},M.createCircle=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(s/2).toString()),D.setAttribute("cy",(s/2).toString()),D.setAttribute("r",s.toString()),c&&M.setAttributes(D,c),D},M.createEllipse=function(s,c,D){var W=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(c/2).toString()),W.setAttribute("rx",(s/2).toString()),W.setAttribute("ry",(c/2).toString()),D&&M.setAttributes(W,D),W},M.createGroup=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&M.setAttributes(c,s),c},M.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},M.createMarker=function(s,c,D,W,k,ce,ze){var gt=document.createElementNS("http://www.w3.org/2000/svg","marker");return M.setAttributes(gt,[["id",s],["orient",c],["markerWidth",D.toString()],["markerHeight",W.toString()],["refX",k.toString()],["refY",ce.toString()]]),gt.appendChild(ze),gt},M.createText=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),s&&M.setAttributes(c,s),c},M.createTSpan=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=s,c&&M.setAttributes(D,c),D},M.createImage=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&M.setAttributes(c,s),c},M.createPoint=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=s,D.y=c,D},M.createPath=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",s),c&&M.setAttributes(D,c),D},M}(),Ce=function(){function M(){}return M.addKey=function(s){M.key=s},Object.defineProperty(M,"isLicensed",{get:function(){return!!M.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(M.key)},enumerable:!1,configurable:!0}),M}(),De=function(){function M(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return M.prototype.rasterize=function(s,c,D){var W=this;return new Promise(function(k){var ce=D!==void 0?D:document.createElement("canvas");s===null&&(W.markersOnly=!0,W.naturalSize=!1);var ze=document.createElementNS("http://www.w3.org/2000/svg","svg");ze.setAttribute("xmlns","http://www.w3.org/2000/svg"),ze.setAttribute("width",c.width.baseVal.valueAsString),ze.setAttribute("height",c.height.baseVal.valueAsString),ze.setAttribute("viewBox","0 0 "+c.viewBox.baseVal.width.toString()+" "+c.viewBox.baseVal.height.toString()),ze.innerHTML=c.innerHTML,W.naturalSize===!0?(ze.width.baseVal.value=s.naturalWidth,ze.height.baseVal.value=s.naturalHeight):W.width!==void 0&&W.height!==void 0&&(ze.width.baseVal.value=W.width,ze.height.baseVal.value=W.height),ce.width=ze.width.baseVal.value,ce.height=ze.height.baseVal.value;var gt=ze.outerHTML,Nt=ce.getContext("2d");W.markersOnly!==!0&&Nt.drawImage(s,0,0,ce.width,ce.height);var Xe=window.URL,Jt=new Image(ce.width,ce.height);Jt.setAttribute("crossOrigin","anonymous");var Pn=new Blob([gt],{type:"image/svg+xml"}),Bn=Xe.createObjectURL(Pn);Jt.onload=function(){Nt.drawImage(Jt,0,0),Xe.revokeObjectURL(Bn);var jr=ce.toDataURL(W.imageType,W.imageQuality);k(jr)},Jt.src=Bn})},M}(),Ne=function(){},we=function(){function M(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(M.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),M.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},M.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},M.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new ke("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new ke("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Se("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Se("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},M.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},M}(),ke=function(M,s){this.selector=M,this.style=s},Se=function(M,s){this.localName=M,this.style=s},Ae=function(){function M(s,c,D,W,k){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=c,this.markerItems=D,this.uiStyleSettings=W,this.styles=k,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return M.prototype.show=function(s){var c=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var D=document.createElement("div");D.className=this.toolbarBlockStyleClass.name,D.style.whiteSpace="nowrap",this.uiContainer.appendChild(D),this.addActionButton(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(k){var ce=document.createElement("div");ce.className=""+c.toolbarButtonStyleClass.name,ce.setAttribute("data-type-name",k.typeName),ce.innerHTML=k.icon,ce.addEventListener("click",function(){c.markerToolbarButtonClicked(ce,k)}),c.buttons.push(ce),c.markerButtons.push(ce)}),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 W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",W.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(W),this.addActionButton(W,'<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(W,'<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()},M.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},M.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},M.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},M.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var c=0;c<this.markerButtons.length;c++)c<s||c===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[c]):(c===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[c]))}},M.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(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")},M.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(c){c.className=c.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),c.className=c.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),c.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},M.prototype.addActionButton=function(s,c,D){var W=this,k=document.createElement("div");switch(k.className=""+this.toolbarButtonStyleClass.name,k.innerHTML=c,k.setAttribute("data-action",D),k.addEventListener("click",function(){W.actionToolbarButtonClicked(k,D)}),D){case"select":k.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":k.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":k.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":k.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":k.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(k),this.buttons.push(k)},M.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Se("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Se("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Se("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Se("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new Se("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Se("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Se("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Se("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new ke("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},M.prototype.markerToolbarButtonClicked=function(s,c){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("marker",c)}),this.markerButtonOverflowBlock.style.display="none"},M.prototype.actionToolbarButtonClicked=function(s,c){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("action",c)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},M.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},M.prototype.setActiveMarkerButton=function(s){var c=this.markerButtons.find(function(D){return D.getAttribute("data-type-name")===s});c&&this.setActiveButton(c)},M.prototype.setCurrentMarker=function(s){var c=this;this.currentMarker=s,this.buttons.filter(function(D){return/delete|notes/.test(D.getAttribute("data-action"))}).forEach(function(D){c.currentMarker===void 0?(D.style.fillOpacity="0.4",D.style.pointerEvents="none"):(D.style.fillOpacity="1",D.style.pointerEvents="all")})},M}(),je=function(){function M(s,c,D,W){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=c,this.uiStyleSettings=D,this.styles=W,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return M.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new Se("toolbox",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-family: sans-serif;
|
|
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolboxStyleColorsClass=this.styles.addClass(new Se("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Se("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Se("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Se("toolbox-panel-row",`
|
|
display: flex;
|
|
`+(this.displayMode==="inline"?"position: absolute;":"")+`
|
|
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
cursor: default;
|
|
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
|
|
`+(this.displayMode==="inline"?"width: 100%;":"")+`
|
|
box-sizing: content-box;
|
|
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new Se("toolbox-panel-row_colors",`
|
|
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Se("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Se("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Se("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new ke("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},M.prototype.show=function(s){var c;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((c=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},M.prototype.setPanelButtons=function(s){var c,D,W=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((c=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((D=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(k){var ce;k.uiStyleSettings=W.uiStyleSettings;var ze=document.createElement("div");ze.className=W.toolboxButtonStyleClass.name+" "+((ce=W.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ce!==void 0?ce:W.toolboxButtonStyleColorsClass.name),ze.innerHTML=k.icon,ze.title=k.title,ze.addEventListener("click",function(){W.panelButtonClick(k)}),W.panelButtons.push(ze),W.buttonRow.appendChild(ze)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},M.prototype.panelButtonClick=function(s){var c=this,D=-1;if(s!==this.activePanel){D=this.panels.indexOf(s),this.panelRow.innerHTML="";var W=s.getUi();W.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(W),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=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){c.displayMode==="inline"?c.panelRow.style.display="none":c.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(k,ce){var ze,gt;k.className=c.toolboxButtonStyleClass.name+" "+(ce===D?""+((ze=c.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ze!==void 0?ze:c.toolboxActiveButtonStyleColorsClass.name):""+((gt=c.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&>!==void 0?gt:c.toolboxButtonStyleColorsClass.name))})},M}(),Be=function(M,s){this.title=M,this.icon=s},Ke=function(M){function s(c,D,W,k){var ce=M.call(this,c,k||'<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 ce.colors=[],ce.addTransparent=!1,ce.colorBoxes=[],ce.colors=D,ce.currentColor=W,ce.setCurrentColor=ce.setCurrentColor.bind(ce),ce.getColorBox=ce.getColorBox.bind(ce),ce}return Z(s,M),s.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.whiteSpace="nowrap",this.colors.forEach(function(W){var k=c.getColorBox(W);D.appendChild(k),c.colorBoxes.push(k)}),D},s.prototype.getColorBox=function(c){var D=this,W=this.uiStyleSettings.toolbarHeight/4,k=this.uiStyleSettings.toolbarHeight-W,ce=document.createElement("div");ce.style.display="inline-block",ce.style.boxSizing="content-box",ce.style.width=k-2+"px",ce.style.height=k-2+"px",ce.style.padding="1px",ce.style.marginRight="2px",ce.style.marginBottom="2px",ce.style.borderWidth="2px",ce.style.borderStyle="solid",ce.style.borderRadius=(k+2)/2+"px",ce.style.borderColor=c===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ce.addEventListener("click",function(){D.setCurrentColor(c,ce)});var ze=document.createElement("div");return ze.style.display="inline-block",ze.style.width=k-2+"px",ze.style.height=k-2+"px",ze.style.backgroundColor=c,ze.style.borderRadius=k/2+"px",c==="transparent"&&(ze.style.fill=this.uiStyleSettings.toolboxAccentColor,ze.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<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" />
|
|
</svg>`),ce.appendChild(ze),ce},s.prototype.setCurrentColor=function(c,D){var W=this;this.currentColor=c,this.colorBoxes.forEach(function(k){k.style.borderColor=k===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(c)},s}(Be),Ue=function(){function M(s,c,D){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=c,this.globalSettings=D,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(M.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),M.prototype.ownsTarget=function(s){return!1},Object.defineProperty(M.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),M.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},M.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},M.prototype.pointerDown=function(s,c){},M.prototype.dblClick=function(s,c){},M.prototype.manipulate=function(s){},M.prototype.pointerUp=function(s){this.stateChanged()},M.prototype.dispose=function(){},M.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},M.prototype.getState=function(){return{typeName:M.typeName,state:this.state,notes:this.notes}},M.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},M.prototype.scale=function(s,c){},M.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},M.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},M.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},M.typeName="MarkerBase",M}(),xe=function(){function M(){this.findGripByVisual=this.findGripByVisual.bind(this)}return M.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},M}(),Ge=function(){function M(){this.GRIP_SIZE=10,this.visual=V.createGroup(),this.visual.appendChild(V.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(V.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return M.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},M}(),qe=function(){function M(){}return M.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},M.toSVGMatrix=function(s,c){return s.a=c.a,s.b=c.b,s.c=c.c,s.d=c.d,s.e=c.e,s.f=c.f,s},M}(),lt=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.left=0,k.top=0,k.width=0,k.height=0,k.defaultSize={x:50,y:20},k.offsetX=0,k.offsetY=0,k.rotationAngle=0,k.CB_DISTANCE=10,k._suppressMarkerCreateEvent=!1,k.container.transform.baseVal.appendItem(V.createTransform()),k.setupControlBox(),k}return Z(s,M),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(c){this._visual=c;var D=V.createTransform();this._visual.transform.baseVal.appendItem(D)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!!M.prototype.ownsTarget.call(this,c)||!!(this.controlGrips.findGripByVisual(c)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(c))},s.prototype.pointerDown=function(c,D){M.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.left=c.x,this.top=c.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var W=this.unrotatePoint(c);if(this.manipulationStartX=W.x,this.manipulationStartY=W.y,this.offsetX=W.x-this.left,this.offsetY=W.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(D),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(D)){this.activeGrip=this.rotatorGrip;var k=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=k.x-this.width/2,this.top=k.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ce=this.container.transform.baseVal.getItem(0);ce.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ce,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(c){var D=this.state;M.prototype.pointerUp.call(this,c),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(c),this._state="select",D==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(c){this.visual.style.transform="translate("+c.x+"px, "+c.y+"px)"},s.prototype.manipulate=function(c){var D=this.unrotatePoint(c);this.state==="creating"?this.resize(c):this.state==="move"?(this.left=this.manipulationStartLeft+(D.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(D.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(D):this.state==="rotate"&&this.rotate(c)},s.prototype.resize=function(c){var D=this.manipulationStartLeft,W=this.manipulationStartWidth,k=this.manipulationStartTop,ce=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:D=this.manipulationStartLeft+c.x-this.manipulationStartX,W=this.manipulationStartWidth+this.manipulationStartLeft-D;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:W=this.manipulationStartWidth+c.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:k=this.manipulationStartTop+c.y-this.manipulationStartY,ce=this.manipulationStartHeight+this.manipulationStartTop-k;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ce=this.manipulationStartHeight+c.y-this.manipulationStartY}W>=0?(this.left=D,this.width=W):(this.left=D+W,this.width=-W),ce>=0?(this.top=k,this.height=ce):(this.top=k+ce,this.height=-ce),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(c){if(Math.abs(c.x-this.centerX)>.1){var D=Math.sign(c.x-this.centerX);this.rotationAngle=180*Math.atan((c.y-this.centerY)/(c.x-this.centerX))/Math.PI+90*D,this.applyRotation()}},s.prototype.applyRotation=function(){var c=this.container.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(c,0)},s.prototype.rotatePoint=function(c){if(this.rotationAngle===0)return c;var D=this.container.getCTM(),W=V.createPoint(c.x,c.y);return{x:(W=W.matrixTransform(D)).x,y:W.y}},s.prototype.unrotatePoint=function(c){if(this.rotationAngle===0)return c;var D=this.container.getCTM();D=D.inverse();var W=V.createPoint(c.x,c.y);return{x:(W=W.matrixTransform(D)).x,y:W.y}},s.prototype.select=function(){M.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){M.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=V.createGroup();var c=V.createTransform();c.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(c),this.container.appendChild(this.controlBox),this.controlRect=V.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),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=V.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 xe,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var c=this.controlBox.transform.baseVal.getItem(0);c.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(c,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(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()},s.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(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},s.prototype.createGrip=function(){var c=new Ge;return c.visual.transform.baseVal.appendItem(V.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.controlGrips.topLeft.GRIP_SIZE,D=-c/2,W=D,k=(this.width+this.CB_DISTANCE)/2-c/2,ce=(this.height+this.CB_DISTANCE)/2-c/2,ze=this.height+this.CB_DISTANCE-c/2,gt=this.width+this.CB_DISTANCE-c/2;this.positionGrip(this.controlGrips.topLeft.visual,D,W),this.positionGrip(this.controlGrips.topCenter.visual,k,W),this.positionGrip(this.controlGrips.topRight.visual,gt,W),this.positionGrip(this.controlGrips.centerLeft.visual,D,ce),this.positionGrip(this.controlGrips.centerRight.visual,gt,ce),this.positionGrip(this.controlGrips.bottomLeft.visual,D,ze),this.positionGrip(this.controlGrips.bottomCenter.visual,k,ze),this.positionGrip(this.controlGrips.bottomRight.visual,gt,ze),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,k,W-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(c,D,W){var k=c.transform.baseVal.getItem(0);k.setTranslate(D,W),c.transform.baseVal.replaceItem(k,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:qe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:qe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},M.prototype.getState.call(this))},s.prototype.restoreState=function(c){M.prototype.restoreState.call(this,c);var D=c;this.left=D.left,this.top=D.top,this.width=D.width,this.height=D.height,this.rotationAngle=D.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(qe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,D.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(qe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,D.containerTransformMatrix))},s.prototype.scale=function(c,D){M.prototype.scale.call(this,c,D);var W=this.rotatePoint({x:this.left,y:this.top}),k=this.unrotatePoint({x:W.x*c,y:W.y*D});this.left=k.x,this.top=k.y,this.width=this.width*c,this.height=this.height*D,this.adjustControlBox()},s}(Ue),ot=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.fillColor="transparent",k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.opacity=1,k.setStrokeColor=k.setStrokeColor.bind(k),k.setFillColor=k.setFillColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.createVisual=k.createVisual.bind(k),k}return Z(s,M),s.prototype.ownsTarget=function(c){return!(!M.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=V.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)},s.prototype.pointerDown=function(c,D){M.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){M.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){M.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){M.prototype.setSize.call(this),V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){M.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&V.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&V.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&V.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&V.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},M.prototype.getState.call(this))},s.prototype.restoreState=function(c){var D=c;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),M.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,D){M.prototype.scale.call(this,c,D),this.setSize()},s.title="Rectangle marker",s}(lt),bt=function(M){function s(c,D,W,k){var ce=M.call(this,c,k||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ce.widths=[],ce.widthBoxes=[],ce.widths=D,ce.currentWidth=W,ce.setCurrentWidth=ce.setCurrentWidth.bind(ce),ce}return Z(s,M),s.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.widths.forEach(function(W){var k=document.createElement("div");k.style.display="flex",k.style.flexGrow="2",k.style.alignItems="center",k.style.justifyContent="space-between",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.borderColor=W===c.currentWidth?c.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){c.setCurrentWidth(W,k)}),D.appendChild(k);var ce=document.createElement("div");ce.innerText=W.toString(),ce.style.marginRight="5px",k.appendChild(ce);var ze=document.createElement("div");ze.style.minHeight="20px",ze.style.flexGrow="2",ze.style.display="flex",ze.style.alignItems="center";var gt=document.createElement("hr");gt.style.minWidth="20px",gt.style.border="0px",gt.style.borderTop=W+"px solid "+c.uiStyleSettings.toolboxColor,gt.style.flexGrow="2",ze.appendChild(gt),k.appendChild(ze),c.widthBoxes.push(k)}),D},s.prototype.setCurrentWidth=function(c,D){var W=this;this.currentWidth=c,this.widthBoxes.forEach(function(k){k.style.borderColor=k===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(Be),ht=function(M){function s(c,D,W,k){var ce=M.call(this,c,k||'<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 ce.styles=[],ce.styleBoxes=[],ce.styles=D,ce.currentStyle=W,ce.setCurrentStyle=ce.setCurrentStyle.bind(ce),ce}return Z(s,M),s.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.styles.forEach(function(W){var k=document.createElement("div");k.style.display="flex",k.style.alignItems="center",k.style.justifyContent="space-between",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.overflow="hidden",k.style.maxWidth=100/c.styles.length-5+"%",k.style.borderColor=W===c.currentStyle?c.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){c.setCurrentStyle(W,k)}),D.appendChild(k);var ce=document.createElement("div");ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.overflow="hidden";var ze=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+c.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(W!==""?'stroke-dasharray="'+W+'"':"")+` />
|
|
</svg>`;ce.innerHTML=ze,k.appendChild(ce),c.styleBoxes.push(k)}),D},s.prototype.setCurrentStyle=function(c,D){var W=this;this.currentStyle=c,this.styleBoxes.forEach(function(k){k.style.borderColor=k===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(Be),ut=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.strokeColor=W.defaultColor,k.strokeWidth=W.defaultStrokeWidth,k.strokeDasharray=W.defaultStrokeDasharray,k.strokePanel=new Ke("Line color",W.defaultColorSet,W.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.strokeWidthPanel=new bt("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ht("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k}return Z(s,M),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=M.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(ot),Ze=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},Et=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.x1=0,k.y1=0,k.x2=0,k.y2=0,k.defaultLength=50,k.manipulationStartX=0,k.manipulationStartY=0,k.manipulationStartX1=0,k.manipulationStartY1=0,k.manipulationStartX2=0,k.manipulationStartY2=0,k.setupControlBox(),k}return Z(s,M),s.prototype.ownsTarget=function(c){return!!M.prototype.ownsTarget.call(this,c)||!(!this.grip1.ownsTarget(c)&&!this.grip2.ownsTarget(c))},s.prototype.pointerDown=function(c,D){M.prototype.pointerDown.call(this,c,D),this.manipulationStartX=c.x,this.manipulationStartY=c.y,this.state==="new"&&(this.x1=c.x,this.y1=c.y,this.x2=c.x,this.y2=c.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(D)?this.activeGrip=this.grip1:this.grip2.ownsTarget(D)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(c){var D=this.state;M.prototype.pointerUp.call(this,c),this.state==="creating"&&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(c),this._state="select",D==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(c){this.state==="creating"?this.resize(c):this.state==="move"?(this.x1=this.manipulationStartX1+c.x-this.manipulationStartX,this.y1=this.manipulationStartY1+c.y-this.manipulationStartY,this.x2=this.manipulationStartX2+c.x-this.manipulationStartX,this.y2=this.manipulationStartY2+c.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(c)},s.prototype.resize=function(c){switch(this.activeGrip){case this.grip1:this.x1=c.x,this.y1=c.y;break;case this.grip2:case void 0:this.x2=c.x,this.y2=c.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){M.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){M.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=V.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var c=new Ge;return c.visual.transform.baseVal.appendItem(V.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-c/2,this.y1-c/2),this.positionGrip(this.grip2.visual,this.x2-c/2,this.y2-c/2)},s.prototype.positionGrip=function(c,D,W){var k=c.transform.baseVal.getItem(0);k.setTranslate(D,W),c.transform.baseVal.replaceItem(k,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},M.prototype.getState.call(this))},s.prototype.restoreState=function(c){M.prototype.restoreState.call(this,c);var D=c;this.x1=D.x1,this.y1=D.y1,this.x2=D.x2,this.y2=D.y2},s.prototype.scale=function(c,D){M.prototype.scale.call(this,c,D),this.x1=this.x1*c,this.y1=this.y1*D,this.x2=this.x2*c,this.y2=this.y2*D,this.adjustVisual(),this.adjustControlBox()},s}(Ue),St=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.setStrokeColor=k.setStrokeColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.strokeColor=W.defaultColor,k.strokeWidth=W.defaultStrokeWidth,k.strokeDasharray=W.defaultStrokeDasharray,k.strokePanel=new Ke("Line color",W.defaultColorSet,W.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.strokeWidthPanel=new bt("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ht("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k}return Z(s,M),s.prototype.ownsTarget=function(c){return!(!M.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorLine&&c!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=V.createGroup(),this.selectorLine=V.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=V.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)},s.prototype.pointerDown=function(c,D){M.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.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()),V.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),V.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),V.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},M.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){M.prototype.restoreState.call(this,c);var D=c;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(Et),He=function(M){function s(c,D,W,k){var ce=M.call(this,c,k||'<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 ce.fonts=[],ce.fontBoxes=[],ce.fonts=D,ce.currentFont=W,ce.setCurrentFont=ce.setCurrentFont.bind(ce),ce}return Z(s,M),s.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.flexGrow="2",this.fonts.forEach(function(W){var k=document.createElement("div");k.style.display="inline-block",k.style.alignItems="center",k.style.justifyContent="space-between",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.overflow="hidden",k.style.maxWidth=100/c.fonts.length-5+"%",k.style.borderColor=W===c.currentFont?c.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){c.setCurrentFont(W,k)}),D.appendChild(k);var ce=document.createElement("div");ce.style.display="flex",ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.fontFamily=W,ce.style.overflow="hidden";var ze=document.createElement("div");ze.style.whiteSpace="nowrap",ze.style.overflow="hidden",ze.style.textOverflow="ellipsis",ze.innerHTML="The quick brown fox jumps over the lazy dog",ce.appendChild(ze),k.appendChild(ce),c.fontBoxes.push(k)}),D},s.prototype.setCurrentFont=function(c,D){var W=this;this.currentFont=c,this.fontBoxes.forEach(function(k){k.style.borderColor=k===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(Be),it=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.color="transparent",k.padding=5,k.DEFAULT_TEXT="your text here",k.text=k.DEFAULT_TEXT,k.isMoved=!1,k.color=W.defaultColor,k.fontFamily=W.defaultFontFamily,k.defaultSize={x:100,y:30},k.setColor=k.setColor.bind(k),k.setFont=k.setFont.bind(k),k.renderText=k.renderText.bind(k),k.sizeText=k.sizeText.bind(k),k.textEditDivClicked=k.textEditDivClicked.bind(k),k.showTextEditor=k.showTextEditor.bind(k),k.setSize=k.setSize.bind(k),k.positionTextEditor=k.positionTextEditor.bind(k),k.colorPanel=new Ke("Color",W.defaultColorSet,W.defaultColor),k.colorPanel.onColorChanged=k.setColor,k.fontFamilyPanel=new He("Font",W.defaultFontFamilies,W.defaultFontFamily),k.fontFamilyPanel.onFontChanged=k.setFont,k}return Z(s,M),s.prototype.ownsTarget=function(c){if(M.prototype.ownsTarget.call(this,c)||c===this.visual||c===this.textElement||c===this.bgRectangle)return!0;var D=!1;return this.textElement.childNodes.forEach(function(W){W===c&&(D=!0)}),D},s.prototype.createVisual=function(){this.visual=V.createGroup(),this.bgRectangle=V.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=V.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(V.createTransform()),this.textElement.transform.baseVal.appendItem(V.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(c,D){M.prototype.pointerDown.call(this,c,D),this.isMoved=!1,this.pointerDownPoint=c,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.renderText=function(){var c=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(D){c.textElement.appendChild(V.createTSpan(D.trim()===""?" ":D.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var c=this.textElement.getBBox(),D=1;if(c.width>0&&c.height>0){var W=(1*this.width-this.width*this.padding*2/100)/c.width,k=(1*this.height-this.height*this.padding*2/100)/c.height;D=Math.min(W,k)}return D},s.prototype.getTextPosition=function(c){var D=this.textElement.getBBox(),W=0,k=0;return D.width>0&&D.height>0&&(W=(this.width-D.width*c)/2,k=this.height/2-D.height*c/2),{x:W,y:k}},s.prototype.sizeText=function(){var c=this.textElement.getBBox(),D=this.getTextScale(),W=this.getTextPosition(D);W.y-=c.y*D,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+W.x+"px, "+W.y+"px) scale("+D+", "+D+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(W.x,W.y),this.textElement.transform.baseVal.getItem(1).setScale(D,D))},s.prototype.manipulate=function(c){M.prototype.manipulate.call(this,c),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(c.x-this.pointerDownPoint.x)>5||Math.abs(c.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(c){M.prototype.resize.call(this,c),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){M.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(c){var D=this.state;D==="creating"&&(this._suppressMarkerCreateEvent=!0),M.prototype.pointerUp.call(this,c),this.setSize(),(D==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var c=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(D){D.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var D=Number.parseFloat(c.textEditor.style.fontSize);c.textEditor.clientWidth>=Number.parseInt(c.textEditor.style.maxWidth)&&D>.9;)D-=.1,c.textEditor.style.fontSize=Math.max(D,.9)+"em"}),this.textEditor.addEventListener("keyup",function(D){D.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(D){if(D.clipboardData){var W=D.clipboardData.getData("text"),k=window.getSelection();if(!k.rangeCount)return!1;k.deleteFromDocument(),k.getRangeAt(0).insertNode(document.createTextNode(W)),D.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){c.textEditDivClicked(c.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var c=this.getTextScale(),D=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),W=this.textElement.getBBox(),k={x:W.width*c,y:W.height*c};D.x-=k.x/2,D.y-=k.y/2,this.textEditor.style.top=D.y+"px",this.textEditor.style.left=D.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-D.x+"px",this.textEditor.style.fontSize=Math.max(16*c,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(c){this.text=c.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){M.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),M.prototype.deselect.call(this)},s.prototype.dblClick=function(c,D){M.prototype.dblClick.call(this,c,D),this.showTextEditor()},s.prototype.setColor=function(c){this.textElement&&V.setAttributes(this.textElement,[["fill",c]]),this.color=c,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(c)},s.prototype.setFont=function(c){this.textElement&&V.setAttributes(this.textElement,[["font-family",c]]),this.fontFamily=c,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},M.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var D=c;this.color=D.color,this.fontFamily=D.fontFamily,this.padding=D.padding,this.text=D.text,this.createVisual(),M.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,D){M.prototype.scale.call(this,c,D),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.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>',s}(lt),ye=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.color="transparent",k.lineWidth=3,k.drawing=!1,k.pixelRatio=1,k.color=W.defaultColor,k.lineWidth=W.defaultStrokeWidth,k.pixelRatio=W.freehandPixelRatio,k.setColor=k.setColor.bind(k),k.addCanvas=k.addCanvas.bind(k),k.finishCreation=k.finishCreation.bind(k),k.setLineWidth=k.setLineWidth.bind(k),k.colorPanel=new Ke("Color",W.defaultColorSet,W.defaultColor),k.colorPanel.onColorChanged=k.setColor,k.lineWidthPanel=new bt("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),k.lineWidthPanel.onWidthChanged=k.setLineWidth,k}return Z(s,M),s.prototype.ownsTarget=function(c){return!(!M.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=V.createGroup(),this.drawingImage=V.createImage(),this.visual.appendChild(this.drawingImage);var c=V.createTransform();this.visual.transform.baseVal.appendItem(c),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,D){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(c.x,c.y),this.drawing=!0):M.prototype.pointerDown.call(this,c,D)},s.prototype.manipulate=function(c){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(c.x,c.y),this.canvasContext.stroke()):M.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){M.prototype.resize.call(this,c),V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):M.prototype.pointerUp.call(this,c)},s.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)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),M.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),M.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var c=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),D=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],W=D[0],k=D[1],ce=D[2],ze=D[3],gt=!1,Nt=0;Nt<this.canvasElement.height;Nt++)for(var Xe=0;Xe<this.canvasElement.width;Xe++)c.data[Nt*this.canvasElement.width*4+4*Xe+3]>0&&(gt=!0,Nt<k&&(k=Nt),Xe<W&&(W=Xe),Nt>ze&&(ze=Nt),Xe>ce&&(ce=Xe));if(gt){this.left=W/this.pixelRatio,this.top=k/this.pixelRatio,this.width=(ce-W)/this.pixelRatio,this.height=(ze-k)/this.pixelRatio;var Jt=document.createElement("canvas");Jt.width=ce-W,Jt.height=ze-k,Jt.getContext("2d").putImageData(this.canvasContext.getImageData(W,k,ce-W,ze-k),0,0),this.drawingImgUrl=Jt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){V.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(c){this.color=c,this.colorChanged(c)},s.prototype.setLineWidth=function(c){this.lineWidth=c},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({drawingImgUrl:this.drawingImgUrl},M.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){this.createVisual(),M.prototype.restoreState.call(this,c),this.drawingImgUrl=c.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(c,D){M.prototype.scale.call(this,c,D),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.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>',s}(lt),he=function(M){function s(c,D,W){var k=M.call(this,c,W||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return k.typeBoxes=[],k.currentType=D,k.setCurrentType=k.setCurrentType.bind(k),k}return Z(s,M),s.prototype.getUi=function(){var c=this,D=document.createElement("div");D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2";for(var W=function(ze){var gt="both";switch(ze){case 0:gt="both";break;case 1:gt="start";break;case 2:gt="end";break;case 3:gt="none"}var Nt=document.createElement("div");if(Nt.style.display="flex",Nt.style.flexGrow="2",Nt.style.alignItems="center",Nt.style.justifyContent="space-between",Nt.style.padding="5px",Nt.style.borderWidth="2px",Nt.style.borderStyle="solid",Nt.style.borderColor=gt===k.currentType?k.uiStyleSettings.toolboxAccentColor:"transparent",Nt.addEventListener("click",function(){c.setCurrentType(gt,Nt)}),D.appendChild(Nt),gt==="both"||gt==="start"){var Xe=document.createElement("div");Xe.style.display="flex",Xe.style.alignItems="center",Xe.style.minHeight="20px",Xe.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Xe.style.marginLeft="5px",Nt.appendChild(Xe)}var Jt=document.createElement("div");Jt.style.display="flex",Jt.style.alignItems="center",Jt.style.minHeight="20px",Jt.style.flexGrow="2";var Pn=document.createElement("hr");if(Pn.style.minWidth="20px",Pn.style.border="0px",Pn.style.borderTop="3px solid "+(k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxColor:"#eeeeee"),Pn.style.flexGrow="2",Jt.appendChild(Pn),Nt.appendChild(Jt),gt==="both"||gt==="end"){var Bn=document.createElement("div");Bn.style.display="flex",Bn.style.alignItems="center",Bn.style.minHeight="20px",Bn.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Bn.style.marginRight="5px",Nt.appendChild(Bn)}k.typeBoxes.push(Nt)},k=this,ce=0;ce<4;ce++)W(ce);return D},s.prototype.setCurrentType=function(c,D){var W=this;this.currentType=c,this.typeBoxes.forEach(function(k){k.style.borderColor=k===D?W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(Be),fe=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.arrowType="end",k.arrowBaseHeight=10,k.arrowBaseWidth=10,k.getArrowPoints=k.getArrowPoints.bind(k),k.setArrowType=k.setArrowType.bind(k),k.arrowTypePanel=new he("Arrow type","end"),k.arrowTypePanel.onArrowTypeChanged=k.setArrowType,k}return Z(s,M),s.prototype.ownsTarget=function(c){return!(!M.prototype.ownsTarget.call(this,c)&&c!==this.arrow1&&c!==this.arrow2)},s.prototype.getArrowPoints=function(c,D){var W=this.arrowBaseWidth+2*this.strokeWidth,k=this.arrowBaseHeight+2*this.strokeWidth;return c-W/2+","+(D+k/2)+" "+c+","+(D-k/2)+" "+(c+W/2)+","+(D+k/2)},s.prototype.createTips=function(){this.arrow1=V.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(V.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=V.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(V.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(c,D){M.prototype.pointerDown.call(this,c,D),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(M.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",V.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),V.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.arrow1.transform.baseVal.getItem(0);D.setRotate(c,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(D,0);var W=this.arrow2.transform.baseVal.getItem(0);W.setRotate(c+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(W,0)}},s.prototype.setArrowType=function(c){this.arrowType=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({arrowType:this.arrowType},M.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){M.prototype.restoreState.call(this,c);var D=c;this.arrowType=D.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(St),X=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.fillColor=W.defaultFillColor,k.strokeWidth=0,k.fillPanel=new Ke("Color",W.defaultColorSet,W.defaultFillColor),k.fillPanel.onColorChanged=k.setFillColor,k}return Z(s,M),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=M.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(ot),$=function(M){function s(c,D,W,k){var ce=M.call(this,c,k||'<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 ce.opacities=[],ce.opacityBoxes=[],ce.opacities=D,ce.currentOpacity=W,ce.setCurrentOpacity=ce.setCurrentOpacity.bind(ce),ce}return Z(s,M),s.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",D.style.justifyContent="space-between",this.opacities.forEach(function(W){var k=document.createElement("div");k.style.display="flex",k.style.alignItems="center",k.style.justifyContent="center",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.borderColor=W===c.currentOpacity?c.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){c.setCurrentOpacity(W,k)}),D.appendChild(k);var ce=document.createElement("div");ce.innerText=100*W+"%",k.appendChild(ce),c.opacityBoxes.push(k)}),D},s.prototype.setCurrentOpacity=function(c,D){var W=this;this.currentOpacity=c,this.opacityBoxes.forEach(function(k){k.style.borderColor=k===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(Be),te=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.setOpacity=k.setOpacity.bind(k),k.fillColor=W.defaultHighlightColor,k.strokeWidth=0,k.opacity=W.defaultHighlightOpacity,k.fillPanel=new Ke("Color",W.defaultColorSet,k.fillColor),k.fillPanel.onColorChanged=k.setFillColor,k.opacityPanel=new $("Opacity",W.defaultOpacitySteps,k.opacity),k.opacityPanel.onOpacityChanged=k.setOpacity,k}return Z(s,M),s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&V.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=M.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="HighlightMarker",s.title="Highlight marker",s.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>',s}(X),oe='<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>',Te=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.bgColor="transparent",k.tipPosition={x:0,y:0},k.tipBase1Position={x:0,y:0},k.tipBase2Position={x:0,y:0},k.tipMoving=!1,k.color=W.defaultStrokeColor,k.bgColor=W.defaultFillColor,k.fontFamily=W.defaultFontFamily,k.defaultSize={x:100,y:30},k.setBgColor=k.setBgColor.bind(k),k.getTipPoints=k.getTipPoints.bind(k),k.positionTip=k.positionTip.bind(k),k.setTipPoints=k.setTipPoints.bind(k),k.colorPanel=new Ke("Text color",W.defaultColorSet,k.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>'),k.colorPanel.onColorChanged=k.setColor,k.bgColorPanel=new Ke("Fill color",W.defaultColorSet,k.bgColor,oe),k.bgColorPanel.onColorChanged=k.setBgColor,k.fontFamilyPanel=new He("Font",W.defaultFontFamilies,W.defaultFontFamily),k.fontFamilyPanel.onFontChanged=k.setFont,k.tipGrip=new Ge,k.tipGrip.visual.transform.baseVal.appendItem(V.createTransform()),k.controlBox.appendChild(k.tipGrip.visual),k}return Z(s,M),s.prototype.ownsTarget=function(c){return M.prototype.ownsTarget.call(this,c)||this.tipGrip.ownsTarget(c)||this.tip===c},s.prototype.createTip=function(){V.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=V.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(c,D){this.state==="new"&&M.prototype.pointerDown.call(this,c,D),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(D)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):M.prototype.pointerDown.call(this,c,D)},s.prototype.pointerUp=function(c){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,M.prototype.pointerUp.call(this,c);else{var D=this.state==="creating";M.prototype.pointerUp.call(this,c),this.setTipPoints(D),this.positionTip()}},s.prototype.manipulate=function(c){if(this.tipMoving){var D=this.unrotatePoint(c);this.tipPosition={x:D.x-this.manipulationStartLeft,y:D.y-this.manipulationStartTop},this.positionTip()}else M.prototype.manipulate.call(this,c)},s.prototype.setBgColor=function(c){this.bgRectangle&&this.tip&&(V.setAttributes(this.bgRectangle,[["fill",c]]),V.setAttributes(this.tip,[["fill",c]])),this.bgColor=c,this.fillColorChanged(c)},s.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},s.prototype.setTipPoints=function(c){c===void 0&&(c=!1);var D=Math.min(this.height/2,15),W=this.height/5;c&&(this.tipPosition={x:D+W/2,y:this.height+20});var k=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?k<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(W=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:0},this.tipBase2Position={x:D+W,y:0}):(this.tipBase1Position={x:0,y:D},this.tipBase2Position={x:0,y:D+W}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?k<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(W=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-W,y:0},this.tipBase2Position={x:this.width-D,y:0}):(this.tipBase1Position={x:this.width,y:D},this.tipBase2Position={x:this.width,y:D+W}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?k<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(W=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-W,y:this.height},this.tipBase2Position={x:this.width-D,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-D-W},this.tipBase2Position={x:this.width,y:this.height-D}):k<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(W=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:this.height},this.tipBase2Position={x:D+W,y:this.height}):(this.tipBase1Position={x:0,y:this.height-D},this.tipBase2Position={x:0,y:this.height-D-W})},s.prototype.resize=function(c){M.prototype.resize.call(this,c),this.positionTip()},s.prototype.positionTip=function(){V.setAttributes(this.tip,[["points",this.getTipPoints()]]);var c=this.tipGrip.visual.transform.baseVal.getItem(0);c.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(c,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),M.prototype.select.call(this)},s.prototype.getState=function(){var c=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},M.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var D=c;this.bgColor=D.bgColor,this.tipPosition=D.tipPosition,M.prototype.restoreState.call(this,c),this.createTip(),this.setTipPoints()},s.prototype.scale=function(c,D){M.prototype.scale.call(this,c,D),this.tipPosition={x:this.tipPosition.x*c,y:this.tipPosition.y*D},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.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>',s}(it),Pe=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.fillColor="transparent",k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.opacity=1,k.strokeColor=W.defaultColor,k.strokeWidth=W.defaultStrokeWidth,k.strokeDasharray=W.defaultStrokeDasharray,k.fillColor=W.defaultFillColor,k.setStrokeColor=k.setStrokeColor.bind(k),k.setFillColor=k.setFillColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.setOpacity=k.setOpacity.bind(k),k.createVisual=k.createVisual.bind(k),k.strokePanel=new Ke("Line color",Q(W.defaultColorSet,["transparent"]),W.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.fillPanel=new Ke("Fill color",Q(W.defaultColorSet,["transparent"]),k.fillColor,oe),k.fillPanel.onColorChanged=k.setFillColor,k.strokeWidthPanel=new bt("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ht("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k.opacityPanel=new $("Opacity",W.defaultOpacitySteps,k.opacity),k.opacityPanel.onOpacityChanged=k.setOpacity,k}return Z(s,M),s.prototype.ownsTarget=function(c){return!(!M.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=V.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)},s.prototype.pointerDown=function(c,D){M.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){M.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){M.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){M.prototype.setSize.call(this),V.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(c){M.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&V.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&V.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(c),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&V.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&V.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&V.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},M.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var D=c;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),M.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,D){M.prototype.scale.call(this,c,D),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.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>',s}(lt),Je=function(M){function s(c,D,W){return M.call(this,c,D,W)||this}return Z(s,M),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!(!M.prototype.ownsTarget.call(this,c)&&c!==this.tip1&&c!==this.tip2)},s.prototype.createTips=function(){this.tip1=V.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(V.createTransform()),this.visual.appendChild(this.tip1),this.tip2=V.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(V.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(c,D){M.prototype.pointerDown.call(this,c,D),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(M.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(V.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()]]),V.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 c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.tip1.transform.baseVal.getItem(0);D.setRotate(c,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(D,0);var W=this.tip2.transform.baseVal.getItem(0);W.setRotate(c+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(W,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=M.prototype.getState.call(this);return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){M.prototype.restoreState.call(this,c),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.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>',s}(St),Wt=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.strokePanel.colors=W.defaultColorSet,k.fillColor="transparent",k}return Z(s,M),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=M.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.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>',s}(Pe),Zt=function(){function M(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(M.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),M.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},M.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},M.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},M.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},M.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},M}(),Xt=function(M){function s(c,D,W){var k=M.call(this,c,D,W)||this;return k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.curveX=0,k.curveY=0,k.manipulationStartCurveX=0,k.manipulationStartCurveY=0,k.setStrokeColor=k.setStrokeColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.positionGrips=k.positionGrips.bind(k),k.addControlGrips=k.addControlGrips.bind(k),k.adjustVisual=k.adjustVisual.bind(k),k.setupControlBox=k.setupControlBox.bind(k),k.resize=k.resize.bind(k),k.strokeColor=W.defaultColor,k.strokeWidth=W.defaultStrokeWidth,k.strokeDasharray=W.defaultStrokeDasharray,k.strokePanel=new Ke("Line color",W.defaultColorSet,W.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.strokeWidthPanel=new bt("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ht("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k}return Z(s,M),s.prototype.ownsTarget=function(c){return!(!M.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorCurve&&c!==this.visibleCurve&&!this.curveGrip.ownsTarget(c))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=V.createGroup(),this.selectorCurve=V.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=V.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)},s.prototype.pointerDown=function(c,D){M.prototype.pointerDown.call(this,c,D),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=c.x,this.curveY=c.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(D)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),V.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),V.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),V.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){M.prototype.setupControlBox.call(this),this.curveControlLine1=V.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=V.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)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,M.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){M.prototype.positionGrips.call(this);var c=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-c/2,this.curveY-c/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()))},s.prototype.manipulate=function(c){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+c.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+c.y-this.manipulationStartY),M.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){this.activeGrip===this.curveGrip&&(this.curveX=c.x,this.curveY=c.y),M.prototype.resize.call(this,c),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual()},s.prototype.scale=function(c,D){this.curveX=this.curveX*c,this.curveY=this.curveY*D,M.prototype.scale.call(this,c,D)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},M.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){M.prototype.restoreState.call(this,c);var D=c;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.curveX=D.curveX,this.curveY=D.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.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>',s}(Et),an=function(){function M(s,c){c===void 0&&(c=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=c}return Object.defineProperty(M.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),M.prototype.preventDefault=function(){this._defaultPrevented=!0},M}(),fn=function(M){function s(c,D,W){var k=M.call(this,c,!1)||this;return k.dataUrl=D,k.state=W,k}return Z(s,M),s}(an),It=function(M){function s(c,D,W){W===void 0&&(W=!1);var k=M.call(this,c,W)||this;return k.marker=D,k}return Z(s,M),s}(an),Kn=function(){function M(){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 M.prototype.addEventListener=function(s,c){this[s].push(c)},M.prototype.removeEventListener=function(s,c){var D=this[s].indexOf(c);D>-1&&this[s].splice(D,1)},M}(),Sn=function(){function M(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ze,this._isOpen=!1,this.undoRedoManager=new Zt,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 Kn,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=M.instanceCounter++,this.styles=new we(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.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(M.prototype,"ALL_MARKER_TYPES",{get:function(){return[ut,ye,fe,it,Wt,Pe,te,Te,Je,X,St,Xt]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ut,ye,fe,it,Pe,te,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ut,ye,fe,it,te]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var c=this;this._availableMarkerTypes.splice(0),s.forEach(function(D){if(typeof D=="string"){var W=c.ALL_MARKER_TYPES.find(function(k){return k.typeName===D});W!==void 0&&c._availableMarkerTypes.push(W)}else c._availableMarkerTypes.push(D)})},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,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(M.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),M.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Ce.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},M.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&Ne.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ne.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new an(s))})},M.prototype.render=function(){return ee(this,void 0,void 0,function(){var s;return pe(this,function(c){switch(c.label){case 0:return this.setCurrentMarker(),(s=new De).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return c.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,c.sent()]}})})},M.prototype.close=function(s){var c=this;if(s===void 0&&(s=!1),this.isOpen){var D=!1;s||this.eventListeners.beforeclose.forEach(function(W){var k=new an(c,!0);W(k),k.defaultPrevented&&(D=!0)}),D||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(W){return W(new an(c))}),this.detachEvents(),this._isOpen=!1)}},M.prototype.addMarkersToToolbar=function(){for(var s,c=[],D=0;D<arguments.length;D++)c[D]=arguments[D];(s=this._availableMarkerTypes).push.apply(s,c)},M.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(c){s(c.dataUrl,c.state)})},M.prototype.removeRenderEventListener=function(s){},M.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},M.prototype.removeCloseEventListener=function(s){},M.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},M.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,c=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,D=c<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(c,D)},M.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},M.prototype.resize=function(s,c){this._isResizing=!0;var D=s/this.imageWidth,W=c/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(c),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",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(D,W),this._isResizing=!1},M.prototype.scaleMarkers=function(s,c){var D,W=this;this._currentMarker&&this._currentMarker instanceof it?this._currentMarker.scale(s,c):(D=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(k){k!==W._currentMarker&&k.scale(s,c)}),D!==void 0&&this.setCurrentMarker(D)},M.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"},M.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=s.left-c.left,this.top=s.top-c.top},M.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)},M.prototype.addDefs=function(){for(var s,c=[],D=0;D<arguments.length;D++)c[D]=arguments[D];this.defs=V.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,c)},M.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},M.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)},M.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},M.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},M.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)},M.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},M.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)},M.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 s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.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>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},M.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?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")},M.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"},M.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},M.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&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 s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?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=this.uiStyleSettings.zIndex!==void 0?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=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Ae(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",this.settings.displayMode==="popup"&&(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",this.settings.displayMode==="popup"&&(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 je(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},M.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},M.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},M.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},M.prototype.toolbarButtonClicked=function(s,c){if(s==="marker"&&c!==void 0)this.createNewMarker(c);else if(s==="action")switch(c){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":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},M.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var c=!1;if(this.eventListeners.markerbeforedelete.forEach(function(W){var k=new It(s,s._currentMarker,!0);W(k),k.defaultPrevented&&(c=!0)}),!c){var D=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(W){return W(new It(s,D))})}}},M.prototype.clear=function(){var s=this,c=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ce){var ze=new It(s,void 0,!0);ce(ze),ze.defaultPrevented&&(c=!0)}),!c)){this.setCurrentMarker();for(var D=function(ce){var ze=W.markers[ce];W.setCurrentMarker(W.markers[ce]),W._currentMarker.dispose(),W.markerImage.removeChild(W._currentMarker.container),W.markers.splice(W.markers.indexOf(W._currentMarker),1),W.eventListeners.markerdelete.forEach(function(gt){return gt(new It(s,ze))})},W=this,k=this.markers.length-1;k>=0;k--)D(k);this.addUndoStep()}},Object.defineProperty(M.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),M.prototype.showNotesEditor=function(){var s;this._currentMarker!==void 0&&(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=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},M.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},M.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},M.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var c=this.getState(),D=this.undoRedoManager.getLastUndoStep();if(!D||D.width===c.width&&D.height===c.height){var W=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(c),W<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(k){return k(new an(s))})}else this.undoRedoManager.replaceLastUndoStep(c),this.eventListeners.statechange.forEach(function(k){return k(new an(s))})}},M.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},M.prototype.undoStep=function(){var s=this,c=this.undoRedoManager.undo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new an(s))}))},M.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},M.prototype.redoStep=function(){var s=this,c=this.undoRedoManager.redo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new an(s))}))},M.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},M.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},M.prototype.startRenderAndClose=function(){return ee(this,void 0,void 0,function(){var s,c,D=this;return pe(this,function(W){switch(W.label){case 0:return[4,this.render()];case 1:return s=W.sent(),c=this.getState(),this.eventListeners.render.forEach(function(k){return k(new fn(D,s,c))}),this.close(!0),[2]}})})},M.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var c={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(D){return c.markers.push(D.getState())}),c},M.prototype.restoreState=function(s){var c=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(D){var W=c._availableMarkerTypes.find(function(ce){return ce.typeName===D.typeName});if(W!==void 0){var k=c.addNewMarker(W);k.restoreState(D),c.markers.push(k)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(D){return D(new an(c))})},M.prototype.addNewMarker=function(s){var c=V.createGroup();return this.markerImage.appendChild(c),new s(c,this.overlayContainer,this.settings)},M.prototype.createNewMarker=function(s){var c,D=this;(c=typeof s=="string"?this._availableMarkerTypes.find(function(W){return W.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(c),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(c.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(W){return W(new It(D,D._currentMarker))}))},M.prototype.markerCreated=function(s){var c=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof ye&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ye):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(D){return D(new It(c,c._currentMarker))})},M.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},M.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},M.prototype.markerStateChanged=function(s){var c=this;this.eventListeners.markerchange.forEach(function(D){return D(new It(c,s))})},M.prototype.setCurrentMarker=function(s){var c=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(D){return D(new It(c,c._currentMarker))})),this._currentMarker=s,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(D){return D(new It(c,c._currentMarker))}))},M.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var c=this.markers.find(function(D){return D.ownsTarget(s.target)});c!==void 0?(this.setCurrentMarker(c),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},M.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var c=this.markers.find(function(D){return D.ownsTarget(s.target)});c!==void 0&&c!==this._currentMarker&&this.setCurrentMarker(c),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},M.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},M.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},M.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},M.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},M.prototype.clientToLocalCoordinates=function(s,c){var D=this.markerImage.getBoundingClientRect();return{x:(s-D.left)/this.zoomLevel,y:(c-D.top)/this.zoomLevel}},M.prototype.onWindowResize=function(){this.positionUI()},M.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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()},M.prototype.addLicenseKey=function(s){Ce.addKey(s)},M.prototype.addEventListener=function(s,c){this.eventListeners.addEventListener(s,c)},M.prototype.removeEventListener=function(s,c){this.eventListeners.removeEventListener(s,c)},M.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(M.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),M.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(c){return c(new an(s))}))},M.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(c){return c(new an(s))}))},M.instanceCounter=0,M}();/* **********************************
|
|
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.
|
|
***************************************************************************** */var Jn=function(M,s){return(Jn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,D){c.__proto__=D}||function(c,D){for(var W in D)Object.prototype.hasOwnProperty.call(D,W)&&(c[W]=D[W])})(M,s)};function Dn(M,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function c(){this.constructor=M}Jn(M,s),M.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function on(M,s,c,D){return new(c||(c=Promise))(function(W,k){function ce(Nt){try{gt(D.next(Nt))}catch(Xe){k(Xe)}}function ze(Nt){try{gt(D.throw(Nt))}catch(Xe){k(Xe)}}function gt(Nt){var Xe;Nt.done?W(Nt.value):(Xe=Nt.value,Xe instanceof c?Xe:new c(function(Jt){Jt(Xe)})).then(ce,ze)}gt((D=D.apply(M,s||[])).next())})}function qn(M,s){var c,D,W,k,ce={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return k={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function ze(gt){return function(Nt){return function(Xe){if(c)throw new TypeError("Generator is already executing.");for(;ce;)try{if(c=1,D&&(W=2&Xe[0]?D.return:Xe[0]?D.throw||((W=D.return)&&W.call(D),0):D.next)&&!(W=W.call(D,Xe[1])).done)return W;switch(D=0,W&&(Xe=[2&Xe[0],W.value]),Xe[0]){case 0:case 1:W=Xe;break;case 4:return ce.label++,{value:Xe[1],done:!1};case 5:ce.label++,D=Xe[1],Xe=[0];continue;case 7:Xe=ce.ops.pop(),ce.trys.pop();continue;default:if(!(W=ce.trys,(W=W.length>0&&W[W.length-1])||Xe[0]!==6&&Xe[0]!==2)){ce=0;continue}if(Xe[0]===3&&(!W||Xe[1]>W[0]&&Xe[1]<W[3])){ce.label=Xe[1];break}if(Xe[0]===6&&ce.label<W[1]){ce.label=W[1],W=Xe;break}if(W&&ce.label<W[2]){ce.label=W[2],ce.ops.push(Xe);break}W[2]&&ce.ops.pop(),ce.trys.pop();continue}Xe=s.call(M,ce)}catch(Jt){Xe=[6,Jt],D=0}finally{c=W=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([gt,Nt])}}}var Ft=function(){function M(){}return M.addKey=function(s){M.key=s},Object.defineProperty(M,"isLicensed",{get:function(){return!!M.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(M.key)},enumerable:!1,configurable:!0}),M}(),Mt=function(){function M(){}return M.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},M.setAttributes=function(s,c){for(var D=0,W=c;D<W.length;D++){var k=W[D],ce=k[0],ze=k[1];s.setAttribute(ce,ze)}},M.createRect=function(s,c,D){var W=document.createElementNS("http://www.w3.org/2000/svg","rect");return W.setAttribute("width",s.toString()),W.setAttribute("height",c.toString()),D&&M.setAttributes(W,D),W},M.createLine=function(s,c,D,W,k){var ce=document.createElementNS("http://www.w3.org/2000/svg","line");return ce.setAttribute("x1",s.toString()),ce.setAttribute("y1",c.toString()),ce.setAttribute("x2",D.toString()),ce.setAttribute("y2",W.toString()),k&&M.setAttributes(ce,k),ce},M.createPolygon=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",s),c&&M.setAttributes(D,c),D},M.createCircle=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(s/2).toString()),D.setAttribute("cy",(s/2).toString()),D.setAttribute("r",s.toString()),c&&M.setAttributes(D,c),D},M.createEllipse=function(s,c,D){var W=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(c/2).toString()),W.setAttribute("rx",(s/2).toString()),W.setAttribute("ry",(c/2).toString()),D&&M.setAttributes(W,D),W},M.createGroup=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&M.setAttributes(c,s),c},M.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},M.createMarker=function(s,c,D,W,k,ce,ze){var gt=document.createElementNS("http://www.w3.org/2000/svg","marker");return M.setAttributes(gt,[["id",s],["orient",c],["markerWidth",D.toString()],["markerHeight",W.toString()],["refX",k.toString()],["refY",ce.toString()]]),gt.appendChild(ze),gt},M.createText=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),s&&M.setAttributes(c,s),c},M.createTSpan=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=s,c&&M.setAttributes(D,c),D},M.createImage=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&M.setAttributes(c,s),c},M.createPoint=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=s,D.y=c,D},M.createPath=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",s),c&&M.setAttributes(D,c),D},M.createElement=function(s,c){var D=document.createElementNS("http://www.w3.org/2000/svg",s);return c&&M.setAttributes(D,c),D},M.getHollowRectanglePath=function(s,c,D,W,k,ce,ze,gt){return"M"+s+","+c+"V"+(c+W)+"H"+(s+D)+"V"+c+"H"+k+"V"+ce+"H"+(k+ze)+"V"+(ce+gt)+"H"+k+"V"+c+"Z"},M}(),Rr=function(){function M(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(M.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),M.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},M.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},M.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new kn("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new kn("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new kn("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Wn("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Wn("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},M.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},M}(),kn=function(M,s){this.selector=M,this.style=s},Wn=function(M,s){this.localName=M,this.style=s},Vr=function(){function M(){this.blocks=[],this.display=""}return M.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},M.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},M.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(c){return s.appendChild(c.getUI())}),s},M}(),br=function(){function M(){}return M.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},M}(),Pr=function(M){function s(){var c=M!==null&&M.apply(this,arguments)||this;return c.buttons=[],c}return Dn(s,M),s.prototype.addButton=function(c){c.className=this.buttonClassName,c.colorsClassName=this.buttonColorsClassName,c.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(c)},s.prototype.getUI=function(){var c=M.prototype.getUI.call(this);return this.buttons.forEach(function(D){return c.appendChild(D.getUI())}),c},s}(br),nr=function(){function M(s,c){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=c,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(M.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),M.prototype.getUI=function(){var s=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 s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},M.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,"")))},M.prototype.hide=function(){this._isHidden=!0},M}(),dr=function(M){function s(){var c=M!==null&&M.apply(this,arguments)||this;return c.elements=[],c}return Dn(s,M),s.prototype.addElement=function(c){this.elements.push(c)},s.prototype.getUI=function(){var c=M.prototype.getUI.call(this);return this.elements.forEach(function(D){return c.appendChild(D)}),c},s}(br),Ur=function(){function M(s,c){this.horizontal=s,this.vertical=c}return Object.defineProperty(M.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),M.prototype.getVerticalLength=function(s){return s/this.ratio},M.prototype.getHorizontalLength=function(s){return s*this.ratio},M}(),Ar=function(){function M(){}return M.getIcon=function(s,c){if(s>0&&c>0){var D=new Ur(s,c),W=D.ratio>=1?20:D.getHorizontalLength(20),k=D.ratio<1?20:D.getVerticalLength(20),ce=document.createElementNS("http://www.w3.org/2000/svg","svg");ce.setAttribute("xmlns","http://www.w3.org/2000/svg"),ce.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ce);var ze=Mt.createDefs();ce.appendChild(ze);var gt=Mt.createElement("clipPath",[["id","text-bg-clip"]]);ze.appendChild(gt);var Nt=Mt.createPath(Mt.getHollowRectanglePath((24-W)/2,(24-k)/2,W,k,(24-W)/2+2,(24-k)/2+2,W-4,k-4));ce.appendChild(Nt);var Xe=Mt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Xe.appendChild(Mt.createTSpan(s+":"+c)),ce.appendChild(Xe);var Jt=Xe.getBBox();Mt.setAttributes(Xe,[["x",((24-Jt.width)/2).toString()],["y",((24-Jt.height)/2-Jt.y).toString()]]);var Pn=Mt.createPath(Mt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Jt.width))/2,(24-Math.ceil(Jt.height))/2,Math.ceil(Jt.width),Math.ceil(Jt.height)));return gt.appendChild(Pn),Mt.setAttributes(Nt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ce),ce.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>'},M}(),ua=function(M){function s(c,D,W){var k=M.call(this,c,D)||this;return k.isDropdownOpen=!1,k.onClick=k.dropdownButtonClicked,k.dropdownButtons=W,k}return Dn(s,M),s.prototype.setupDropdown=function(){var c=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(D){D.className=c.className,D.colorsClassName=c.colorsClassName,c.dropdownBlock.appendChild(D.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(nr),Er=function(){function M(s,c){this.GRIP_SIZE=10,this.color=s,this.fillColor=c,this.visual=Mt.createGroup(),this.visual.appendChild(Mt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Mt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return M.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},M.prototype.setCenter=function(s,c){this.visual.childNodes.forEach(function(D){return Mt.setAttributes(D,[["cx",s.toString()],["cy",c.toString()]])})},M}(),ya=function(){function M(s,c,D,W){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=c,this.margin=D,this.container=W,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(M.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&Mt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),M.prototype.open=function(){var s=this;this.cropShadeElement=Mt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Mt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var c=0;c<this.numberOfGridLines;c++)this.horizontalGridLines.push(Mt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Mt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(D){return s.gridContainer.appendChild(D)}),this.verticalGridLines.forEach(function(D){return s.gridContainer.appendChild(D)}),this.cropRectElement=Mt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Er(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Er(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Er(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Er(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},M.prototype.setCropRectangle=function(s){this.cropRect=s;var c=Object.assign({},this.cropRect);this.zoomFactor!==1&&(c.width=this.cropRect.width*this.zoomFactor,c.height=this.cropRect.height*this.zoomFactor,c.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-c.width/2,c.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-c.height/2),Mt.setAttributes(this.cropRectElement,[["x",c.x.toString()],["y",c.y.toString()],["width",c.width.toString()],["height",c.height.toString()]]);var D=c.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(k,ce){var ze=c.y+D*(ce+1);Mt.setAttributes(k,[["x1",""+c.x],["y1",""+ze],["x2",""+(c.x+c.width)],["y2",""+ze]])});var W=c.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(k,ce){var ze=c.x+W*(ce+1);Mt.setAttributes(k,[["x1",""+ze],["y1",""+c.y],["x2",""+ze],["y2",""+(c.y+c.height)]])}),Mt.setAttributes(this.cropShadeElement,[["d",Mt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,c.x,c.y,c.width,c.height)]]),this.topLeftGrip.setCenter(c.x,c.y),this.topRightGrip.setCenter(c.x+c.width,c.y),this.bottomLeftGrip.setCenter(c.x,c.y+c.height),this.bottomRightGrip.setCenter(c.x+c.width,c.y+c.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},M.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)},M.prototype.clientToLocalCoordinates=function(s,c){var D=this.container.getBoundingClientRect();return{x:s-D.left+this.margin,y:c-D.top+this.margin}},M.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},M.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var c=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(c)}s.preventDefault()},M.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},M.prototype.move=function(s){var c=s.x-this.previousPoint.x,D=s.y-this.previousPoint.y;this.zoomFactor!==1&&(c=-c/this.zoomFactor,D=-D/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+c),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+D),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},M.prototype.resize=function(s){var c=Object.assign({},this.cropRect),D=s.x-this.previousPoint.x,W=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:c.x+D<this.margin&&(D=this.margin-c.x),c.x+=D,c.width=this.cropRect.x+this.cropRect.width-c.x;break;case this.bottomRightGrip:case this.topRightGrip:c.width+D>this.canvasWidth*this.zoomFactor&&(D=this.canvasWidth*this.zoomFactor-c.width),c.width+=D}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(c.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(D),c.height=this.aspectRatio.getVerticalLength(c.width)):(c.y+=W,c.height=this.cropRect.y+this.cropRect.height-c.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?c.height=this.aspectRatio.getVerticalLength(c.width):c.height+=W}c.width<10&&(c.x=this.cropRect.x,c.width=10),c.height<10&&(c.y=this.cropRect.y,c.height=10),this.previousPoint=s,c.x>=this.margin&&c.y>=this.margin&&c.x-this.margin+c.width<=this.canvasWidth&&c.y-this.margin+c.height<=this.canvasHeight&&(this.cropRect=c,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},M.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,c=this.cropRect.y+this.cropRect.height/2,D=this.aspectRatio.getHorizontalLength(this.cropRect.height),W=this.aspectRatio.getVerticalLength(this.cropRect.width);D/this.canvasWidth<W/this.canvasHeight?this.cropRect.width=D:this.cropRect.height=W,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=s-this.cropRect.width/2,this.cropRect.y=c-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)}},M.prototype.getRescaledRect=function(s,c,D,W,k,ce){var ze=D/s,gt=W/c;return{x:(k.x-ce)*ze+ce,y:(k.y-ce)*gt+ce,width:k.width*ze,height:k.height*gt}},M.prototype.scaleCanvas=function(s,c){var D=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,c,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=c,this.onCropChange&&this.onCropChange(D),this.setCropRectangle(D)},M}(),da=function(){function M(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,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(M.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),M.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},M.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},M.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},M.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},M.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();Mt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},M.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},M.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var c="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,D=1;D<=this.width/5+10;D++){var W=D%5==0?this.height/3:this.height/6;c+="h4v"+-W+"h1v"+W}c+="v1H0Z",this.scaleShape=Mt.createPath(c);var k=Mt.createTransform();this.scaleShape.transform.baseVal.appendItem(k),s.appendChild(this.scaleShape),this.angleLabelElement=Mt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Mt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ce=Mt.createTSpan("");return ce.innerHTML="°",this.angleLabelElement.appendChild(ce),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},M}(),ba=function(){function M(){this.naturalSize=!1,this.imageType="image/png"}return M.prototype.rasterize=function(s,c,D,W,k,ce,ze){var gt=this;return new Promise(function(Nt){var Xe=document.createElement("canvas");Xe.width=s.width.baseVal.value-2*W,Xe.height=s.height.baseVal.value-2*W;var Jt=1,Pn=1;gt.naturalSize===!0?(Jt=c.naturalWidth/(s.width.baseVal.value-2*W)/ce,Pn=c.naturalHeight/(s.height.baseVal.value-2*W)/ze,Xe.width=c.naturalWidth/ce,Xe.height=c.naturalHeight/ze):gt.width!==void 0&>.height!==void 0&&(Jt=gt.width/D.width,Pn=gt.height/D.height,Xe.width*=Jt,Xe.height*=Pn);var Bn=Xe.getContext("2d");Bn.translate(Xe.width/2,Xe.height/2),Bn.rotate(k*Math.PI/180),Bn.scale(ce,ze),Bn.translate(-Xe.width/2,-Xe.height/2),Bn.drawImage(c,0,0,Xe.width,Xe.height);var jr=document.createElement("canvas");jr.width=D.width*Jt,jr.height=D.height*Pn,jr.getContext("2d").putImageData(Bn.getImageData((D.x-W)*Jt,(D.y-W)*Pn,D.width*Jt,D.height*Pn),0,0),Nt(jr.toDataURL(gt.imageType,gt.imageQuality))})},M}(),ra=function(){function M(s){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=M.instanceCounter++,this.styles=new Rr(this.instanceNo),this.target=s,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(M.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),M.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(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},M.prototype.show=function(){this.showUI(),this.open()},M.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(c){return c()}),this._isOpen=!1)},M.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},M.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},M.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},M.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},M.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},M.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,c=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,D=c+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(c,D)}},M.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},M.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",Mt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},M.prototype.resize=function(s,c){this.imageWidth=Math.round(s),this.imageHeight=Math.round(c),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",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},M.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var c=s.toDataURL();Mt.setAttributes(this.editingTarget,[["href",c]]),this.setEditingTargetSize()},M.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=s.left-c.left-this.CANVAS_MARGIN,this.top=s.top-c.top-this.CANVAS_MARGIN},M.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=Mt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Mt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Mt.createGroup(),this.editingTargetRotationScaleContainer=Mt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=Mt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var c=Mt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(c),this.editingTargetContainer=Mt.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)},M.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},M.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Mt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new ya(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()},M.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,c=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=s+"px "+c+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-c+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},M.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)},M.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},M.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},M.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"},M.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},M.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&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 s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,c=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=c+"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=this.styles.settings.zIndex!==void 0?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=this.styles.settings.zIndex!==void 0?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=this.displayMode==="popup"?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,this.displayMode==="popup"&&(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",this.displayMode==="popup"&&(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},M.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},M.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Vr,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 c=new Pr;c.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(c);var D=[];this.aspectRatios.forEach(function(Pn){var Bn=new nr(Ar.getIcon(Pn.horizontal,Pn.vertical),Pn.horizontal===0&&Pn.vertical===0?"FREE":Pn.horizontal+":"+Pn.vertical);Bn.onClick=function(){return s.ratioButtonClicked(Pn)},D.push(Bn)}),this.aspectRatioButton=new ua(Ar.getIcon(0,0),"Aspect ratio",D),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,c.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var W=new nr('<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");W.isActive=this.isGridVisible,W.onClick=function(){s.isGridVisible=!s.isGridVisible,W.isActive=s.isGridVisible},c.addButton(W);var k=new nr('<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(k.isActive=this.zoomToCropEnabled,k.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,k.isActive=s.zoomToCropEnabled},c.addButton(k),!Ft.isLicensed){var ce=new dr;this.topToolbar.addElementBlock(ce);var ze=document.createElement("div");ze.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var gt=document.createElement("a");gt.style.color="currentColor",gt.href="https://markerjs.com/products/cropro",gt.target="_blank",gt.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>',ze.appendChild(gt),ce.addElement(ze)}var Nt=new Pr;Nt.minWidth=3*this.toolbarHeight+"px",Nt.contentAlign="end",this.topToolbar.addButtonBlock(Nt);var Xe=new nr('<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");Xe.onClick=this.startRenderAndClose,Nt.addButton(Xe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Xe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Jt=new nr('<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");Jt.onClick=this.close,Nt.addButton(Jt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Jt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},M.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Vr,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 c=new Pr;c.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(c);var D=new nr('<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");D.onClick=this.rotateLeftButtonClicked,c.addButton(D);var W=new nr('<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");W.onClick=this.rotateRightButtonClicked,c.addButton(W);var k=new dr;k.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(k),this.straightener=new da("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(Nt){s.rotateBy(Nt),s.straightener.angle=s.rotationAngle},k.addElement(this.straightener.getUI());var ce=new Pr;ce.minWidth=2*this.toolbarHeight+"px",ce.contentAlign="end",this.bottomToolbar.addButtonBlock(ce);var ze=new nr('<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");ze.onClick=this.flipHorizontallyButtonClicked,ce.addButton(ze);var gt=new nr('<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");gt.onClick=this.flipVerticallyButtonClicked,ce.addButton(gt)},M.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},M.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Ar.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},M.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ur(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},M.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},M.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},M.prototype.restoreState=function(s){if(s){var c=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(c),this.cropRectChanged(c),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},M.prototype.clientToLocalCoordinates=function(s,c){var D=this.cropImage.getBoundingClientRect();return{x:s-D.left,y:c-D.top}},M.prototype.onWindowResize=function(){this.positionUI()},M.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"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()},M.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},M.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},M.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},M.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},M.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var c=this.editingTargetRotationContainer.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(c,0);var D=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/D.width,this.imageHeight/D.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},M.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},M.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},M.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},M.prototype.startRenderAndClose=function(){return on(this,void 0,void 0,function(){var s,c;return qn(this,function(D){switch(D.label){case 0:return[4,this.render()];case 1:return s=D.sent(),c=this.getState(),this.renderEventListeners.forEach(function(W){return W(s,c)}),this.close(!0),[2]}})})},M.prototype.render=function(){return on(this,void 0,void 0,function(){var s;return qn(this,function(c){switch(c.label){case 0:return(s=new ba).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),Mt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.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 c.sent(),[4,s.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,c.sent()]}})})},M.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Wn("toolbar",`
|
|
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
overflow: hidden;
|
|
line-height: 0px;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Wn("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Wn("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Wn("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*s)+`px;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Wn("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Wn("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new kn("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new kn("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Wn("toolbar_dropdown",`
|
|
position: absolute;
|
|
max-width: `+4*this.toolbarHeight+`px;
|
|
z-index: 20;
|
|
white-space: normal;
|
|
box-sizing: content-box;
|
|
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
|
|
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
|
|
line-height: 0px;
|
|
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Wn("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Wn("toolbar_straightener_block",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
-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%);
|
|
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new Wn("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Wn("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},M.instanceCounter=0,M}(),ca=K("8hTe"),Zr=K.n(ca),Ea=/<pre[^>]*>/g;function ha(M){var s=document.createElement("div");return s.innerHTML=M,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var _a=Ye.a=function(M){var s=M.value,c=s===void 0?"":s,D=M.edit,W=D===void 0?!1:D,k=M.className,ce=M.showTextOnly,ze=M.showLines,gt=M.replaces,Nt=M.zoomImg,Xe=M.hasMask,Jt=M.style,Pn=Jt===void 0?{}:Jt,Bn=M.stylesPrev,jr=Bn===void 0?{}:Bn,Dt=String(c),Re=Object(P.useRef)(),rt=Object(P.useRef)(),Ve=Object(P.useState)(""),Qe=Object(I.a)(Ve,2),Ht=Qe[0],Ut=Qe[1],kt=Object(P.useState)("office"),wt=Object(I.a)(kt,2),mt=wt[0],Rt=wt[1],_t=function(){var We=new ra(rt.current);We.displayMode="popup",We.addRenderEventListener(function(){var tn=Object(R.a)(T.a.mark(function tt(dt){var at;return T.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:return Re.current.style.display="none",yt.next=3,Object(ve.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dt}});case 3:at=yt.sent,at!=null&&at.id&>(rt.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(at==null?void 0:at.id,"?type=").concat(at.content_type));case 5:case"end":return yt.stop()}},tt)}));return function(tt){return tn.apply(this,arguments)}}()),We.show()},Kt=function(){var We=new Sn(rt.current);We.settings.displayMode="popup",We.addEventListener("render",function(){var tn=Object(R.a)(T.a.mark(function tt(dt){var at;return T.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:if(Re.current.style.display="none",!rt.current){yt.next=6;break}return yt.next=4,Object(ve.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dt.dataUrl}});case 4:at=yt.sent,at!=null&&at.id&>(rt.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(at==null?void 0:at.id,"?type=").concat(at.content_type));case 6:case"end":return yt.stop()}},tt)}));return function(tt){return tn.apply(this,arguments)}}()),We.show(),window.markerArea=We},Ot=Object(P.useMemo)(function(){try{var ge=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,We=/\"\/api\/attachments\/|\"\/attachments\/download\//g,tn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Dt=Dt.replace(ge,"("+q.a.API_SERVER+"/api/attachments/").replace(We,'"'+q.a.API_SERVER+"/api/attachments/").replace(tn,'"'+q.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,`
|
|
`),Dt=Dt.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(ft){}var tt=B(Dt),dt=g();if(Dt.match(/\[TOC\]/)&&(tt=tt.replace("<p>[TOC]</p>",m()),v()),tt=tt.replace(/(__special_katext_id_\d+__)/g,function(ft,yt){var vt=dt[yt],Qt=vt.type,un=vt.expression;return Object(re.renderToString)(ha(un)||"",{displayMode:Qt==="block",throwOnError:!1,output:"html"})}),tt=tt.replace(/▁/g,"\u2581\u2581\u2581"),f(),ce){var at=document.createElement("div");return at.innerHTML=tt,at.innerText}return setTimeout(function(){return jt()},500),tt},[Dt]),At=Object(P.useRef)();d.WebkitLineClamp=ze,ze&&(Pn=Object(E.a)(Object(E.a)({},Pn),d));function Bt(ge){var We=ge.target;if(We.tagName.toUpperCase()==="IMG"){if(Nt){var tn=We.getAttribute("src");Ut(tn),Rt("image")}}else if(We.tagName.toUpperCase()==="A"){var tt=We.getAttribute("href");if(tt.indexOf("office")>-1)ge.preventDefault(),Ut(tt),Rt("office");else if(tt.indexOf("application/pdf")>-1)ge.preventDefault(),Ut(tt),Rt("pdf");else if(tt.indexOf("type=text")>-1)ge.preventDefault(),Ut(tt),Rt("html");else if(tt.startsWith("#")){ge.preventDefault();var dt=document.getElementById(tt.replace("#",""));dt&&dt.scrollIntoView(!0)}}}var jt=function(){var We,tn=(We=At.current)===null||We===void 0?void 0:We.querySelectorAll("video");tn==null||tn.forEach(function(tt){if(tt.oncontextmenu=function(){return!1},tt.src.indexOf(".m3u8")>-1&&!tt.canPlayType("application/vnd.apple.mpegurl")){if(F.a.isSupported()){var dt=new F.a;dt.loadSource(tt.src),dt.attachMedia(tt)}}})};Object(P.useEffect)(function(){if(At.current&&Ot&&(Ot.match(Ea)&&window.PR.prettyPrint()),At.current)return At.current.addEventListener("click",Bt),function(){At.current.removeEventListener("click",Bt),f(),v()}},[Ot,At.current,Bt]);var xn=function(We){if(!W)return;We.target.nodeName==="IMG"?(Re.current.style.display="flex",Re.current.style.width=We.target.clientWidth+"px",Re.current.style.height=We.target.clientHeight+"px",Re.current.style.top=We.target.offsetTop+"px",Re.current.style.left=We.target.offsetLeft+"px",rt.current.src=We.target.getAttribute("src")):Re.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:At,style:Object(E.a)({},Pn),className:"".concat(k||""," markdown-body ").concat(Zr.a.mdBody),onMouseOver:xn,dangerouslySetInnerHTML:{__html:Ot}}),b.a.createElement("div",{ref:Re,className:Zr.a.button},b.a.createElement(j.a,null,b.a.createElement(N.a,{onClick:function(){return _t()}},"\u88C1\u526A"),b.a.createElement(N.a,{onClick:function(){return Kt()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:rt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(ae.a,{close:!0,data:Ht,hasMask:Xe,type:Ht!=null&&Ht.length?mt:"",style:Object(E.a)({},jr),onClose:function(){return Ut("")}}))}},"A60/":function(Pt,Ye,K){Pt.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:function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return R});var Ee=K("MNnm"),j="rc-util-key";function O(I){if(I.attachTo)return I.attachTo;var L=document.querySelector("head");return L||document.body}function N(I){var L,T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(Ee.a)())return null;var P=document.createElement("style");if((L=T.csp)===null||L===void 0?void 0:L.nonce){var b;P.nonce=(b=T.csp)===null||b===void 0?void 0:b.nonce}P.innerHTML=I;var S=O(T),w=S.firstChild;return T.prepend&&S.prepend?S.prepend(P):T.prepend&&w?S.insertBefore(P,w):S.appendChild(P),P}var E=new Map;function R(I,L){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P=O(T);if(!E.has(P)){var b=N("",T),S=b.parentNode;E.set(P,S),S.removeChild(b)}var w=Array.from(E.get(P).children).find(function(n){return n.tagName==="STYLE"&&n[j]===L});if(w){var C,x;if(((C=T.csp)===null||C===void 0?void 0:C.nonce)&&w.nonce!==((x=T.csp)===null||x===void 0?void 0:x.nonce)){var _;w.nonce=(_=T.csp)===null||_===void 0?void 0:_.nonce}return w.innerHTML!==I&&(w.innerHTML=I),w}var p=N(I,T);return p[j]=L,p}},BdwD:function(Pt,Ye,K){"use strict";var Ee=K("+L6B"),j=K("2/Rp"),O=K("0Owb"),N=K("k1fw"),E=K("q1tI"),R=K.n(E),I=K("FOrL"),L=K.n(I),T=function(b){var S=b.buttonProps,w=S===void 0?{}:S,C=b.styles,x=C===void 0?{}:C,_=b.customText,p=b.ButtonText,n=b.ButtonClick,u=b.Buttonclass,l=b.ButtonTwo;return R.a.createElement("section",{className:"tc animated fadeIn",style:Object(N.a)(Object(N.a)({},{color:"#999",margin:"200px auto"}),x)},R.a.createElement("img",{src:L.a}),R.a.createElement("p",{className:"mt20 font14"},_||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),p&&R.a.createElement(j.a,Object(O.a)({className:u,onClick:n},w),p),l&&l)};Ye.a=T},DlQD:function(Pt,Ye,K){(function(Ee,j){Pt.exports=j()})(this,function(){"use strict";function Ee(ye,he){for(var fe=0;fe<he.length;fe++){var X=he[fe];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(ye,X.key,X)}}function j(ye,he,fe){return he&&Ee(ye.prototype,he),fe&&Ee(ye,fe),ye}function O(ye,he){if(!ye)return;if(typeof ye=="string")return N(ye,he);var fe=Object.prototype.toString.call(ye).slice(8,-1);if(fe==="Object"&&ye.constructor&&(fe=ye.constructor.name),fe==="Map"||fe==="Set")return Array.from(ye);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return N(ye,he)}function N(ye,he){(he==null||he>ye.length)&&(he=ye.length);for(var fe=0,X=new Array(he);fe<he;fe++)X[fe]=ye[fe];return X}function E(ye,he){var fe;if(typeof Symbol=="undefined"||ye[Symbol.iterator]==null){if(Array.isArray(ye)||(fe=O(ye))||he&&ye&&typeof ye.length=="number"){fe&&(ye=fe);var X=0;return function(){return X>=ye.length?{done:!0}:{done:!1,value:ye[X++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return fe=ye[Symbol.iterator](),fe.next.bind(fe)}function R(ye,he){return he={exports:{}},ye(he,he.exports),he.exports}var I=R(function(ye){function he(){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}}function fe(X){ye.exports.defaults=X}ye.exports={defaults:he(),getDefaults:he,changeDefaults:fe}}),L=I.defaults,T=I.getDefaults,P=I.changeDefaults,b=/[&<>"']/,S=/[&<>"']/g,w=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,x={"&":"&","<":"<",">":">",'"':""","'":"'"},_=function(he){return x[he]};function p(ye,he){if(he){if(b.test(ye))return ye.replace(S,_)}else if(w.test(ye))return ye.replace(C,_);return ye}var n=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(ye){return ye.replace(n,function(he,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var l=/(^|[^\[])\^/g;function v(ye,he){ye=ye.source||ye,he=he||"";var fe={replace:function($,te){return te=te.source||te,te=te.replace(l,"$1"),ye=ye.replace($,te),fe},getRegex:function(){return new RegExp(ye,he)}};return fe}var d=/[^\w:]/g,o=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function m(ye,he,fe){if(ye){var X;try{X=decodeURIComponent(u(fe)).replace(d,"").toLowerCase()}catch($){return null}if(X.indexOf("javascript:")===0||X.indexOf("vbscript:")===0||X.indexOf("data:")===0)return null}he&&!o.test(fe)&&(fe=i(he,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch($){return null}return fe}var h={},a=/^[^:]+:\/*[^/]*$/,r=/^([^:]+:)[\s\S]*$/,e=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(ye,he){h[" "+ye]||(a.test(ye)?h[" "+ye]=ye+"/":h[" "+ye]=t(ye,"/",!0)),ye=h[" "+ye];var fe=ye.indexOf(":")===-1;return he.substring(0,2)==="//"?fe?he:ye.replace(r,"$1")+he:he.charAt(0)==="/"?fe?he:ye.replace(e,"$1")+he:ye+he}var g={exec:function(){}};function f(ye){for(var he=1,fe,X;he<arguments.length;he++){fe=arguments[he];for(X in fe)Object.prototype.hasOwnProperty.call(fe,X)&&(ye[X]=fe[X])}return ye}function y(ye,he){var fe=ye.replace(/\|/g,function(te,oe,Te){for(var Pe=!1,Je=oe;--Je>=0&&Te[Je]==="\\";)Pe=!Pe;return Pe?"|":" |"}),X=fe.split(/ \|/),$=0;if(X.length>he)X.splice(he);else for(;X.length<he;)X.push("");for(;$<X.length;$++)X[$]=X[$].trim().replace(/\\\|/g,"|");return X}function t(ye,he,fe){var X=ye.length;if(X===0)return"";for(var $=0;$<X;){var te=ye.charAt(X-$-1);if(te===he&&!fe)$++;else if(te!==he&&fe)$++;else break}return ye.substr(0,X-$)}function A(ye,he){if(ye.indexOf(he[1])===-1)return-1;for(var fe=ye.length,X=0,$=0;$<fe;$++)if(ye[$]==="\\")$++;else if(ye[$]===he[0])X++;else if(ye[$]===he[1]&&(X--,X<0))return $;return-1}function U(ye){ye&&ye.sanitize&&!ye.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")}var B={escape:p,unescape:u,edit:v,cleanUrl:m,resolveUrl:i,noopTest:g,merge:f,splitCells:y,rtrim:t,findClosingBracket:A,checkSanitizeDeprecation:U},G=I.defaults,J=B.rtrim,F=B.splitCells,q=B.escape,re=B.findClosingBracket;function ae(ye,he,fe){var X=he.href,$=he.title?q(he.title):null,te=ye[1].replace(/\\([\[\]])/g,"$1");return ye[0].charAt(0)!=="!"?{type:"link",raw:fe,href:X,title:$,text:te}:{type:"image",raw:fe,href:X,title:$,text:q(te)}}function ve(ye,he){var fe=ye.match(/^(\s+)(?:```)/);if(fe===null)return he;var X=fe[1];return he.split(`
|
|
`).map(function($){var te=$.match(/^\s+/);if(te===null)return $;var oe=te[0];return oe.length>=X.length?$.slice(X.length):$}).join(`
|
|
`)}var de=function(){function ye(fe){this.options=fe||G}var he=ye.prototype;return he.space=function(X){var $=this.rules.block.newline.exec(X);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
|
|
`}},he.code=function(X,$){var te=this.rules.block.code.exec(X);if(te){var oe=$[$.length-1];if(oe&&oe.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var Te=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:J(Te,`
|
|
`)}}},he.fences=function(X){var $=this.rules.block.fences.exec(X);if($){var te=$[0],oe=ve(te,$[3]||"");return{type:"code",raw:te,lang:$[2]?$[2].trim():$[2],text:oe}}},he.heading=function(X){var $=this.rules.block.heading.exec(X);if($)return{type:"heading",raw:$[0],depth:$[1].length,text:$[2]}},he.nptable=function(X){var $=this.rules.block.nptable.exec(X);if($){var te={type:"table",header:F($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[],raw:$[0]};if(te.header.length===te.align.length){var oe=te.align.length,Te;for(Te=0;Te<oe;Te++)/^ *-+: *$/.test(te.align[Te])?te.align[Te]="right":/^ *:-+: *$/.test(te.align[Te])?te.align[Te]="center":/^ *:-+ *$/.test(te.align[Te])?te.align[Te]="left":te.align[Te]=null;for(oe=te.cells.length,Te=0;Te<oe;Te++)te.cells[Te]=F(te.cells[Te],te.header.length);return te}}},he.hr=function(X){var $=this.rules.block.hr.exec(X);if($)return{type:"hr",raw:$[0]}},he.blockquote=function(X){var $=this.rules.block.blockquote.exec(X);if($){var te=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:te}}},he.list=function(X){var $=this.rules.block.list.exec(X);if($){for(var te=$[0],oe=$[2],Te=oe.length>1,Pe=oe[oe.length-1]===")",Je={type:"list",raw:te,ordered:Te,start:Te?+oe.slice(0,-1):"",loose:!1,items:[]},Wt=$[0].match(this.rules.block.item),Zt=!1,Xt,an,fn,It,Kn,Sn,Jn,Dn=Wt.length,on=0;on<Dn;on++)Xt=Wt[on],te=Xt,an=Xt.length,Xt=Xt.replace(/^ *([*+-]|\d+[.)]) */,""),~Xt.indexOf(`
|
|
`)&&(an-=Xt.length,Xt=this.options.pedantic?Xt.replace(/^ {1,4}/gm,""):Xt.replace(new RegExp("^ {1,"+an+"}","gm"),"")),on!==Dn-1&&(fn=this.rules.block.bullet.exec(Wt[on+1])[0],(Te?fn.length===1||!Pe&&fn[fn.length-1]===")":fn.length>1||this.options.smartLists&&fn!==oe)&&(It=Wt.slice(on+1).join(`
|
|
`),Je.raw=Je.raw.substring(0,Je.raw.length-It.length),on=Dn-1)),Kn=Zt||/\n\n(?!\s*$)/.test(Xt),on!==Dn-1&&(Zt=Xt.charAt(Xt.length-1)===`
|
|
`,Kn||(Kn=Zt)),Kn&&(Je.loose=!0),Sn=/^\[[ xX]\] /.test(Xt),Jn=void 0,Sn&&(Jn=Xt[1]!==" ",Xt=Xt.replace(/^\[[ xX]\] +/,"")),Je.items.push({type:"list_item",raw:te,task:Sn,checked:Jn,loose:Kn,text:Xt});return Je}},he.html=function(X){var $=this.rules.block.html.exec(X);if($)return{type:this.options.sanitize?"paragraph":"html",raw:$[0],pre:!this.options.sanitizer&&($[1]==="pre"||$[1]==="script"||$[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer($[0]):q($[0]):$[0]}},he.def=function(X){var $=this.rules.block.def.exec(X);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var te=$[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:$[0],href:$[2],title:$[3]}}},he.table=function(X){var $=this.rules.block.table.exec(X);if($){var te={type:"table",header:F($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
|
|
`):[]};if(te.header.length===te.align.length){te.raw=$[0];var oe=te.align.length,Te;for(Te=0;Te<oe;Te++)/^ *-+: *$/.test(te.align[Te])?te.align[Te]="right":/^ *:-+: *$/.test(te.align[Te])?te.align[Te]="center":/^ *:-+ *$/.test(te.align[Te])?te.align[Te]="left":te.align[Te]=null;for(oe=te.cells.length,Te=0;Te<oe;Te++)te.cells[Te]=F(te.cells[Te].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},he.lheading=function(X){var $=this.rules.block.lheading.exec(X);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},he.paragraph=function(X){var $=this.rules.block.paragraph.exec(X);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
|
|
`?$[1].slice(0,-1):$[1]}},he.text=function(X,$){var te=this.rules.block.text.exec(X);if(te){var oe=$[$.length-1];return oe&&oe.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},he.escape=function(X){var $=this.rules.inline.escape.exec(X);if($)return{type:"escape",raw:$[0],text:q($[1])}},he.tag=function(X,$,te){var oe=this.rules.inline.tag.exec(X);if(oe)return!$&&/^<a /i.test(oe[0])?$=!0:$&&/^<\/a>/i.test(oe[0])&&($=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(oe[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(oe[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:oe[0],inLink:$,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):q(oe[0]):oe[0]}},he.link=function(X){var $=this.rules.inline.link.exec(X);if($){var te=re($[2],"()");if(te>-1){var oe=$[0].indexOf("!")===0?5:4,Te=oe+$[1].length+te;$[2]=$[2].substring(0,te),$[0]=$[0].substring(0,Te).trim(),$[3]=""}var Pe=$[2],Je="";if(this.options.pedantic){var Wt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Pe);Wt?(Pe=Wt[1],Je=Wt[3]):Je=""}else Je=$[3]?$[3].slice(1,-1):"";Pe=Pe.trim().replace(/^<([\s\S]*)>$/,"$1");var Zt=ae($,{href:Pe&&Pe.replace(this.rules.inline._escapes,"$1"),title:Je&&Je.replace(this.rules.inline._escapes,"$1")},$[0]);return Zt}},he.reflink=function(X,$){var te;if((te=this.rules.inline.reflink.exec(X))||(te=this.rules.inline.nolink.exec(X))){var oe=(te[2]||te[1]).replace(/\s+/g," ");if(oe=$[oe.toLowerCase()],!oe||!oe.href){var Te=te[0].charAt(0);return{type:"text",raw:Te,text:Te}}var Pe=ae(te,oe,te[0]);return Pe}},he.strong=function(X,$,te){te===void 0&&(te="");var oe=this.rules.inline.strong.start.exec(X);if(oe&&(!oe[1]||oe[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){$=$.slice(-1*X.length);var Te=oe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var Pe;(oe=Te.exec($))!=null;)if(Pe=this.rules.inline.strong.middle.exec($.slice(0,oe.index+3)),Pe)return{type:"strong",raw:X.slice(0,Pe[0].length),text:X.slice(2,Pe[0].length-2)}}},he.em=function(X,$,te){te===void 0&&(te="");var oe=this.rules.inline.em.start.exec(X);if(oe&&(!oe[1]||oe[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){$=$.slice(-1*X.length);var Te=oe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var Pe;(oe=Te.exec($))!=null;)if(Pe=this.rules.inline.em.middle.exec($.slice(0,oe.index+2)),Pe)return{type:"em",raw:X.slice(0,Pe[0].length),text:X.slice(1,Pe[0].length-1)}}},he.codespan=function(X){var $=this.rules.inline.code.exec(X);if($){var te=$[2].replace(/\n/g," "),oe=/[^ ]/.test(te),Te=te.startsWith(" ")&&te.endsWith(" ");return oe&&Te&&(te=te.substring(1,te.length-1)),te=q(te,!0),{type:"codespan",raw:$[0],text:te}}},he.br=function(X){var $=this.rules.inline.br.exec(X);if($)return{type:"br",raw:$[0]}},he.del=function(X){var $=this.rules.inline.del.exec(X);if($)return{type:"del",raw:$[0],text:$[1]}},he.autolink=function(X,$){var te=this.rules.inline.autolink.exec(X);if(te){var oe,Te;return te[2]==="@"?(oe=q(this.options.mangle?$(te[1]):te[1]),Te="mailto:"+oe):(oe=q(te[1]),Te=oe),{type:"link",raw:te[0],text:oe,href:Te,tokens:[{type:"text",raw:oe,text:oe}]}}},he.url=function(X,$){var te;if(te=this.rules.inline.url.exec(X)){var oe,Te;if(te[2]==="@")oe=q(this.options.mangle?$(te[0]):te[0]),Te="mailto:"+oe;else{var Pe;do Pe=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(Pe!==te[0]);oe=q(te[0]),te[1]==="www."?Te="http://"+oe:Te=oe}return{type:"link",raw:te[0],text:oe,href:Te,tokens:[{type:"text",raw:oe,text:oe}]}}},he.inlineText=function(X,$,te){var oe=this.rules.inline.text.exec(X);if(oe){var Te;return $?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):q(oe[0]):oe[0]:Te=q(this.options.smartypants?te(oe[0]):oe[0]),{type:"text",raw:oe[0],text:Te}}},ye}(),Z=B.noopTest,ee=B.edit,pe=B.merge,Q={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:Z,table:Z,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Q._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Q._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Q.def=ee(Q.def).replace("label",Q._label).replace("title",Q._title).getRegex(),Q.bullet=/(?:[*+-]|\d{1,9}[.)])/,Q.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Q.item=ee(Q.item,"gm").replace(/bull/g,Q.bullet).getRegex(),Q.list=ee(Q.list).replace(/bull/g,Q.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Q.def.source+")").getRegex(),Q._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",Q._comment=/<!--(?!-?>)[\s\S]*?-->/,Q.html=ee(Q.html,"i").replace("comment",Q._comment).replace("tag",Q._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Q.paragraph=ee(Q._paragraph).replace("hr",Q.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",Q._tag).getRegex(),Q.blockquote=ee(Q.blockquote).replace("paragraph",Q.paragraph).getRegex(),Q.normal=pe({},Q),Q.gfm=pe({},Q.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*|$)"}),Q.gfm.nptable=ee(Q.gfm.nptable).replace("hr",Q.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",Q._tag).getRegex(),Q.gfm.table=ee(Q.gfm.table).replace("hr",Q.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",Q._tag).getRegex(),Q.pedantic=pe({},Q.normal,{html:ee(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Q._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:Z,paragraph:ee(Q.normal._paragraph).replace("hr",Q.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",Q.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var V={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Z,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:Z,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};V._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",V.punctuation=ee(V.punctuation).replace(/punctuation/g,V._punctuation).getRegex(),V._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",V._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",V.em.start=ee(V.em.start).replace(/punctuation/g,V._punctuation).getRegex(),V.em.middle=ee(V.em.middle).replace(/punctuation/g,V._punctuation).replace(/overlapSkip/g,V._overlapSkip).getRegex(),V.em.endAst=ee(V.em.endAst,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.em.endUnd=ee(V.em.endUnd,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.strong.start=ee(V.strong.start).replace(/punctuation/g,V._punctuation).getRegex(),V.strong.middle=ee(V.strong.middle).replace(/punctuation/g,V._punctuation).replace(/blockSkip/g,V._blockSkip).getRegex(),V.strong.endAst=ee(V.strong.endAst,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.strong.endUnd=ee(V.strong.endUnd,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.blockSkip=ee(V._blockSkip,"g").getRegex(),V.overlapSkip=ee(V._overlapSkip,"g").getRegex(),V._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,V._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,V._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])?)+(?![-_])/,V.autolink=ee(V.autolink).replace("scheme",V._scheme).replace("email",V._email).getRegex(),V._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,V.tag=ee(V.tag).replace("comment",Q._comment).replace("attribute",V._attribute).getRegex(),V._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,V._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,V._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,V.link=ee(V.link).replace("label",V._label).replace("href",V._href).replace("title",V._title).getRegex(),V.reflink=ee(V.reflink).replace("label",V._label).getRegex(),V.reflinkSearch=ee(V.reflinkSearch,"g").replace("reflink",V.reflink).replace("nolink",V.nolink).getRegex(),V.normal=pe({},V),V.pedantic=pe({},V.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:ee(/^!?\[(label)\]\((.*?)\)/).replace("label",V._label).getRegex(),reflink:ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",V._label).getRegex()}),V.gfm=pe({},V.normal,{escape:ee(V.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),V.gfm.url=ee(V.gfm.url,"i").replace("email",V.gfm._extended_email).getRegex(),V.breaks=pe({},V.gfm,{br:ee(V.br).replace("{2,}","*").getRegex(),text:ee(V.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ce={block:Q,inline:V},De=I.defaults,Ne=Ce.block,we=Ce.inline;function ke(ye){return ye.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Se(ye){var he="",fe,X,$=ye.length;for(fe=0;fe<$;fe++)X=ye.charCodeAt(fe),Math.random()>.5&&(X="x"+X.toString(16)),he+="&#"+X+";";return he}var Ae=function(){function ye(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||De,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var X={block:Ne.normal,inline:we.normal};this.options.pedantic?(X.block=Ne.pedantic,X.inline=we.pedantic):this.options.gfm&&(X.block=Ne.gfm,this.options.breaks?X.inline=we.breaks:X.inline=we.gfm),this.tokenizer.rules=X}ye.lex=function(X,$){var te=new ye($);return te.lex(X)};var he=ye.prototype;return he.lex=function(X){return X=X.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(X,this.tokens,!0),this.inline(this.tokens),this.tokens},he.blockTokens=function(X,$,te){$===void 0&&($=[]),te===void 0&&(te=!0),X=X.replace(/^ +$/gm,"");for(var oe,Te,Pe,Je;X;){if(oe=this.tokenizer.space(X)){X=X.substring(oe.raw.length),oe.type&&$.push(oe);continue}if(oe=this.tokenizer.code(X,$)){X=X.substring(oe.raw.length),oe.type?$.push(oe):(Je=$[$.length-1],Je.raw+=`
|
|
`+oe.raw,Je.text+=`
|
|
`+oe.text);continue}if(oe=this.tokenizer.fences(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.heading(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.nptable(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.hr(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.blockquote(X)){X=X.substring(oe.raw.length),oe.tokens=this.blockTokens(oe.text,[],te),$.push(oe);continue}if(oe=this.tokenizer.list(X)){for(X=X.substring(oe.raw.length),Pe=oe.items.length,Te=0;Te<Pe;Te++)oe.items[Te].tokens=this.blockTokens(oe.items[Te].text,[],!1);$.push(oe);continue}if(oe=this.tokenizer.html(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(te&&(oe=this.tokenizer.def(X))){X=X.substring(oe.raw.length),this.tokens.links[oe.tag]||(this.tokens.links[oe.tag]={href:oe.href,title:oe.title});continue}if(oe=this.tokenizer.table(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.lheading(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(te&&(oe=this.tokenizer.paragraph(X))){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.text(X,$)){X=X.substring(oe.raw.length),oe.type?$.push(oe):(Je=$[$.length-1],Je.raw+=`
|
|
`+oe.raw,Je.text+=`
|
|
`+oe.text);continue}if(X){var Wt="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(Wt);break}else throw new Error(Wt)}}return $},he.inline=function(X){var $,te,oe,Te,Pe,Je,Wt=X.length;for($=0;$<Wt;$++){Je=X[$];switch(Je.type){case"paragraph":case"text":case"heading":{Je.tokens=[],this.inlineTokens(Je.text,Je.tokens);break}case"table":{for(Je.tokens={header:[],cells:[]},Te=Je.header.length,te=0;te<Te;te++)Je.tokens.header[te]=[],this.inlineTokens(Je.header[te],Je.tokens.header[te]);for(Te=Je.cells.length,te=0;te<Te;te++)for(Pe=Je.cells[te],Je.tokens.cells[te]=[],oe=0;oe<Pe.length;oe++)Je.tokens.cells[te][oe]=[],this.inlineTokens(Pe[oe],Je.tokens.cells[te][oe]);break}case"blockquote":{this.inline(Je.tokens);break}case"list":{for(Te=Je.items.length,te=0;te<Te;te++)this.inline(Je.items[te].tokens);break}}}return X},he.inlineTokens=function(X,$,te,oe,Te){$===void 0&&($=[]),te===void 0&&(te=!1),oe===void 0&&(oe=!1),Te===void 0&&(Te="");var Pe,Je=X,Wt;if(this.tokens.links){var Zt=Object.keys(this.tokens.links);if(Zt.length>0)for(;(Wt=this.tokenizer.rules.inline.reflinkSearch.exec(Je))!=null;)Zt.includes(Wt[0].slice(Wt[0].lastIndexOf("[")+1,-1))&&(Je=Je.slice(0,Wt.index)+"["+"a".repeat(Wt[0].length-2)+"]"+Je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Wt=this.tokenizer.rules.inline.blockSkip.exec(Je))!=null;)Je=Je.slice(0,Wt.index)+"["+"a".repeat(Wt[0].length-2)+"]"+Je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;X;){if(Pe=this.tokenizer.escape(X)){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(Pe=this.tokenizer.tag(X,te,oe)){X=X.substring(Pe.raw.length),te=Pe.inLink,oe=Pe.inRawBlock,$.push(Pe);continue}if(Pe=this.tokenizer.link(X)){X=X.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,oe)),$.push(Pe);continue}if(Pe=this.tokenizer.reflink(X,this.tokens.links)){X=X.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,oe)),$.push(Pe);continue}if(Pe=this.tokenizer.strong(X,Je,Te)){X=X.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],te,oe),$.push(Pe);continue}if(Pe=this.tokenizer.em(X,Je,Te)){X=X.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],te,oe),$.push(Pe);continue}if(Pe=this.tokenizer.codespan(X)){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(Pe=this.tokenizer.br(X)){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(Pe=this.tokenizer.del(X)){X=X.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],te,oe),$.push(Pe);continue}if(Pe=this.tokenizer.autolink(X,Se)){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(!te&&(Pe=this.tokenizer.url(X,Se))){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(Pe=this.tokenizer.inlineText(X,oe,ke)){X=X.substring(Pe.raw.length),Te=Pe.raw.slice(-1),$.push(Pe);continue}if(X){var Xt="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(Xt);break}else throw new Error(Xt)}}return $},j(ye,null,[{key:"rules",get:function(){return{block:Ne,inline:we}}}]),ye}(),je=I.defaults,Be=B.cleanUrl,Ke=B.escape,Ue=function(){function ye(fe){this.options=fe||je}var he=ye.prototype;return he.code=function(X,$,te){var oe=($||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(X,oe);Te!=null&&Te!==X&&(te=!0,X=Te)}return oe?'<pre><code class="'+this.options.langPrefix+Ke(oe,!0)+'">'+(te?X:Ke(X,!0))+`</code></pre>
|
|
`:"<pre><code>"+(te?X:Ke(X,!0))+`</code></pre>
|
|
`},he.blockquote=function(X){return`<blockquote>
|
|
`+X+`</blockquote>
|
|
`},he.html=function(X){return X},he.heading=function(X,$,te,oe){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+oe.slug(te)+'">'+X+"</h"+$+`>
|
|
`:"<h"+$+">"+X+"</h"+$+`>
|
|
`},he.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},he.list=function(X,$,te){var oe=$?"ol":"ul",Te=$&&te!==1?' start="'+te+'"':"";return"<"+oe+Te+`>
|
|
`+X+"</"+oe+`>
|
|
`},he.listitem=function(X){return"<li>"+X+`</li>
|
|
`},he.checkbox=function(X){return"<input "+(X?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},he.paragraph=function(X){return"<p>"+X+`</p>
|
|
`},he.table=function(X,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
|
|
<thead>
|
|
`+X+`</thead>
|
|
`+$+`</table>
|
|
`},he.tablerow=function(X){return`<tr>
|
|
`+X+`</tr>
|
|
`},he.tablecell=function(X,$){var te=$.header?"th":"td",oe=$.align?"<"+te+' align="'+$.align+'">':"<"+te+">";return oe+X+"</"+te+`>
|
|
`},he.strong=function(X){return"<strong>"+X+"</strong>"},he.em=function(X){return"<em>"+X+"</em>"},he.codespan=function(X){return"<code>"+X+"</code>"},he.br=function(){return this.options.xhtml?"<br/>":"<br>"},he.del=function(X){return"<del>"+X+"</del>"},he.link=function(X,$,te){if(X=Be(this.options.sanitize,this.options.baseUrl,X),X===null)return te;var oe='<a href="'+Ke(X)+'"';return $&&(oe+=' title="'+$+'"'),oe+=">"+te+"</a>",oe},he.image=function(X,$,te){if(X=Be(this.options.sanitize,this.options.baseUrl,X),X===null)return te;var oe='<img src="'+X+'" alt="'+te+'"';return $&&(oe+=' title="'+$+'"'),oe+=this.options.xhtml?"/>":">",oe},he.text=function(X){return X},ye}(),xe=function(){function ye(){}var he=ye.prototype;return he.strong=function(X){return X},he.em=function(X){return X},he.codespan=function(X){return X},he.del=function(X){return X},he.html=function(X){return X},he.text=function(X){return X},he.link=function(X,$,te){return""+te},he.image=function(X,$,te){return""+te},he.br=function(){return""},ye}(),Ge=function(){function ye(){this.seen={}}var he=ye.prototype;return he.slug=function(X){var $=X.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty($)){var te=$;do this.seen[te]++,$=te+"-"+this.seen[te];while(this.seen.hasOwnProperty($))}return this.seen[$]=0,$},ye}(),qe=I.defaults,lt=B.unescape,ot=function(){function ye(fe){this.options=fe||qe,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new xe,this.slugger=new Ge}ye.parse=function(X,$){var te=new ye($);return te.parse(X)};var he=ye.prototype;return he.parse=function(X,$){$===void 0&&($=!0);var te="",oe,Te,Pe,Je,Wt,Zt,Xt,an,fn,It,Kn,Sn,Jn,Dn,on,qn,Ft,Mt,Rr=X.length;for(oe=0;oe<Rr;oe++){It=X[oe];switch(It.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(It.tokens),It.depth,lt(this.parseInline(It.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(It.text,It.lang,It.escaped);continue}case"table":{for(an="",Xt="",Je=It.header.length,Te=0;Te<Je;Te++)Xt+=this.renderer.tablecell(this.parseInline(It.tokens.header[Te]),{header:!0,align:It.align[Te]});for(an+=this.renderer.tablerow(Xt),fn="",Je=It.cells.length,Te=0;Te<Je;Te++){for(Zt=It.tokens.cells[Te],Xt="",Wt=Zt.length,Pe=0;Pe<Wt;Pe++)Xt+=this.renderer.tablecell(this.parseInline(Zt[Pe]),{header:!1,align:It.align[Pe]});fn+=this.renderer.tablerow(Xt)}te+=this.renderer.table(an,fn);continue}case"blockquote":{fn=this.parse(It.tokens),te+=this.renderer.blockquote(fn);continue}case"list":{for(Kn=It.ordered,Sn=It.start,Jn=It.loose,Je=It.items.length,fn="",Te=0;Te<Je;Te++)on=It.items[Te],qn=on.checked,Ft=on.task,Dn="",on.task&&(Mt=this.renderer.checkbox(qn),Jn?on.tokens.length>0&&on.tokens[0].type==="text"?(on.tokens[0].text=Mt+" "+on.tokens[0].text,on.tokens[0].tokens&&on.tokens[0].tokens.length>0&&on.tokens[0].tokens[0].type==="text"&&(on.tokens[0].tokens[0].text=Mt+" "+on.tokens[0].tokens[0].text)):on.tokens.unshift({type:"text",text:Mt}):Dn+=Mt),Dn+=this.parse(on.tokens,Jn),fn+=this.renderer.listitem(Dn,Ft,qn);te+=this.renderer.list(fn,Kn,Sn);continue}case"html":{te+=this.renderer.html(It.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(It.tokens));continue}case"text":{for(fn=It.tokens?this.parseInline(It.tokens):It.text;oe+1<Rr&&X[oe+1].type==="text";)It=X[++oe],fn+=`
|
|
`+(It.tokens?this.parseInline(It.tokens):It.text);te+=$?this.renderer.paragraph(fn):fn;continue}default:{var kn='Token with "'+It.type+'" type was not found.';if(this.options.silent){console.error(kn);return}else throw new Error(kn)}}}return te},he.parseInline=function(X,$){$=$||this.renderer;var te="",oe,Te,Pe=X.length;for(oe=0;oe<Pe;oe++){Te=X[oe];switch(Te.type){case"escape":{te+=$.text(Te.text);break}case"html":{te+=$.html(Te.text);break}case"link":{te+=$.link(Te.href,Te.title,this.parseInline(Te.tokens,$));break}case"image":{te+=$.image(Te.href,Te.title,Te.text);break}case"strong":{te+=$.strong(this.parseInline(Te.tokens,$));break}case"em":{te+=$.em(this.parseInline(Te.tokens,$));break}case"codespan":{te+=$.codespan(Te.text);break}case"br":{te+=$.br();break}case"del":{te+=$.del(this.parseInline(Te.tokens,$));break}case"text":{te+=$.text(Te.text);break}default:{var Je='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(Je);return}else throw new Error(Je)}}}return te},ye}(),bt=B.merge,ht=B.checkSanitizeDeprecation,ut=B.escape,Ze=I.getDefaults,Et=I.changeDefaults,St=I.defaults;function He(ye,he,fe){if(typeof ye=="undefined"||ye===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ye!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ye)+", string expected");if(typeof he=="function"&&(fe=he,he=null),he=bt({},He.defaults,he||{}),ht(he),fe){var X=he.highlight,$;try{$=Ae.lex(ye,he)}catch(Pe){return fe(Pe)}var te=function(Je){var Wt;if(!Je)try{Wt=ot.parse($,he)}catch(Zt){Je=Zt}return he.highlight=X,Je?fe(Je):fe(null,Wt)};if(!X||X.length<3)return te();if(delete he.highlight,!$.length)return te();var oe=0;He.walkTokens($,function(Pe){Pe.type==="code"&&(oe++,setTimeout(function(){X(Pe.text,Pe.lang,function(Je,Wt){if(Je)return te(Je);Wt!=null&&Wt!==Pe.text&&(Pe.text=Wt,Pe.escaped=!0),oe--,oe===0&&te()})},0))}),oe===0&&te();return}try{var Te=Ae.lex(ye,he);return he.walkTokens&&He.walkTokens(Te,he.walkTokens),ot.parse(Te,he)}catch(Pe){if(Pe.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,he.silent)return"<p>An error occurred:</p><pre>"+ut(Pe.message+"",!0)+"</pre>";throw Pe}}He.options=He.setOptions=function(ye){return bt(He.defaults,ye),Et(He.defaults),He},He.getDefaults=Ze,He.defaults=St,He.use=function(ye){var he=bt({},ye);if(ye.renderer&&function(){var X=He.defaults.renderer||new Ue,$=function(Te){var Pe=X[Te];X[Te]=function(){for(var Je=arguments.length,Wt=new Array(Je),Zt=0;Zt<Je;Zt++)Wt[Zt]=arguments[Zt];var Xt=ye.renderer[Te].apply(X,Wt);return Xt===!1&&(Xt=Pe.apply(X,Wt)),Xt}};for(var te in ye.renderer)$(te);he.renderer=X}(),ye.tokenizer&&function(){var X=He.defaults.tokenizer||new de,$=function(Te){var Pe=X[Te];X[Te]=function(){for(var Je=arguments.length,Wt=new Array(Je),Zt=0;Zt<Je;Zt++)Wt[Zt]=arguments[Zt];var Xt=ye.tokenizer[Te].apply(X,Wt);return Xt===!1&&(Xt=Pe.apply(X,Wt)),Xt}};for(var te in ye.tokenizer)$(te);he.tokenizer=X}(),ye.walkTokens){var fe=He.defaults.walkTokens;he.walkTokens=function(X){ye.walkTokens(X),fe&&fe(X)}}He.setOptions(he)},He.walkTokens=function(ye,he){for(var fe=E(ye),X;!(X=fe()).done;){var $=X.value;he($);switch($.type){case"table":{for(var te=E($.tokens.header),oe;!(oe=te()).done;){var Te=oe.value;He.walkTokens(Te,he)}for(var Pe=E($.tokens.cells),Je;!(Je=Pe()).done;)for(var Wt=Je.value,Zt=E(Wt),Xt;!(Xt=Zt()).done;){var an=Xt.value;He.walkTokens(an,he)}break}case"list":{He.walkTokens($.items,he);break}default:$.tokens&&He.walkTokens($.tokens,he)}}},He.Parser=ot,He.parser=ot.parse,He.Renderer=Ue,He.TextRenderer=xe,He.Lexer=Ae,He.lexer=Ae.lex,He.Tokenizer=de,He.Slugger=Ge,He.parse=He;var it=He;return it})},FOrL:function(Pt,Ye,K){Pt.exports=K.p+"static/nodata.a6b3f948.png"},IPdS:function(Pt,Ye,K){Pt.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:function(Pt,Ye,K){"use strict";K.r(Ye);var Ee=K("DjyN"),j=K("NUBc"),O=K("T2oS"),N=K("W9HT"),E=K("qVdP"),R=K("jsC+"),I=K("k1fw"),L=K("+L6B"),T=K("2/Rp"),P=K("5Dmo"),b=K("3S7+"),S=K("lUTK"),w=K("BvKs"),C=K("oBTY"),x=K("sRBo"),_=K("kaz8"),p=K("miYZ"),n=K("tsqr"),u=K("7Kak"),l=K("9yH6"),v=K("2qtc"),d=K("kLXV"),o=K("9og8"),m=K("tJVT"),h=K("PpiC"),a=K("5NDa"),r=K("5rEg"),e=K("Znn+"),i=K("ZTPi"),g=K("WmNS"),f=K.n(g),y=K("q1tI"),t=K.n(y),A=K("9kvl"),U=K("iris"),B=K("d5o6"),G=K.n(B),J=K("P/tu"),F=K("WCUW"),q=function(Re){var rt=Re.problemset,Ve=Re.dispatch,Qe=Re.onOk,Ht=Object(y.useState)(""),Ut=Object(m.a)(Ht,2),kt=Ut[0],wt=Ut[1],mt=Object(y.useState)([0]),Rt=Object(m.a)(mt,2),_t=Rt[0],Kt=Rt[1],Ot=function(){Ve({type:"problemset/setActionTabs",payload:{}})};Object(y.useEffect)(function(){if(rt.actionTabs.key==="\u65B0\u5EFA\u6587\u4EF6\u5939"){var Bt,jt;Kt([(Bt=rt.actionTabs)===null||Bt===void 0||((jt=Bt.params)===null||jt===void 0)?void 0:jt.group_id]),wt("")}},[rt.actionTabs.key]);var At=function(){var Bt=Object(o.a)(f.a.mark(function jt(){var xn,ge,We;return f.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:if(xn=["\uFF1F","\u3001","/","\u2572","*","<",">","|"],kt.trim()){tt.next=4;break}return n.b.warn("\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0"),tt.abrupt("return");case 4:if(!(kt.charAt(0)===" ")){tt.next=7;break}return n.b.warn("\u9996\u5B57\u7B26\u4E0D\u80FD\u4E3A\u7A7A\u683C"),tt.abrupt("return");case 7:ge=0;case 8:if(!(ge<kt.length)){tt.next=15;break}if(!xn.includes(kt.charAt(ge))){tt.next=12;break}return n.b.warn("\u6587\u4EF6\u5939\u540D\u79F0\u5305\u542B\u7279\u6B8A\u5B57\u7B26"),tt.abrupt("return",!1);case 12:ge++,tt.next=8;break;case 15:return tt.next=17,Object(F.n)({parent_id:_t.length>0?_t[0]:0,name:kt});case 17:We=tt.sent,We.status===0&&(Ot(),Qe(We==null?void 0:We.id));case 19:case"end":return tt.stop()}},jt)}));return function(){return Bt.apply(this,arguments)}}();return t.a.createElement(d.a,{centered:!0,title:"\u65B0\u5EFA\u6587\u4EF6\u5939",visible:rt.actionTabs.key==="\u65B0\u5EFA\u6587\u4EF6\u5939",width:500,onCancel:Ot,onOk:At,destroyOnClose:!0},t.a.createElement("div",{className:G.a.addModal},t.a.createElement("div",{className:G.a.row},t.a.createElement("span",{className:G.a.label},"\u6587\u4EF6\u5939\u540D\u79F0: "),t.a.createElement(r.a,{placeholder:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0",value:kt,onChange:function(jt){return wt(jt.target.value)}})),t.a.createElement("div",{className:G.a.row,style:{alignItems:"start",maxHeight:500,overflow:"auto"}},t.a.createElement("span",{className:G.a.label},"\u6587\u4EF6\u5939\u4F4D\u7F6E: "),t.a.createElement(J.a,{value:_t,onChange:function(jt){return Kt(jt)}}))))},re=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(q),ae=K("BdwD"),ve=K("iNYN"),de=K.n(ve),Z=function(Re){var rt=Re.problemset,Ve=Re.globalSetting,Qe=Re.loading,Ht=Re.dispatch,Ut=Object(h.a)(Re,["problemset","globalSetting","loading","dispatch"]);return t.a.createElement(d.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:rt.actionTabs.key==="Problemset-PublicReview",title:"\u63D0\u793A",okText:"\u77E5\u9053\u5566",cancelText:"",width:"442px",onOk:function(){Ht({type:"problemset/setActionTabs",payload:{}})},onCancel:function(){Ht({type:"problemset/setActionTabs",payload:{}})}},t.a.createElement("div",{className:de.a.modalContent},"\u516C\u5F00\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u7BA1\u7406\u5458\u7684\u5BA1\u6838"),t.a.createElement("div",{className:de.a.modalContent},"\u6211\u4EEC\u5C06\u57281-2\u4E2A\u5DE5\u4F5C\u65E5\u5185\u5B8C\u6210\u5BA1\u6838"))},ee=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.loading,Ve=Dt.globalSetting;return{problemset:Re,globalSetting:Ve,loading:rt.effects}})(Z),pe=K("xlxt"),Q=K.n(pe),V=K("mgmH"),Ce=function(Re){var rt=Re.problemset,Ve=Re.dispatch,Qe=Object(y.useState)([]),Ht=Object(m.a)(Qe,2),Ut=Ht[0],kt=Ht[1],wt=function(){Ve({type:"problemset/setActionTabs",payload:{}})};Object(y.useEffect)(function(){if(rt.actionTabs.key==="\u5BFC\u51FA\u8BD5\u9898"){var Rt,_t;kt([(Rt=rt.actionTabs)===null||Rt===void 0||((_t=Rt.params)===null||_t===void 0)?void 0:_t.group_id])}},[rt.actionTabs.key]);var mt=function(){if(Ut.length===0){n.b.warn("\u8BF7\u9009\u62E9\u6587\u4EF6\u5939");return}Object(V.k)({group_id:Ut[0]}),wt()};return t.a.createElement(d.a,{centered:!0,title:"\u5BFC\u51FA\u8BD5\u9898",visible:rt.actionTabs.key==="\u5BFC\u51FA\u8BD5\u9898",width:718,destroyOnClose:!0,wrapClassName:Q.a.customModal,onCancel:wt,onOk:mt},t.a.createElement("aside",{className:Q.a.exportModal},t.a.createElement(J.a,{value:Ut,onChange:function(_t){return kt(_t)}})))},De=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(Ce),Ne=K("i8i3"),we=K.n(Ne),ke=K("Ty5D"),Se=function(Re){var rt,Ve,Qe=Re.problemset,Ht=Re.dispatch,Ut=Re.onOk,kt=Object(ke.i)(),wt=Object(y.useState)([]),mt=Object(m.a)(wt,2),Rt=mt[0],_t=mt[1],Kt=Object(y.useState)(1),Ot=Object(m.a)(Kt,2),At=Ot[0],Bt=Ot[1],jt=Object(y.useState)([]),xn=Object(m.a)(jt,2),ge=xn[0],We=xn[1],tn=Object(y.useState)([]),tt=Object(m.a)(tn,2),dt=tt[0],at=tt[1],ft=Object(y.useState)(!0),yt=Object(m.a)(ft,2),vt=yt[0],Qt=yt[1],un=Object(y.useState)(!1),Gt=Object(m.a)(un,2),zt=Gt[0],_r=Gt[1],gr=Object(y.useState)(!1),xr=Object(m.a)(gr,2),xt=xr[0],In=xr[1];Object(y.useEffect)(function(){if(Qe.actionTabs.key==="\u5171\u4EAB\u8BD5\u9898"){var wn,Nn;bn(),We([(wn=Qe.actionTabs)===null||wn===void 0||((Nn=wn.params)===null||Nn===void 0)?void 0:Nn.group_id])}},[Qe.actionTabs.key]);var bn=function(){var wn=Object(o.a)(f.a.mark(function Nn(){var jn,rr,$n;return f.a.wrap(function(pr){for(;;)switch(pr.prev=pr.next){case 0:return Qt(!0),pr.next=3,Object(F.v)({type:0,page:1,per_page:10,order_by:"new"});case 3:jn=pr.sent,jn!=null&&jn.item_banks_group&&(rr={id:-1,item_banks_count:(jn==null?void 0:jn.no_group_count)||0,name:{name:"\u672A\u52A0\u5165\u5206\u7EC4"}},$n=[rr].concat((jn==null?void 0:jn.item_banks_group)||[]),_t($n)),Qt(!1);case 6:case"end":return pr.stop()}},Nn)}));return function(){return wn.apply(this,arguments)}}(),Yn=function(){Ht({type:"problemset/setActionTabs",payload:{}})},zn=function(){var wn=Object(o.a)(f.a.mark(function Nn(){var jn;return f.a.wrap(function($n){for(;;)switch($n.prev=$n.next){case 0:if(!(ge.length===0)){$n.next=3;break}return n.b.warn("\u8BF7\u9009\u62E9\u9700\u8981\u7684\u6587\u4EF6\u5939"),$n.abrupt("return");case 3:if(!(At===1)){$n.next=6;break}return Bt(2),$n.abrupt("return");case 6:return _r(!0),$n.next=9,Object(F.j)({item_banks_group_ids:ge,clazz:"ItemBank",group_ids:dt});case 9:jn=$n.sent,(jn==null?void 0:jn.status)===0&&(Ut(),Yn()),_r(!1);case 12:case"end":return $n.stop()}},Nn)}));return function(){return wn.apply(this,arguments)}}(),Vn=function(Nn){We(Nn),In(Nn.length===Rt.length)};return t.a.createElement(d.a,{centered:!0,afterClose:function(){at([]),Bt(1),In(!1),_t([])},title:"\u5171\u4EAB\u8BD5\u9898".concat(At,"/2"),visible:Qe.actionTabs.key==="\u5171\u4EAB\u8BD5\u9898",footer:null,width:718,destroyOnClose:!0,wrapClassName:we.a.customModal,onCancel:Yn},t.a.createElement("aside",{className:we.a.shareModal},t.a.createElement(N.a,{spinning:vt},t.a.createElement("div",{className:we.a.content},At===1&&t.a.createElement("div",{className:we.a.group},t.a.createElement(J.a,{value:ge,onChange:function(Nn){return We(Nn)}})),At===2&&t.a.createElement("div",{className:we.a.teachGroup},t.a.createElement("p",null,"\u5171\u4EAB\u81F3\u6559\u7814\u56E2\u961F"),t.a.createElement(_.a.Group,{value:dt,onChange:function(Nn){return at(Nn)}},Qe==null||((rt=Qe.teachGroupData)===null||rt===void 0||((Ve=rt.groups)===null||Ve===void 0))?void 0:Ve.map(function(wn){return t.a.createElement(_.a,{key:wn.group_id,value:wn.group_id},wn==null?void 0:wn.name)})))),t.a.createElement("div",{className:we.a.footer},t.a.createElement(T.a,{onClick:Yn},"\u53D6\u6D88"),t.a.createElement(T.a,{loading:zt,onClick:zn,type:"primary"},At===1?"\u4E0B\u4E00\u6B65":"\u786E\u8BA4\u5171\u4EAB")))))},Ae=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(Se),je=function(Re){var rt=Re.problemset,Ve=Re.globalSetting,Qe=Re.loading,Ht=Re.dispatch,Ut=Re.onReloadData,kt=Ut===void 0?function(){}:Ut,wt=Object(h.a)(Re,["problemset","globalSetting","loading","dispatch","onReloadData"]),mt=Object(y.useRef)(!1),Rt=Object(y.useState)(!1),_t=Object(m.a)(Rt,2),Kt=_t[0],Ot=_t[1];Object(y.useEffect)(function(){rt.actionTabs.key==="Problemset-SetPrivate"?window.localStorage.getItem("problemset-set-private-hint-flag")==="1"?At():Ot(!0):Ot(!1)},[rt.actionTabs.key]);var At=function(){var Bt=Object(o.a)(f.a.mark(function jt(){var xn;return f.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:return mt.current&&window.localStorage.setItem("problemset-set-private-hint-flag","1"),We.next=3,Ht({type:"problemset/setPrivate",payload:rt.actionTabs.params});case 3:xn=We.sent,Ht({type:"problemset/setActionTabs",payload:{}}),mt.current=!1,xn.status===0&&kt();case 7:case"end":return We.stop()}},jt)}));return function(){return Bt.apply(this,arguments)}}();return t.a.createElement(d.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:Kt,title:"\u64A4\u9500\u516C\u5F00\u544A\u77E5",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",confirmLoading:Qe["problemset/setPrivate"],width:"442px",onOk:At,onCancel:function(){Ht({type:"problemset/setActionTabs",payload:{}}),mt.current=!1}},t.a.createElement("div",{className:de.a.modalContentLeft},"\u672C\u9898\u5DF2\u516C\u5F00\uFF0C\u64A4\u9500\u516C\u5F00\u53EF\u80FD\u5BFC\u81F4\u90E8\u5206\u7528\u6237\u5BF9\u672C\u9898\u7684\u4F7F\u7528\u53D7\u635F\u3002"),t.a.createElement("div",{className:de.a.modalContentLeft},"\u786E\u8BA4\u64A4\u9500\u516C\u5F00\u56DE\u5230\u81EA\u6709\u72B6\u6001\u5417\uFF1F"),t.a.createElement("div",null,t.a.createElement(_.a,{className:"mt10",defaultChecked:!1,onChange:function(jt){return mt.current=jt.target.checked}},"\u4E0D\u518D\u63D0\u793A")))},Be=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.loading,Ve=Dt.globalSetting;return{problemset:Re,globalSetting:Ve,loading:rt.effects}})(je),Ke=function(Re){var rt=Re.problemset,Ve=Re.globalSetting,Qe=Re.loading,Ht=Re.dispatch,Ut=Re.onReloadData,kt=Ut===void 0?function(){}:Ut,wt=Object(h.a)(Re,["problemset","globalSetting","loading","dispatch","onReloadData"]),mt=function(){var Rt=Object(o.a)(f.a.mark(function _t(){var Kt;return f.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Ht({type:"problemset/handleDelete",payload:rt.actionTabs.params});case 2:Kt=At.sent,Ht({type:"problemset/setActionTabs",payload:{}}),Kt.status===0&&kt();case 5:case"end":return At.stop()}},_t)}));return function(){return Rt.apply(this,arguments)}}();return t.a.createElement(d.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:rt.actionTabs.key==="Problemset-Delete",title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",confirmLoading:Qe["problemset/handleDelete"],width:"442px",onOk:mt,onCancel:function(){Ht({type:"problemset/setActionTabs",payload:{}})}},t.a.createElement("div",{className:de.a.modalContent},"\u786E\u8BA4\u5220\u9664\u540E\uFF0C\u65E0\u6CD5\u64A4\u9500"),t.a.createElement("div",{className:de.a.modalContent},"\u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F"))},Ue=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.loading,Ve=Dt.globalSetting;return{problemset:Re,globalSetting:Ve,loading:rt.effects}})(Ke),xe=K("LvDl"),Ge=K("9Bee"),qe=function(Re){var rt,Ve=Re.problemset,Qe=Re.dispatch,Ht=Object(y.useState)({}),Ut=Object(m.a)(Ht,2),kt=Ut[0],wt=Ut[1],mt=Object(y.useState)([]),Rt=Object(m.a)(mt,2),_t=Rt[0],Kt=Rt[1],Ot=Object(y.useState)(!1),At=Object(m.a)(Ot,2),Bt=At[0],jt=At[1],xn=["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(y.useEffect)(function(){var tt;if((Ve==null||((tt=Ve.actionTabs)===null||tt===void 0)?void 0:tt.key)==="SINGLE"){var dt,at=Object(xe.cloneDeep)(Ve==null||((dt=Ve.actionTabs)===null||dt===void 0)?void 0:dt.params);wt(at),Kt(at.choices)}},[Ve==null||((rt=Ve.actionTabs)===null||rt===void 0)?void 0:rt.key]);var ge=function(){var tt=Object(o.a)(f.a.mark(function dt(){var at,ft;return f.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:if(_t.some(function(Qt){return Qt==null?void 0:Qt.checked})){vt.next=3;break}return n.b.warn("\u8BF7\u60A8\u4F5C\u7B54\u540E\u518D\u63D0\u4EA4"),vt.abrupt("return");case 3:Bt&&(ft=Object(xe.cloneDeep)(Ve==null||((at=Ve.actionTabs)===null||at===void 0)?void 0:at.params),Kt(ft.choices)),jt(!Bt);case 5:case"end":return vt.stop()}},dt)}));return function(){return tt.apply(this,arguments)}}(),We=function(dt,at){console.log(dt.target.checked);var ft=_t.map(function(yt,vt){return Object(I.a)(Object(I.a)({},yt),{},{checked:vt===at?dt.target.checked:!1})});Kt(ft)},tn=function(){wt({}),Kt([]),jt(!1),Qe({type:"problemset/setActionTabs",payload:{}})};return t.a.createElement(d.a,{centered:!0,destroyOnClose:!0,visible:Ve.actionTabs.key==="SINGLE",title:"\u8BD5\u9898\u4F53\u9A8C",okText:Bt?"\u91CD\u65B0\u7B54\u9898":"\u63D0\u4EA4\u7B54\u6848",cancelText:"\u53D6\u6D88",width:708,onOk:ge,onCancel:tn},t.a.createElement("div",null,t.a.createElement("div",{className:"c-light-primary mb5 font16"},"\u5355\u9009\u9898"),t.a.createElement(Ge.a,{value:kt==null?void 0:kt.name}),_t==null?void 0:_t.map(function(tt,dt){var at=tt.is_answer,ft=tt.checked,yt=tt.choice_text,vt="";return Bt&&at&&(vt=de.a.green),Bt&&!at&&ft&&(vt=de.a.red),t.a.createElement("div",{key:dt,style:{pointerEvents:Bt?"none":"auto"},className:"".concat(de.a.row," ").concat(vt)},t.a.createElement(l.a,{onChange:function(un){return We(un,dt)},checked:ft}),t.a.createElement("span",null,xn[dt],".\xA0"),t.a.createElement(Ge.a,{className:de.a.html,value:yt}),Bt&&at&&t.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),Bt&&!at&&ft&&t.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))}),Bt&&t.a.createElement(y.Fragment,null,t.a.createElement("div",{className:de.a.line}),t.a.createElement("div",{className:"c-grey-333 mb5"},t.a.createElement("b",null,"\u6B63\u786E\u7B54\u6848:\xA0"),xn[_t.findIndex(function(tt){return tt.is_answer})]),t.a.createElement("div",{className:"c-grey-333 mb10"},t.a.createElement("b",null,"\u89E3\u6790:\xA0"),(kt==null?void 0:kt.analysis)||"\u6682\u65E0\u89E3\u6790"))))},lt=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(qe),ot=function(Re){var rt,Ve=Re.problemset,Qe=Re.dispatch,Ht=Object(y.useState)({}),Ut=Object(m.a)(Ht,2),kt=Ut[0],wt=Ut[1],mt=Object(y.useState)([]),Rt=Object(m.a)(mt,2),_t=Rt[0],Kt=Rt[1],Ot=Object(y.useState)(!1),At=Object(m.a)(Ot,2),Bt=At[0],jt=At[1],xn=["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(y.useEffect)(function(){var dt;if((Ve==null||((dt=Ve.actionTabs)===null||dt===void 0)?void 0:dt.key)==="MULTIPLE"){var at,ft=Object(xe.cloneDeep)(Ve==null||((at=Ve.actionTabs)===null||at===void 0)?void 0:at.params);wt(ft),Kt(ft.choices)}},[Ve==null||((rt=Ve.actionTabs)===null||rt===void 0)?void 0:rt.key]);var ge=function(){var dt=Object(o.a)(f.a.mark(function at(){var ft,yt;return f.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(_t.some(function(un){return un==null?void 0:un.checked})){Qt.next=3;break}return n.b.warn("\u8BF7\u60A8\u4F5C\u7B54\u540E\u518D\u63D0\u4EA4"),Qt.abrupt("return");case 3:Bt&&(yt=Object(xe.cloneDeep)(Ve==null||((ft=Ve.actionTabs)===null||ft===void 0)?void 0:ft.params),Kt(yt.choices)),jt(!Bt);case 5:case"end":return Qt.stop()}},at)}));return function(){return dt.apply(this,arguments)}}(),We=function(at,ft){console.log(at.target.checked);var yt=_t.map(function(vt,Qt){return Object(I.a)(Object(I.a)({},vt),{},{checked:Qt===ft?at.target.checked:vt.checked})});Kt(yt)},tn=function(){wt({}),Kt([]),jt(!1),Qe({type:"problemset/setActionTabs",payload:{}})},tt=function(){var at="";return _t.forEach(function(ft,yt){ft.is_answer&&(at=at+xn[yt])}),at};return t.a.createElement(d.a,{centered:!0,destroyOnClose:!0,visible:Ve.actionTabs.key==="MULTIPLE",title:"\u8BD5\u9898\u4F53\u9A8C",okText:Bt?"\u91CD\u65B0\u7B54\u9898":"\u63D0\u4EA4\u7B54\u6848",cancelText:"\u53D6\u6D88",width:708,onOk:ge,onCancel:tn},t.a.createElement("div",null,t.a.createElement("div",{className:"c-light-primary mb5 font16"},"\u591A\u9009\u9898"),t.a.createElement(Ge.a,{value:kt==null?void 0:kt.name}),_t==null?void 0:_t.map(function(dt,at){var ft=dt.is_answer,yt=dt.checked,vt=dt.choice_text,Qt="";return Bt&&ft&&(Qt=de.a.green),Bt&&!ft&&yt&&(Qt=de.a.red),t.a.createElement("div",{key:at,style:{pointerEvents:Bt?"none":"auto"},className:"".concat(de.a.row," ").concat(Qt)},t.a.createElement(_.a,{style:{padding:3},onChange:function(Gt){return We(Gt,at)},checked:yt}),t.a.createElement("span",null,xn[at],".\xA0"),t.a.createElement(Ge.a,{className:de.a.html,value:vt}),Bt&&ft&&t.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),Bt&&!ft&&yt&&t.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))}),Bt&&t.a.createElement(y.Fragment,null,t.a.createElement("div",{className:de.a.line}),t.a.createElement("div",{className:"c-grey-333 mb5"},t.a.createElement("b",null,"\u6B63\u786E\u7B54\u6848:\xA0"),tt()),t.a.createElement("div",{className:"c-grey-333 mb10"},t.a.createElement("b",null,"\u89E3\u6790:\xA0"),(kt==null?void 0:kt.analysis)||"\u6682\u65E0\u89E3\u6790"))))},bt=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(ot),ht=function(Re){var rt,Ve,Qe=Re.problemset,Ht=Re.dispatch,Ut=Object(y.useState)({}),kt=Object(m.a)(Ut,2),wt=kt[0],mt=kt[1],Rt=Object(y.useState)([]),_t=Object(m.a)(Rt,2),Kt=_t[0],Ot=_t[1],At=Object(y.useState)(!1),Bt=Object(m.a)(At,2),jt=Bt[0],xn=Bt[1],ge=["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(y.useEffect)(function(){var dt;if((Qe==null||((dt=Qe.actionTabs)===null||dt===void 0)?void 0:dt.key)==="JUDGMENT"){var at,ft=Object(xe.cloneDeep)(Qe==null||((at=Qe.actionTabs)===null||at===void 0)?void 0:at.params);mt(ft),Ot(ft.choices)}},[Qe==null||((rt=Qe.actionTabs)===null||rt===void 0)?void 0:rt.key]);var We=function(){var dt=Object(o.a)(f.a.mark(function at(){var ft,yt;return f.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(Kt.some(function(un){return un==null?void 0:un.checked})){Qt.next=3;break}return n.b.warn("\u8BF7\u60A8\u4F5C\u7B54\u540E\u518D\u63D0\u4EA4"),Qt.abrupt("return");case 3:jt&&(yt=Object(xe.cloneDeep)(Qe==null||((ft=Qe.actionTabs)===null||ft===void 0)?void 0:ft.params),Ot(yt.choices)),xn(!jt);case 5:case"end":return Qt.stop()}},at)}));return function(){return dt.apply(this,arguments)}}(),tn=function(at,ft){console.log(at.target.checked);var yt=Kt.map(function(vt,Qt){return Object(I.a)(Object(I.a)({},vt),{},{checked:Qt===ft?at.target.checked:!1})});Ot(yt)},tt=function(){mt({}),Ot([]),xn(!1),Ht({type:"problemset/setActionTabs",payload:{}})};return t.a.createElement(d.a,{centered:!0,destroyOnClose:!0,visible:Qe.actionTabs.key==="JUDGMENT",title:"\u8BD5\u9898\u4F53\u9A8C",okText:jt?"\u91CD\u65B0\u7B54\u9898":"\u63D0\u4EA4\u7B54\u6848",cancelText:"\u53D6\u6D88",width:708,onOk:We,onCancel:tt},t.a.createElement("div",null,t.a.createElement("div",{className:"c-light-primary mb5 font16"},"\u5224\u65AD\u9898"),t.a.createElement(Ge.a,{value:wt==null?void 0:wt.name}),Kt==null?void 0:Kt.map(function(dt,at){var ft=dt.is_answer,yt=dt.checked,vt=dt.choice_text,Qt="";return jt&&ft&&(Qt=de.a.green),jt&&!ft&&yt&&(Qt=de.a.red),t.a.createElement("div",{key:at,style:{pointerEvents:jt?"none":"auto"},className:"".concat(de.a.row," ").concat(Qt)},t.a.createElement(l.a,{onChange:function(Gt){return tn(Gt,at)},checked:yt}),t.a.createElement(Ge.a,{className:de.a.html,value:vt}),jt&&ft&&t.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),jt&&!ft&&yt&&t.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))}),jt&&t.a.createElement(y.Fragment,null,t.a.createElement("div",{className:de.a.line}),t.a.createElement("div",{className:"c-grey-333 mb5"},t.a.createElement("b",null,"\u6B63\u786E\u7B54\u6848:\xA0"),(Ve=Kt.find(function(dt){return dt.is_answer}))===null||Ve===void 0?void 0:Ve.choice_text),t.a.createElement("div",{className:"c-grey-333 mb10"},t.a.createElement("b",null,"\u89E3\u6790:\xA0"),(wt==null?void 0:wt.analysis)||"\u6682\u65E0\u89E3\u6790"))))},ut=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(ht),Ze=function(Re){var rt,Ve,Qe=Re.problemset,Ht=Re.dispatch,Ut=Object(y.useState)({}),kt=Object(m.a)(Ut,2),wt=kt[0],mt=kt[1],Rt=Object(y.useState)([]),_t=Object(m.a)(Rt,2),Kt=_t[0],Ot=_t[1],At=Object(y.useState)(!1),Bt=Object(m.a)(At,2),jt=Bt[0],xn=Bt[1],ge=["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(y.useEffect)(function(){var dt;if((Qe==null||((dt=Qe.actionTabs)===null||dt===void 0)?void 0:dt.key)==="COMPLETION"){var at,ft,yt=Object(xe.cloneDeep)(Qe==null||((at=Qe.actionTabs)===null||at===void 0)?void 0:at.params);mt(yt),Ot(yt==null||((ft=yt.standard_answer)===null||ft===void 0)?void 0:ft.map(function(vt){return{value:"",answer:(vt==null?void 0:vt.answer_text)||[]}}))}},[Qe==null||((rt=Qe.actionTabs)===null||rt===void 0)?void 0:rt.key]);var We=function(){var dt=Object(o.a)(f.a.mark(function at(){var ft,yt,vt;return f.a.wrap(function(un){for(;;)switch(un.prev=un.next){case 0:if(!Kt.some(function(Gt){return(Gt==null?void 0:Gt.value)===""})){un.next=3;break}return n.b.warn("\u8BF7\u60A8\u4F5C\u7B54\u540E\u518D\u63D0\u4EA4"),un.abrupt("return");case 3:jt&&(vt=Object(xe.cloneDeep)(Qe==null||((ft=Qe.actionTabs)===null||ft===void 0)?void 0:ft.params),Ot(vt==null||((yt=vt.standard_answer)===null||yt===void 0)?void 0:yt.map(function(Gt){return{value:"",answer:(Gt==null?void 0:Gt.answer_text)||[]}}))),xn(!jt);case 5:case"end":return un.stop()}},at)}));return function(){return dt.apply(this,arguments)}}(),tn=function(at,ft){var yt=Kt.map(function(vt,Qt){return Object(I.a)(Object(I.a)({},vt),{},{value:Qt===ft?at.target.value:vt.value})});Ot(yt)},tt=function(){mt({}),Ot([]),xn(!1),Ht({type:"problemset/setActionTabs",payload:{}})};return t.a.createElement(d.a,{centered:!0,destroyOnClose:!0,visible:Qe.actionTabs.key==="COMPLETION",title:"\u8BD5\u9898\u4F53\u9A8C",okText:jt?"\u91CD\u65B0\u7B54\u9898":"\u63D0\u4EA4\u7B54\u6848",cancelText:"\u53D6\u6D88",width:708,onOk:We,onCancel:tt},t.a.createElement("div",null,t.a.createElement("div",{className:"c-light-primary mb5 font16"},"\u586B\u7A7A\u9898"),t.a.createElement(Ge.a,{value:wt==null?void 0:wt.name}),Kt==null?void 0:Kt.map(function(dt,at){var ft=dt.value,yt=dt.answer,vt="";return jt&&yt!==null&&yt!==void 0&&yt.includes(ft)&&(vt=de.a.green),jt&&!(yt!=null&&yt.includes(ft))&&(vt=de.a.red),t.a.createElement("div",{key:at,style:{pointerEvents:jt?"none":"auto",marginTop:10},className:"".concat(de.a.row," ").concat(vt)},t.a.createElement("div",{style:{minWidth:80}},"\u586B\u7A7A",at+1,"\u7B54\u6848:"),t.a.createElement(r.a.TextArea,{className:de.a.textArea,style:{width:610,marginRight:10},onChange:function(un){return tn(un,at)},value:ft}),jt&&(yt==null?void 0:yt.includes(ft))&&t.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),jt&&!(yt!=null&&yt.includes(ft))&&t.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))}),jt&&t.a.createElement(y.Fragment,null,t.a.createElement("div",{className:de.a.line}),wt==null||((Ve=wt.standard_answer)===null||Ve===void 0)?void 0:Ve.map(function(dt,at){var ft;return t.a.createElement("div",{className:"c-grey-333 mb5"},t.a.createElement("b",null,"\u586B\u7A7A",at+1,"\u7B54\u6848:\xA0"),(dt==null||((ft=dt.answer_text)===null||ft===void 0)?void 0:ft.join("\u3001"))||"")}),t.a.createElement("div",{className:"c-grey-333 mb10"},t.a.createElement("b",null,"\u89E3\u6790:\xA0"),(wt==null?void 0:wt.analysis)||"\u6682\u65E0\u89E3\u6790"))))},Et=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(Ze),St=K("Q9mQ"),He=K("diRs"),it=K("+z73"),ye=K.n(it),he=function(Re){var rt=Re.data,Ve=rt===void 0?[]:rt,Qe=Re.onClick,Ht=function(){return Ve.map(function(wt,mt){return t.a.createElement("div",{key:mt,className:ye.a.few},t.a.createElement("b",{title:wt.name,style:{color:mt===0?"#333333":"#999999"},onClick:function(){return Qe(wt.id)}},wt.name),mt<Ve.length-1&&t.a.createElement("span",null,"/"))})},Ut=function(){var wt=!0,mt=Ve.slice(2,-2),Rt=t.a.createElement("div",{className:ye.a.pWrap},mt.map(function(_t){return t.a.createElement("span",{title:_t.name,onClick:function(){return Qe(_t.id)},key:_t.id},_t.name)}));return Ve.map(function(_t,Kt){var Ot=null;return Kt>1&&Kt<Ve.length-2?wt&&(Ot=t.a.createElement(He.a,{key:Kt,placement:"bottom",content:Rt},t.a.createElement("span",{style:{color:"#999",cursor:"pointer"}},".../")),wt=!1):Ot=t.a.createElement("div",{key:Kt,className:ye.a.few},t.a.createElement("b",{title:_t.name,style:{color:Kt===0?"#333333":"#999999"},onClick:function(){return Qe(_t.id)}},_t.name),Kt<Ve.length-1&&t.a.createElement("span",null,"/")),Ot})};return t.a.createElement("aside",{style:{overflowX:"auto"}},(Ve==null?void 0:Ve.length)>5?Ut():Ht())},fe=he,X=K("tK3L"),$=K.n(X),te=K("bbsP"),oe=K("/wGt"),Te=K("IPdS"),Pe=K.n(Te),Je=[],Wt=function(Re){Je.forEach(function(rt){if(Re.target===rt.element||Zt.isParent(Re.target,rt.element))return;rt.callbacks.forEach(function(Ve){return Ve()})})};window.document.body?window.document.body.addEventListener("click",Wt):window.addEventListener("DOMContentLoaded",function(){window.document.body.addEventListener("click",Wt)});var Zt={isParent:function(Re,rt){for(var Ve=Re;Ve&&Ve.tagName&&Ve.tagName.toLowerCase()!=="body";){if(Ve===rt)return!0;Ve=Ve.parentNode}return!1},init:function(Re,rt){var Ve=Je.filter(function(Qe){return Qe.element===Re});return Ve.length>0?Ve[0].callbacks.push(rt):Je.push({element:Re,callbacks:[rt]}),{clear:function(){Je=Je.filter(function(Ht){return Ht.element!==Re})}}}},Xt=Zt,an=[{stateName:"single_questions_count",type:"SINGLE",typeName:"\u5355\u9009\u9898"},{stateName:"multiple_questions_count",type:"MULTIPLE",typeName:"\u591A\u9009\u9898"},{stateName:"judgement_questions_count",type:"JUDGMENT",typeName:"\u5224\u65AD\u9898"},{stateName:"completion_questions_count",type:"COMPLETION",typeName:"\u586B\u7A7A\u9898"},{stateName:"subjective_questions_count",type:"SUBJECTIVE",typeName:"\u7B80\u7B54\u9898"},{stateName:"program_questions_count",type:"PROGRAM",typeName:"\u7F16\u7A0B\u9898"},{stateName:"practical_questions_count",type:"PRACTICAL",typeName:"\u5B9E\u8BAD\u9898"},{stateName:"combination_questions_count",type:"COMBINATION",typeName:"\u7EC4\u5408\u9898"}],fn=function(Re){var rt=Re.visible,Ve=Re.basketData,Qe=Re.basketTotal,Ht=Re.onClose,Ut=Ht===void 0?function(){}:Ht,kt=Re.onDelete,wt=kt===void 0?function(){}:kt,mt=Object(y.useRef)(),Rt=Object(y.useRef)();return Object(y.useEffect)(function(){return Rt.current?(Qe>=0&&!mt.current&&(mt.current=Xt.init(Rt.current,function(){Ut()})),function(){mt.current&&mt.current.clear()}):void 0},[Rt.current]),t.a.createElement(oe.a,{className:Pe.a.drawerWrap,placement:"right",closable:!1,mask:!1,visible:rt,forceRender:!0,onClose:Ut},Qe>0?t.a.createElement("div",{style:{height:"100%"},ref:Rt},t.a.createElement("div",{className:Pe.a.title},"\u8BD5\u9898\u7BEE"),an.map(function(_t){return Ve[_t.stateName]>0&&t.a.createElement("div",{className:Pe.a.problemset,key:_t.type},t.a.createElement("div",{className:Pe.a.content},_t.typeName,"(",Ve[_t.stateName],")"),t.a.createElement("div",{className:Pe.a.delete,onClick:function(){return wt(_t.type)}},t.a.createElement("i",{className:"iconfont icon-shanchu1 ".concat(Pe.a.deleteIcon)})))}),t.a.createElement("div",{className:Pe.a.previewWrap},t.a.createElement("div",{className:Pe.a.preview,onClick:function(){return A.d.push("/problemset/preview")}},"\u8BD5\u5377\u9884\u89C8"))):t.a.createElement("div",{ref:Rt},t.a.createElement(ae.a,{customText:"\u8BF7\u9009\u62E9\u8BD5\u9898\u8FDB\u884C\u7EC4\u5377"})))},It={SINGLE:"\u5355\u9009\u9898",MULTIPLE:"\u591A\u9009\u9898",JUDGMENT:"\u5224\u65AD\u9898",COMPLETION:"\u586B\u7A7A\u9898",SUBJECTIVE:"\u7B80\u7B54\u9898",PROGRAM:"\u7F16\u7A0B\u9898",PRACTICAL:"\u5B9E\u8BAD\u9898",COMBINATION:"\u7EC4\u5408\u9898"},Kn=function(Re){var rt,Ve,Qe=Re.problemset,Ht=Re.globalSetting,Ut=Re.loading,kt=Re.dispatch,wt=Re.onReloadData,mt=wt===void 0?function(){}:wt,Rt=Re.onReloadBasketData,_t=Rt===void 0?function(){}:Rt,Kt=Object(h.a)(Re,["problemset","globalSetting","loading","dispatch","onReloadData","onReloadBasketData"]),Ot=function(){var At=Object(o.a)(f.a.mark(function Bt(){var jt;return f.a.wrap(function(ge){for(;;)switch(ge.prev=ge.next){case 0:return ge.next=2,kt({type:"problemset/basketDelete",payload:Qe.actionTabs.params});case 2:jt=ge.sent,kt({type:"problemset/setActionTabs",payload:{}}),jt.status===0&&(mt(),_t());case 5:case"end":return ge.stop()}},Bt)}));return function(){return At.apply(this,arguments)}}();return t.a.createElement(d.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:Qe.actionTabs.key==="Problemset-BasketDelete",title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",confirmLoading:Ut["problemset/handleDelete"],width:"442px",onOk:Ot,onCancel:function(){kt({type:"problemset/setActionTabs",payload:{}})}},t.a.createElement("div",{className:de.a.modalContent},"\u662F\u5426\u5220\u9664\u8BD5\u9898\u7BEE\u4E2D",It[(rt=Qe.actionTabs)===null||rt===void 0||((Ve=rt.params)===null||Ve===void 0)?void 0:Ve.type]))},Sn=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.loading,Ve=Dt.globalSetting;return{problemset:Re,globalSetting:Ve,loading:rt.effects}})(Kn),Jn=K("A60/"),Dn=K.n(Jn),on=function(Re){var rt=Re.count,Ve=Re.visibleBasket,Qe=Re.onToggleVisible,Ht=Qe===void 0?function(){}:Qe;return t.a.createElement("div",{className:"".concat(Ve?Dn.a.right180:Dn.a.right20," ").concat(Dn.a.wrap)},t.a.createElement(b.a,{title:"\u8BD5\u9898\u7BEE",placement:"left"},t.a.createElement("div",{className:Dn.a.basket,onClick:Ht},rt>0&&t.a.createElement("div",{className:Dn.a.count},rt),t.a.createElement("span",{className:Dn.a.iconWrap},t.a.createElement("i",{className:"".concat(Dn.a.icon," iconfont icon-shitilan")})),t.a.createElement("p",{className:Dn.a.name},"\u8BD5\u9898\u7BEE"))))},qn=K("+vTd"),Ft=K.n(qn),Mt=K("xKgJ"),Rr=["A\uFF0E","B\uFF0E","C\uFF0E","D\uFF0E","E\uFF0E","F\uFF0E","G\uFF0E","H\uFF0E","I\uFF0E","J\uFF0E","K\uFF0E","L\uFF0E","M\uFF0E","N\uFF0E","O\uFF0E","P\uFF0E","Q\uFF0E","R\uFF0E","S\uFF0E","T\uFF0E","U\uFF0E","V\uFF0E","W\uFF0E","X\uFF0E","Y\uFF0E","Z\uFF0E"],kn=["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"],Wn=function(Re){var rt,Ve=Re.isProblemset,Qe=Re.data,Ht=Re.user,Ut=Re.selectIds,kt=Re.activeTabsKey,wt=Re.onPublicReview,mt=wt===void 0?function(){}:wt,Rt=Re.onStartExperience,_t=Rt===void 0?function(){}:Rt,Kt=Re.onSelectCheckBox,Ot=Kt===void 0?function(){}:Kt,At=Re.onSetPrivate,Bt=At===void 0?function(){}:At,jt=Re.onCorrection,xn=jt===void 0?function(){}:jt,ge=Re.onCollect,We=ge===void 0?function(){}:ge,tn=Re.onSetPublic,tt=tn===void 0?function(){}:tn,dt=Re.onDelete,at=dt===void 0?function(){}:dt,ft=Re.onCancel,yt=ft===void 0?function(){}:ft,vt=Re.onSelect,Qt=vt===void 0?function(){}:vt,un=Re.onMoveTo,Gt=un===void 0?function(){}:un,zt=Re.onSetShare,_r=zt===void 0?function(){}:zt,gr=Re.onCancelShare,xr=gr===void 0?function(){}:gr,xt=Re.onPublish,In=xt===void 0?function(){}:xt,bn=Re.onCancelPublish,Yn=bn===void 0?function(){}:bn,zn=Object(y.useState)(!1),Vn=Object(m.a)(zn,2),wn=Vn[0],Nn=Vn[1],jn=function(){if(Qe.item_type==="JUDGMENT")return t.a.createElement("div",{className:Ft.a.judgmentContent},Qe.choices.map(function(Hn,Cr){return t.a.createElement(l.a,{key:Cr,disabled:!0},Hn.choice_text)}));if(Qe.item_type==="PROGRAM"){var ar;return t.a.createElement("div",{className:Ft.a.programContent},t.a.createElement(Ge.a,{value:(ar=Qe.program_attr)===null||ar===void 0?void 0:ar.description}))}if(Qe.item_type==="COMBINATION"){var Zn;return t.a.createElement("div",{className:Ft.a.combinationContent},Qe==null||((Zn=Qe.sub_item_banks)===null||Zn===void 0)?void 0:Zn.map(function(Hn,Cr){var Fr,Jr="(\u9898\u76EE".concat(Cr+1,"-\u5355\u9009\u9898) ");return t.a.createElement(y.Fragment,null,t.a.createElement("div",{style:{marginTop:10,marginBottom:10}},t.a.createElement(Ge.a,{value:Jr+Hn.name})),Hn.choices.map(function(mr,Tr){return t.a.createElement("div",{key:Tr,className:Ft.a.otherContentItem},t.a.createElement("p",null,Rr[Tr]),t.a.createElement(Ge.a,{className:Ft.a.otehrContentHtml,value:mr.choice_text}))}),t.a.createElement("div",{className:Ft.a.con},t.a.createElement("b",{className:"c-grey-333 font14"}," \u7B54\u6848\uFF1A",kn==null?void 0:kn[Hn==null||((Fr=Hn.choices)===null||Fr===void 0)?void 0:Fr.findIndex(function(mr){return mr==null?void 0:mr.is_answer})]," "),t.a.createElement("div",null,t.a.createElement("span",null,"\u89E3\u6790\uFF1A"),t.a.createElement(Ge.a,{className:Ft.a.parseAnswerHtml,value:Hn.analysis||"\u6682\u65E0\u89E3\u6790"}))))}))}return t.a.createElement("div",{className:Ft.a.otherContent},Qe.choices.map(function(Hn,Cr){return t.a.createElement("div",{key:Cr,className:Ft.a.otherContentItem},t.a.createElement("p",null,Rr[Cr]),t.a.createElement(Ge.a,{className:Ft.a.otehrContentHtml,value:Hn.choice_text}))}))},rr=function(){var ar;return t.a.createElement("div",null,(ar=Qe.standard_answer)===null||ar===void 0?void 0:ar.map(function(Zn,Hn){return t.a.createElement(Ge.a,{key:Hn,className:Ft.a.answerHtml,value:"\u7B54\u6848\uFF08\u586B\u7A7A".concat(Zn.position,"\uFF09\uFF1A").concat(Zn.answer_text.join("\u3001"))})}))},$n=function(){var ar,Zn,Hn,Cr={SUBJECTIVE:(ar=Qe.answer_texts)===null||ar===void 0?void 0:ar[0],JUDGMENT:(Zn=Qe.choices)===null||Zn===void 0||((Hn=Zn.find(function(Lr){return Lr.is_answer}))===null||Hn===void 0)?void 0:Hn.choice_text},Fr=Qe.choices.map(function(Lr){return Lr.is_answer}).findIndex(function(Lr){return Lr}),Jr=Fr>-1?kn[Fr]:"",mr="";Qe.choices.map(function(Lr,aa){Lr.is_answer&&(mr+=kn[aa])});var Tr=Cr[Qe.item_type],ir={SINGLE:t.a.createElement(Ge.a,{className:Ft.a.answerHtml,value:"\u7B54\u6848\uFF1A".concat(Jr||"\u65E0")}),MULTIPLE:t.a.createElement(Ge.a,{className:Ft.a.answerHtml,value:"\u7B54\u6848\uFF1A".concat(mr||"\u65E0")}),COMPLETION:rr()},or=t.a.createElement(Ge.a,{className:Ft.a.answerHtml,value:"\u7B54\u6848\uFF1A".concat(Tr||"\u65E0")});return ir[Qe.item_type]||or},Br=function(ar){var Zn=Object(C.a)(Ut);ar.target.checked?Zn.push(Qe.id):Zn=Zn.filter(function(Hn){return Hn!==Qe.id}),Ot(Zn)};return t.a.createElement("div",{className:Ft.a.itemWrap},t.a.createElement("div",{className:Ft.a.list},t.a.createElement(_.a,{className:"mr10",onChange:Br,checked:Ut.includes(Qe.id)}),t.a.createElement("div",{className:Ft.a.title},t.a.createElement(Ge.a,{key:1,showLines:1,showTextOnly:!0,className:Ft.a.topicTitleContent,value:Qe.name})),!wn&&t.a.createElement("div",{onClick:function(){return Nn(!wn)},className:Ft.a.tr},"\u5C55\u5F00",t.a.createElement("i",{style:{transform:"rotate(90deg)"},className:"iconfont icon-lujing"}))),t.a.createElement("aside",{style:wn?{height:"auto"}:{overflow:"hidden",height:0}},t.a.createElement(Ge.a,{key:2,className:"".concat(Ft.a.topicTitleContent," mt20"),value:Qe.name}),t.a.createElement("div",{className:"".concat(Ft.a.row," mt15")},jn()),t.a.createElement("div",{className:Ft.a.row},t.a.createElement("div",{className:Ft.a.updateTimeRow},t.a.createElement("div",{className:Ft.a.updateTimeWrap},Qe.item_type==="PROGRAM"&&t.a.createElement("p",{className:Ft.a.programLanguage},"\u7F16\u7A0B\u8BED\u8A00\uFF1A",(rt=Qe.program_attr)===null||rt===void 0?void 0:rt.language)))),Qe.item_type!=="PROGRAM"&&Qe.item_type!=="COMBINATION"&&t.a.createElement("div",null,t.a.createElement("div",{className:Ft.a.parseAnswerBorder}),t.a.createElement("div",{className:Ft.a.answer},$n()),t.a.createElement("div",{className:Ft.a.parse},t.a.createElement("div",{className:Ft.a.parseText},"\u89E3\u6790\uFF1A"),t.a.createElement("div",{className:Ft.a.parseAnswer},Qe.analysis?t.a.createElement(Ge.a,{className:Ft.a.parseAnswerHtml,value:Qe.analysis}):"\u6682\u65E0\u89E3\u6790"))),t.a.createElement("div",{className:Ft.a.bottom},Qe.item_type!=="SUBJECTIVE"&&Qe.item_type!=="COMBINATION"&&t.a.createElement("span",{onClick:function(){return _t(Qe)}},"\u4F53\u9A8C"),t.a.createElement("span",{onClick:function(){return Nn(!1)}},"\u6536\u8D77",t.a.createElement("i",{className:"iconfont icon-zhankaijiantou"})," "))))},Vr=function(Re){var rt,Ve,Qe,Ht,Ut,kt,wt,mt,Rt,_t,Kt,Ot,At,Bt,jt,xn,ge=Re.isProblemset,We=Re.data,tn=Re.user,tt=Re.activeTabsKey,dt=Re.onPublicReview,at=dt===void 0?function(){}:dt,ft=Re.onStartExperience,yt=ft===void 0?function(){}:ft,vt=Re.onSetPrivate,Qt=vt===void 0?function(){}:vt,un=Re.onCorrection,Gt=un===void 0?function(){}:un,zt=Re.onCollect,_r=zt===void 0?function(){}:zt,gr=Re.onSetPublic,xr=gr===void 0?function(){}:gr,xt=Re.onDelete,In=xt===void 0?function(){}:xt,bn=Re.onCancel,Yn=bn===void 0?function(){}:bn,zn=Re.onSelect,Vn=zn===void 0?function(){}:zn,wn=Re.onMoveTo,Nn=wn===void 0?function(){}:wn,jn=Re.onSetShare,rr=jn===void 0?function(){}:jn,$n=Re.onCancelShare,Br=$n===void 0?function(){}:$n,pr=Re.onPublish,ar=pr===void 0?function(){}:pr,Zn=Re.onCancelPublish,Hn=Zn===void 0?function(){}:Zn,Cr=We.item_type==="PROGRAM"?"/problems/".concat((rt=We.program_attr)===null||rt===void 0?void 0:rt.identifier,"/edit"):"/problemset/edit/".concat(We.id),Fr=tt==="0"&&!We.public&&!We.apply&&(We.item_type==="PROGRAM"&&((Ve=We.program_attr)===null||Ve===void 0?void 0:Ve.status)!==0||We.item_type!=="PROGRAM"),Jr=t.a.createElement(w.a,{forceSubMenuRender:!0,className:Ft.a.menu},tt==="0"&&!We.public&&t.a.createElement(w.a.Item,{key:"-1"},t.a.createElement("a",{className:Ft.a.actionLink,target:"_blank",href:Cr},"\u7F16\u8F91")),(tt==="0"||tt==="3")&&We.item_type==="PROGRAM"&&((Qe=We.program_attr)===null||Qe===void 0?void 0:Qe.status)!==0&&!We.public&&((Ht=We.author)===null||Ht===void 0?void 0:Ht.login)===((Ut=tn.userInfo)===null||Ut===void 0?void 0:Ut.login)&&t.a.createElement(w.a.Item,{key:"0"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){var or;return Hn(We==null||((or=We.program_attr)===null||or===void 0)?void 0:or.identifier)}},"\u64A4\u9500\u53D1\u5E03")),tt==="0"&&t.a.createElement(w.a.Item,{key:"1"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Nn(We.id)}},"\u79FB\u52A8\u5230")),tt==="0"&&!(We!=null&&We.is_share)&&t.a.createElement(w.a.Item,{key:"3"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return rr(We.id)}},"\u5171\u4EAB")),(tt==="0"&&(We==null?void 0:We.is_share)||tt==="3"&&((kt=We.author)===null||kt===void 0?void 0:kt.login)===((wt=tn.userInfo)===null||wt===void 0?void 0:wt.login))&&t.a.createElement(w.a.Item,{key:"3"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Br(We.id)}},"\u64A4\u9500\u5171\u4EAB")),Fr&&t.a.createElement(w.a.Item,{key:"4"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return xr(We.id)}},"\u516C\u5F00")),tt==="0"&&!We.public&&We.apply&&(We.item_type==="PROGRAM"&&We.program_attr.status!==0||We.item_type!=="PROGRAM")&&t.a.createElement(w.a.Item,{key:"5"},t.a.createElement("a",{className:Ft.a.reviewFlag,onClick:at},"\u5BA1\u6838\u4E2D")),(tt==="0"||tt==="1")&&We.public&&((mt=We.author)===null||mt===void 0?void 0:mt.login)===((Rt=tn.userInfo)===null||Rt===void 0?void 0:Rt.login)&&t.a.createElement(w.a.Item,{key:"6"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Qt(We.id)}},"\u64A4\u9500\u516C\u5F00")),tt==="2"&&t.a.createElement(w.a.Item,{key:"7"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return _r(We.id,We.is_collected)}},"\u53D6\u6D88\u6536\u85CF")),(tt==="0"||tt==="3")&&We.item_type==="PROGRAM"&&((_t=We.program_attr)===null||_t===void 0?void 0:_t.status)===0&&!We.public&&((Kt=We.author)===null||Kt===void 0?void 0:Kt.login)===((Ot=tn.userInfo)===null||Ot===void 0?void 0:Ot.login)&&t.a.createElement(w.a.Item,{key:"8"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){var or;return ar(We==null||((or=We.program_attr)===null||or===void 0)?void 0:or.identifier)}},"\u53D1\u5E03")),(tt==="1"||tt==="3")&&!Object(Mt.o)()&&!Object(Mt.m)()&&((At=We.author)===null||At===void 0?void 0:At.login)!==((Bt=tn.userInfo)===null||Bt===void 0?void 0:Bt.login)&&t.a.createElement(w.a.Item,{key:"9"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return _r(We.id,We.is_collected)}},We.is_collected?"\u53D6\u6D88\u6536\u85CF":"\u6536\u85CF")),tt!=="0"&&!Object(Mt.o)()&&!Object(Mt.m)()&&t.a.createElement(w.a.Item,{key:"10"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Gt(We.id)}},"\u7EA0\u9519")),(tt==="0"&&!We.public||tt==="1"&&Object(Mt.o)()&&((jt=We.author)===null||jt===void 0?void 0:jt.login)!==((xn=tn.userInfo)===null||xn===void 0?void 0:xn.login))&&t.a.createElement(w.a.Item,{key:"11"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return In(We.id)}},"\u5220\u9664"))),mr=t.a.createElement(w.a,{forceSubMenuRender:!0,className:Ft.a.menu},t.a.createElement(w.a.Item,{key:"10"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Gt(We.id)}},"\u7EA0\u9519"))),Tr=tt!=="0"&&!Object(Mt.o)()&&!Object(Mt.m)();return t.a.createElement(t.a.Fragment,null,ge?t.a.createElement(R.a,{className:"ml40",overlay:Jr},t.a.createElement("span",{style:{cursor:"default"},onClick:function(or){return or.preventDefault()}},t.a.createElement("span",{className:"c-light-primary"},"\u66F4\u591A"))):Tr?t.a.createElement(R.a,{className:"ml40",overlay:mr},t.a.createElement("span",{style:{cursor:"default"},onClick:function(or){return or.preventDefault()}},t.a.createElement("span",{className:"c-light-primary"},"\u66F4\u591A"))):t.a.createElement("span",null))},br=Wn,Pr=K("YaiT"),nr=K.n(Pr),dr=K("ErOA"),Ur=function(Re){var rt=Re.isProblemset,Ve=Re.data,Qe=Re.user,Ht=Re.onOpen,Ut=Ht===void 0?function(){}:Ht,kt=Re.onMove,wt=kt===void 0?function(){}:kt,mt=Re.onRenameOk,Rt=mt===void 0?function(){}:mt,_t=Re.onDeleteOk,Kt=_t===void 0?function(){}:_t,Ot=Object(y.useState)(!1),At=Object(m.a)(Ot,2),Bt=At[0],jt=At[1],xn=Object(y.useState)(""),ge=Object(m.a)(xn,2),We=ge[0],tn=ge[1];Object(y.useEffect)(function(){Ve.name&&tn(Ve==null?void 0:Ve.name)},[Ve==null?void 0:Ve.name]);var tt=function(){var at=Object(o.a)(f.a.mark(function ft(yt){var vt,Qt,un;return f.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:if(vt=["\uFF1F","\u3001","/","\u2572","*","<",">","|"],We.trim()){zt.next=4;break}return n.b.warn("\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0"),zt.abrupt("return");case 4:if(!(We.charAt(0)===" ")){zt.next=7;break}return n.b.warn("\u9996\u5B57\u7B26\u4E0D\u80FD\u4E3A\u7A7A\u683C"),zt.abrupt("return");case 7:Qt=0;case 8:if(!(Qt<We.length)){zt.next=15;break}if(!vt.includes(We.charAt(Qt))){zt.next=12;break}return n.b.warn("\u6587\u4EF6\u5939\u540D\u79F0\u5305\u542B\u7279\u6B8A\u5B57\u7B26"),zt.abrupt("return",!1);case 12:Qt++,zt.next=8;break;case 15:return zt.next=17,Object(dr.a)("/api/item_banks_groups/".concat(Math.abs(yt),".json"),{method:"put",body:{name:We}});case 17:un=zt.sent,un.status===0&&(jt(!1),Rt());case 19:case"end":return zt.stop()}},ft)}));return function(yt){return at.apply(this,arguments)}}(),dt=function(ft){d.a.confirm({title:"\u63D0\u793A",okText:"\u786E\u8BA4\u5220\u9664",className:"custom-modal-divider ",icon:null,content:t.a.createElement("div",null,t.a.createElement("p",null,"\u672C\u6B21\u5220\u9664\u64CD\u4F5C\u786E\u5B9A\u540E\u5185\u5BB9\u5C06\u65E0\u6CD5\u6062\u590D\uFF0C\u662F\u5426\u7EE7\u7EED\uFF1F"),t.a.createElement("p",null,"\u5220\u9664\u6587\u4EF6\u5939\uFF0C\u5C06\u540C\u6B65\u5220\u9664\u5176\u6240\u5305\u542B\u7684\u5168\u90E8\u5B50\u6587\u4EF6\u5939\u548C\u8BD5\u9898\uFF0C\u8BF7\u614E\u91CD\u64CD\u4F5C\uFF01")),cancelText:"\u53D6\u6D88",onOk:function(){var yt=Object(o.a)(f.a.mark(function Qt(){var un;return f.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return zt.next=2,Object(dr.a)("/api/item_banks_groups/".concat(Math.abs(ft),".json"),{method:"delete",body:{}});case 2:un=zt.sent,un.status===0&&Kt([ft]);case 4:case"end":return zt.stop()}},Qt)}));function vt(){return yt.apply(this,arguments)}return vt}()})};return t.a.createElement("div",{className:nr.a.list},t.a.createElement("div",{className:"iconfont icon-wenjianjia2 c-light-primary mr10"}),Bt?t.a.createElement(r.a,{style:{maxWidth:800},value:We,onChange:function(ft){return tn(ft.target.value)}}):t.a.createElement("div",{title:Ve==null?void 0:Ve.name,onClick:function(){return Ut(Ve.id)},className:nr.a.name},Ve==null?void 0:Ve.name),rt&&t.a.createElement("div",{className:nr.a.btns},Bt?t.a.createElement(t.a.Fragment,null,t.a.createElement("div",{onClick:function(){return tt(Ve.id)},className:"ml0"},t.a.createElement("i",{className:"iconfont icon-chenggong1",style:{color:"#33BD8C"}})),t.a.createElement("div",{onClick:function(){return jt(!1)},className:"ml10"},t.a.createElement("i",{className:"iconfont icon-qingchu"}))):t.a.createElement(t.a.Fragment,null,t.a.createElement("div",{onClick:function(){return wt(Ve.id,!0)},className:"ml0"},t.a.createElement("i",{className:"iconfont icon-shangyi3",style:{transform:"translateY(2px)"}})),t.a.createElement("div",{onClick:function(){return wt(Ve.id,!1)},className:"ml10",style:{transform:"rotate(180deg) translateY(1px)"}},t.a.createElement("i",{className:"iconfont icon-shangyi3"}))),t.a.createElement(T.a,{style:{marginLeft:16},onClick:function(){return jt(!0)},type:"link"},"\u91CD\u547D\u540D"),t.a.createElement(T.a,{onClick:function(){return dt(Ve.id)},type:"link",danger:!0},"\u5220\u9664")))},Ar=Ur,ua=K("rCGY"),Er=K.n(ua),ya=function(Re){var rt,Ve,Qe=Re.dispatch,Ht=Re.problemset,Ut=Re.groupIds,kt=Ut===void 0?[]:Ut,wt=Re.onChangeTeachGroup,mt=wt===void 0?function(){}:wt,Rt=Ht.teachGroupData;return!!(Rt!=null&&(rt=Rt.groups)!==null&&rt!==void 0&&rt.length)&&t.a.createElement("div",{className:Er.a.groupWrap},t.a.createElement("span",{className:"".concat(Er.a.minWidth73," ml20 mt3")},"\u6559\u7814\u56E2\u961F\uFF1A"),t.a.createElement("span",null,t.a.createElement("li",{className:"mr10 mb10 ".concat(Er.a.minWidth60," ").concat(Er.a.directionItem," ").concat(kt!=null&&kt.length?"":Er.a.active),onClick:function(){return mt([])}},"\u5168\u90E8")),t.a.createElement("div",{className:Er.a.directionContentWrap},Rt==null||((Ve=Rt.groups)===null||Ve===void 0)?void 0:Ve.map(function(_t){return t.a.createElement("span",null,t.a.createElement("li",{key:_t.group_id,onClick:function(){return mt([_t.group_id])},className:"".concat(Er.a.directionItem," ").concat(kt!=null&&kt.includes(_t.group_id)?Er.a.active:"")},_t.name))})))},da=K("1vsH"),ba=K("/zsF"),ra=K("PArb"),ca=K("14J3"),Zr=K("BMrR"),Ea=K("jCWc"),ha=K("kPKH"),_a=K("y8nQ"),M=K("Vl3Y"),s=K("nSDg"),c=K.n(s),D=K("HBuW"),W=K("NLgs"),k=r.a.Search,ce={id:"type",name:"\u6765\u6E90",children:[{name:"\u5168\u90E8",id:"all",type:"type"},{name:"\u6211\u7684",id:"mine",type:"type"}]},ze={id:"diff",name:"\u96BE\u5EA6",children:[{name:"\u5168\u90E8",id:"",type:"diff"},{name:"\u521D\u7EA7",id:1,type:"diff"},{name:"\u4E2D\u7EA7",id:2,type:"diff"},{name:"\u4E2D\u9AD8\u7EA7",id:3,type:"diff"},{name:"\u9AD8\u7EA7",id:4,type:"diff"}]},gt=function(Re){var rt,Ve,Qe,Ht,Ut=Re.classroomList,kt=Re.loading,wt=Re.dispatch,mt=Re.cb,Rt=Re.shixunIds,_t=Rt===void 0?[]:Rt,Kt=Object(ke.i)(),Ot=Object(ke.h)(),At=Ut.actionTabs,Bt=M.a.useForm(),jt=Object(m.a)(Bt,1),xn=jt[0],ge=Ut.shixunLists,We=Object(y.useState)([]),tn=Object(m.a)(We,2),tt=tn[0],dt=tn[1],at=Object(y.useState)([]),ft=Object(m.a)(at,2),yt=ft[0],vt=ft[1],Qt=Object(y.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}),un=Object(m.a)(Qt,2),Gt=un[0],zt=un[1];Object(y.useEffect)(function(){Ut.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"&&wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})},[Ut.actionTabs.key,Gt]),Object(y.useEffect)(function(){try{Ut.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"?(document.body.removeAttribute("data-custom"),document.body.setAttribute("data-self","height")):document.body.removeAttribute("data-self")}catch(xt){}return function(){document.body.removeAttribute("data-self"),document.body.setAttribute("data-custom","initial")}},[Ut.actionTabs.key]),Object(y.useEffect)(function(){_r()},[Kt]);var _r=function(){var xt=Object(o.a)(f.a.mark(function In(){var bn;return f.a.wrap(function(zn){for(;;)switch(zn.prev=zn.next){case 0:return zn.next=2,Object(D.ob)({});case 2:bn=zn.sent,vt((bn==null?void 0:bn.disciplines)||[]);case 4:case"end":return zn.stop()}},In)}));return function(){return xt.apply(this,arguments)}}(),gr=function(In,bn,Yn){Gt.tag_level=In,Gt.sub_discipline_id=bn,Gt.discipline_id=Yn,zt(Object(I.a)({},Gt)),wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})},xr=function(){wt({type:"classroomList/setActionTabs",payload:{}}),zt({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 Ut.actionTabs.key!=="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"?null:t.a.createElement(oe.a,{placement:"bottom",height:"100%",closable:!0,onClose:xr,visible:Ut.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",key:"bottom",className:c.a.drawer,footer:t.a.createElement("div",{className:"tc"},t.a.createElement(T.a,{size:"large",onClick:function(){xr(),dt([])},style:{marginRight:8}},"\u53D6\u6D88"),t.a.createElement(T.a,{size:"large",onClick:Object(o.a)(f.a.mark(function xt(){var In,bn,Yn;return f.a.wrap(function(Vn){for(;;)switch(Vn.prev=Vn.next){case 0:In=function(Nn){var jn=tt[Nn];if(_t.includes(jn)){var rr,$n;return n.b.info("\u8BF7\u52FF\u91CD\u590D\u9009\u62E9\uFF1A".concat(ge==null||((rr=ge.shixun_list)===null||rr===void 0||(($n=rr.find(function(Br){return Br.id===jn}))===null||$n===void 0))?void 0:$n.title)),{v:void 0}}},bn=0;case 2:if(!(bn<(tt==null?void 0:tt.length))){Vn.next=9;break}if(Yn=In(bn),!(typeof Yn=="object")){Vn.next=6;break}return Vn.abrupt("return",Yn.v);case 6:bn++,Vn.next=2;break;case 9:xr(),mt(tt),dt([]);case 12:case"end":return Vn.stop()}},xt)})),type:"primary"},"\u786E\u5B9A"))},t.a.createElement("section",{className:"tc"},t.a.createElement(k,{placeholder:"\u5B9E\u8BAD\u4FE1\u606F/\u9662\u6821\u540D\u79F0/\u521B\u5EFA\u8005",enterButton:"\u641C\u7D22",size:"large",className:c.a.search,onSearch:function(In){Gt.keyword=In,Gt.page=1,wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})}})),t.a.createElement("section",{className:"edu-container"},t.a.createElement("ul",{className:c.a.menu},t.a.createElement("li",null,ce.name),ce==null||((rt=ce.children)===null||rt===void 0)?void 0:rt.map(function(xt,In){return t.a.createElement("li",{className:Gt[ce.id]==xt.id?c.a.actived:"",onClick:function(){Gt[ce.id]=xt.id,zt(Object(I.a)({},Gt)),wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})}},t.a.createElement("strong",null,xt.name))})),t.a.createElement("ul",{className:c.a.menuDirection},t.a.createElement("li",{className:c.a.directionName},"\u65B9\u5411"),t.a.createElement("li",{className:Gt.discipline_id?"":c.a.actived,onClick:function(){gr(null,null,null)}},t.a.createElement("strong",null,"\u5168\u90E8")),yt==null?void 0:yt.map(function(xt,In){return t.a.createElement("li",{key:In,className:Gt.discipline_id==xt.id?c.a.actived:""},t.a.createElement("strong",{onClick:function(){gr(1,null,xt.id)}},xt.name),t.a.createElement("div",null,xt.sub_disciplines.map(function(bn,Yn){return t.a.createElement("div",{key:Yn,className:"mt5"},t.a.createElement("div",{className:Gt.sub_discipline_id==bn.id?"".concat(c.a.actived2," ").concat(c.a.subTag):c.a.subTag,onClick:function(){gr(2,bn.id,xt.id)}},bn.name),t.a.createElement("ul",{className:"mt5"},bn.tags&&bn.tags.map(function(zn,Vn){return t.a.createElement("li",{key:Vn,className:Gt.sub_discipline_id==zn.id&&Gt.tag_level===3?c.a.actived2:"",onClick:function(){gr(3,zn.id,xt.id)}},zn.name)})))})))})),t.a.createElement("ul",{className:c.a.menu},t.a.createElement("li",null,ze.name),ze==null||((Ve=ze.children)===null||Ve===void 0)?void 0:Ve.map(function(xt,In){return t.a.createElement("li",{className:Gt[ze.id]==xt.id?c.a.actived:"",onClick:function(){Gt[ze.id]=xt.id,zt(Object(I.a)({},Gt)),wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})}},t.a.createElement("strong",null,xt.name))})),t.a.createElement(Zr.a,null,t.a.createElement(ha.a,{flex:"1"},t.a.createElement("div",{className:c.a.menuCourse,style:{margin:"0px 15px"}},t.a.createElement("ul",null,t.a.createElement("li",null,"\u5DF2\u9009",t.a.createElement("span",{className:"c-blue"},tt.length),"\u4E2A\u5B9E\u8BAD"),t.a.createElement("li",null,"\u5171",t.a.createElement("span",{className:"c-blue"},ge.shixuns_count),"\u4E2A\u8BFE\u7A0B"),t.a.createElement("li",{className:"current",onClick:function(){Gt.order=Gt.order==="asc"?"desc":"asc",zt(Object(I.a)({},Gt))}},"\u5B66\u4E60\u4EBA\u6570",t.a.createElement("p",{className:"edu-sorter current ".concat(Gt.order)},Gt.order==="asc"?t.a.createElement("span",{className:"iconfont icon-sanjiaoxing-up"}):t.a.createElement("span",{className:"iconfont icon-sanjiaoxing-down"})))))),t.a.createElement(ha.a,{className:"c-grey-999"},"\u4EC5\u5DF2\u53D1\u5E03\u7684\u5B9E\u8BAD\u8FDB\u5165\u672C\u5217\u8868\u5907\u9009")),ge==null||((Qe=ge.shixun_list)===null||Qe===void 0)?void 0:Qe.map(function(xt,In){return t.a.createElement("div",{className:c.a.listItem,key:In},t.a.createElement(_.a,{checked:tt.includes(xt.id),value:xt.id,disabled:xt==null?void 0:xt.need_authorize,onChange:function(Yn){var zn=tt.indexOf(xt.id);tt.indexOf(xt.id)>-1?dt(tt.filter(function(Vn){return Vn!==xt.id})):dt(tt.concat(xt.id))}}),t.a.createElement("div",{className:c.a.info},t.a.createElement("div",{className:c.a.title},t.a.createElement("div",{className:c.a.titleLeft},t.a.createElement("a",{className:"c-black",href:"/shixuns/".concat(xt==null?void 0:xt.identifier,"/challenges"),target:"_blank"},t.a.createElement("strong",{className:"font16",dangerouslySetInnerHTML:{__html:xt.title}})),(xt==null?void 0:xt.need_authorize)&&t.a.createElement("span",{onClick:function(){Object(W.a)(!1)},style:{marginRight:"auto"},className:"tag-style bg-pink current ml10"},"\u9700\u6388\u6743"),Object(Mt.v)()&&(xt==null?void 0:xt.mark_status)===1&&t.a.createElement(b.a,{title:xt==null?void 0:xt.mark_content},t.a.createElement("span",{style:{marginRight:"auto",background:"#2FA34F"},className:"tag-style current ml10"},"\u6B63\u5E38")),Object(Mt.v)()&&(xt==null?void 0:xt.mark_status)===2&&t.a.createElement(b.a,{title:xt==null?void 0:xt.mark_content},t.a.createElement("span",{style:{marginRight:"auto",background:"#FF8C29"},className:"tag-style current ml10"},"\u9700\u5B8C\u5584")),Object(Mt.v)()&&(xt==null?void 0:xt.mark_status)===3&&t.a.createElement(b.a,{title:xt==null?void 0:xt.mark_content},t.a.createElement("span",{style:{marginRight:"auto",background:"#E53333"},className:"tag-style current ml10"},"\u65E0\u6CD5\u4F7F\u7528")))),t.a.createElement("div",{className:"flex-wrp mt10 font14 c-light-black"},t.a.createElement("span",{className:c.a.description,dangerouslySetInnerHTML:{__html:xt.description}})),t.a.createElement("div",{className:" mt15"},xt.challenge_names.map(function(bn,Yn){return t.a.createElement("span",{key:Yn,className:"mr30 font12"},"\u7B2C",Yn+1,"\u5173 ",bn," ")})),t.a.createElement(ra.a,{dashed:!0}),t.a.createElement("div",{className:"c-light-black mt20 font12"},t.a.createElement("span",null,xt.author_name),t.a.createElement("span",{className:"ml15 mr15"},"|"),t.a.createElement("span",null,xt.author_school_name),t.a.createElement("span",{className:"ml15 mr15"},"|"),t.a.createElement("span",null,"\u96BE\u5EA6\u7CFB\u6570 ",xt.level),t.a.createElement("span",{className:"ml15 mr15"},"|"),t.a.createElement("span",null,"\u5B66\u4E60\u4EBA\u6570 "),t.a.createElement("span",null,xt.study_count))))}),(ge==null||((Ht=ge.shixun_list)===null||Ht===void 0)?void 0:Ht.length)===0&&t.a.createElement(ae.a,null),t.a.createElement("p",null)),t.a.createElement("div",{className:"tc mt20"},t.a.createElement(j.a,{defaultCurrent:1,hideOnSinglePage:!0,defaultPageSize:20,showSizeChanger:!1,current:Gt.page||1,showQuickJumper:!0,total:ge==null?void 0:ge.shixuns_count,onChange:function(In){Gt.page=In,zt(Object(I.a)({},Gt))}})))},Nt=Object(A.a)(function(Dt){var Re=Dt.classroomList,rt=Dt.loading;return{classroomList:Re,loading:rt}})(gt),Xe=i.a.TabPane,Jt=r.a.Search,Pn=r.a.TextArea,Bn=function(Re){var rt,Ve,Qe,Ht,Ut,kt,wt,mt=Re.problemset,Rt=Re.user,_t=Re.globalSetting,Kt=Re.loading,Ot=Re.dispatch,At=Re.match,Bt=Object(h.a)(Re,["problemset","user","globalSetting","loading","dispatch","match"]),jt=Object(y.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:((rt=Bt.location)===null||rt===void 0||((Ve=rt.query)===null||Ve===void 0)?void 0:Ve.id)||null,exam_id:(At==null||((Qe=At.params)===null||Qe===void 0)?void 0:Qe.id)||null,exercise_id:(At==null||((Ht=At.params)===null||Ht===void 0)?void 0:Ht.categoryId)||null}),xn=Object(m.a)(jt,2),ge=xn[0],We=xn[1],tn=Object(y.useState)(0),tt=Object(m.a)(tn,2),dt=tt[0],at=tt[1],ft=Object(y.useState)([]),yt=Object(m.a)(ft,2),vt=yt[0],Qt=yt[1],un=Object(y.useState)("0"),Gt=Object(m.a)(un,2),zt=Gt[0],_r=Gt[1],gr=Object(y.useState)(0),xr=Object(m.a)(gr,2),xt=xr[0],In=xr[1],bn=Object(y.useState)(-1),Yn=Object(m.a)(bn,2),zn=Yn[0],Vn=Yn[1],wn=Object(y.useState)([]),Nn=Object(m.a)(wn,2),jn=Nn[0],rr=Nn[1],$n=Object(y.useState)(!1),Br=Object(m.a)($n,2),pr=Br[0],ar=Br[1],Zn=Object(y.useState)([]),Hn=Object(m.a)(Zn,2),Cr=Hn[0],Fr=Hn[1],Jr=Object(y.useState)(0),mr=Object(m.a)(Jr,2),Tr=mr[0],ir=mr[1],or=Object(y.useState)(!1),Lr=Object(m.a)(or,2),aa=Lr[0],Na=Lr[1],Va=Object(y.useState)(!1),xa=Object(m.a)(Va,2),Ua=xa[0],Ca=xa[1],ja=Object(y.useRef)(!1),ni=Object(y.useRef)(""),ia=Object(y.useRef)(),qr=Object(y.useRef)(),cr=Object(y.useRef)(),$a=Object(y.useState)(),Ta=Object(m.a)($a,2),Xa=Ta[0],ri=Ta[1],ne=Object(y.useState)([]),me=Object(m.a)(ne,2),ue=me[0],ie=me[1],H=Object(y.useRef)(!1),Y=(At==null?void 0:At.url)==="/problemset",z=Rt.userInfo||{},se=z.admin,le=z.business,_e=z.is_shixun_marker,be=z.is_teacher,Oe=z.user_identity,Ie=se||le||_e||be||Oe!=="\u5B66\u751F",nt=Object(y.useState)("\u6309\u66F4\u65B0\u65F6\u95F4\u964D\u5E8F"),et=Object(m.a)(nt,2),ct=et[0],Yt=et[1],dn=Object(y.useState)([]),en=Object(m.a)(dn,2),sn=en[0],cn=en[1],ln=Object(y.useState)(0),nn=Object(m.a)(ln,2),mn=nn[0],hn=nn[1],Xn=Object(y.useRef)(null),En=Object(y.useRef)(!1),$t=Object(y.useState)(!1),Vt=Object(m.a)($t,2),vn=Vt[0],pn=Vt[1],Lt=[{name:"\u6309\u66F4\u65B0\u65F6\u95F4\u5347\u5E8F",type:"updated_at",direction:"asc"},{name:"\u6309\u66F4\u65B0\u65F6\u95F4\u964D\u5E8F",type:"updated_at",direction:"desc"},{name:"\u6309\u4F7F\u7528\u6B21\u6570\u5347\u5E8F",type:"quotes",direction:"asc"},{name:"\u6309\u4F7F\u7528\u6B21\u6570\u964D\u5E8F",type:"quotes",direction:"desc"}];Object(y.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]),Object(y.useEffect)(function(){var Fe;Ot({type:"problemset/getDisciplines",payload:{source:"question"}});var Me=((Fe=Bt.location.query)===null||Fe===void 0?void 0:Fe.group_id)||0;ge.group_id=Number(Me),We(ge),qt(ge),gn(),Fn()},[]),Object(y.useEffect)(function(){return Ot({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),Ot({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1}),function(){Ot({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),Ot({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[]),Object(y.useEffect)(function(){return Ot({type:"globalSetting/headerFixedToggle",payload:!0}),function(){Ot({type:"globalSetting/headerFixedToggle",payload:!1})}},[]),Object(y.useEffect)(function(){return Ot({type:"globalSetting/headerFooterToggle",payload:Y}),function(){Ot({type:"globalSetting/headerFooterToggle",payload:!0})}},[]),Object(y.useEffect)(function(){if(mt.disciplinesData){var Fe;rr((mt==null||((Fe=mt.disciplinesData)===null||Fe===void 0)?void 0:Fe.tag_disciplines)||[])}Object(da.T)("\u8BD5\u9898\u5E93")},[mt==null?void 0:mt.disciplinesData]);var Cn=function(Me,Le){var $e=[];if(!Me){var st,Ct;mt==null||((st=mt.disciplinesData)===null||st===void 0||((Ct=st.disciplines)===null||Ct===void 0))||Ct.forEach(function(Un){var yr;Un==null||((yr=Un.sub_disciplines)===null||yr===void 0)||yr.forEach(function(Or){var la;Or==null||((la=Or.tag_disciplines)===null||la===void 0)||la.forEach(function(Mr){Mr.name!=="\u672A\u5339\u914D\u77E5\u8BC6\u70B9"&&$e.push(Mr)})})})}if(Me&&!Le){var pt,Tt,On,An=mt==null||((pt=mt.disciplinesData)===null||pt===void 0||((Tt=pt.disciplines)===null||Tt===void 0))?void 0:Tt.find(function(Un){return Un.id===Me});An==null||((On=An.sub_disciplines)===null||On===void 0)||On.forEach(function(Un){var yr;Un==null||((yr=Un.tag_disciplines)===null||yr===void 0)||yr.forEach(function(Or){Or.name!=="\u672A\u5339\u914D\u77E5\u8BC6\u70B9"&&$e.push(Or)})})}if(Me&&Le){var Gr,yn,tr,Nr,ur=mt==null||((Gr=mt.disciplinesData)===null||Gr===void 0||((yn=Gr.disciplines)===null||yn===void 0))?void 0:yn.find(function(Un){return Un.id===Me}),Yr=ur==null||((tr=ur.sub_disciplines)===null||tr===void 0)?void 0:tr.find(function(Un){return Un.id===Le});Yr==null||((Nr=Yr.tag_disciplines)===null||Nr===void 0)||Nr.forEach(function(Un){Un.name!=="\u672A\u5339\u914D\u77E5\u8BC6\u70B9"&&$e.push(Un)})}return $e},Fn=function(){var Fe=Object(o.a)(f.a.mark(function Me(){return f.a.wrap(function($e){for(;;)switch($e.prev=$e.next){case 0:Ot({type:"problemset/getTeachGroupData"});case 1:case"end":return $e.stop()}},Me)}));return function(){return Fe.apply(this,arguments)}}();Object(y.useEffect)(function(){var Fe=mt.basketData||{},Me=Fe.completion_questions_count,Le=Me===void 0?0:Me,$e=Fe.judgement_questions_count,st=$e===void 0?0:$e,Ct=Fe.multiple_questions_count,pt=Ct===void 0?0:Ct,Tt=Fe.practical_questions_count,On=Tt===void 0?0:Tt,An=Fe.program_questions_count,Gr=An===void 0?0:An,yn=Fe.single_questions_count,tr=yn===void 0?0:yn,Nr=Fe.subjective_questions_count,ur=Nr===void 0?0:Nr,Yr=Fe.combination_questions_count,Un=Yr===void 0?0:Yr,yr=Le+st+pt+On+Gr+tr+ur+Un;ir(yr)},[mt.basketData]);var qt=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){var $e,st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return pt.next=2,Ot({type:"problemset/getItemBanks",payload:Le});case 2:$e=pt.sent,$e&&$e.status!==403&&$e.status!==401&&$e.status!==500&&(at($e.items_count||0),Qt($e.items||[]),ri($e.used_shixun_ids||[]),Gn($e.items||[]),ie([]),Fr(($e==null?void 0:$e.navigation)||[]),cn(($e==null?void 0:$e.item_banks_group)||[]),En.current||(hn(($e==null||((st=$e.item_banks_group)===null||st===void 0)?void 0:st.length)>5?1:0),En.current=!1),In(($e==null?void 0:$e.added_num)||0),pn(!1));case 4:case"end":return pt.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),gn=function(){Ot({type:"problemset/getBasketList",payload:{}})},Gn=function(Me){var Le=Me.every(function($e){var st;return((st=$e.program_attr)===null||st===void 0?void 0:st.status)===0});ja.current=Le},hr=function(Me,Le){if(ge.discipline_id=Me||"",ge.sub_discipline_id=Le||"",ge.tag_discipline_id="",ge.page=1,ge.per_page=20,delete ge.id,Vn(Me===null?-1:null),We(ge),qt(ge),Me===null){var $e;rr((mt==null||(($e=mt.disciplinesData)===null||$e===void 0)?void 0:$e.tag_disciplines)||[]);return}rr(Cn(Me,Le))},Sr=function(Me){ge.item_type=Me||"",ge.page=1,ge.per_page=20,We(ge),qt(ge)},Qn=function(Me){ge.difficulty=Me||"",ge.page=1,ge.per_page=20,delete ge.id,We(ge),qt(ge)},wr=function(Me){if(ge.tag_discipline_id=Me,ge.page=1,ge.per_page=20,delete ge.id,Me===-1){var Le;ge.discipline_id="",ge.sub_discipline_id="",ge.tag_discipline_id="",rr((mt==null||((Le=mt.disciplinesData)===null||Le===void 0)?void 0:Le.tag_disciplines)||[])}Vn(Me),We(ge),qt(ge)},Kr=function(Me){ge.discipline_id="",ge.sub_discipline_id="",ge.tag_discipline_id="",ge.item_type=null,ge.difficulty=null,ge.type=Me,Me==="0"?ge.group_id=0:ge.group_id=null,ge.page=1,ge.per_page=20,delete ge.id,Vn(-1),_r(Me),We(ge),qt(ge)},Dr=function(Me,Le){ge.page=Me,ge.per_page=Le,We(ge),qt(ge)},kr=function(Me){ge.discipline_id="",ge.sub_discipline_id="",ge.tag_discipline_id="",ge.item_type=null,ge.difficulty=null,ge.page=1,ge.keyword=Me,delete ge.id,Ca(!!Me),Vn(-1),We(ge),qt(ge)},rn=function(){ge.per_page=20,We(ge),qt(ge)},fr=function(Me){var Le=Me.length===vt.length&&ge.page>1?ge.page-1:ge.page;ge.page=Le,ge.per_page=20,gn(),We(ge),qt(ge)},sr=function(){Ot({type:"problemset/setActionTabs",payload:{key:"Problemset-PublicReview"}})},er=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le,$e){var st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:if(!$e){pt.next=6;break}return pt.next=3,Object(F.l)({id:Le});case 3:pt.t0=pt.sent,pt.next=9;break;case 6:return pt.next=8,Object(F.C)({id:Le});case 8:pt.t0=pt.sent;case 9:st=pt.t0,(st==null?void 0:st.status)===0&&rn();case 11:case"end":return pt.stop()}},Me)}));return function(Le,$e){return Fe.apply(this,arguments)}}(),Wr=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){return f.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:Oa(Le);case 1:case"end":return st.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),Hr=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){return f.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:Sa(Le);case 1:case"end":return st.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),$r=function(Me){qr.current="",ia.current="",d.a.confirm({centered:!0,width:530,icon:null,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u8BD5\u9898\u7EA0\u9519",content:t.a.createElement("div",{className:"font14"},t.a.createElement("div",null,"\u9519\u8BEF\u7C7B\u578B\uFF1A"),t.a.createElement(l.a.Group,{className:"mt10",onChange:function($e){return ia.current=$e.target.value}},t.a.createElement(l.a,{value:"\u9898\u5E72"},"\u9898\u5E72"),t.a.createElement(l.a,{value:"\u7B54\u6848"},"\u7B54\u6848"),t.a.createElement(l.a,{value:"\u89E3\u6790"},"\u89E3\u6790"),t.a.createElement(l.a,{value:"\u5C5E\u6027"},"\u5C5E\u6027"),t.a.createElement(l.a,{value:"\u5176\u5B83"},"\u5176\u5B83")),t.a.createElement("div",{className:"mt10"},"\u9519\u8BEF\u63CF\u8FF0\uFF1A"),t.a.createElement(Pn,{className:"mt10",rows:4,defaultValue:qr.current,onChange:function($e){return qr.current=$e.target.value}})),onOk:function(){return new Promise(function(){var $e=Object(o.a)(f.a.mark(function st(Ct,pt){var Tt;return f.a.wrap(function(An){for(;;)switch(An.prev=An.next){case 0:if(ia.current&&qr.current){An.next=3;break}return n.b.info("\u8BF7\u586B\u5199\u9519\u8BEF\u7C7B\u578B\u548C\u9519\u8BEF\u63CF\u8FF0\uFF01"),An.abrupt("return",pt());case 3:return An.next=5,Object(F.m)({id:Me,clazz:ia.current,description:qr.current});case 5:Tt=An.sent,Tt.status===0&&n.b.info("\u6DFB\u52A0\u6210\u529F\uFF01"),Ct();case 8:case"end":return An.stop()}},st)}));return function(st,Ct){return $e.apply(this,arguments)}}())}})},Mn=function(Me){Ot({type:"problemset/setActionTabs",payload:{key:"Problemset-SetPrivate",params:{id:Me}}})},Ir=function(Me){Ot({type:"problemset/setActionTabs",payload:{key:"Problemset-Delete",params:{id:Me}}})},Xr=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){var $e,st,Ct,pt;return f.a.wrap(function(On){for(;;)switch(On.prev=On.next){case 0:if($e=Le.item_type,!($e==="PROGRAM")){On.next=12;break}return st=Le.program_attr.identifier,On.next=5,Ot({type:"problemset/startExperience",payload:{id:st}});case 5:if(Ct=On.sent,!(Ct.status===0)){On.next=10;break}return pt=Ct.identifier,Object(da.O)("/myproblems/".concat(pt)),On.abrupt("return");case 10:return n.b.warn(Ct.message),On.abrupt("return");case 12:Ot({type:"problemset/setActionTabs",payload:{key:$e,params:Le}});case 13:case"end":return On.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),Ln=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){var $e,st,Ct;return f.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:if(!ge.exam_id){Tt.next=6;break}return Tt.next=3,Object(F.I)({item_id:Le,id:ge.exam_id});case 3:return $e=Tt.sent,$e.status===0&&rn(),Tt.abrupt("return");case 6:if(!(ge!=null&&ge.exercise_id)){Tt.next=12;break}return Tt.next=9,Object(dr.a)("/api/exercise_questions/delete_by_item_bank.json ",{method:"post",body:{exercise_id:ge==null?void 0:ge.exercise_id,item_bank_ids:[Le]}});case 9:return st=Tt.sent,st.status===0&&rn(),Tt.abrupt("return");case 12:return Tt.next=14,Ot({type:"problemset/cancel",payload:{id:Le,item_bank:1}});case 14:Ct=Tt.sent,Ct.status===0&&(rn(),gn());case 16:case"end":return Tt.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),Tn=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){return f.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:ge.page=1,ge.per_page=20,ge.group_id=Math.abs(Le),We(ge),qt(ge);case 5:case"end":return st.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),lr=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le,$e){var st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:if(En.current=!0,pn(!0),!$e){pt.next=8;break}return pt.next=5,Object(F.E)({id:Math.abs(Le)});case 5:pt.t0=pt.sent,pt.next=11;break;case 8:return pt.next=10,Object(F.D)({id:Math.abs(Le)});case 10:pt.t0=pt.sent;case 11:st=pt.t0,st.status===0?rn():(En.current=!1,pn(!1));case 13:case"end":return pt.stop()}},Me)}));return function(Le,$e){return Fe.apply(this,arguments)}}(),fa=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){var $e,st,Ct;return f.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:if(!ge.exam_id){Tt.next=6;break}return Tt.next=3,Object(F.q)({exam_id:ge.exam_id,item_bank_ids:[Le]});case 3:return $e=Tt.sent,$e.status===0&&rn(),Tt.abrupt("return");case 6:if(!(ge!=null&&ge.exercise_id)){Tt.next=12;break}return Tt.next=9,Object(dr.a)("/api/exercises/".concat(ge==null?void 0:ge.exercise_id,"/select_questions.json"),{method:"post",body:{item_bank_ids:[Le]}});case 9:return st=Tt.sent,st.status===0&&rn(),Tt.abrupt("return");case 12:if(!(Tr===200)){Tt.next=15;break}return n.b.info("\u5DF2\u9009200\u4E2A\u8BD5\u9898\uFF08\u4E0D\u80FD\u5728\u9009\u7528\u66F4\u591A\u8BD5\u9898\uFF09"),Tt.abrupt("return");case 15:return Tt.next=17,Ot({type:"problemset/select",payload:{item_bank_ids:[Le]}});case 17:Ct=Tt.sent,Ct.status===0&&(rn(),gn());case 19:case"end":return Tt.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),ea=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){return f.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:if(Le){st.next=3;break}if(ue!=null&&ue.length){st.next=3;break}return st.abrupt("return",n.b.info("\u8BF7\u5148\u9009\u62E9\u8BD5\u9898"));case 3:cr.current=[0],d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u79FB\u52A8\u5230",maskClosable:!0,className:"custom-modal-divider",icon:null,content:t.a.createElement("div",{className:"font14 ".concat($.a.overflow),style:{maxHeight:500,overflow:"auto"}},t.a.createElement("p",{className:"c-grey-333"},"\u8BF7\u9009\u62E9\u9700\u8981\u79FB\u52A8\u5230\u7684\u6587\u4EF6\u5939"),t.a.createElement(J.a,{defaultValue:!0,value:cr.current,onChange:function(pt){return cr.current=pt}})),onOk:function(){var Ct=Object(o.a)(f.a.mark(function Tt(){var On,An;return f.a.wrap(function(yn){for(;;)switch(yn.prev=yn.next){case 0:return yn.next=2,Object(F.f)({ids:Le?[Le]:ue,groups_ids:(On=cr.current)===null||On===void 0?void 0:On[0]});case 2:An=yn.sent,cr.current=[],(An==null?void 0:An.status)===0&&rn();case 5:case"end":return yn.stop()}},Tt)}));function pt(){return Ct.apply(this,arguments)}return pt}()});case 5:case"end":return st.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),Qr=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){var $e,st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return pt.next=2,Object(F.z)({clazz:"ItemBank",id:Le});case 2:$e=pt.sent,st=($e==null?void 0:$e.groups)||[],cr.current=[],d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A\u64A4\u9500",cancelText:"\u53D6\u6D88",title:"\u672C\u9898\u5DF2\u5171\u4EAB\u7684\u6559\u7814\u56E2\u961F",maskClosable:!0,icon:null,content:t.a.createElement("div",{className:"font14 ".concat($.a.overflow)},t.a.createElement("p",{className:"c-grey-999"},"\u9009\u4E2D\u5E76\u786E\u5B9A\uFF0C\u5373\u64A4\u9500\u672C\u9898\u5BF9\u9009\u4E2D\u6559\u7814\u56E2\u961F\u7684\u5206\u4EAB"),t.a.createElement(_.a.Group,{className:$.a.checkbox,defaultValue:cr.current,onChange:function(On){return cr.current=On}},st==null?void 0:st.map(function(Tt){return t.a.createElement(_.a,{key:Tt.group_id,value:Tt.group_id},Tt.name)}))),onOk:function(){var Tt=Object(o.a)(f.a.mark(function An(){return f.a.wrap(function(yn){for(;;)switch(yn.prev=yn.next){case 0:return yn.abrupt("return",new Promise(function(){var tr=Object(o.a)(f.a.mark(function Nr(ur,Yr){var Un,yr,Or;return f.a.wrap(function(Mr){for(;;)switch(Mr.prev=Mr.next){case 0:if(cr.current.length){Mr.next=3;break}return n.b.warn("\u8BF7\u9009\u62E9\u9700\u8981\u64A4\u9500\u5171\u4EAB\u7684\u6559\u7814\u56E2\u961F"),Mr.abrupt("return",Yr());case 3:return yr=st==null||((Un=st.map(function(Rn){return Rn.group_id}))===null||Un===void 0)?void 0:Un.filter(function(Rn){return!cr.current.includes(Rn)}),Mr.next=6,Object(F.j)({ids:[Le],clazz:"ItemBank",group_ids:yr});case 6:return Or=Mr.sent,cr.current=[],(Or==null?void 0:Or.status)===0&&(n.b.info("\u64A4\u9500\u5171\u4EAB\u6210\u529F"),rn()),Mr.abrupt("return",ur());case 10:case"end":return Mr.stop()}},Nr)}));return function(Nr,ur){return tr.apply(this,arguments)}}()));case 1:case"end":return yn.stop()}},An)}));function On(){return Tt.apply(this,arguments)}return On}()});case 6:case"end":return pt.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),Ya=function(Me){Ot({type:"problemset/setActionTabs",payload:{key:"Problemset-BasketDelete",params:{type:Me}}})},Qa=function(){Ot({type:"problemset/setActionTabs",payload:{key:"\u65B0\u5EFA\u6587\u4EF6\u5939",params:ge}});return},Ba=function(){var Me={discipline_id:"&discipline_id=".concat(ge.discipline_id),sub_discipline_id:"&sub_discipline_id=".concat(ge.sub_discipline_id),tag_discipline_id:"&sub_discipline_id=".concat(ge.tag_discipline_id),difficulty:"&difficulty=".concat(ge.difficulty),item_type:"&item_type=".concat(ge.item_type),group_id:"&group_id=".concat(ge.group_id||0)},Le="/problemset/newitem?pages=".concat(ge.page);Object.keys(Me).forEach(function($e){ge[$e]&&(Le=Le+Me[$e])}),A.d===null||A.d===void 0||A.d.push(Le)},ta=function(Me){var Le=ue;if(!(Le!=null&&Le.length))return n.b.info("\u8BF7\u5148\u9009\u62E9\u8BD5\u9898");if(Tr+Le.length>200&&Me&&Y){n.b.info("\u8BD5\u9898\u7BEE\u4E2D\u6700\u591A\u53EF\u518D\u52A0\u5165".concat(200-Tr,"\u9898\uFF0C\u5F53\u524D\u9009\u4E2D").concat(Le.length,"\u9898\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9"));return}Me?Ja(Le):Za(Le)},Ja=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){var $e;return f.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:$e=Object(C.a)(Le),vt.forEach(function(pt){if($e.includes(pt.id)){var Tt;pt.item_type==="PROGRAM"&&((Tt=pt.program_attr)===null||Tt===void 0?void 0:Tt.status)===0&&Object(xe.remove)($e,function(On){return On===pt.id})}}),d.a.confirm({width:530,title:"\u63D0\u793A",className:"custom-modal-divider ",icon:null,centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:t.a.createElement("div",null,"\u5F53\u524D\u5DF2\u9009\u62E9",Le.length,"\u9053\u8BD5\u9898\uFF0C\u5DF2\u52A0\u5165\u8FC7\u7684\u8BD5\u9898\u6216\u672A\u53D1\u5E03\u7684\u7F16\u7A0B\u9898\u5C06\u4E0D\u4F1A\u91CD\u590D\u52A0\u5165 "),onOk:function(){var pt=Object(o.a)(f.a.mark(function On(){var An;return f.a.wrap(function(yn){for(;;)switch(yn.prev=yn.next){case 0:if(!ge.exam_id){yn.next=6;break}return yn.next=3,Object(F.q)({exam_id:ge.exam_id,item_bank_ids:$e});case 3:An=yn.sent,yn.next=15;break;case 6:if(!(ge!=null&&ge.exercise_id)){yn.next=12;break}return yn.next=9,Object(dr.a)("/api/exercises/".concat(ge==null?void 0:ge.exercise_id,"/select_questions.json"),{method:"post",body:{item_bank_ids:$e}});case 9:An=yn.sent,yn.next=15;break;case 12:return yn.next=14,Ot({type:"problemset/select",payload:{item_bank_ids:$e}});case 14:An=yn.sent;case 15:An.status===0&&(rn(),gn());case 16:case"end":return yn.stop()}},On)}));function Tt(){return pt.apply(this,arguments)}return Tt}()});case 3:case"end":return Ct.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),Za=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){var $e;return f.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:if(!ge.exam_id){Ct.next=6;break}return Ct.next=3,Object(dr.a)("/api/examination_banks/".concat(ge.exam_id,"/batch_revoke_item.json"),{method:"post",body:{item_ids:Le}});case 3:$e=Ct.sent,Ct.next=15;break;case 6:if(!(ge!=null&&ge.exercise_id)){Ct.next=12;break}return Ct.next=9,Object(dr.a)("/api/exercise_questions/delete_by_item_bank.json ",{method:"post",body:{exercise_id:ge==null?void 0:ge.exercise_id,item_bank_ids:Le}});case 9:$e=Ct.sent,Ct.next=15;break;case 12:return Ct.next=14,Ot({type:"problemset/unselectAll",payload:{item_ids:Le}});case 14:$e=Ct.sent;case 15:$e.status===0&&(rn(),gn());case 16:case"end":return Ct.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),Fa=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){var $e;return f.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:if(!(Y&&Tr===200)){Ct.next=3;break}return n.b.info("\u5DF2\u9009200\u4E2A\u8BD5\u9898\uFF08\u4E0D\u80FD\u5728\u9009\u7528\u66F4\u591A\u8BD5\u9898\uFF09"),Ct.abrupt("return");case 3:if(!ge.exam_id){Ct.next=10;break}return Ct.next=6,Object(F.q)({exam_id:ge.exam_id,shixun_ids:Le});case 6:$e=Ct.sent,$e.status===0&&rn(),Ct.next=14;break;case 10:return Ct.next=12,Ot({type:"problemset/select",payload:{shixun_ids:Le}});case 12:$e=Ct.sent,$e.status===0&&(gn(),rn());case 14:case"end":return Ct.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),qa=function(){Ot({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"}})},Sa=function(Me){var Le,$e,st,Ct;if(!(ue!=null&&ue.length)&&!Me){Ot({type:"problemset/setActionTabs",payload:{key:"\u5171\u4EAB\u8BD5\u9898",params:ge}});return}if(!((Le=mt.teachGroupData)!==null&&Le!==void 0&&($e=Le.groups)!==null&&$e!==void 0&&$e.length))return n.b.info("\u60A8\u6682\u672A\u521B\u5EFA\u6216\u52A0\u5165\u4EFB\u4F55\u6559\u7814\u56E2\u961F\uFF0C\u8BF7\u524D\u5F80\u201C\u6211\u7684\u4E2A\u4EBA\u4E2D\u5FC3-\u6559\u7814\u56E2\u961F\u201D\u67E5\u770B");d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u5171\u4EAB\u81F3\u6559\u7814\u56E2\u961F",maskClosable:!0,icon:null,content:t.a.createElement("div",{className:"font14 ".concat($.a.overflow)},t.a.createElement(_.a.Group,{className:$.a.checkbox,defaultValue:cr.current,onChange:function(Tt){return cr.current=Tt}},(st=mt.teachGroupData)===null||st===void 0||((Ct=st.groups)===null||Ct===void 0)?void 0:Ct.map(function(pt){return t.a.createElement(_.a,{key:pt.group_id,value:pt.group_id},pt.name)}))),onOk:function(){return new Promise(function(){var Tt=Object(o.a)(f.a.mark(function On(An,Gr){var yn,tr;return f.a.wrap(function(ur){for(;;)switch(ur.prev=ur.next){case 0:if((yn=cr.current)!==null&&yn!==void 0&&yn.length){ur.next=3;break}return n.b.info("\u8BF7\u5148\u9009\u62E9\u6559\u7814\u56E2\u961F"),ur.abrupt("return",Gr());case 3:return ur.next=5,Object(F.j)({ids:Me?[Me]:ue,clazz:"ItemBank",group_ids:cr.current});case 5:tr=ur.sent,(tr==null?void 0:tr.status)===0&&(n.b.info("\u6240\u9009\u8BD5\u9898\u6210\u529F\u5206\u4EAB\u81F3\u6559\u7814\u56E2\u961F"),cr.current=[],ie([]),rn(),An());case 7:case"end":return ur.stop()}},On)}));return function(On,An){return Tt.apply(this,arguments)}}())}})},Ka=function(){var Me=function(){var Le=Object(o.a)(f.a.mark(function $e(){var st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return ar(!0),pt.next=3,Object(F.h)({ids:ue});case 3:st=pt.sent,ar(!1),(st==null?void 0:st.status)===0&&d.a.info({centered:!0,width:530,className:"custom-modal-divider ",okText:"\u786E\u5B9A",title:"\u5220\u9664\u7ED3\u679C",maskClosable:!1,keyboard:!1,icon:null,content:"\u672C\u6B21\u6210\u529F\u5220\u9664".concat(st.success,"\u6761\u8BD5\u9898\uFF0C\u6709").concat(st.fail,"\u6761\u8BD5\u9898\u56E0\u4E3A\u516C\u5F00\u65E0\u6CD5\u5220\u9664\uFF0C\u8BF7\u64A4\u9500\u540E\u518D\u8FDB\u884C\u5220\u9664\u3002"),onOk:function(){fr(new Array(st.success))}});case 6:case"end":return pt.stop()}},$e)}));return function(){return Le.apply(this,arguments)}}();if(ue!=null&&ue.length){d.a.confirm({centered:!0,width:530,className:"custom-modal-divider ",okText:"\u786E\u5B9A",title:"\u63D0\u793A",cancelText:"\u53D6\u6D88",icon:null,content:"\u672C\u6B21\u9009\u4E2D\u4E86".concat(ue==null?void 0:ue.length,"\u6761\u8BD5\u9898\u8FDB\u884C\u5220\u9664\u64CD\u4F5C\uFF0C\u5220\u9664\u540E\u5C06\u65E0\u6CD5\u6062\u590D\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5220\u9664\uFF1F"),onOk:Me});return}n.b.warn("\u8BF7\u9009\u62E9\u9700\u8981\u5220\u9664\u7684\u8BD5\u9898")},wa=function(){var Me,Le;if(!(ue!=null&&ue.length))return n.b.info("\u8BF7\u5148\u9009\u62E9\u8BD5\u9898");if(vt!=null&&(Me=vt.filter(function($e){return ue.includes($e.id)}))!==null&&Me!==void 0&&Me.every(function($e){return $e.public}))return n.b.info("\u6240\u9009\u8BD5\u9898\u5DF2\u516C\u5F00\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9");if(vt!=null&&(Le=vt.filter(function($e){return ue.includes($e.id)}))!==null&&Le!==void 0&&Le.find(function($e){var st;return $e.item_type==="PROGRAM"&&((st=$e.program_attr)===null||st===void 0?void 0:st.status)===0}))return n.b.info("\u5DF2\u9009\u9898\u4E2D\u5B58\u5728\u672A\u53D1\u5E03\u7684\u7F16\u7A0B\u9898");window.localStorage.getItem("problemset-set-public-hint-flag")==="1"||Rt.userInfo.professional_certification?Oa():d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u516C\u5F00\u89C4\u5219\u544A\u77E5",maskClosable:!0,icon:null,content:t.a.createElement("div",{className:"font16 c-grey-333"},"\u516C\u5F00\u5E76\u7ECF\u5E73\u53F0\u5BA1\u6838\u540E\uFF0C\u8BE5\u9898\u5C06\u5728\u516C\u5171\u8BD5\u9898\u5E93\u53EF\u89C1\uFF0CEducoder\u6240\u6709\u7528\u6237\u5747\u53EF\u4F7F\u7528\u8BE5\u9898\u3002",t.a.createElement("br",null),"\u516C\u5F00\u540E\u4E0D\u53EF\u4FEE\u6539\uFF0C\u4F46\u53EF\u4EE5\u64A4\u9500\uFF1B\u64A4\u9500\u516C\u5F00\u540E\u53EF\u4EE5\u4FEE\u6539\u3002",t.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u7533\u8BF7\u516C\u5F00\uFF1F",t.a.createElement("br",null),t.a.createElement(_.a,{className:"mt10",defaultChecked:!1,onChange:function(st){return H.current=st.target.checked}},"\u4E0D\u518D\u63D0\u793A")),onOk:function(){Oa()}})},Oa=function(){var Fe=Object(o.a)(f.a.mark(function Me(Le){var $e,st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return $e=zt==="3"?1:2,pt.next=3,Object(F.g)({ids:Le?[Le]:ue,source:$e});case 3:st=pt.sent,st.status===0&&(H.current&&window.localStorage.setItem("problemset-set-public-hint-flag","1"),H.current=!1,ie([]),rn());case 5:case"end":return pt.stop()}},Me)}));return function(Le){return Fe.apply(this,arguments)}}(),Ra=function(Me){d.a.confirm({centered:!0,icon:null,title:"\u63D0\u793A",className:"custom-modal-divider",content:t.a.createElement(t.a.Fragment,null,t.a.createElement("div",{className:$.a.modalContent},"\u53D1\u5E03\u540E\u5373\u53EF\u5E94\u7528\u5230\u81EA\u5DF1\u7BA1\u7406\u7684\u8BFE\u5802"),t.a.createElement("div",{className:$.a.modalContent}," \u662F\u5426\u786E\u8BA4\u53D1\u5E03?")),okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){var Le=Object(o.a)(f.a.mark(function st(){var Ct;return f.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return Tt.next=2,Object(F.H)({identifier:Me});case 2:Ct=Tt.sent,(Ct==null?void 0:Ct.status)===0&&(n.b.success("\u53D1\u5E03\u6210\u529F"),rn());case 4:case"end":return Tt.stop()}},st)}));function $e(){return Le.apply(this,arguments)}return $e}()})},na=function(Me){d.a.confirm({centered:!0,icon:null,title:"\u63D0\u793A",className:"custom-modal-divider",content:t.a.createElement("p",{className:$.a.modalContent},"\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F"),okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){var Le=Object(o.a)(f.a.mark(function st(){var Ct;return f.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return Tt.next=2,Object(F.G)({identifier:Me});case 2:Ct=Tt.sent,(Ct==null?void 0:Ct.status)===0&&(n.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F"),rn());case 4:case"end":return Tt.stop()}},st)}));function $e(){return Le.apply(this,arguments)}return $e}()})},Wa=function(Me){ge.page=1,ge.group_id=Me[0]||null,delete ge.id,We(ge),qt(ge)},oa=function(Me){ge.sort_by=Me.type,ge.sort_direction=Me.direction,ge.page=1,ge.per_page=20,Yt(Me.name),We(ge),qt(ge)},sa=function(){ge.page=1,We(ge),qt(ge)},Pa=function(Me){ge.discipline_id="",ge.sub_discipline_id="",ge.tag_discipline_id="",ge.item_type=null,ge.difficulty=null,ge.page=1,ge.per_page=20,ge.group_id=Me,Vn(-1),We(ge),qt(ge)},Ha=function(){if(!(ue!=null&&ue.length)){Ot({type:"problemset/setActionTabs",payload:{key:"\u5BFC\u51FA\u8BD5\u9898",params:ge}});return}d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u5BFC\u51FA\u63D0\u793A",maskClosable:!0,icon:null,content:t.a.createElement("div",{className:"font14 ".concat($.a.overflow)},"\u5DF2\u9009\u4E2D",ue==null?void 0:ue.length,"\u9053\u9898\uFF0C\u5176\u4E2D\u7F16\u7A0B\u9898\u4E0E\u5B9E\u8BAD\u9898\u6682\u4E0D\u652F\u6301\u5BFC\u51FA\u3002"),onOk:function(){Object(V.k)({ids:ue})}})},ai=t.a.createElement(w.a,null,Ie&&t.a.createElement(w.a.Item,{onClick:function(){return ta(!0)}},"\u6279\u91CF\u52A0\u5165"),Ie&&t.a.createElement(w.a.Item,{onClick:function(){return ta(!1)}},"\u6279\u91CF\u79FB\u51FA"),zt==="0"&&Y&&t.a.createElement(w.a.Item,{onClick:function(){return ea()}},"\u79FB\u52A8\u5230"),zt==="0"&&Y&&t.a.createElement(w.a.Item,{onClick:wa},"\u6279\u91CF\u516C\u5F00"),zt==="0"&&Y&&t.a.createElement(w.a.Item,{onClick:function(){return Sa()}},"\u6279\u91CF\u5171\u4EAB"),zt==="0"&&Y&&t.a.createElement(w.a.Item,{onClick:Ka},"\u6279\u91CF\u5220\u9664")),Ga=function(Me){ie(Me)},pa=function(Me){ie(Me?vt==null?void 0:vt.map(function(Le){return Le.id}):[])},za=function(){var Me="/problemset/preview";if(ge.exam_id&&(Me="/paperlibrary/edit/".concat(ge.exam_id)),ge!=null&&ge.exercise_id){var Le;Me="/classrooms/".concat(At==null||((Le=At.params)===null||Le===void 0)?void 0:Le.coursesId,"/exercise/").concat(ge==null?void 0:ge.exercise_id,"/edit")}A.d.push(Me)},ma=[{type:"SINGLE",name:"\u5355\u9009\u9898"},{type:"MULTIPLE",name:"\u591A\u9009\u9898"},{type:"JUDGMENT",name:"\u5224\u65AD\u9898"},{type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},{type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},{type:"COMPLETION",name:"\u586B\u7A7A\u9898"},{type:"COMBINATION",name:"\u7EC4\u5408\u9898"}],va={1:"\u7B80\u5355",2:"\u9002\u4E2D",3:"\u56F0\u96BE"},Aa=function(Me,Le){var $e,st=Le.id<0?"--":Ie?Le[ge.exercise_id?"added":"choosed"]?t.a.createElement("span",{key:1,className:$.a.btnCancel,onClick:function(Tt){Tt.target.style.pointerEvents="none",Ln(Le.id)}},Y?"\u79FB\u51FA\u8BD5\u9898\u7BEE":t.a.createElement("span",null,t.a.createElement("b",{className:"iconfont icon-yichu ".concat($.a.cancelC)}),"\u79FB\u51FA")):Le.item_type==="PROGRAM"&&(($e=Le.program_attr)===null||$e===void 0?void 0:$e.status)===0?t.a.createElement(b.a,{placement:"top",title:"\u7F16\u7A0B\u9898\u672A\u53D1\u5E03\uFF0C\u4E0D\u80FD\u52A0\u5165\uFF01"},t.a.createElement("span",{className:$.a.btnAdd,style:{cursor:"not-allowed",background:"#E3E6EC",color:"#B1BACD"}}," ",Y?"\u52A0\u5165\u8BD5\u9898\u7BEE":t.a.createElement("span",{style:{padding:"0 3px"}},t.a.createElement("b",{className:"iconfont icon-jiaru ".concat($.a.addC)}),"\u52A0\u5165")," ")):t.a.createElement("span",{className:$.a.btnAdd,onClick:function(){return fa(Le.id)}},Y?"\u52A0\u5165\u8BD5\u9898\u7BEE":t.a.createElement("span",{style:{padding:"0 3px"}},t.a.createElement("b",{className:"iconfont icon-jiaru ".concat($.a.addC)}),"\u52A0\u5165")):t.a.createElement(t.a.Fragment,null),Ct=t.a.createElement("span",{className:$.a.actonBtn},st,Le.id>0&&t.a.createElement(Vr,{isProblemset:Y,user:Rt,key:Le.id,data:Le,activeTabsKey:zt,selectIds:ue,onCollect:er,onSetPublic:Wr,onStartExperience:Xr,onCorrection:$r,onPublicReview:sr,onSetPrivate:Mn,onDelete:Ir,onCancel:Ln,onSelect:fa,onMoveTo:ea,onSetShare:Hr,onCancelShare:Qr,onPublish:Ra,onCancelPublish:na}));return Ct},ii=[{title:zt==="0"?"\u6587\u4EF6\u5939/\u9898\u76EE":"\u9898\u76EE",dataIndex:"name",key:"name",align:"left",render:function(Me,Le){return Le.id>0?t.a.createElement(br,{isProblemset:Y,user:Rt,key:Le.id,data:Le,activeTabsKey:zt,selectIds:ue,onCollect:er,onSetPublic:Wr,onStartExperience:Xr,onCorrection:$r,onPublicReview:sr,onSetPrivate:Mn,onDelete:Ir,onCancel:Ln,onSelect:fa,onMoveTo:ea,onSetShare:Hr,onCancelShare:Qr,onPublish:Ra,onCancelPublish:na}):t.a.createElement(Ar,{isProblemset:Y,onRenameOk:rn,onDeleteOk:fr,user:Rt,key:Le.id,data:Le,onOpen:Tn,onMove:lr})}},{title:"\u9898\u578B",dataIndex:"item_type",key:"item_type",align:"center",width:60,render:function(Me){var Le;return t.a.createElement("div",null,((Le=ma.find(function($e){return $e.type===Me}))===null||Le===void 0?void 0:Le.name)||"--")}},{title:"\u96BE\u6613\u5EA6",dataIndex:"difficulty",key:"difficulty",align:"center",width:60,render:function(Me,Le){return t.a.createElement("span",null,(Le==null?void 0:Le.id)<0?"--":va[Me])}},{title:"\u4F7F\u7528\u6B21\u6570",dataIndex:"quotes",key:"quotes",align:"center",ellipsis:!0,width:80,render:function(Me,Le){return t.a.createElement("span",null,(Le==null?void 0:Le.id)<0?"--":Me)}},{title:"\u521B\u5EFA\u8005",dataIndex:"author",key:"author",ellipsis:!0,align:"center",width:94,render:function(Me){return t.a.createElement("span",null,Me==null?void 0:Me.name)}},{title:"\u77E5\u8BC6\u70B9",dataIndex:"tag_discipline",key:"tag_discipline",align:"center",width:146,render:function(Me){return t.a.createElement("span",null,Me||"--")}},{title:"\u66F4\u65B0\u65F6\u95F4",dataIndex:"updated_at",key:"updated_at",align:"center",width:146,render:function(Me,Le){return t.a.createElement("span",null,(Le==null?void 0:Le.id)<0?"--":Me)}},{title:"\u64CD\u4F5C",dataIndex:"choosed",key:"choosed",align:"center",width:146,render:Aa}];return t.a.createElement(y.Fragment,null,t.a.createElement("section",null,t.a.createElement("div",{className:$.a.wrap},t.a.createElement("div",{className:$.a.title},"\u8BD5\u9898\u5E93"),t.a.createElement(U.a,{showSelectAll:!1,className:$.a.select,disciplinesData:(Ut=mt.disciplinesData)===null||Ut===void 0?void 0:Ut.disciplines,knowledgeData:jn,directionValue:ge.discipline_id,subDisciplineValue:ge.sub_discipline_id,typeValue:ge.item_type,showKnowledge:!0,knowledgeValue:zn,difficultyValue:ge.difficulty,showShixun:!Object(Mt.m)()&&!ge.exercise_id,onShixunChange:qa,onDirectionChange:hr,onTypeChange:Sr,onDifficultyChange:Qn,onKnowledgeChange:wr}),t.a.createElement("div",{className:$.a.contentWrap},t.a.createElement("div",{className:$.a.tabsWrap},t.a.createElement(i.a,{activeKey:zt,onChange:Kr,tabBarExtraContent:t.a.createElement("div",{className:$.a.searchWrap},zt==="0"&&Y&&t.a.createElement("div",{className:$.a.searchContent},t.a.createElement(T.a,{type:"primary",ghost:!0,onClick:Qa,className:"mr20"},t.a.createElement("i",{className:"iconfont icon-xinjianwenjianjia mr5 font14"}),"\u65B0\u5EFA\u6587\u4EF6\u5939"),t.a.createElement(T.a,{type:"primary",className:"mr30",ghost:!0,onClick:Ba},t.a.createElement("i",{className:"iconfont icon-xinzengshiti2 mr5 font14"}),"\u65B0\u589E\u8BD5\u9898")),t.a.createElement(Jt,{allowClear:!0,className:$.a.search,style:{width:300},placeholder:"\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",value:ge.keyword,onChange:function(Me){ge.keyword=Me.target.value,We(Object(I.a)({},ge))},onSearch:kr}))},t.a.createElement(Xe,{tab:"\u516C\u5171",key:"1"}),((kt=mt.teachGroupData)===null||kt===void 0||((wt=kt.groups)===null||wt===void 0)?void 0:wt.length)&&t.a.createElement(Xe,{tab:"\u6559\u7814\u5171\u4EAB",key:"3"}),!Object(Mt.o)()&&!Object(Mt.m)()&&t.a.createElement(Xe,{tab:"\u6536\u85CF\u5939",key:"2"}),t.a.createElement(Xe,{tab:"\u6211\u521B\u5EFA\u7684",key:"0"}))),t.a.createElement("div",{className:$.a.batchWrap},t.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center"}},t.a.createElement("div",{className:"font14"},t.a.createElement(R.a,{overlay:t.a.createElement(w.a,{selectedKeys:[ct]},Lt==null?void 0:Lt.map(function(Fe,Me){return t.a.createElement(w.a.Item,{key:Fe.name,onClick:function(){return oa(Fe)}},Fe.name)}))},t.a.createElement("span",{style:{color:"#464F66"}},t.a.createElement("i",{className:"iconfont icon-paixu font14 mr5 c-light-primary"}),ct))),zt==="3"&&t.a.createElement("div",{style:{paddingTop:20,marginLeft:20}},t.a.createElement(ya,{dispatch:Ot,problemset:mt,groupIds:ge.group_id?[ge.group_id]:[],onChangeTeachGroup:Wa}))),t.a.createElement("div",null,zt==="0"&&Y&&t.a.createElement(T.a,{onClick:Ha,type:"link"},t.a.createElement("i",{className:"iconfont icon-daochushiti mr5 c-light-primary"}),t.a.createElement("span",{className:"c-light-primary"},"\u5BFC\u51FA\u8BD5\u9898")))),Ua?t.a.createElement("div",null,t.a.createElement(T.a,{style:{paddingLeft:0,marginLeft:25},onClick:function(){ge.page=1,ge.keyword=null,delete ge.id,We(ge),Ca(!1),qt(ge)},type:"link"}," ",t.a.createElement("i",{className:"iconfont icon-fanhui2 font14"}),"\u8FD4\u56DE"),t.a.createElement("span",{className:"font14 mr20 c-grey-333"},"\u641C\u7D22\u201C",ge.keyword,"\u201D")):zt==="0"?t.a.createElement("div",{style:{overflow:"hidden",height:mn===1?208:"auto"},ref:Xn,className:$.a.treeWarp},t.a.createElement(fe,{data:Cr,onClick:Tn}),t.a.createElement(N.a,{spinning:vn},sn==null?void 0:sn.map(function(Fe){return t.a.createElement(Ar,{isProblemset:Y,onRenameOk:function(){En.current=!0,rn()},onDeleteOk:function(){En.current=!0,rn()},user:Rt,key:Fe.id,data:Fe,onOpen:Tn,onMove:lr})})),!!mn&&t.a.createElement("div",{className:$.a.action},mn===1&&t.a.createElement("span",{onClick:function(){return hn(2)}},"\u5C55\u5F00",t.a.createElement("i",{className:"iconfont icon-xiala"})),mn===2&&t.a.createElement("span",{onClick:function(){return hn(1)}},"\u6536\u8D77",t.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))):null,t.a.createElement("div",{className:$.a.contentListWrap},dt!==0?t.a.createElement(N.a,{size:"large",spinning:Kt["problemset/getItemBanks"]},vt.map(function(Fe,Me){var Le,$e;return t.a.createElement("div",{className:$.a.li},t.a.createElement("div",{className:$.a.top},t.a.createElement(br,{isProblemset:Y,user:Rt,key:Fe.id,data:Fe,activeTabsKey:zt,selectIds:ue,onCollect:er,onSetPublic:Wr,onStartExperience:Xr,onCorrection:$r,onPublicReview:sr,onSetPrivate:Mn,onDelete:Ir,onCancel:Ln,onSelect:fa,onSelectCheckBox:Ga,onMoveTo:ea,onSetShare:Hr,onCancelShare:Qr,onPublish:Ra,onCancelPublish:na})),t.a.createElement("div",{className:$.a.bottom},t.a.createElement("p",{className:$.a.actionLeftItem},(Le=ma.find(function(st){return st.type===Fe.item_type}))===null||Le===void 0?void 0:Le.name),t.a.createElement("i",{className:$.a.line}),t.a.createElement("p",{className:$.a.actionLeftItem},va[Fe.difficulty]),t.a.createElement("i",{className:$.a.line}),t.a.createElement("p",{className:$.a.actionLeftItem},"\u521B\u5EFA\u8005:",t.a.createElement("span",{className:"c-grey-333"},Fe==null||(($e=Fe.author)===null||$e===void 0)?void 0:$e.name)),t.a.createElement("i",{className:$.a.line}),t.a.createElement("p",{className:$.a.actionLeftItem},"\u66F4\u65B0:",t.a.createElement("span",{className:"c-grey-333"},Fe==null?void 0:Fe.updated_at)),t.a.createElement("i",{className:$.a.line}),t.a.createElement("p",{className:$.a.actionLeftItem},"\u4F7F\u7528\u6B21\u6570:",t.a.createElement("span",{className:"c-grey-333"},Fe==null?void 0:Fe.quotes)),t.a.createElement("div",{className:$.a.more},Aa({},Fe))))})):t.a.createElement(N.a,{size:"large",spinning:Kt["problemset/getItemBanks"]},t.a.createElement(ae.a,null))),dt!==0&&t.a.createElement(j.a,{showSizeChanger:dt>20,showQuickJumper:!0,onChange:Dr,defaultCurrent:1,pageSize:ge==null?void 0:ge.per_page,current:ge.page||1,total:dt,showTotal:function(Me){return t.a.createElement("span",{className:"mr10"},"\u5171",t.a.createElement("span",{className:"c-orange"},Me),"\u6761\u6570\u636E")}})),Y&&t.a.createElement(fn,{basketData:mt.basketData,visible:aa,basketTotal:Tr,onClose:function(){return Na(!1)},onDelete:Ya}),!Object(Mt.m)()&&Y&&t.a.createElement(on,{visibleBasket:aa,onToggleVisible:function(){return Na(!aa)},count:Tr})),t.a.createElement(ee,null),t.a.createElement(Be,{onReloadData:rn}),t.a.createElement(Ue,{onReloadData:function(){return fr([null])}}),t.a.createElement(Sn,{onReloadData:rn,onReloadBasketData:gn}),t.a.createElement(Nt,{shixunIds:Xa,cb:Fa}),t.a.createElement(lt,null),t.a.createElement(bt,null),t.a.createElement(ut,null),t.a.createElement(Et,null),t.a.createElement(De,null),t.a.createElement(Ae,{onOk:sa}),t.a.createElement(re,{onOk:Pa})),Y?t.a.createElement(y.Fragment,null,!!(ue!=null&&ue.length)&&t.a.createElement("div",{className:$.a.batch},t.a.createElement("aside",null,t.a.createElement("div",{style:{flexShrink:0,marginRight:20}},t.a.createElement(_.a,{className:"font14",checked:vt!=null&&vt.length?ue.length===(vt==null?void 0:vt.length):!1,onChange:function(Me){return pa(Me.target.checked)}},"\u672C\u9875\u5168\u9009",t.a.createElement("span",{style:{color:"#999",fontSize:12}},"/\u5DF2\u9009(",ue==null?void 0:ue.length,")"))),t.a.createElement("div",{className:$.a.btns},Ie&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ta(!0)}},t.a.createElement("i",{className:"iconfont icon-piliangjiaru"}),"\u6279\u91CF\u52A0\u5165"),Ie&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ta(!1)}},t.a.createElement("i",{className:"iconfont icon-piliangyichu"}),"\u6279\u91CF\u79FB\u51FA"),zt==="0"&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ea()}},t.a.createElement("i",{className:"iconfont icon-yidongmulu font16"}),"\u6279\u91CF\u79FB\u52A8"),zt==="0"&&t.a.createElement("div",{className:$.a.btn,onClick:wa}," ",t.a.createElement("i",{className:"iconfont icon-pilianggongkai"}),"\u6279\u91CF\u516C\u5F00"),zt==="0"&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return Sa()}}," ",t.a.createElement("i",{className:"iconfont icon-pilianggongxiang"}),"\u6279\u91CF\u5171\u4EAB"),zt==="0"&&t.a.createElement("div",{className:$.a.btn,onClick:Ka}," ",t.a.createElement("i",{className:"iconfont icon-piliangshanchu3 c-red"}),"\u6279\u91CF\u5220\u9664"),t.a.createElement("div",{onClick:function(){return ie([])},style:{marginLeft:"auto"},className:$.a.btn}," ",t.a.createElement("i",{className:"iconfont icon-piliangcaozuoicon2"}),"\u53D6\u6D88\u64CD\u4F5C"))))):t.a.createElement("div",{className:$.a.batch},t.a.createElement("aside",null,t.a.createElement("div",{style:{flexShrink:0,marginRight:20}},t.a.createElement(_.a,{className:"font14",checked:vt!=null&&vt.length?ue.length===(vt==null?void 0:vt.length):!1,onChange:function(Me){return pa(Me.target.checked)}},"\u672C\u9875\u5168\u9009",t.a.createElement("span",{style:{color:"#999",fontSize:12}},"/\u5DF2\u9009(",ue==null?void 0:ue.length,")"))),t.a.createElement("div",{className:$.a.btns},Ie&&!!(ue!=null&&ue.length)&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ta(!0)}},t.a.createElement("i",{className:"iconfont icon-piliangjiaru"}),"\u6279\u91CF\u52A0\u5165"),Ie&&!!(ue!=null&&ue.length)&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ta(!1)}},t.a.createElement("i",{className:"iconfont icon-piliangyichu"}),"\u6279\u91CF\u79FB\u51FA"),t.a.createElement("div",{className:"c-grey-333 font12 mr40",style:{marginLeft:"auto"}},"\u5DF2\u52A0\u5165:\xA0\xA0",xt,"\u9898"),t.a.createElement("div",{onClick:za,className:$.a.btn},"\u8FD4\u56DE\u8BD5\u5377")))))},jr=Ye.default=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.user,Ve=Dt.loading,Qe=Dt.globalSetting;return{problemset:Re,user:rt,globalSetting:Qe,loading:Ve.effects}})(Bn)},LdHM:function(Pt,Ye,K){"use strict";K.d(Ye,"b",function(){return l}),K.d(Ye,"a",function(){return d});var Ee=K("1OyB"),j=K("vuIU"),O=K("Ji7U"),N=K("LK+K"),E=K("q1tI"),R=K("rePB"),I=K("Ff2n"),L=K("ODXe"),T=K("4IlW"),P=K("bX4T"),b=K("YrtM"),S=K("TSYQ"),w=K.n(S),C=K("+nKL"),x=K("8OUc"),_=function(F,q){var re=F.prefixCls,ae=F.id,ve=F.flattenOptions,de=F.childrenAsData,Z=F.values,ee=F.searchValue,pe=F.multiple,Q=F.defaultActiveFirstOption,V=F.height,Ce=F.itemHeight,De=F.notFoundContent,Ne=F.open,we=F.menuItemSelectedIcon,ke=F.virtual,Se=F.onSelect,Ae=F.onToggleOpen,je=F.onActiveValue,Be=F.onScroll,Ke=F.onMouseEnter,Ue="".concat(re,"-item"),xe=Object(b.a)(function(){return ve},[Ne,ve],function(it,ye){return ye[0]&&it[1]!==ye[1]}),Ge=E.useRef(null),qe=function(ye){ye.preventDefault()},lt=function(ye){Ge.current&&Ge.current.scrollTo({index:ye})},ot=function(ye){for(var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=xe.length,X=0;X<fe;X+=1){var $=(ye+X*he+fe)%fe,te=xe[$],oe=te.group,Te=te.data;if(!oe&&!Te.disabled)return $}return-1},bt=E.useState(function(){return ot(0)}),ht=Object(L.a)(bt,2),ut=ht[0],Ze=ht[1],Et=function(ye){Ze(ye);var he=xe[ye];if(!he){je(null,-1);return}je(he.data.value,ye)};E.useEffect(function(){Et(Q!==!1?ot(0):-1)},[xe.length,ee]),E.useEffect(function(){var it=setTimeout(function(){if(!pe&&Ne&&Z.size===1){var ye=Array.from(Z)[0],he=xe.findIndex(function(fe){var X=fe.data;return X.value===ye});Et(he),lt(he)}});return function(){return clearTimeout(it)}},[Ne]);var St=function(ye){ye!==void 0&&Se(ye,{selected:!Z.has(ye)}),pe||Ae(!1)};if(E.useImperativeHandle(q,function(){return{onKeyDown:function(ye){var he=ye.which;switch(he){case T.a.UP:case T.a.DOWN:{var fe=0;if(he===T.a.UP?fe=-1:he===T.a.DOWN&&(fe=1),fe!==0){var X=ot(ut+fe,fe);lt(X),Et(X)}break}case T.a.ENTER:{var $=xe[ut];$&&!$.data.disabled?St($.data.value):St(void 0),Ne&&ye.preventDefault();break}case T.a.ESC:Ae(!1)}},onKeyUp:function(){},scrollTo:function(ye){lt(ye)}}}),xe.length===0)return E.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:qe},De);function He(it){var ye=xe[it];if(!ye)return null;var he=ye.data||{},fe=he.value,X=he.label,$=he.children,te=Object(P.a)(he,!0),oe=de?$:X;return ye?E.createElement("div",Object.assign({"aria-label":typeof oe=="string"?oe:null},te,{key:it,role:"option",id:"".concat(ae,"_list_").concat(it),"aria-selected":Z.has(fe)}),fe):null}return E.createElement(E.Fragment,null,E.createElement("div",{role:"listbox",id:"".concat(ae,"_list"),style:{height:0,width:0,overflow:"hidden"}},He(ut-1),He(ut),He(ut+1)),E.createElement(C.a,{itemKey:"key",ref:Ge,data:xe,height:V,itemHeight:Ce,fullHeight:!1,onMouseDown:qe,onScroll:Be,virtual:ke,onMouseEnter:Ke},function(it,ye){var he,fe=it.group,X=it.groupOption,$=it.data,te=$.label,oe=$.key;if(fe)return E.createElement("div",{className:w()(Ue,"".concat(Ue,"-group"))},te!==void 0?te:oe);var Te=$.disabled,Pe=$.value,Je=$.title,Wt=$.children,Zt=$.style,Xt=$.className,an=Object(I.a)($,["disabled","value","title","children","style","className"]),fn=Z.has(Pe),It="".concat(Ue,"-option"),Kn=w()(Ue,It,Xt,(he={},Object(R.a)(he,"".concat(It,"-grouped"),X),Object(R.a)(he,"".concat(It,"-active"),ut===ye&&!Te),Object(R.a)(he,"".concat(It,"-disabled"),Te),Object(R.a)(he,"".concat(It,"-selected"),fn),he)),Sn=de?Wt:te,Jn=!we||typeof we=="function"||fn;return E.createElement("div",Object.assign({},an,{"aria-selected":fn,className:Kn,title:Je,onMouseMove:function(){if(ut===ye||Te)return;Et(ye)},onClick:function(){Te||St(Pe)},style:Zt}),E.createElement("div",{className:"".concat(It,"-content")},Sn||Pe),E.isValidElement(we)||fn,Jn&&E.createElement(x.a,{className:"".concat(Ue,"-option-state"),customizeIcon:we,customizeIconProps:{isSelected:fn}},fn?"\u2713":null))}))},p=E.forwardRef(_);p.displayName="OptionList";var n=p,u=function(){return null};u.isSelectOption=!0;var l=u,v=function(){return null};v.isSelectOptGroup=!0;var d=v,o=K("VTBJ"),m=K("Zm9Q");function h(J){var F=J.key,q=J.props,re=q.children,ae=q.value,ve=Object(I.a)(q,["children","value"]);return Object(o.a)({key:F,value:ae!==void 0?ae:F,children:re},ve)}function a(J){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(m.a)(J).map(function(q,re){if(!E.isValidElement(q)||!q.type)return null;var ae=q.type.isSelectOptGroup,ve=q.key,de=q.props,Z=de.children,ee=Object(I.a)(de,["children"]);return F||!ae?h(q):Object(o.a)(Object(o.a)({key:"__RC_SELECT_GRP__".concat(ve===null?re:ve,"__"),label:ve},ee),{},{options:a(Z)})}).filter(function(q){return q})}var r=K("2Qr1"),e=K("qNPg"),i=K("U8pU"),g=K("Kwbf"),f=K("WKfj");function y(J){var F=J.mode,q=J.options,re=J.children,ae=J.backfill,ve=J.allowClear,de=J.placeholder,Z=J.getInputElement,ee=J.showSearch,pe=J.onSearch,Q=J.defaultOpen,V=J.autoFocus,Ce=J.labelInValue,De=J.value,Ne=J.inputValue,we=J.optionLabelProp,ke=F==="multiple"||F==="tags",Se=ee!==void 0?ee:ke||F==="combobox",Ae=q||a(re);if(Object(g.a)(F!=="tags"||Ae.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),F==="tags"||F==="combobox"){var je=Ae.some(function(Ue){return Ue.options?Ue.options.some(function(xe){return typeof("value"in xe?xe.value:xe.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(g.a)(!je,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(F!=="combobox"||!we,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(F==="combobox"||!ae,"`backfill` only works with `combobox` mode."),Object(g.a)(F==="combobox"||!Z,"`getInputElement` only work with `combobox` mode."),Object(g.b)(F!=="combobox"||!Z||!ve||!de,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!Se&&F!=="combobox"&&F!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!Q||V,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),De!=null){var Be=Object(f.d)(De);Object(g.a)(!Ce||Be.every(function(Ue){return Object(i.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!ke||Array.isArray(De),"`value` should be array when `mode` is `multiple` or `tags`")}if(re){var Ke=null;Object(m.a)(re).some(function(Ue){if(!E.isValidElement(Ue)||!Ue.type)return!1;var xe=Ue.type;if(xe.isSelectOption)return!1;if(xe.isSelectOptGroup){var Ge=Object(m.a)(Ue.props.children).every(function(qe){return!E.isValidElement(qe)||!Ue.type||qe.type.isSelectOption?!0:(Ke=qe.type,!1)});return!Ge}return Ke=xe,!0}),Ke&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ke.displayName||Ke.name||Ke,"`.")),Object(g.a)(Ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var t=y,A=Object(e.a)({prefixCls:"rc-select",components:{optionList:n},convertChildrenToData:a,flattenOptions:r.d,getLabeledValue:r.e,filterOptions:r.b,isValueDisabled:r.g,findValueOption:r.c,warningProps:t,fillOptionsWithMissingValue:r.a}),U=function(J){Object(O.a)(q,J);var F=Object(N.a)(q);function q(){var re;return Object(Ee.a)(this,q),re=F.apply(this,arguments),re.selectRef=E.createRef(),re.focus=function(){re.selectRef.current.focus()},re.blur=function(){re.selectRef.current.blur()},re}return Object(j.a)(q,[{key:"render",value:function(){return E.createElement(A,Object.assign({ref:this.selectRef},this.props))}}]),q}(E.Component);U.Option=l,U.OptGroup=d;var B=U,G=Ye.c=B},NLgs:function(Pt,Ye,K){"use strict";K.d(Ye,"e",function(){return v}),K.d(Ye,"f",function(){return d}),K.d(Ye,"d",function(){return m}),K.d(Ye,"c",function(){return h}),K.d(Ye,"a",function(){return a}),K.d(Ye,"b",function(){return r});var Ee=K("miYZ"),j=K("tsqr"),O=K("9og8"),N=K("2qtc"),E=K("kLXV"),R=K("WmNS"),I=K.n(R),L=K("q1tI"),T=K.n(L),P=K("9kvl"),b=K("xKgJ"),S=K("1vsH"),w=K("RCxd"),C=K("mOS8"),x=K.n(C),_=K("1ZF9"),p=K.n(_),n=K("WdTA"),u=K.n(n),l=K("m3rI"),v=function(i){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!!(d(i)&&o(g))},d=function(i){return Object(b.p)()?!0:(i({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},o=function(){var i,g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,f=Object(P.c)()._store.getState(),y=f.user;return(i=y.userInfo)!==null&&i!==void 0&&i.profile_completed?!0:(E.a.confirm({title:"\u63D0\u793A",width:530,centered:!0,content:g?"\u6309\u7167\u6709\u5173\u653F\u7B56\u89C4\u5B9A\uFF0C\u7279\u6B8A\u5B9E\u9A8C\u9700\u8981\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u624D\u80FD\u4F7F\u7528\uFF0C\u8BF7\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u7801":"\u60A8\u9700\u8981\u53BB\u5B8C\u5584\u60A8\u7684\u4E2A\u4EBA\u8D44\u6599\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD",okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){P.d.push("/account/profile/edit")}}),!1)},m=function(){var i,g=Object(P.c)()._store.getState(),f=g.user;return(i=f.userInfo)!==null&&i!==void 0&&i.professional_certification?!0:(E.a.confirm({title:"\u63D0\u793A",centered:!0,content:T.a.createElement("div",{className:"tc"},"\u60A8\u9700\u8981\u53BB\u5B8C\u6210\u60A8\u7684\u804C\u4E1A\u8BA4\u8BC1\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD"),okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){Object(S.O)("/account/certification")}}),!1)},h=function(){return Object(b.a)()?!0:(E.a.warning({centered:!0,width:530,title:"\u63D0\u793A",content:T.a.createElement("div",{className:"tc",style:{marginLeft:-38}},T.a.createElement("p",null,"\u60A8\u53EF\u4EE5\u626B\u7801\u52A0\u7FA4@\u7FA4\u7BA1\u7406\u5458\uFF0C\u7533\u8BF7\u64CD\u4F5C\u6743\u9650\u54E6\uFF01"),T.a.createElement("img",{src:Object(b.t)()?u.a:"".concat(l.a.IMG_SERVER,"/images/educoder/qqqun20191230.png"),width:200})),okText:"\u6211\u77E5\u9053\u4E86",maskClosable:!0}),!1)},a=function(i,g){return i?!0:(E.a.confirm({centered:!0,zIndex:1e4,width:530,title:"\u63D0\u793A",content:T.a.createElement("div",null,T.a.createElement("p",null,g||"\u8BE5\u5B9E\u8DF5\u8D44\u6E90\u9700\u6388\u6743\u540E\u624D\u53EF\u4F7F\u7528\u3002 \u60A8\u53EF\u4EE5\u5728QQ\u670D\u52A1\u7FA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\uFF0C\u83B7\u5F97\u7EE7\u7EED\u64CD\u4F5C\u7684\u6743\u9650\u3002"),T.a.createElement("div",{style:{marginLeft:"110px"}},T.a.createElement("img",{src:p.a,width:200}),T.a.createElement("div",{style:{marginLeft:"35px"}},"\u7FA4\u53F7\uFF1A","714336072"))),okText:"\u7ACB\u5373\u8054\u7CFB",cancelText:"\u53D6\u6D88",onOk:function(){Object(S.O)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1)},r=function(i){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",f=Object(P.c)()._store.getState(),y=f.shixunsDetail.detail;return(y==null?void 0:y.public)===2||(y==null?void 0:y.public)===1||(y==null?void 0:y.shixun_status)===3?(E.a.info({centered:!0,icon:T.a.createElement(w.a,{style:{color:"#faad14"}}),width:460,title:"\u63D0\u793A",content:T.a.createElement("div",{className:"tc",style:{marginLeft:-38}},T.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:38,margin:"12px 0"}},T.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u72B6\u6001\u4E3A",(y==null?void 0:y.public)===2?"\u5DF2\u516C\u5F00":(y==null?void 0:y.public)===1?"\u5F85\u5BA1\u6838":"\u5DF2\u5173\u95ED","\uFF0C",g,"\u3002"),T.a.createElement("p",null,"\u5982\u6709\u9700\u8981\uFF0C\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u8FDB\u884C\u6280\u672F\u652F\u6301\u3002")),T.a.createElement("img",{style:{border:"4px solid #0152d9",borderRadius:"4px"},src:x.a,alt:"\u4E8C\u7EF4\u7801",width:160})),okText:"\u6211\u77E5\u9053\u4E86"}),!0):(y==null?void 0:y.shixun_status)===2?(E.a.confirm({centered:!0,icon:T.a.createElement(w.a,null),title:"\u63D0\u793A",content:T.a.createElement("div",null,T.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u53D1\u5E03\uFF0C",g,"\u3002"),T.a.createElement("br",null),T.a.createElement("span",null,"\u5982\u6709\u9700\u8981\uFF0C\u60A8\u53EF\u4EE5\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u518D\u8FDB\u884C\u64CD\u4F5C\u3002")),okText:"\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){E.a.confirm({width:440,centered:!0,icon:T.a.createElement(w.a,{style:{color:"#faad14"}}),title:"\u63D0\u793A",content:"\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u5B66\u5458\u5C06\u65E0\u6CD5\u8FDB\u884C\u7EC3\u4E60\u3002\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F",okText:"\u786E\u5B9A\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){var A=Object(O.a)(I.a.mark(function B(){var G;return I.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,i({type:"shixunsDetail/cancelRelease",payload:{id:y==null?void 0:y.identifier}});case 2:G=F.sent,G.status!==401&&(j.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F\u3002\u5B9E\u8BAD\u56DE\u5230\u672A\u53D1\u5E03\u7684\u72B6\u6001\u3002"),i({type:"shixunsDetail/getShixunsDetail",payload:{id:y==null?void 0:y.identifier}}),i({type:"practiceSetting/getCommonData",payload:{id:y==null?void 0:y.identifier}}));case 4:case"end":return F.stop()}},B)}));function U(){return A.apply(this,arguments)}return U}()})}}),!0):!1}},NvD2:function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return R});var Ee=K("Kwbf");function j(I,L){var T=new Set;return I.forEach(function(P){L.has(P)||T.add(P)}),T}function O(I){var L=I||{},T=L.disabled,P=L.disableCheckbox,b=L.checkable;return!!(T||P)||b===!1}function N(I,L,T,P){for(var b=new Set(I),S=new Set,w=0;w<=T;w+=1){var C=L.get(w)||new Set;C.forEach(function(n){var u=n.key,l=n.node,v=n.children,d=v===void 0?[]:v;b.has(u)&&!P(l)&&d.filter(function(o){return!P(o.node)}).forEach(function(o){b.add(o.key)})})}for(var x=new Set,_=T;_>=0;_-=1){var p=L.get(_)||new Set;p.forEach(function(n){var u=n.parent,l=n.node;if(P(l)||!n.parent||x.has(n.parent.key))return;if(P(n.parent.node)){x.add(u.key);return}var v=!0,d=!1;(u.children||[]).filter(function(o){return!P(o.node)}).forEach(function(o){var m=o.key,h=b.has(m);v&&!h&&(v=!1),!d&&(h||S.has(m))&&(d=!0)}),v&&b.add(u.key),d&&S.add(u.key),x.add(u.key)})}return{checkedKeys:Array.from(b),halfCheckedKeys:Array.from(j(S,b))}}function E(I,L,T,P,b){for(var S=new Set(I),w=new Set(L),C=0;C<=P;C+=1){var x=T.get(C)||new Set;x.forEach(function(u){var l=u.key,v=u.node,d=u.children,o=d===void 0?[]:d;!S.has(l)&&!w.has(l)&&!b(v)&&o.filter(function(m){return!b(m.node)}).forEach(function(m){S.delete(m.key)})})}w=new Set;for(var _=new Set,p=P;p>=0;p-=1){var n=T.get(p)||new Set;n.forEach(function(u){var l=u.parent,v=u.node;if(b(v)||!u.parent||_.has(u.parent.key))return;if(b(u.parent.node)){_.add(l.key);return}var d=!0,o=!1;(l.children||[]).filter(function(m){return!b(m.node)}).forEach(function(m){var h=m.key,a=S.has(h);d&&!a&&(d=!1),!o&&(a||w.has(h))&&(o=!0)}),d||S.delete(l.key),o&&w.add(l.key),_.add(l.key)})}return{checkedKeys:Array.from(S),halfCheckedKeys:Array.from(j(w,S))}}function R(I,L,T,P){var b=[],S;P?S=P:S=O;var w=new Set(I.filter(function(p){var n=!!T[p];return n||b.push(p),n})),C=new Map,x=0;Object.keys(T).forEach(function(p){var n=T[p],u=n.level,l=C.get(u);l||(l=new Set,C.set(u,l)),l.add(n),x=Math.max(x,u)}),Object(Ee.a)(!b.length,"Tree missing follow keys: ".concat(b.slice(0,100).map(function(p){return"'".concat(p,"'")}).join(", ")));var _;return L===!0?_=N(w,C,x,S):_=E(w,L.halfCheckedKeys,C,x,S),_}},OZM5:function(Pt,Ye,K){"use strict";K.d(Ye,"b",function(){return P}),K.d(Ye,"a",function(){return b}),K.d(Ye,"k",function(){return S}),K.d(Ye,"h",function(){return w}),K.d(Ye,"i",function(){return C}),K.d(Ye,"g",function(){return x}),K.d(Ye,"c",function(){return _}),K.d(Ye,"d",function(){return p}),K.d(Ye,"j",function(){return l}),K.d(Ye,"e",function(){return v}),K.d(Ye,"f",function(){return d});var Ee=K("KQm4"),j=K("U8pU"),O=K("Ff2n"),N=K("q1tI"),E=K.n(N),R=K("Kwbf"),I=K("WaYH"),L=.25,T=2;function P(o,m){var h=o.slice(),a=h.indexOf(m);return a>=0&&h.splice(a,1),h}function b(o,m){var h=o.slice();return h.indexOf(m)===-1&&h.push(m),h}function S(o){return o.split("-")}function w(o,m){return"".concat(o,"-").concat(m)}function C(o){return o&&o.type&&o.type.isTreeNode}function x(o,m){var h=[o],a=m[o];function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];e.forEach(function(i){var g=i.key,f=i.children;h.push(g),r(f)})}return r(a.children),h}function _(o,m){var h=o.clientY,a=m.selectHandle.getBoundingClientRect(),r=a.top,e=a.bottom,i=a.height,g=Math.max(i*L,T);return h<=r+g?-1:h>=e-g?1:0}function p(o,m){if(!o)return;var h=m.multiple;return h?o.slice():o.length?[o[0]]:o}var n=function(m){return m};function u(o,m){if(!o)return[];var h=m||{},a=h.processProps,r=a===void 0?n:a,e=Array.isArray(o)?o:[o];return e.map(function(i){var g=i.children,f=Object(O.a)(i,["children"]),y=u(g,m);return E.a.createElement(I.a,Object.assign({},r(f)),y)})}function l(o){if(!o)return null;var m;if(Array.isArray(o))m={checkedKeys:o,halfCheckedKeys:void 0};else if(Object(j.a)(o)==="object")m={checkedKeys:o.checked||void 0,halfCheckedKeys:o.halfChecked||void 0};else return Object(R.a)(!1,"`checkedKeys` is not an array or an object"),null;return m}function v(o,m){var h=new Set;function a(r){if(h.has(r))return;var e=m[r];if(!e)return;h.add(r);var i=e.parent,g=e.node;if(g.disabled)return;i&&a(i.key)}return(o||[]).forEach(function(r){a(r)}),Object(Ee.a)(h)}function d(o){var m={};return Object.keys(o).forEach(function(h){(h.startsWith("data-")||h.startsWith("aria-"))&&(m[h]=o[h])}),m}},"P/tu":function(Pt,Ye,K){"use strict";var Ee=K("ozfa"),j=K("MJZm"),O=K("0Owb"),N=K("9og8"),E=K("tJVT"),R=K("PpiC"),I=K("WmNS"),L=K.n(I),T=K("q1tI"),P=K.n(T),b=K("WCUW"),S=K("spXi"),w=K.n(S),C=function(_){var p=_.value,n=_.onChange,u=_.defaultValue,l=_.disabled,v=Object(R.a)(_,["value","onChange","defaultValue","disabled"]),d=Object(T.useState)([]),o=Object(E.a)(d,2),m=o[0],h=o[1],a=Object(T.useState)("1"),r=Object(E.a)(a,2),e=r[0],i=r[1];Object(T.useEffect)(function(){g()},[]);var g=function(){var t=Object(N.a)(L.a.mark(function A(){var U,B;return L.a.wrap(function(J){for(;;)switch(J.prev=J.next){case 0:return J.next=2,Object(b.x)({});case 2:U=J.sent,U!=null&&U.data&&(B=[{title:P.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:w.a.name},"\u6839\u76EE\u5F55"),value:0,key:0,icon:P.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:f(U.data||[])}],h(B),i("2"));case 4:case"end":return J.stop()}},A)}));return function(){return t.apply(this,arguments)}}(),f=function(A){function U(B){var G=B.children,J=Array.isArray(G)&&G.length>0,F=B==null?void 0:B.group_id;return{title:P.a.createElement("div",{title:B==null?void 0:B.name,className:w.a.name},B==null?void 0:B.name),value:F,key:F,icon:P.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:J?G==null?void 0:G.map(function(q){return U(q)}):[]}}return A==null?void 0:A.map(function(B){return U(B)})},y=u?{defaultExpandedKeys:[0]}:{selectedKeys:p,defaultExpandedKeys:p};return P.a.createElement("div",{className:w.a.customTree},P.a.createElement(j.a,Object(O.a)({key:e},y,{showIcon:!0,treeData:m,onSelect:n,disabled:l},v)))};Ye.a=C},Q0Vu:function(Pt,Ye,K){Pt.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:function(Pt,Ye){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var K,Ee,j,O=!1,N,E;window.PR_SHOULD_USE_CONTINUATION=!0;var R,I;(function(){var L=window,T=["break,continue,do,else,for,if,return,while"],P=[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"],b=[P,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[b,"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"],w=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[b,"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"],x="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",_=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],p="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",n=[T,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],u=[T,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[T,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],v=[S,C,w,_,p,n,u,l],d=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,o="str",m="kwd",h="com",a="typ",r="lit",e="pun",i="pln",g="tag",f="dec",y="src",t="atn",A="atv",U="nocode",B="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(Se){for(var Ae=0,je=!1,Be=!1,Ke=0,Ue=Se.length;Ke<Ue;++Ke){var xe=Se[Ke];if(xe.ignoreCase)Be=!0;else if(/[a-z]/i.test(xe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){je=!0,Be=!1;break}}var Ge={b:8,t:9,n:10,v:11,f:12,r:13};function qe(ut){var Ze=ut.charCodeAt(0);if(Ze!==92)return Ze;var Et=ut.charAt(1);return Ze=Ge[Et],Ze||("0"<=Et&&Et<="7"?parseInt(ut.substring(1),8):Et==="u"||Et==="x"?parseInt(ut.substring(2),16):ut.charCodeAt(1))}function lt(ut){if(ut<32)return(ut<16?"\\x0":"\\x")+ut.toString(16);var Ze=String.fromCharCode(ut);return Ze==="\\"||Ze==="-"||Ze==="]"||Ze==="^"?"\\"+Ze:Ze}function ot(ut){var Ze=ut.substring(1,ut.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")),Et=[],St=Ze[0]==="^",He=["["];St&&He.push("^");for(var it=St?1:0,ye=Ze.length;it<ye;++it){var he=Ze[it];if(/\\[bdsw]/i.test(he))He.push(he);else{var fe=qe(he),X;it+2<ye&&Ze[it+1]==="-"?(X=qe(Ze[it+2]),it+=2):X=fe,Et.push([fe,X]),X<65||fe>122||(X<65||fe>90||Et.push([Math.max(65,fe)|32,Math.min(X,90)|32]),X<97||fe>122||Et.push([Math.max(97,fe)&~32,Math.min(X,122)&~32]))}}Et.sort(function(Te,Pe){return Te[0]-Pe[0]||Pe[1]-Te[1]});for(var $=[],te=[],it=0;it<Et.length;++it){var oe=Et[it];oe[0]<=te[1]+1?te[1]=Math.max(te[1],oe[1]):$.push(te=oe)}for(var it=0;it<$.length;++it){var oe=$[it];He.push(lt(oe[0])),oe[1]>oe[0]&&(oe[1]+1>oe[0]&&He.push("-"),He.push(lt(oe[1])))}return He.push("]"),He.join("")}function bt(ut){for(var Ze=ut.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")),Et=Ze.length,St=[],He=0,it=0;He<Et;++He){var ye=Ze[He];if(ye==="(")++it;else if(ye.charAt(0)==="\\"){var he=+ye.substring(1);he&&(he<=it?St[he]=-1:Ze[He]=lt(he))}}for(var He=1;He<St.length;++He)St[He]===-1&&(St[He]=++Ae);for(var He=0,it=0;He<Et;++He){var ye=Ze[He];if(ye==="(")++it,St[it]||(Ze[He]="(?:");else if(ye.charAt(0)==="\\"){var he=+ye.substring(1);he&&he<=it&&(Ze[He]="\\"+St[he])}}for(var He=0;He<Et;++He)Ze[He]==="^"&&Ze[He+1]!=="^"&&(Ze[He]="");if(ut.ignoreCase&&je)for(var He=0;He<Et;++He){var ye=Ze[He],fe=ye.charAt(0);ye.length>=2&&fe==="["?Ze[He]=ot(ye):fe!=="\\"&&(Ze[He]=ye.replace(/[a-zA-Z]/g,function(te){var oe=te.charCodeAt(0);return"["+String.fromCharCode(oe&~32,oe|32)+"]"}))}return Ze.join("")}for(var ht=[],Ke=0,Ue=Se.length;Ke<Ue;++Ke){var xe=Se[Ke];if(xe.global||xe.multiline)throw new Error(""+xe);ht.push("(?:"+bt(xe)+")")}return new RegExp(ht.join("|"),Be?"gi":"g")}function J(Se,Ae){var je=/(?:^|\s)nocode(?:\s|$)/,Be=[],Ke=0,Ue=[],xe=0;function Ge(qe){var lt=qe.nodeType;if(lt==1){if(je.test(qe.className))return;for(var ot=qe.firstChild;ot;ot=ot.nextSibling)Ge(ot);var bt=qe.nodeName.toLowerCase();(bt==="br"||bt==="li")&&(Be[xe]=`
|
|
`,Ue[xe<<1]=Ke++,Ue[xe++<<1|1]=qe)}else if(lt==3||lt==4){var ht=qe.nodeValue;ht.length&&(Ae?ht=ht.replace(/\r\n?/g,`
|
|
`):ht=ht.replace(/[ \t\r\n]+/g," "),Be[xe]=ht,Ue[xe<<1]=Ke,Ke+=ht.length,Ue[xe++<<1|1]=qe)}}return Ge(Se),{sourceCode:Be.join("").replace(/\n$/,""),spans:Ue}}function F(Se,Ae,je,Be,Ke){if(!je)return;var Ue={sourceNode:Se,pre:1,langExtension:null,numberLines:null,sourceCode:je,spans:null,basePos:Ae,decorations:null};Be(Ue),Ke.push.apply(Ke,Ue.decorations)}var q=/\S/;function re(Se){for(var Ae=void 0,je=Se.firstChild;je;je=je.nextSibling){var Be=je.nodeType;Ae=Be===1?Ae?Se:je:Be===3&&q.test(je.nodeValue)?Se:Ae}return Ae===Se?void 0:Ae}function ae(Se,Ae){var je={},Be;(function(){for(var xe=Se.concat(Ae),Ge=[],qe={},lt=0,ot=xe.length;lt<ot;++lt){var bt=xe[lt],ht=bt[3];if(ht)for(var ut=ht.length;--ut>=0;)je[ht.charAt(ut)]=bt;var Ze=bt[1],Et=""+Ze;qe.hasOwnProperty(Et)||(Ge.push(Ze),qe[Et]=null)}Ge.push(/[\0-\uffff]/),Be=G(Ge)})();var Ke=Ae.length,Ue=function(xe){for(var Ge=xe.sourceCode,qe=xe.basePos,lt=xe.sourceNode,ot=[qe,i],bt=0,ht=Ge.match(Be)||[],ut={},Ze=0,Et=ht.length;Ze<Et;++Ze){var St=ht[Ze],He=ut[St],it=void 0,ye;if(typeof He=="string")ye=!1;else{var he=je[St.charAt(0)];if(he)it=St.match(he[1]),He=he[0];else{for(var fe=0;fe<Ke;++fe)if(he=Ae[fe],it=St.match(he[1]),it){He=he[0];break}it||(He=i)}ye=He.length>=5&&He.substring(0,5)==="lang-",ye&&!(it&&typeof it[1]=="string")&&(ye=!1,He=y),ye||(ut[St]=He)}var X=bt;if(bt+=St.length,!ye)ot.push(qe+X,He);else{var $=it[1],te=St.indexOf($),oe=te+$.length;it[2]&&(oe=St.length-it[2].length,te=oe-$.length);var Te=He.substring(5);F(lt,qe+X,St.substring(0,te),Ue,ot),F(lt,qe+X+te,$,V(Te,$),ot),F(lt,qe+X+oe,St.substring(oe),Ue,ot)}}xe.decorations=ot};return Ue}function ve(Se){var Ae=[],je=[];Se.tripleQuotedStrings?Ae.push([o,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Se.multiLineStrings?Ae.push([o,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ae.push([o,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Se.verbatimStrings&&je.push([o,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Be=Se.hashComments;Be&&(Se.cStyleComments?(Be>1?Ae.push([h,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ae.push([h,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),je.push([o,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ae.push([h,/^#[^\r\n]*/,null,"#"])),Se.cStyleComments&&(je.push([h,/^\/\/[^\r\n]*/,null]),je.push([h,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ke=Se.regexLiterals;if(Ke){var Ue=Ke>1?"":`
|
|
\r`,xe=Ue?".":"[\\S\\s]",Ge="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+xe+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+xe+")*(?:\\x5D|$))+/";je.push(["lang-regex",RegExp("^"+B+"("+Ge+")")])}var qe=Se.types;qe&&je.push([a,qe]);var lt=(""+Se.keywords).replace(/^ | $/g,"");lt.length&&je.push([m,new RegExp("^(?:"+lt.replace(/[\s,]+/g,"|")+")\\b"),null]),Ae.push([i,/^\s+/,null,` \r
|
|
\xA0`]);var ot="^.[^\\s\\w.$@'\"`/\\\\]*";return Se.regexLiterals&&(ot+="(?!s*/)"),je.push([r,/^@[a-z_$][a-z_$@0-9]*/i,null],[a,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[i,/^[a-z_$][a-z_$@0-9]*/i,null],[r,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[i,/^\\[\s\S]?/,null],[e,new RegExp(ot),null]),ae(Ae,je)}var de=ve({keywords:v,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Z(Se,Ae,je){for(var Be=/(?:^|\s)nocode(?:\s|$)/,Ke=/\r\n?|\n/,Ue=Se.ownerDocument,xe=Ue.createElement("li");Se.firstChild;)xe.appendChild(Se.firstChild);var Ge=[xe];function qe(Ze){var Et=Ze.nodeType;if(Et==1&&!Be.test(Ze.className))if(Ze.nodeName==="br")lt(Ze),Ze.parentNode&&Ze.parentNode.removeChild(Ze);else for(var St=Ze.firstChild;St;St=St.nextSibling)qe(St);else if((Et==3||Et==4)&&je){var He=Ze.nodeValue,it=He.match(Ke);if(it){var ye=He.substring(0,it.index);Ze.nodeValue=ye;var he=He.substring(it.index+it[0].length);if(he){var fe=Ze.parentNode;fe.insertBefore(Ue.createTextNode(he),Ze.nextSibling)}lt(Ze),ye||Ze.parentNode.removeChild(Ze)}}}function lt(Ze){for(;!Ze.nextSibling;)if(Ze=Ze.parentNode,!Ze)return;function Et(it,ye){var he=ye?it.cloneNode(!1):it,fe=it.parentNode;if(fe){var X=Et(fe,1),$=it.nextSibling;X.appendChild(he);for(var te=$;te;te=$)$=te.nextSibling,X.appendChild(te)}return he}for(var St=Et(Ze.nextSibling,0),He;(He=St.parentNode)&&He.nodeType===1;)St=He;Ge.push(St)}for(var ot=0;ot<Ge.length;++ot)qe(Ge[ot]);Ae===(Ae|0)&&Ge[0].setAttribute("value",Ae);var bt=Ue.createElement("ol");bt.className="linenums";for(var ht=Math.max(0,Ae-1|0)||0,ot=0,ut=Ge.length;ot<ut;++ot)xe=Ge[ot],xe.className="L"+(ot+ht)%10,xe.firstChild||xe.appendChild(Ue.createTextNode("\xA0")),bt.appendChild(xe);Se.appendChild(bt)}function ee(Se){var Ae=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ae=Ae&&+Ae[1]<=8;var je=/\n/g,Be=Se.sourceCode,Ke=Be.length,Ue=0,xe=Se.spans,Ge=xe.length,qe=0,lt=Se.decorations,ot=lt.length,bt=0;lt[ot]=Ke;var ht,ut;for(ut=ht=0;ut<ot;)lt[ut]!==lt[ut+2]?(lt[ht++]=lt[ut++],lt[ht++]=lt[ut++]):ut+=2;for(ot=ht,ut=ht=0;ut<ot;){for(var Ze=lt[ut],Et=lt[ut+1],St=ut+2;St+2<=ot&<[St+1]===Et;)St+=2;lt[ht++]=Ze,lt[ht++]=Et,ut=St}ot=lt.length=ht;var He=Se.sourceNode,it="";He&&(it=He.style.display,He.style.display="none");try{for(var ye=null;qe<Ge;){var he=xe[qe],fe=xe[qe+2]||Ke,X=lt[bt+2]||Ke,St=Math.min(fe,X),$=xe[qe+1],te;if($.nodeType!==1&&(te=Be.substring(Ue,St))){Ae&&(te=te.replace(je,"\r")),$.nodeValue=te;var oe=$.ownerDocument,Te=oe.createElement("span");Te.className=lt[bt+1];var Pe=$.parentNode;Pe.replaceChild(Te,$),Te.appendChild($),Ue<fe&&(xe[qe+1]=$=oe.createTextNode(Be.substring(St,fe)),Pe.insertBefore($,Te.nextSibling))}Ue=St,Ue>=fe&&(qe+=2),Ue>=X&&(bt+=2)}}finally{He&&(He.style.display=it)}}var pe={};function Q(Se,Ae){for(var je=Ae.length;--je>=0;){var Be=Ae[je];pe.hasOwnProperty(Be)?L.console&&console.warn("cannot override language handler %s",Be):pe[Be]=Se}}function V(Se,Ae){return Se&&pe.hasOwnProperty(Se)||(Se=/^\s*</.test(Ae)?"default-markup":"default-code"),pe[Se]}Q(de,["default-code"]),Q(ae([],[[i,/^[^<?]+/],[f,/^<!\w[^>]*(?:>|$)/],[h,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[e,/^(?:<[%?]|[%?]>)/],["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"]),Q(ae([[i,/^[\s]+/,null,` \r
|
|
`],[A,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[t,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[e,/^[=<>\/]+/],["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"]),Q(ae([],[[A,/^[\s\S]+/]]),["uq.val"]),Q(ve({keywords:S,hashComments:!0,cStyleComments:!0,types:d}),["c","cc","cpp","cxx","cyc","m"]),Q(ve({keywords:"null,true,false"}),["json"]),Q(ve({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:d}),["cs"]),Q(ve({keywords:w,cStyleComments:!0}),["java"]),Q(ve({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Q(ve({keywords:n,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Q(ve({keywords:p,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Q(ve({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Q(ve({keywords:_,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Q(ve({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Q(ae([],[[o,/^[\s\S]+/]]),["regex"]);function Ce(Se){var Ae=Se.langExtension;try{var je=J(Se.sourceNode,Se.pre),Be=je.sourceCode;Se.sourceCode=Be,Se.spans=je.spans,Se.basePos=0,V(Ae,Be)(Se),ee(Se)}catch(Ke){L.console&&console.log(Ke&&Ke.stack||Ke)}}function De(Se,Ae,je){var Be=je||!1,Ke=Ae||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+Se+"</pre>",Ue=Ue.firstChild,Be&&Z(Ue,Be,!0);var xe={langExtension:Ke,numberLines:Be,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ce(xe),Ue.innerHTML}function Ne(Se,Ae){var je=Ae||document.body,Be=je.ownerDocument||document;function Ke(he){return je.getElementsByTagName(he)}for(var Ue=[Ke("pre"),Ke("code"),Ke("xmp")],xe=[],Ge=0;Ge<Ue.length;++Ge)for(var qe=0,lt=Ue[Ge].length;qe<lt;++qe)xe.push(Ue[Ge][qe]);Ue=null;var ot=Date;ot.now||(ot={now:function(){return+new Date}});var bt=0,ht=/\blang(?:uage)?-([\w.]+)(?!\S)/,ut=/\bprettyprint\b/,Ze=/\bprettyprinted\b/,Et=/pre|xmp/i,St=/^code$/i,He=/^(?:pre|code|xmp)$/i,it={};function ye(){for(var he=L.PR_SHOULD_USE_CONTINUATION?ot.now()+250:Infinity;bt<xe.length&&ot.now()<he;bt++){for(var fe=xe[bt],X=it,$=fe;$=$.previousSibling;){var te=$.nodeType,oe=(te===7||te===8)&&$.nodeValue;if(oe?!/^\??prettify\b/.test(oe):te!==3||/\S/.test($.nodeValue))break;if(oe){X={},oe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Dn,on,qn){X[on]=qn});break}}var Te=fe.className;if((X!==it||ut.test(Te))&&!Ze.test(Te)){for(var Pe=!1,Je=fe.parentNode;Je;Je=Je.parentNode){var Wt=Je.tagName;if(He.test(Wt)&&Je.className&&ut.test(Je.className)){Pe=!0;break}}if(!Pe){fe.className+=" prettyprinted";var Zt=X.lang;if(!Zt){Zt=Te.match(ht);var Xt;!Zt&&(Xt=re(fe))&&St.test(Xt.tagName)&&(Zt=Xt.className.match(ht)),Zt&&(Zt=Zt[1])}var an;if(Et.test(fe.tagName))an=1;else{var fn=fe.currentStyle,It=Be.defaultView,Kn=fn?fn.whiteSpace:It&&It.getComputedStyle?It.getComputedStyle(fe,null).getPropertyValue("white-space"):0;an=Kn&&Kn.substring(0,3)==="pre"}var Sn=X.linenums;(Sn=Sn==="true"||+Sn)||(Sn=Te.match(/\blinenums\b(?::(\d+))?/),Sn=Sn?Sn[1]&&Sn[1].length?+Sn[1]:!0:!1),Sn&&Z(fe,Sn,an);var Jn={langExtension:Zt,sourceNode:fe,numberLines:Sn,pre:an,sourceCode:null,basePos:null,spans:null,decorations:null};Ce(Jn)}}}bt<xe.length?L.setTimeout(ye,250):typeof Se=="function"&&Se()}ye()}var we=L.PR={createSimpleLexer:ae,registerLangHandler:Q,sourceDecorator:ve,PR_ATTRIB_NAME:t,PR_ATTRIB_VALUE:A,PR_COMMENT:h,PR_DECLARATION:f,PR_KEYWORD:m,PR_LITERAL:r,PR_NOCODE:U,PR_PLAIN:i,PR_PUNCTUATION:e,PR_SOURCE:y,PR_STRING:o,PR_TAG:g,PR_TYPE:a,prettyPrintOne:O?L.prettyPrintOne=De:R=De,prettyPrint:I=O?L.prettyPrint=Ne:I=Ne},ke=L.define;typeof ke=="function"&&ke.amd&&ke("google-code-prettify",[],function(){return we})})()},WaYH:function(Pt,Ye,K){"use strict";var Ee=K("rePB"),j=K("Ff2n"),O=K("VTBJ"),N=K("1OyB"),E=K("vuIU"),R=K("JX7q"),I=K("Ji7U"),L=K("LK+K"),T=K("q1tI"),P=K("TSYQ"),b=K.n(P),S=K("sboe"),w=K("OZM5"),C=function(m){var h=m.prefixCls,a=m.level,r=m.isStart,e=m.isEnd;if(!a)return null;for(var i="".concat(h,"-indent-unit"),g=[],f=0;f<a;f+=1){var y;g.push(T.createElement("span",{key:f,className:b()(i,(y={},Object(Ee.a)(y,"".concat(i,"-start"),r[f+1]),Object(Ee.a)(y,"".concat(i,"-end"),e[f+1]),Object(Ee.a)(y,"".concat(i,"-end-first-level"),!f&&e[0]),y))}))}return T.createElement("span",{"aria-hidden":"true",className:"".concat(h,"-indent")},g)},x=C,_=K("815F"),p="open",n="close",u="---",l=function(o){Object(I.a)(h,o);var m=Object(L.a)(h);function h(){var a;return Object(N.a)(this,h),a=m.apply(this,arguments),a.state={dragNodeHighlight:!1},a.onSelectorClick=function(r){var e=a.props.context.onNodeClick;e(r,Object(_.b)(a.props)),a.isSelectable()?a.onSelect(r):a.onCheck(r)},a.onSelectorDoubleClick=function(r){var e=a.props.context.onNodeDoubleClick;e(r,Object(_.b)(a.props))},a.onSelect=function(r){if(a.isDisabled())return;var e=a.props.context.onNodeSelect;r.preventDefault(),e(r,Object(_.b)(a.props))},a.onCheck=function(r){if(a.isDisabled())return;var e=a.props,i=e.disableCheckbox,g=e.checked,f=a.props.context.onNodeCheck;if(!a.isCheckable()||i)return;r.preventDefault();var y=!g;f(r,Object(_.b)(a.props),y)},a.onMouseEnter=function(r){var e=a.props.context.onNodeMouseEnter;e(r,Object(_.b)(a.props))},a.onMouseLeave=function(r){var e=a.props.context.onNodeMouseLeave;e(r,Object(_.b)(a.props))},a.onContextMenu=function(r){var e=a.props.context.onNodeContextMenu;e(r,Object(_.b)(a.props))},a.onDragStart=function(r){var e=a.props.context.onNodeDragStart;r.stopPropagation(),a.setState({dragNodeHighlight:!0}),e(r,Object(R.a)(a));try{r.dataTransfer.setData("text/plain","")}catch(i){}},a.onDragEnter=function(r){var e=a.props.context.onNodeDragEnter;r.preventDefault(),r.stopPropagation(),e(r,Object(R.a)(a))},a.onDragOver=function(r){var e=a.props.context.onNodeDragOver;r.preventDefault(),r.stopPropagation(),e(r,Object(R.a)(a))},a.onDragLeave=function(r){var e=a.props.context.onNodeDragLeave;r.stopPropagation(),e(r,Object(R.a)(a))},a.onDragEnd=function(r){var e=a.props.context.onNodeDragEnd;r.stopPropagation(),a.setState({dragNodeHighlight:!1}),e(r,Object(R.a)(a))},a.onDrop=function(r){var e=a.props.context.onNodeDrop;r.preventDefault(),r.stopPropagation(),a.setState({dragNodeHighlight:!1}),e(r,Object(R.a)(a))},a.onExpand=function(r){var e=a.props.context.onNodeExpand;e(r,Object(_.b)(a.props))},a.setSelectHandle=function(r){a.selectHandle=r},a.getNodeState=function(){var r=a.props.expanded;return a.isLeaf()?null:r?p:n},a.hasChildren=function(){var r=a.props.eventKey,e=a.props.context.keyEntities,i=e[r]||{},g=i.children;return!!(g||[]).length},a.isLeaf=function(){var r=a.props,e=r.isLeaf,i=r.loaded,g=a.props.context.loadData,f=a.hasChildren();return e===!1?!1:e||!g&&!f||g&&i&&!f},a.isDisabled=function(){var r=a.props.disabled,e=a.props.context.disabled;return!!(e||r)},a.isCheckable=function(){var r=a.props.checkable,e=a.props.context.checkable;return!e||r===!1?!1:e},a.syncLoadData=function(r){var e=r.expanded,i=r.loading,g=r.loaded,f=a.props.context,y=f.loadData,t=f.onNodeLoad;if(i)return;y&&e&&!a.isLeaf()&&(!a.hasChildren()&&!g&&t(Object(_.b)(a.props)))},a.renderSwitcher=function(){var r=a.props,e=r.expanded,i=r.switcherIcon,g=a.props.context,f=g.prefixCls,y=g.switcherIcon,t=i||y;if(a.isLeaf())return T.createElement("span",{className:b()("".concat(f,"-switcher"),"".concat(f,"-switcher-noop"))},typeof t=="function"?t(Object(O.a)(Object(O.a)({},a.props),{},{isLeaf:!0})):t);var A=b()("".concat(f,"-switcher"),"".concat(f,"-switcher_").concat(e?p:n));return T.createElement("span",{onClick:a.onExpand,className:A},typeof t=="function"?t(Object(O.a)(Object(O.a)({},a.props),{},{isLeaf:!1})):t)},a.renderCheckbox=function(){var r=a.props,e=r.checked,i=r.halfChecked,g=r.disableCheckbox,f=a.props.context.prefixCls,y=a.isDisabled(),t=a.isCheckable();if(!t)return null;var A=typeof t!="boolean"?t:null;return T.createElement("span",{className:b()("".concat(f,"-checkbox"),e&&"".concat(f,"-checkbox-checked"),!e&&i&&"".concat(f,"-checkbox-indeterminate"),(y||g)&&"".concat(f,"-checkbox-disabled")),onClick:a.onCheck},A)},a.renderIcon=function(){var r=a.props.loading,e=a.props.context.prefixCls;return T.createElement("span",{className:b()("".concat(e,"-iconEle"),"".concat(e,"-icon__").concat(a.getNodeState()||"docu"),r&&"".concat(e,"-icon_loading"))})},a.renderSelector=function(){var r=a.state.dragNodeHighlight,e=a.props,i=e.title,g=e.selected,f=e.icon,y=e.loading,t=e.data,A=a.props.context,U=A.prefixCls,B=A.showIcon,G=A.icon,J=A.draggable,F=A.loadData,q=A.titleRender,re=a.isDisabled(),ae="".concat(U,"-node-content-wrapper"),ve;if(B){var de=f||G;ve=de?T.createElement("span",{className:b()("".concat(U,"-iconEle"),"".concat(U,"-icon__customize"))},typeof de=="function"?de(a.props):de):a.renderIcon()}else F&&y&&(ve=a.renderIcon());var Z;typeof i=="function"?Z=i(t):q?Z=q(t):Z=i;var ee=T.createElement("span",{className:"".concat(U,"-title")},Z);return T.createElement("span",{ref:a.setSelectHandle,title:typeof i=="string"?i:"",className:b()("".concat(ae),"".concat(ae,"-").concat(a.getNodeState()||"normal"),!re&&(g||r)&&"".concat(U,"-node-selected"),!re&&J&&"draggable"),draggable:!re&&J||void 0,"aria-grabbed":!re&&J||void 0,onMouseEnter:a.onMouseEnter,onMouseLeave:a.onMouseLeave,onContextMenu:a.onContextMenu,onClick:a.onSelectorClick,onDoubleClick:a.onSelectorDoubleClick,onDragStart:J?a.onDragStart:void 0},ve,ee)},a}return Object(E.a)(h,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var r=this.props.selectable,e=this.props.context.selectable;return typeof r=="boolean"?r:e}},{key:"render",value:function(){var r,e=this.props,i=e.eventKey,g=e.className,f=e.style,y=e.dragOver,t=e.dragOverGapTop,A=e.dragOverGapBottom,U=e.isLeaf,B=e.isStart,G=e.isEnd,J=e.expanded,F=e.selected,q=e.checked,re=e.halfChecked,ae=e.loading,ve=e.domRef,de=e.active,Z=e.onMouseMove,ee=Object(j.a)(e,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),pe=this.props.context,Q=pe.prefixCls,V=pe.filterTreeNode,Ce=pe.draggable,De=pe.keyEntities,Ne=this.isDisabled(),we=Object(w.f)(ee),ke=De[i]||{},Se=ke.level,Ae=G[G.length-1];return T.createElement("div",Object.assign({ref:ve,className:b()(g,"".concat(Q,"-treenode"),(r={},Object(Ee.a)(r,"".concat(Q,"-treenode-disabled"),Ne),Object(Ee.a)(r,"".concat(Q,"-treenode-switcher-").concat(J?"open":"close"),!U),Object(Ee.a)(r,"".concat(Q,"-treenode-checkbox-checked"),q),Object(Ee.a)(r,"".concat(Q,"-treenode-checkbox-indeterminate"),re),Object(Ee.a)(r,"".concat(Q,"-treenode-selected"),F),Object(Ee.a)(r,"".concat(Q,"-treenode-loading"),ae),Object(Ee.a)(r,"".concat(Q,"-treenode-active"),de),Object(Ee.a)(r,"".concat(Q,"-treenode-leaf-last"),Ae),Object(Ee.a)(r,"drag-over",!Ne&&y),Object(Ee.a)(r,"drag-over-gap-top",!Ne&&t),Object(Ee.a)(r,"drag-over-gap-bottom",!Ne&&A),Object(Ee.a)(r,"filter-node",V&&V(Object(_.b)(this.props))),r)),style:f,onDragEnter:Ce?this.onDragEnter:void 0,onDragOver:Ce?this.onDragOver:void 0,onDragLeave:Ce?this.onDragLeave:void 0,onDrop:Ce?this.onDrop:void 0,onDragEnd:Ce?this.onDragEnd:void 0,onMouseMove:Z},we),T.createElement(x,{prefixCls:Q,level:Se,isStart:B,isEnd:G}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),h}(T.Component),v=function(m){return T.createElement(S.a.Consumer,null,function(h){return T.createElement(l,Object.assign({},m,{context:h}))})};v.displayName="TreeNode",v.defaultProps={title:u},v.isTreeNode=1;var d=Ye.a=v},WdTA:function(Pt,Ye,K){Pt.exports=K.p+"static/studnetqun.598eeb43.png"},Y1PL:function(Pt,Ye,K){"use strict";K.r(Ye),K.d(Ye,"ResizableTextArea",function(){return re});var Ee=K("wx14"),j=K("1OyB"),O=K("vuIU"),N=K("Ji7U"),E=K("LK+K"),R=K("q1tI"),I=K("VTBJ"),L=K("rePB"),T=K("Zm9Q"),P=K("Kwbf"),b=K("c+Xe"),S=K("m+aA"),w=K("bdgK"),C=new Map;function x(de){de.forEach(function(Z){var ee,pe=Z.target;(ee=C.get(pe))===null||ee===void 0||ee.forEach(function(Q){return Q(pe)})})}var _=new w.default(x),p=null,n=null;function u(de,Z){C.has(de)||(C.set(de,new Set),_.observe(de)),C.get(de).add(Z)}function l(de,Z){C.has(de)&&(C.get(de).delete(Z),C.get(de).size||(_.unobserve(de),C.delete(de)))}var v=function(de){Object(N.a)(ee,de);var Z=Object(E.a)(ee);function ee(){return Object(j.a)(this,ee),Z.apply(this,arguments)}return Object(O.a)(ee,[{key:"render",value:function(){return this.props.children}}]),ee}(R.Component),d=R.createContext(null);function o(de){var Z=de.children,ee=de.onBatchResize,pe=R.useRef(0),Q=R.useRef([]),V=R.useContext(d),Ce=R.useCallback(function(De,Ne,we){pe.current+=1;var ke=pe.current;Q.current.push({size:De,element:Ne,data:we}),Promise.resolve().then(function(){ke===pe.current&&(ee==null||ee(Q.current),Q.current=[])}),V==null||V(De,Ne,we)},[ee,V]);return R.createElement(d.Provider,{value:Ce},Z)}function m(de){var Z=de.children,ee=de.disabled,pe=R.useRef(null),Q=R.useRef(null),V=R.useContext(d),Ce=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),De=R.isValidElement(Z)&&Object(b.c)(Z),Ne=De?Z.ref:null,we=R.useMemo(function(){return Object(b.a)(Ne,pe)},[Ne,pe]),ke=R.useRef(de);ke.current=de;var Se=R.useCallback(function(Ae){var je=ke.current,Be=je.onResize,Ke=je.data,Ue=Ae.getBoundingClientRect(),xe=Ue.width,Ge=Ue.height,qe=Ae.offsetWidth,lt=Ae.offsetHeight,ot=Math.floor(xe),bt=Math.floor(Ge);if(Ce.current.width!==ot||Ce.current.height!==bt||Ce.current.offsetWidth!==qe||Ce.current.offsetHeight!==lt){var ht={width:ot,height:bt,offsetWidth:qe,offsetHeight:lt};Ce.current=ht;var ut=qe===Math.round(xe)?xe:qe,Ze=lt===Math.round(Ge)?Ge:lt,Et=Object(I.a)(Object(I.a)({},ht),{},{offsetWidth:ut,offsetHeight:Ze});V==null||V(Et,Ae,Ke),Be&&Promise.resolve().then(function(){Be(Et,Ae)})}},[]);return R.useEffect(function(){var Ae=Object(S.a)(pe.current)||Object(S.a)(Q.current);return Ae&&!ee&&u(Ae,Se),function(){return l(Ae,Se)}},[pe.current,ee]),R.createElement(v,{ref:Q},De?R.cloneElement(Z,{ref:we}):Z)}var h="rc-observer-key";function a(de){var Z=de.children,ee=Object(T.a)(Z);return ee.map(function(pe,Q){var V=(pe==null?void 0:pe.key)||"".concat(h,"-").concat(Q);return R.createElement(m,Object(Ee.a)({},de,{key:V}),pe)})}a.Collection=o;var r=a,e=K("bT9E"),i=K("TSYQ"),g=K.n(i),f=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,y=["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"],t={},A;function U(de){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ee=de.getAttribute("id")||de.getAttribute("data-reactid")||de.getAttribute("name");if(Z&&t[ee])return t[ee];var pe=window.getComputedStyle(de),Q=pe.getPropertyValue("box-sizing")||pe.getPropertyValue("-moz-box-sizing")||pe.getPropertyValue("-webkit-box-sizing"),V=parseFloat(pe.getPropertyValue("padding-bottom"))+parseFloat(pe.getPropertyValue("padding-top")),Ce=parseFloat(pe.getPropertyValue("border-bottom-width"))+parseFloat(pe.getPropertyValue("border-top-width")),De=y.map(function(we){return"".concat(we,":").concat(pe.getPropertyValue(we))}).join(";"),Ne={sizingStyle:De,paddingSize:V,borderSize:Ce,boxSizing:Q};return Z&&ee&&(t[ee]=Ne),Ne}function B(de){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,pe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;A||(A=document.createElement("textarea"),A.setAttribute("tab-index","-1"),A.setAttribute("aria-hidden","true"),document.body.appendChild(A)),de.getAttribute("wrap")?A.setAttribute("wrap",de.getAttribute("wrap")):A.removeAttribute("wrap");var Q=U(de,Z),V=Q.paddingSize,Ce=Q.borderSize,De=Q.boxSizing,Ne=Q.sizingStyle;A.setAttribute("style","".concat(Ne,";").concat(f)),A.value=de.value||de.placeholder||"";var we=Number.MIN_SAFE_INTEGER,ke=Number.MAX_SAFE_INTEGER,Se=A.scrollHeight,Ae;if(De==="border-box"?Se+=Ce:De==="content-box"&&(Se-=V),ee!==null||pe!==null){A.value=" ";var je=A.scrollHeight-V;ee!==null&&(we=je*ee,De==="border-box"&&(we=we+V+Ce),Se=Math.max(we,Se)),pe!==null&&(ke=je*pe,De==="border-box"&&(ke=ke+V+Ce),Ae=Se>ke?"":"hidden",Se=Math.min(ke,Se))}return{height:Se,minHeight:we,maxHeight:ke,overflowY:Ae,resize:"none"}}var G=K("Gytx"),J=K.n(G),F;(function(de){de[de.NONE=0]="NONE",de[de.RESIZING=1]="RESIZING",de[de.RESIZED=2]="RESIZED"})(F||(F={}));var q=function(de){Object(N.a)(ee,de);var Z=Object(E.a)(ee);function ee(pe){var Q;return Object(j.a)(this,ee),Q=Z.call(this,pe),Q.nextFrameActionId=void 0,Q.resizeFrameId=void 0,Q.textArea=void 0,Q.saveTextArea=function(V){Q.textArea=V},Q.handleResize=function(V){var Ce=Q.state.resizeStatus,De=Q.props,Ne=De.autoSize,we=De.onResize;if(Ce!==F.NONE)return;typeof we=="function"&&we(V),Ne&&Q.resizeOnNextFrame()},Q.resizeOnNextFrame=function(){cancelAnimationFrame(Q.nextFrameActionId),Q.nextFrameActionId=requestAnimationFrame(Q.resizeTextarea)},Q.resizeTextarea=function(){var V=Q.props.autoSize;if(!V||!Q.textArea)return;var Ce=V.minRows,De=V.maxRows,Ne=B(Q.textArea,!1,Ce,De);Q.setState({textareaStyles:Ne,resizeStatus:F.RESIZING},function(){cancelAnimationFrame(Q.resizeFrameId),Q.resizeFrameId=requestAnimationFrame(function(){Q.setState({resizeStatus:F.RESIZED},function(){Q.resizeFrameId=requestAnimationFrame(function(){Q.setState({resizeStatus:F.NONE}),Q.fixFirefoxAutoScroll()})})})})},Q.renderTextArea=function(){var V=Q.props,Ce=V.prefixCls,De=Ce===void 0?"rc-textarea":Ce,Ne=V.autoSize,we=V.onResize,ke=V.className,Se=V.disabled,Ae=Q.state,je=Ae.textareaStyles,Be=Ae.resizeStatus,Ke=Object(e.a)(Q.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=g()(De,ke,Object(L.a)({},"".concat(De,"-disabled"),Se));"value"in Ke&&(Ke.value=Ke.value||"");var xe=Object(I.a)(Object(I.a)(Object(I.a)({},Q.props.style),je),Be===F.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(r,{onResize:Q.handleResize,disabled:!(Ne||we)},R.createElement("textarea",Object(Ee.a)({},Ke,{className:Ue,style:xe,ref:Q.saveTextArea})))},Q.state={textareaStyles:{},resizeStatus:F.NONE},Q}return Object(O.a)(ee,[{key:"componentDidUpdate",value:function(Q){(Q.value!==this.props.value||!J()(Q.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 Q=this.textArea.selectionStart,V=this.textArea.selectionEnd;this.textArea.setSelectionRange(Q,V)}}catch(Ce){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ee}(R.Component),re=q,ae=function(de){Object(N.a)(ee,de);var Z=Object(E.a)(ee);function ee(pe){var Q;Object(j.a)(this,ee),Q=Z.call(this,pe),Q.resizableTextArea=void 0,Q.focus=function(){Q.resizableTextArea.textArea.focus()},Q.saveTextArea=function(Ce){Q.resizableTextArea=Ce},Q.handleChange=function(Ce){var De=Q.props.onChange;Q.setValue(Ce.target.value,function(){Q.resizableTextArea.resizeTextarea()}),De&&De(Ce)},Q.handleKeyDown=function(Ce){var De=Q.props,Ne=De.onPressEnter,we=De.onKeyDown;Ce.keyCode===13&&Ne&&Ne(Ce),we&&we(Ce)};var V=typeof pe.value=="undefined"||pe.value===null?pe.defaultValue:pe.value;return Q.state={value:V},Q}return Object(O.a)(ee,[{key:"setValue",value:function(Q,V){"value"in this.props||this.setState({value:Q},V)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(re,Object(Ee.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Q){return"value"in Q?{value:Q.value}:null}}]),ee}(R.Component),ve=Ye.default=ae},YaiT:function(Pt,Ye,K){Pt.exports={list:"list___mDipN",btns:"btns___2c8h_",name:"name___eV55A"}},ZW9T:function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return v});var Ee=K("k1fw"),j=K("miYZ"),O=K("tsqr"),N=K("rAM+"),E=K("tJVT"),R=K("PpiC"),I=K("q1tI"),L=K.n(I),T=K("bdgK");function P(d,o,m,h,a){var r=o.getWordUntilPosition(m),e={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:r.startColumn,endColumn:r.endColumn},i=h.map(function(g){return{label:g,kind:d.languages.CompletionItemKind.Keyword,insertText:g,insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:e}});return a.map(function(g){i.push(Object(Ee.a)(Object(Ee.a)({},g),{},{range:e}))}),i}var b=function(d){var o={label:"ifelse",kind:d.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet},m=["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"];d.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(e,i){var g=P(d,e,i,m,[o]);return{suggestions:g}}});var h=["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"];d.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(e,i){var g=[{label:"print",kind:d.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet}],f=P(d,e,i,h,g);return{suggestions:f}}});var a=["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"];d.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(e,i){var g=[o,{label:"main",kind:d.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:d.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet}],f=P(d,e,i,a,g);return{suggestions:f}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",w=K("LvDl");function C(d){return/^\d+$/.test(d)?"".concat(d,"px"):d}function x(){}var _=!1,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 n(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=d;if(Array.isArray(d)){for(var m=0;m<d.length;m++){var h=p[d[m]];if(h)return h}return o[0]}return p[o]||o}var u=null,l=Ye.b=function(d){var o=d.width,m=o===void 0?"100%":o,h=d.height,a=h===void 0?"100%":h,r=d.value,e=d.language,i=e===void 0?"javascript":e,g=d.style,f=g===void 0?{}:g,y=d.options,t=y===void 0?{}:y,A=d.overrideServices,U=A===void 0?{}:A,B=d.theme,G=B===void 0?"vs-dark":B,J=d.onEditBlur,F=d.onSave,q=d.autoHeight,re=q===void 0?!1:q,ae=d.forbidCopy,ve=ae===void 0?!1:ae,de=d.onChange,Z=de===void 0?x:de,ee=d.editorDidMount,pe=ee===void 0?x:ee,Q=d.onFocus,V=Q===void 0?x:Q,Ce=d.filename,De=Ce===void 0?"educoder.txt":Ce,Ne=Object(R.a)(d,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),we=Object(I.useRef)(),ke=Object(I.useRef)({}),Se=Object(I.useRef)(),Ae=Object(I.useRef)(!1),je=Object(I.useRef)(),Be=Object(I.useState)(!1),Ke=Object(E.a)(Be,2),Ue=Ke[0],xe=Ke[1];function Ge(){var te;return we.current&&(te=new T.default(function(oe){var Te=Object(N.a)(oe),Pe;try{for(Te.s();!(Pe=Te.n()).done;){var Je=Pe.value;(Je.target.offsetHeight>0||Je.target.offsetWidth>0)&&ke.current.instance.layout()}}catch(Wt){Te.e(Wt)}finally{Te.f()}}),te.observe(we.current)),te}function qe(){O.b.warn(decodeURIComponent(S))}var lt=function(){var oe=ke.current.instance;if(r!=null&&oe&&Ue){var Te=oe.getModel();Te&&r!==Te.getValue()&&(_=!0,Te.setValue(r),oe.layout(),_=!1)}};Object(I.useEffect)(function(){Se.current&&clearTimeout(Se.current),Se.current=setTimeout(function(){lt()},500)},[r,Ue,ke.current]);function ot(){var te=ke.current.instance;if(te){var oe=te.getSelection(),Te=ke.current.pastePos||{},Pe=new u.Range(Te.startLineNumber||oe.endLineNumber,Te.startColumn||oe.endColumn,Te.endLineNumber||oe.endLineNumber,Te.endColumn||oe.endColumn);setTimeout(function(){te.executeEdits("",[{range:Pe,text:""}])},300)}}function bt(te){(window.navigator.platform.match("Mac")?te.metaKey:te.ctrlKey)&&te.keyCode==83&&(te.preventDefault(),F())}var ht=function(){if(re&&ke.current.instance){var oe=ke.current.instance.getContentHeight();X(oe<a?a:oe)}else X(a)};function ut(te){var oe=document.createEvent("MouseEvents");oe.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),te.dispatchEvent(oe)}function Ze(te,oe){var Te=window.URL||window.webkitURL||window,Pe=new Blob([oe]),Je=document.createElementNS("http://www.w3.org/1999/xhtml","a");Je.href=Te.createObjectURL(Pe),Je.download=te,ut(Je)}Object(I.useEffect)(function(){ht()},[ht]),Object(I.useEffect)(function(){we.current&&!Ue&&K.e(27).then(K.t.bind(null,"M/lh",7)).then(function(te){try{u=te,ke.current.instance=u.editor.create(we.current,{value:r,language:n(i),theme:G,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},U);var oe=ke.current.instance;if(pe(oe,u),setTimeout(function(){ht(),ke.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ze(De||"educoder.txt",oe.getValue())}})},500),ke.current.subscription=oe.onDidChangeModelContent(function(Pe){Ae.current?clearTimeout(je.current):(ht(),Z(oe.getValue(),Pe)),je.current=setTimeout(function(){Ae.current=!1},500)}),window.Monaco||b(u),ve&&(oe.addCommand(u.KeyMod.CtrlCmd|u.KeyMod.Shift|u.KeyCode.KEY_V,function(){return qe(),null}),oe.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_C,function(){return qe(),null})),window.Monaco=u,J&&oe.onDidBlurEditorWidget(function(){J(oe.getValue())}),V&&oe.onDidFocusEditorText(function(){V(oe.getValue())}),ve){oe.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_V,function(){return qe(),null}),oe.onDidPaste(function(Pe){ke.current.pastePos=Pe});try{window.addEventListener("paste",ot)}catch(Pe){}}var Te=Ge();return xe(!0),function(){var Pe=ke.current.instance;Pe.dispose();var Je=Pe.getModel();Je&&Je.dispose(),ke.current.subscription&&ke.current.subscription.dispose(),ve&&window.removeEventListener("paste",ot),Te.unobserve(we.current)}}catch(Pe){}})},[]),Object(I.useEffect)(function(){var te=ke.current.instance;if(te&&Ue)return document.addEventListener("keydown",bt,!1),function(){document.removeEventListener("keydown",bt)}},[F,Ue]),Object(I.useEffect)(function(){var te=ke.current.instance;if(te&&Ue){var oe=n(i);u.editor.setModelLanguage(te.getModel(),oe),console.log("language:",i,te.getModel(),oe)}},[i,Ue]),Object(I.useEffect)(function(){var te=ke.current.instance;te&&Ue&&u.editor.setTheme(G)},[G,Ue]),Object(I.useEffect)(function(){var te=ke.current.instance;te&&Ue&&(te.updateOptions(Object(Ee.a)({},t)),setTimeout(function(){te.getModel().updateOptions(Object(Ee.a)({},t))},200))},[JSON.stringify(t),Ue]),Object(I.useEffect)(function(){var te=ke.current.instance;te&&Ue&&te.layout()},[m,a,Ue]);var Et=Object(I.useState)(C(m)),St=Object(E.a)(Et,2),He=St[0],it=St[1],ye=Object(I.useState)(C(a)),he=Object(E.a)(ye,2),fe=he[0],X=he[1],$=Object(Ee.a)(Object(Ee.a)({},f),{},{width:He,height:fe});return L.a.createElement("div",{className:"my-monaco-editor",ref:we,style:$})};function v(d){var o=d.width,m=o===void 0?"100%":o,h=d.height,a=h===void 0?"100%":h,r=d.original,e=d.modified,i=d.language,g=d.options,f=g===void 0?{}:g,y=Object(I.useRef)(),t=Object(I.useState)(null),A=Object(E.a)(t,2),U=A[0],B=A[1];function G(re){var ae;return y.current&&(ae=new T.default(function(ve){var de=Object(N.a)(ve),Z;try{for(de.s();!(Z=de.n()).done;){var ee=Z.value;(ee.target.offsetHeight>0||ee.target.offsetWidth>0)&&re.layout()}}catch(pe){de.e(pe)}finally{de.f()}}),ae.observe(y.current)),ae}Object(I.useEffect)(function(){y.current&&K.e(27).then(K.t.bind(null,"M/lh",7)).then(function(re){u=re;var ae=u.editor.createDiffEditor(y.current,Object(Ee.a)(Object(Ee.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},f),{},{wordWrap:!0}));B(ae);var ve=G(ae);return function(){ae.dispose();var de=ae.getModel();de&&de.dispose(),ve.unobserve(y.current)}})},[]),Object(I.useEffect)(function(){U&&U.setModel({original:u.editor.createModel(r,i),modified:u.editor.createModel(e,i)})},[r,e,i,U]);var J=C(m),F=C(a),q={width:J,height:F};return L.a.createElement("div",{className:"my-diff-editor",ref:y,style:q})}},ZpRC:function(Pt,Ye,K){"use strict";function Ee(b){return typeof b=="object"&&b!=null&&b.nodeType===1}function j(b,S){return(!S||b!=="hidden")&&b!=="visible"&&b!=="clip"}function O(b,S){if(b.clientHeight<b.scrollHeight||b.clientWidth<b.scrollWidth){var w=getComputedStyle(b,null);return j(w.overflowY,S)||j(w.overflowX,S)||function(C){var x=function(_){if(!_.ownerDocument||!_.ownerDocument.defaultView)return null;try{return _.ownerDocument.defaultView.frameElement}catch(p){return null}}(C);return!!x&&(x.clientHeight<C.scrollHeight||x.clientWidth<C.scrollWidth)}(b)}return!1}function N(b,S,w,C,x,_,p,n){return _<b&&p>S||_>b&&p<S?0:_<=b&&n<=w||p>=S&&n>=w?_-b-C:p>S&&n<w||_<b&&n>w?p-S+x:0}var E=function(b,S){var w=window,C=S.scrollMode,x=S.block,_=S.inline,p=S.boundary,n=S.skipOverflowHiddenElements,u=typeof p=="function"?p:function(je){return je!==p};if(!Ee(b))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,v=[],d=b;Ee(d)&&u(d);){if((d=d.parentElement)===l){v.push(d);break}d!=null&&d===document.body&&O(d)&&!O(document.documentElement)||d!=null&&O(d,n)&&v.push(d)}for(var o=w.visualViewport?w.visualViewport.width:innerWidth,m=w.visualViewport?w.visualViewport.height:innerHeight,h=window.scrollX||pageXOffset,a=window.scrollY||pageYOffset,r=b.getBoundingClientRect(),e=r.height,i=r.width,g=r.top,f=r.right,y=r.bottom,t=r.left,A=x==="start"||x==="nearest"?g:x==="end"?y:g+e/2,U=_==="center"?t+i/2:_==="end"?f:t,B=[],G=0;G<v.length;G++){var J=v[G],F=J.getBoundingClientRect(),q=F.height,re=F.width,ae=F.top,ve=F.right,de=F.bottom,Z=F.left;if(C==="if-needed"&&g>=0&&t>=0&&y<=m&&f<=o&&g>=ae&&y<=de&&t>=Z&&f<=ve)return B;var ee=getComputedStyle(J),pe=parseInt(ee.borderLeftWidth,10),Q=parseInt(ee.borderTopWidth,10),V=parseInt(ee.borderRightWidth,10),Ce=parseInt(ee.borderBottomWidth,10),De=0,Ne=0,we="offsetWidth"in J?J.offsetWidth-J.clientWidth-pe-V:0,ke="offsetHeight"in J?J.offsetHeight-J.clientHeight-Q-Ce:0;if(l===J)De=x==="start"?A:x==="end"?A-m:x==="nearest"?N(a,a+m,m,Q,Ce,a+A,a+A+e,e):A-m/2,Ne=_==="start"?U:_==="center"?U-o/2:_==="end"?U-o:N(h,h+o,o,pe,V,h+U,h+U+i,i),De=Math.max(0,De+a),Ne=Math.max(0,Ne+h);else{De=x==="start"?A-ae-Q:x==="end"?A-de+Ce+ke:x==="nearest"?N(ae,de,q,Q,Ce+ke,A,A+e,e):A-(ae+q/2)+ke/2,Ne=_==="start"?U-Z-pe:_==="center"?U-(Z+re/2)+we/2:_==="end"?U-ve+V+we:N(Z,ve,re,pe,V+we,U,U+i,i);var Se=J.scrollLeft,Ae=J.scrollTop;A+=Ae-(De=Math.max(0,Math.min(Ae+De,J.scrollHeight-q+ke))),U+=Se-(Ne=Math.max(0,Math.min(Se+Ne,J.scrollWidth-re+we)))}B.push({el:J,top:De,left:Ne})}return B};function R(b){return b===Object(b)&&Object.keys(b).length!==0}function I(b,S){S===void 0&&(S="auto");var w="scrollBehavior"in document.body.style;b.forEach(function(C){var x=C.el,_=C.top,p=C.left;x.scroll&&w?x.scroll({top:_,left:p,behavior:S}):(x.scrollTop=_,x.scrollLeft=p)})}function L(b){return b===!1?{block:"end",inline:"nearest"}:R(b)?b:{block:"start",inline:"nearest"}}function T(b,S){var w=!b.ownerDocument.documentElement.contains(b);if(R(S)&&typeof S.behavior=="function")return S.behavior(w?[]:E(b,S));if(w)return;var C=L(S);return I(E(b,C),C.behavior)}var P=Ye.a=T},bT9E:function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return j});var Ee=K("VTBJ");function j(O,N){var E=Object(Ee.a)({},O);return Array.isArray(N)&&N.forEach(function(R){delete E[R]}),E}},d5o6:function(Pt,Ye,K){Pt.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:function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return l.a});var Ee=K("rePB"),j=K("VTBJ"),O=K("KQm4"),N=K("1OyB"),E=K("vuIU"),R=K("Ji7U"),I=K("LK+K"),L=K("q1tI"),T=K("4IlW"),P=K("Kwbf"),b=K("TSYQ"),S=K.n(b),w=K("sboe"),C=K("OZM5"),x=K("815F"),_=K("ODXe"),p=K("Ff2n"),n=K("+nKL"),u=K("8XRh"),l=K("WaYH"),v=function(ve,de){var Z=ve.className,ee=ve.style,pe=ve.motion,Q=ve.motionNodes,V=ve.motionType,Ce=ve.onMotionStart,De=ve.onMotionEnd,Ne=ve.active,we=ve.treeNodeRequiredProps,ke=Object(p.a)(ve,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Se=L.useState(!0),Ae=Object(_.a)(Se,2),je=Ae[0],Be=Ae[1],Ke=L.useContext(w.a),Ue=Ke.prefixCls,xe=L.useRef(!1),Ge=function(){xe.current||De(),xe.current=!0};return Object(L.useEffect)(function(){Q&&V==="hide"&&je&&Be(!1)},[Q]),Object(L.useEffect)(function(){return Q&&Ce(),function(){Q&&Ge()}},[]),Q?L.createElement(u.default,Object.assign({ref:de,visible:je},pe,{motionAppear:V==="show",onAppearEnd:Ge,onLeaveEnd:Ge}),function(qe,lt){var ot=qe.className,bt=qe.style;return L.createElement("div",{ref:lt,className:S()("".concat(Ue,"-treenode-motion"),ot),style:bt},Q.map(function(ht){var ut=ht.data,Ze=ut.key,Et=Object(p.a)(ut,["key"]),St=ht.isStart,He=ht.isEnd;delete Et.children;var it=Object(x.f)(Ze,we);return L.createElement(l.a,Object.assign({},Et,it,{active:Ne,data:ht.data,key:Ze,isStart:St,isEnd:He}))}))}):L.createElement(l.a,Object.assign({domRef:de,className:Z,style:ee},ke,{active:Ne}))};v.displayName="MotionTreeNode";var d=L.forwardRef(v),o=d;function m(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],de=ae.length,Z=ve.length;if(Math.abs(de-Z)!==1)return{add:!1,key:null};function ee(pe,Q){var V=new Map;pe.forEach(function(De){V.set(De,!0)});var Ce=Q.filter(function(De){return!V.has(De)});return Ce.length===1?Ce[0]:null}return de<Z?{add:!0,key:ee(ae,ve)}:{add:!1,key:ee(ve,ae)}}function h(ae,ve,de){var Z=ae.findIndex(function(V){var Ce=V.data;return Ce.key===de}),ee=ae[Z+1],pe=ve.findIndex(function(V){var Ce=V.data;return Ce.key===de});if(ee){var Q=ve.findIndex(function(V){var Ce=V.data;return Ce.key===ee.data.key});return ve.slice(pe+1,Q)}return ve.slice(pe+1)}var a={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},r=function(){},e="RC_TREE_MOTION_".concat(Math.random()),i={key:e},g={key:e,level:0,index:0,pos:"0",node:i},f={parent:null,children:[],pos:g.pos,data:i,isStart:[],isEnd:[]};function y(ae,ve,de,Z){return ve===!1||!de?ae:ae.slice(0,Math.ceil(de/Z)+1)}function t(ae){var ve=ae.data.key,de=ae.pos;return Object(x.e)(ve,de)}function A(ae){for(var ve=String(ae.data.key),de=ae;de.parent;)de=de.parent,ve="".concat(de.data.key," > ").concat(ve);return ve}var U=function(ve,de){var Z=ve.prefixCls,ee=ve.data,pe=ve.selectable,Q=ve.checkable,V=ve.expandedKeys,Ce=ve.selectedKeys,De=ve.checkedKeys,Ne=ve.loadedKeys,we=ve.loadingKeys,ke=ve.halfCheckedKeys,Se=ve.keyEntities,Ae=ve.disabled,je=ve.dragging,Be=ve.dragOverNodeKey,Ke=ve.dropPosition,Ue=ve.motion,xe=ve.height,Ge=ve.itemHeight,qe=ve.virtual,lt=ve.focusable,ot=ve.activeItem,bt=ve.focused,ht=ve.tabIndex,ut=ve.onKeyDown,Ze=ve.onFocus,Et=ve.onBlur,St=ve.onActiveChange,He=ve.onListChangeStart,it=ve.onListChangeEnd,ye=Object(p.a)(ve,["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"]),he=L.useRef(null);L.useImperativeHandle(de,function(){return{scrollTo:function(Wn){he.current.scrollTo(Wn)}}});var fe=L.useState(V),X=Object(_.a)(fe,2),$=X[0],te=X[1],oe=L.useState(ee),Te=Object(_.a)(oe,2),Pe=Te[0],Je=Te[1],Wt=L.useState(ee),Zt=Object(_.a)(Wt,2),Xt=Zt[0],an=Zt[1],fn=L.useState([]),It=Object(_.a)(fn,2),Kn=It[0],Sn=It[1],Jn=L.useState(null),Dn=Object(_.a)(Jn,2),on=Dn[0],qn=Dn[1];function Ft(){Je(ee),an(ee),Sn([]),qn(null),it()}L.useEffect(function(){te(V);var kn=m($,V);if(kn.key!==null)if(kn.add){var Wn=Pe.findIndex(function(Ur){var Ar=Ur.data.key;return Ar===kn.key}),Vr=y(h(Pe,ee,kn.key),qe,xe,Ge),br=Pe.slice();br.splice(Wn+1,0,f),an(br),Sn(Vr),qn("show")}else{var Pr=ee.findIndex(function(Ur){var Ar=Ur.data.key;return Ar===kn.key}),nr=y(h(ee,Pe,kn.key),qe,xe,Ge),dr=ee.slice();dr.splice(Pr+1,0,f),an(dr),Sn(nr),qn("hide")}else Pe!==ee&&(Je(ee),an(ee))},[V,ee]),L.useEffect(function(){je||Ft()},[je]);var Mt=Ue?Xt:ee,Rr={expandedKeys:V,selectedKeys:Ce,loadedKeys:Ne,loadingKeys:we,checkedKeys:De,halfCheckedKeys:ke,dragOverNodeKey:Be,dropPosition:Ke,keyEntities:Se};return L.createElement(L.Fragment,null,bt&&ot&&L.createElement("span",{style:a,"aria-live":"assertive"},A(ot)),L.createElement("div",{role:"tree"},L.createElement("input",{style:a,disabled:lt===!1||Ae,tabIndex:lt!==!1?ht:null,onKeyDown:ut,onFocus:Ze,onBlur:Et,value:"",onChange:r})),L.createElement(n.a,Object.assign({},ye,{data:Mt,itemKey:t,height:xe,fullHeight:!1,virtual:qe,itemHeight:Ge,prefixCls:"".concat(Z,"-list"),ref:he}),function(kn){var Wn=kn.pos,Vr=kn.data,br=Vr.key,Pr=Object(p.a)(Vr,["key"]),nr=kn.isStart,dr=kn.isEnd,Ur=Object(x.e)(br,Wn);delete Pr.children;var Ar=Object(x.f)(Ur,Rr);return L.createElement(o,Object.assign({},Pr,Ar,{active:ot&&br===ot.data.key,pos:Wn,data:kn.data,isStart:nr,isEnd:dr,motion:Ue,motionNodes:br===e?Kn:null,motionType:on,onMotionStart:He,onMotionEnd:Ft,treeNodeRequiredProps:Rr,onMouseMove:function(){St(null)}}))}))},B=L.forwardRef(U);B.displayName="NodeList";var G=B,J=K("NvD2"),F=function(ae){Object(R.a)(de,ae);var ve=Object(I.a)(de);function de(){var Z;return Object(N.a)(this,de),Z=ve.apply(this,arguments),Z.destroyed=!1,Z.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},Z.listRef=L.createRef(),Z.onNodeDragStart=function(ee,pe){var Q=Z.state,V=Q.expandedKeys,Ce=Q.keyEntities,De=Z.props.onDragStart,Ne=pe.props.eventKey;Z.dragNode=pe;var we=Object(C.b)(V,Ne);Z.setState({dragging:!0,dragNodesKeys:Object(C.g)(Ne,Ce)}),Z.setExpandedKeys(we),De&&De({event:ee,node:Object(x.b)(pe.props)})},Z.onNodeDragEnter=function(ee,pe){var Q=Z.state,V=Q.expandedKeys,Ce=Q.keyEntities,De=Q.dragNodesKeys,Ne=Z.props.onDragEnter,we=pe.props,ke=we.pos,Se=we.eventKey;if(!Z.dragNode||De.indexOf(Se)!==-1)return;var Ae=Object(C.c)(ee,pe);if(Z.dragNode.props.eventKey===Se&&Ae===0){Z.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){Z.setState({dragOverNodeKey:Se,dropPosition:Ae}),Z.delayedDragEnterLogic||(Z.delayedDragEnterLogic={}),Object.keys(Z.delayedDragEnterLogic).forEach(function(je){clearTimeout(Z.delayedDragEnterLogic[je])}),Z.delayedDragEnterLogic[ke]=window.setTimeout(function(){if(!Z.state.dragging)return;var je=Object(O.a)(V),Be=Ce[Se];Be&&(Be.children||[]).length&&(je=Object(C.a)(V,Se)),"expandedKeys"in Z.props||Z.setExpandedKeys(je),Ne&&Ne({event:ee,node:Object(x.b)(pe.props),expandedKeys:je})},400)},0)},Z.onNodeDragOver=function(ee,pe){var Q=Z.state.dragNodesKeys,V=Z.props.onDragOver,Ce=pe.props.eventKey;if(Q.indexOf(Ce)!==-1)return;if(Z.dragNode&&Ce===Z.state.dragOverNodeKey){var De=Object(C.c)(ee,pe);if(De===Z.state.dropPosition)return;Z.setState({dropPosition:De})}V&&V({event:ee,node:Object(x.b)(pe.props)})},Z.onNodeDragLeave=function(ee,pe){var Q=Z.props.onDragLeave;Z.setState({dragOverNodeKey:""}),Q&&Q({event:ee,node:Object(x.b)(pe.props)})},Z.onNodeDragEnd=function(ee,pe){var Q=Z.props.onDragEnd;Z.setState({dragOverNodeKey:""}),Z.cleanDragState(),Q&&Q({event:ee,node:Object(x.b)(pe.props)}),Z.dragNode=null},Z.onNodeDrop=function(ee,pe){var Q=Z.state,V=Q.dragNodesKeys,Ce=V===void 0?[]:V,De=Q.dropPosition,Ne=Z.props.onDrop,we=pe.props,ke=we.eventKey,Se=we.pos;if(Z.setState({dragOverNodeKey:""}),Z.cleanDragState(),Ce.indexOf(ke)!==-1){Object(P.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Ae=Object(C.k)(Se),je={event:ee,node:Object(x.b)(pe.props),dragNode:Z.dragNode?Object(x.b)(Z.dragNode.props):null,dragNodesKeys:Ce.slice(),dropPosition:De+Number(Ae[Ae.length-1]),dropToGap:!1};De!==0&&(je.dropToGap=!0),Ne&&Ne(je),Z.dragNode=null},Z.cleanDragState=function(){var ee=Z.state.dragging;ee&&Z.setState({dragging:!1})},Z.onNodeClick=function(ee,pe){var Q=Z.props.onClick;Q&&Q(ee,pe)},Z.onNodeDoubleClick=function(ee,pe){var Q=Z.props.onDoubleClick;Q&&Q(ee,pe)},Z.onNodeSelect=function(ee,pe){var Q=Z.state.selectedKeys,V=Z.state.keyEntities,Ce=Z.props,De=Ce.onSelect,Ne=Ce.multiple,we=pe.selected,ke=pe.key,Se=!we;Se?Ne?Q=Object(C.a)(Q,ke):Q=[ke]:Q=Object(C.b)(Q,ke);var Ae=Q.map(function(je){var Be=V[je];return Be?Be.node:null}).filter(function(je){return je});Z.setUncontrolledState({selectedKeys:Q}),De&&De(Q,{event:"select",selected:Se,node:pe,selectedNodes:Ae,nativeEvent:ee.nativeEvent})},Z.onNodeCheck=function(ee,pe,Q){var V=Z.state,Ce=V.keyEntities,De=V.checkedKeys,Ne=V.halfCheckedKeys,we=Z.props,ke=we.checkStrictly,Se=we.onCheck,Ae=pe.key,je,Be={event:"check",node:pe,checked:Q,nativeEvent:ee.nativeEvent};if(ke){var Ke=Q?Object(C.a)(De,Ae):Object(C.b)(De,Ae),Ue=Object(C.b)(Ne,Ae);je={checked:Ke,halfChecked:Ue},Be.checkedNodes=Ke.map(function(bt){return Ce[bt]}).filter(function(bt){return bt}).map(function(bt){return bt.node}),Z.setUncontrolledState({checkedKeys:Ke})}else{var xe=Object(J.a)([].concat(Object(O.a)(De),[Ae]),!0,Ce),Ge=xe.checkedKeys,qe=xe.halfCheckedKeys;if(!Q){var lt=new Set(Ge);lt.delete(Ae);var ot=Object(J.a)(Array.from(lt),{checked:!1,halfCheckedKeys:qe},Ce);Ge=ot.checkedKeys,qe=ot.halfCheckedKeys}je=Ge,Be.checkedNodes=[],Be.checkedNodesPositions=[],Be.halfCheckedKeys=qe,Ge.forEach(function(bt){var ht=Ce[bt];if(!ht)return;var ut=ht.node,Ze=ht.pos;Be.checkedNodes.push(ut),Be.checkedNodesPositions.push({node:ut,pos:Ze})}),Z.setUncontrolledState({checkedKeys:Ge},!1,{halfCheckedKeys:qe})}Se&&Se(je,Be)},Z.onNodeLoad=function(ee){return new Promise(function(pe){Z.setState(function(Q){var V=Q.loadedKeys,Ce=V===void 0?[]:V,De=Q.loadingKeys,Ne=De===void 0?[]:De,we=Z.props,ke=we.loadData,Se=we.onLoad,Ae=ee.key;if(!ke||Ce.indexOf(Ae)!==-1||Ne.indexOf(Ae)!==-1)return{};var je=ke(ee);return je.then(function(){var Be=Z.state,Ke=Be.loadedKeys,Ue=Be.loadingKeys,xe=Object(C.a)(Ke,Ae),Ge=Object(C.b)(Ue,Ae);Se&&Se(xe,{event:"load",node:ee}),Z.setUncontrolledState({loadedKeys:xe}),Z.setState({loadingKeys:Ge}),pe()}),{loadingKeys:Object(C.a)(Ne,Ae)}})})},Z.onNodeMouseEnter=function(ee,pe){var Q=Z.props.onMouseEnter;Q&&Q({event:ee,node:pe})},Z.onNodeMouseLeave=function(ee,pe){var Q=Z.props.onMouseLeave;Q&&Q({event:ee,node:pe})},Z.onNodeContextMenu=function(ee,pe){var Q=Z.props.onRightClick;Q&&(ee.preventDefault(),Q({event:ee,node:pe}))},Z.onFocus=function(){var ee=Z.props.onFocus;Z.setState({focused:!0}),ee&&ee.apply(void 0,arguments)},Z.onBlur=function(){var ee=Z.props.onBlur;Z.setState({focused:!1}),Z.onActiveChange(null),ee&&ee.apply(void 0,arguments)},Z.getTreeNodeRequiredProps=function(){var ee=Z.state,pe=ee.expandedKeys,Q=ee.selectedKeys,V=ee.loadedKeys,Ce=ee.loadingKeys,De=ee.checkedKeys,Ne=ee.halfCheckedKeys,we=ee.dragOverNodeKey,ke=ee.dropPosition,Se=ee.keyEntities;return{expandedKeys:pe||[],selectedKeys:Q||[],loadedKeys:V||[],loadingKeys:Ce||[],checkedKeys:De||[],halfCheckedKeys:Ne||[],dragOverNodeKey:we,dropPosition:ke,keyEntities:Se}},Z.setExpandedKeys=function(ee){var pe=Z.state.treeData,Q=Object(x.d)(pe,ee);Z.setUncontrolledState({expandedKeys:ee,flattenNodes:Q},!0)},Z.onNodeExpand=function(ee,pe){var Q=Z.state.expandedKeys,V=Z.state.listChanging,Ce=Z.props,De=Ce.onExpand,Ne=Ce.loadData,we=pe.key,ke=pe.expanded;if(V)return;var Se=Q.indexOf(we),Ae=!ke;if(Object(P.a)(ke&&Se!==-1||!ke&&Se===-1,"Expand state not sync with index check"),Ae?Q=Object(C.a)(Q,we):Q=Object(C.b)(Q,we),Z.setExpandedKeys(Q),De&&De(Q,{node:pe,expanded:Ae,nativeEvent:ee.nativeEvent}),Ae&&Ne){var je=Z.onNodeLoad(pe);je&&je.then(function(){var Be=Object(x.d)(Z.state.treeData,Q);Z.setUncontrolledState({flattenNodes:Be})})}},Z.onListChangeStart=function(){Z.setUncontrolledState({listChanging:!0})},Z.onListChangeEnd=function(){setTimeout(function(){Z.setUncontrolledState({listChanging:!1})})},Z.onActiveChange=function(ee){var pe=Z.state.activeKey,Q=Z.props.onActiveChange;if(pe===ee)return;Z.setState({activeKey:ee}),ee!==null&&Z.scrollTo({key:ee}),Q&&Q(ee)},Z.getActiveItem=function(){var ee=Z.state,pe=ee.activeKey,Q=ee.flattenNodes;return pe===null?null:Q.find(function(V){var Ce=V.data.key;return Ce===pe})||null},Z.offsetActiveKey=function(ee){var pe=Z.state,Q=pe.flattenNodes,V=pe.activeKey,Ce=Q.findIndex(function(we){var ke=we.data.key;return ke===V});Ce===-1&&ee<0&&(Ce=Q.length),Ce=(Ce+ee+Q.length)%Q.length;var De=Q[Ce];if(De){var Ne=De.data.key;Z.onActiveChange(Ne)}else Z.onActiveChange(null)},Z.onKeyDown=function(ee){var pe=Z.state,Q=pe.activeKey,V=pe.expandedKeys,Ce=pe.checkedKeys,De=Z.props,Ne=De.onKeyDown,we=De.checkable,ke=De.selectable;switch(ee.which){case T.a.UP:{Z.offsetActiveKey(-1),ee.preventDefault();break}case T.a.DOWN:{Z.offsetActiveKey(1),ee.preventDefault();break}}var Se=Z.getActiveItem();if(Se&&Se.data){var Ae=Z.getTreeNodeRequiredProps(),je=Se.data.isLeaf===!1||!!(Se.data.children||[]).length,Be=Object(x.b)(Object(j.a)(Object(j.a)({},Object(x.f)(Q,Ae)),{},{data:Se.data,active:!0}));switch(ee.which){case T.a.LEFT:{je&&V.includes(Q)?Z.onNodeExpand({},Be):Se.parent&&Z.onActiveChange(Se.parent.data.key),ee.preventDefault();break}case T.a.RIGHT:{je&&!V.includes(Q)?Z.onNodeExpand({},Be):Se.children&&Se.children.length&&Z.onActiveChange(Se.children[0].data.key),ee.preventDefault();break}case T.a.ENTER:case T.a.SPACE:{we&&!Be.disabled&&Be.checkable!==!1&&!Be.disableCheckbox?Z.onNodeCheck({},Be,!Ce.includes(Q)):!we&&ke&&!Be.disabled&&Be.selectable!==!1&&Z.onNodeSelect({},Be);break}}}Ne&&Ne(ee)},Z.setUncontrolledState=function(ee){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(Z.destroyed)return;var V=!1,Ce=!0,De={};Object.keys(ee).forEach(function(Ne){if(Ne in Z.props){Ce=!1;return}V=!0,De[Ne]=ee[Ne]}),V&&(!pe||Ce)&&Z.setState(Object(j.a)(Object(j.a)({},De),Q))},Z.scrollTo=function(ee){Z.listRef.current.scrollTo(ee)},Z}return Object(E.a)(de,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var ee,pe=this.state,Q=pe.focused,V=pe.flattenNodes,Ce=pe.keyEntities,De=pe.dragging,Ne=pe.activeKey,we=this.props,ke=we.prefixCls,Se=we.className,Ae=we.style,je=we.showLine,Be=we.focusable,Ke=we.tabIndex,Ue=Ke===void 0?0:Ke,xe=we.selectable,Ge=we.showIcon,qe=we.icon,lt=we.switcherIcon,ot=we.draggable,bt=we.checkable,ht=we.checkStrictly,ut=we.disabled,Ze=we.motion,Et=we.loadData,St=we.filterTreeNode,He=we.height,it=we.itemHeight,ye=we.virtual,he=we.titleRender,fe=we.onContextMenu,X=Object(C.f)(this.props);return L.createElement(w.a.Provider,{value:{prefixCls:ke,selectable:xe,showIcon:Ge,icon:qe,switcherIcon:lt,draggable:ot,checkable:bt,checkStrictly:ht,disabled:ut,keyEntities:Ce,loadData:Et,filterTreeNode:St,titleRender:he,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}},L.createElement("div",{className:S()(ke,Se,(ee={},Object(Ee.a)(ee,"".concat(ke,"-show-line"),je),Object(Ee.a)(ee,"".concat(ke,"-focused"),Q),Object(Ee.a)(ee,"".concat(ke,"-active-focused"),Ne!==null),ee))},L.createElement(G,Object.assign({ref:this.listRef,prefixCls:ke,style:Ae,data:V,disabled:ut,selectable:xe,checkable:!!bt,motion:Ze,dragging:De,height:He,itemHeight:it,virtual:ye,focusable:Be,focused:Q,tabIndex:Ue,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:fe},this.getTreeNodeRequiredProps(),X))))}}],[{key:"getDerivedStateFromProps",value:function(ee,pe){var Q=pe.prevProps,V={prevProps:ee};function Ce(qe){return!Q&&qe in ee||Q&&Q[qe]!==ee[qe]}var De;if(Ce("treeData")?De=ee.treeData:Ce("children")&&(Object(P.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),De=Object(x.c)(ee.children)),De){V.treeData=De;var Ne=Object(x.a)(De);V.keyEntities=Object(j.a)(Object(Ee.a)({},e,g),Ne.keyEntities)}var we=V.keyEntities||pe.keyEntities;if(Ce("expandedKeys")||Q&&Ce("autoExpandParent"))V.expandedKeys=ee.autoExpandParent||!Q&&ee.defaultExpandParent?Object(C.e)(ee.expandedKeys,we):ee.expandedKeys;else if(!Q&&ee.defaultExpandAll){var ke=Object(j.a)({},we);delete ke[e],V.expandedKeys=Object.keys(ke).map(function(qe){return ke[qe].key})}else!Q&&ee.defaultExpandedKeys&&(V.expandedKeys=ee.autoExpandParent||ee.defaultExpandParent?Object(C.e)(ee.defaultExpandedKeys,we):ee.defaultExpandedKeys);if(V.expandedKeys||delete V.expandedKeys,De||V.expandedKeys){var Se=Object(x.d)(De||pe.treeData,V.expandedKeys||pe.expandedKeys);V.flattenNodes=Se}if(ee.selectable&&(Ce("selectedKeys")?V.selectedKeys=Object(C.d)(ee.selectedKeys,ee):!Q&&ee.defaultSelectedKeys&&(V.selectedKeys=Object(C.d)(ee.defaultSelectedKeys,ee))),ee.checkable){var Ae;if(Ce("checkedKeys")?Ae=Object(C.j)(ee.checkedKeys)||{}:!Q&&ee.defaultCheckedKeys?Ae=Object(C.j)(ee.defaultCheckedKeys)||{}:De&&(Ae=Object(C.j)(ee.checkedKeys)||{checkedKeys:pe.checkedKeys,halfCheckedKeys:pe.halfCheckedKeys}),Ae){var je=Ae,Be=je.checkedKeys,Ke=Be===void 0?[]:Be,Ue=je.halfCheckedKeys,xe=Ue===void 0?[]:Ue;if(!ee.checkStrictly){var Ge=Object(J.a)(Ke,!0,we);Ke=Ge.checkedKeys,xe=Ge.halfCheckedKeys}V.checkedKeys=Ke,V.halfCheckedKeys=xe}}return Ce("loadedKeys")&&(V.loadedKeys=ee.loadedKeys),V}}]),de}(L.Component);F.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:[]},F.TreeNode=l.a;var q=F,re=Ye.b=q},fcSX:function(Pt,Ye,K){"use strict";var Ee=K("Ff2n"),j=K("1OyB"),O=K("vuIU"),N=K("Ji7U"),E=K("md7G"),R=K("foSv"),I=K("1W/9"),L=K("q1tI"),T=K("rePB"),P=K("JX7q"),b=K("TSYQ"),S=K.n(b),w=K("qx4F"),C=K("4IlW");function x(U){return Array.isArray(U)?U:[U]}var _={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},p=Object.keys(_).filter(function(U){if(typeof document=="undefined")return!1;var B=document.getElementsByTagName("html")[0];return U in(B?B.style:{})})[0],n=_[p];function u(U,B,G,J){U.addEventListener?U.addEventListener(B,G,J):U.attachEvent&&U.attachEvent("on".concat(B),G)}function l(U,B,G,J){U.removeEventListener?U.removeEventListener(B,G,J):U.attachEvent&&U.detachEvent("on".concat(B),G)}function v(U,B){var G=typeof U=="function"?U(B):U;return Array.isArray(G)?G.length===2?G:[G[0],G[1]]:[G]}var d=function(B){return!isNaN(parseFloat(B))&&isFinite(B)},o=!(typeof window!="undefined"&&window.document&&window.document.createElement),m=function U(B,G,J,F){if(!G||G===document||G instanceof Document)return!1;if(G===B.parentNode)return!0;var q=Math.max(Math.abs(J),Math.abs(F))===Math.abs(F),re=Math.max(Math.abs(J),Math.abs(F))===Math.abs(J),ae=G.scrollHeight-G.clientHeight,ve=G.scrollWidth-G.clientWidth,de=document.defaultView.getComputedStyle(G),Z=de.overflowY==="auto"||de.overflowY==="scroll",ee=de.overflowX==="auto"||de.overflowX==="scroll",pe=ae&&Z,Q=ve&ⅇreturn q&&(!pe||pe&&(G.scrollTop>=ae&&F<0||G.scrollTop<=0&&F>0))||re&&(!Q||Q&&(G.scrollLeft>=ve&&J<0||G.scrollLeft<=0&&J>0))?U(B,G.parentNode,J,F):!1};function h(U){var B=a();return function(){var J=Object(R.a)(U),F;if(B){var q=Object(R.a)(this).constructor;F=Reflect.construct(J,arguments,q)}else F=J.apply(this,arguments);return Object(E.a)(this,F)}}function a(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(U){return!1}}var r={},e=function(U){Object(N.a)(G,U);var B=h(G);function G(J){var F;return Object(j.a)(this,G),F=B.call(this,J),F.domFocus=function(){F.dom&&F.dom.focus()},F.removeStartHandler=function(q){if(q.touches.length>1)return;F.startPos={x:q.touches[0].clientX,y:q.touches[0].clientY}},F.removeMoveHandler=function(q){if(q.changedTouches.length>1)return;var re=q.currentTarget,ae=q.changedTouches[0].clientX-F.startPos.x,ve=q.changedTouches[0].clientY-F.startPos.y;(re===F.maskDom||re===F.handlerDom||re===F.contentDom&&m(re,q.target,ae,ve))&&q.cancelable&&q.preventDefault()},F.transitionEnd=function(q){var re=q.target;l(re,n,F.transitionEnd),re.style.transition=""},F.onKeyDown=function(q){if(q.keyCode===C.a.ESC){var re=F.props.onClose;q.stopPropagation(),re&&re(q)}},F.onWrapperTransitionEnd=function(q){var re=F.props,ae=re.open,ve=re.afterVisibleChange;q.target===F.contentWrapper&&q.propertyName.match(/transform$/)&&(F.dom.style.transition="",!ae&&F.getCurrentDrawerSome()&&(document.body.style.overflowX="",F.maskDom&&(F.maskDom.style.left="",F.maskDom.style.width="")),ve&&ve(!!ae))},F.openLevelTransition=function(){var q=F.props,re=q.open,ae=q.width,ve=q.height,de=F.getHorizontalBoolAndPlacementName(),Z=de.isHorizontal,ee=de.placementName,pe=F.contentDom?F.contentDom.getBoundingClientRect()[Z?"width":"height"]:0,Q=(Z?ae:ve)||pe;F.setLevelAndScrolling(re,ee,Q)},F.setLevelTransform=function(q,re,ae,ve){var de=F.props,Z=de.placement,ee=de.levelMove,pe=de.duration,Q=de.ease,V=de.showMask;F.levelDom.forEach(function(Ce){Ce.style.transition="transform ".concat(pe," ").concat(Q),u(Ce,n,F.transitionEnd);var De=q?ae:0;if(ee){var Ne=v(ee,{target:Ce,open:q});De=q?Ne[0]:Ne[1]||0}var we=typeof De=="number"?"".concat(De,"px"):De,ke=Z==="left"||Z==="top"?we:"-".concat(we);ke=V&&Z==="right"&&ve?"calc(".concat(ke," + ").concat(ve,"px)"):ke,Ce.style.transform=De?"".concat(re,"(").concat(ke,")"):""})},F.setLevelAndScrolling=function(q,re,ae){var ve=F.props.onChange;if(!o){var de=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(w.a)(!0):0;F.setLevelTransform(q,re,ae,de),F.toggleScrollingToDrawerAndBody(de)}ve&&ve(q)},F.toggleScrollingToDrawerAndBody=function(q){var re=F.props,ae=re.getOpenCount,ve=re.getContainer,de=re.showMask,Z=re.open,ee=ve&&ve(),pe=ae&&ae();if(ee&&ee.parentNode===document.body&&de){var Q=["touchstart"],V=[document.body,F.maskDom,F.handlerDom,F.contentDom];Z&&document.body.style.overflow!=="hidden"?(q&&F.addScrollingEffect(q),pe===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",V.forEach(function(Ce,De){if(!Ce)return;u(Ce,Q[De]||"touchmove",De?F.removeMoveHandler:F.removeStartHandler,F.passive)})):F.getCurrentDrawerSome()&&(pe||(document.body.style.overflow=""),document.body.style.touchAction="",q&&F.remScrollingEffect(q),V.forEach(function(Ce,De){if(!Ce)return;l(Ce,Q[De]||"touchmove",De?F.removeMoveHandler:F.removeStartHandler,F.passive)}))}},F.addScrollingEffect=function(q){var re=F.props,ae=re.placement,ve=re.duration,de=re.ease,Z=re.getOpenCount,ee=re.switchScrollingEffect,pe=Z&&Z();pe===1&&ee();var Q="width ".concat(ve," ").concat(de),V="transform ".concat(ve," ").concat(de);F.dom.style.transition="none";switch(ae){case"right":F.dom.style.transform="translateX(-".concat(q,"px)");break;case"top":case"bottom":F.dom.style.width="calc(100% - ".concat(q,"px)"),F.dom.style.transform="translateZ(0)";break;default:break}clearTimeout(F.timeout),F.timeout=setTimeout(function(){F.dom&&(F.dom.style.transition="".concat(V,",").concat(Q),F.dom.style.width="",F.dom.style.transform="")})},F.remScrollingEffect=function(q){var re=F.props,ae=re.placement,ve=re.duration,de=re.ease,Z=re.getOpenCount,ee=re.switchScrollingEffect,pe=Z&&Z();pe||ee(!0),p&&(document.body.style.overflowX="hidden"),F.dom.style.transition="none";var Q,V="width ".concat(ve," ").concat(de),Ce="transform ".concat(ve," ").concat(de);switch(ae){case"left":{F.dom.style.width="100%",V="width 0s ".concat(de," ").concat(ve);break}case"right":{F.dom.style.transform="translateX(".concat(q,"px)"),F.dom.style.width="100%",V="width 0s ".concat(de," ").concat(ve),F.maskDom&&(F.maskDom.style.left="-".concat(q,"px"),F.maskDom.style.width="calc(100% + ".concat(q,"px)"));break}case"top":case"bottom":{F.dom.style.width="calc(100% + ".concat(q,"px)"),F.dom.style.height="100%",F.dom.style.transform="translateZ(0)",Q="height 0s ".concat(de," ").concat(ve);break}default:break}clearTimeout(F.timeout),F.timeout=setTimeout(function(){F.dom&&(F.dom.style.transition="".concat(Ce,",").concat(Q?"".concat(Q,","):"").concat(V),F.dom.style.transform="",F.dom.style.width="",F.dom.style.height="")})},F.getCurrentDrawerSome=function(){return!Object.keys(r).some(function(q){return r[q]})},F.getLevelDom=function(q){var re=q.level,ae=q.getContainer;if(o)return;var ve=ae&&ae(),de=ve?ve.parentNode:null;if(F.levelDom=[],re==="all"){var Z=de?Array.prototype.slice.call(de.children):[];Z.forEach(function(ee){ee.nodeName!=="SCRIPT"&&ee.nodeName!=="STYLE"&&ee.nodeName!=="LINK"&&ee!==ve&&F.levelDom.push(ee)})}else re&&x(re).forEach(function(ee){document.querySelectorAll(ee).forEach(function(pe){F.levelDom.push(pe)})})},F.getHorizontalBoolAndPlacementName=function(){var q=F.props.placement,re=q==="left"||q==="right",ae="translate".concat(re?"X":"Y");return{isHorizontal:re,placementName:ae}},F.state={_self:Object(P.a)(F)},F}return Object(O.a)(G,[{key:"componentDidMount",value:function(){var F=this;if(!o){var q=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return q=!0,null}}))}catch(Z){}this.passive=q?{passive:!1}:!1}var re=this.props,ae=re.open,ve=re.getContainer,de=ve&&ve();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)),this.getLevelDom(this.props),ae&&(de&&de.parentNode===document.body&&(r[this.drawerId]=ae),this.openLevelTransition(),this.forceUpdate(function(){F.domFocus()}))}},{key:"componentDidUpdate",value:function(F){var q=this.props,re=q.open,ae=q.getContainer,ve=ae&&ae();re!==F.open&&(re&&this.domFocus(),ve&&ve.parentNode===document.body&&(r[this.drawerId]=!!re),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var F=this.props,q=F.getOpenCount,re=F.open,ae=F.switchScrollingEffect,ve=typeof q=="function"&&q();delete r[this.drawerId],re&&(this.setLevelTransform(!1),document.body.style.touchAction=""),ve||(document.body.style.overflow="",ae(!0))}},{key:"render",value:function(){var F,q=this,re=this.props,ae=re.className,ve=re.children,de=re.style,Z=re.width,ee=re.height,pe=re.defaultOpen,Q=re.open,V=re.prefixCls,Ce=re.placement,De=re.level,Ne=re.levelMove,we=re.ease,ke=re.duration,Se=re.getContainer,Ae=re.handler,je=re.onChange,Be=re.afterVisibleChange,Ke=re.showMask,Ue=re.maskClosable,xe=re.maskStyle,Ge=re.onClose,qe=re.onHandleClick,lt=re.keyboard,ot=re.getOpenCount,bt=re.switchScrollingEffect,ht=Object(Ee.a)(re,["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"]),ut=this.dom?Q:!1,Ze=S()(V,(F={},Object(T.a)(F,"".concat(V,"-").concat(Ce),!0),Object(T.a)(F,"".concat(V,"-open"),ut),Object(T.a)(F,ae||"",!!ae),Object(T.a)(F,"no-mask",!Ke),F)),Et=this.getHorizontalBoolAndPlacementName(),St=Et.placementName,He=Ce==="left"||Ce==="top"?"-100%":"100%",it=ut?"":"".concat(St,"(").concat(He,")"),ye=Ae&&L.cloneElement(Ae,{onClick:function(fe){Ae.props.onClick&&Ae.props.onClick(),qe&&qe(fe)},ref:function(fe){q.handlerDom=fe}});return L.createElement("div",Object.assign({},ht,{tabIndex:-1,className:Ze,style:de,ref:function(fe){q.dom=fe},onKeyDown:ut&<?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),Ke&&L.createElement("div",{className:"".concat(V,"-mask"),onClick:Ue?Ge:void 0,style:xe,ref:function(fe){q.maskDom=fe}}),L.createElement("div",{className:"".concat(V,"-content-wrapper"),style:{transform:it,msTransform:it,width:d(Z)?"".concat(Z,"px"):Z,height:d(ee)?"".concat(ee,"px"):ee},ref:function(fe){q.contentWrapper=fe}},L.createElement("div",{className:"".concat(V,"-content"),ref:function(fe){q.contentDom=fe},onTouchStart:ut&&Ke?this.removeStartHandler:void 0,onTouchMove:ut&&Ke?this.removeMoveHandler:void 0},ve),ye))}}],[{key:"getDerivedStateFromProps",value:function(F,q){var re=q.prevProps,ae=q._self,ve={prevProps:F};if(re!==void 0){var de=F.placement,Z=F.level;de!==re.placement&&(ae.contentDom=null),Z!==re.level&&ae.getLevelDom(F)}return ve}}]),G}(L.Component);e.defaultProps={switchScrollingEffect:function(){}};var i=e;function g(U){var B=f();return function(){var J=Object(R.a)(U),F;if(B){var q=Object(R.a)(this).constructor;F=Reflect.construct(J,arguments,q)}else F=J.apply(this,arguments);return Object(E.a)(this,F)}}function f(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(U){return!1}}var y=function(U){Object(N.a)(G,U);var B=g(G);function G(J){var F;Object(j.a)(this,G),F=B.call(this,J),F.onHandleClick=function(re){var ae=F.props,ve=ae.onHandleClick,de=ae.open;if(ve&&ve(re),typeof de=="undefined"){var Z=F.state.open;F.setState({open:!Z})}},F.onClose=function(re){var ae=F.props,ve=ae.onClose,de=ae.open;ve&&ve(re),typeof de=="undefined"&&F.setState({open:!1})};var q=typeof J.open!="undefined"?J.open:!!J.defaultOpen;return F.state={open:q},"onMaskClick"in J&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),F}return Object(O.a)(G,[{key:"render",value:function(){var F=this,q=this.props,re=q.defaultOpen,ae=q.getContainer,ve=q.wrapperClassName,de=q.forceRender,Z=q.handler,ee=Object(Ee.a)(q,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),pe=this.state.open;if(!ae)return L.createElement("div",{className:ve,ref:function(Ce){F.dom=Ce}},L.createElement(i,Object.assign({},ee,{open:pe,handler:Z,getContainer:function(){return F.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var Q=!!Z||de;return L.createElement(I.a,{visible:pe,forceRender:Q,getContainer:ae,wrapperClassName:ve},function(V){var Ce=V.visible,De=V.afterClose,Ne=Object(Ee.a)(V,["visible","afterClose"]);return L.createElement(i,Object.assign({},ee,Ne,{open:Ce!==void 0?Ce:pe,afterVisibleChange:De!==void 0?De:ee.afterVisibleChange,handler:Z,onClose:F.onClose,onHandleClick:F.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function(F,q){var re=q.prevProps,ae={prevProps:F};return typeof re!="undefined"&&F.open!==re.open&&(ae.open=F.open),ae}}]),G}(L.Component);y.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:L.createElement("div",{className:"drawer-handle"},L.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var t=y,A=Ye.a=t},i8i3:function(Pt,Ye,K){Pt.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:function(Pt,Ye,K){Pt.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:function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return w});var Ee=K("qVdP"),j=K("jsC+"),O=K("lUTK"),N=K("BvKs"),E=K("tJVT"),R=K("q1tI"),I=K.n(R),L=K("Q0Vu"),T=K.n(L),P=[{name:"\u7F16\u7A0B\u9898",value:"PROGRAM"},{name:"\u5355\u9009\u9898",value:"SINGLE"},{name:"\u591A\u9009\u9898",value:"MULTIPLE"},{name:"\u5224\u65AD\u9898",value:"JUDGMENT"},{name:"\u586B\u7A7A\u9898",value:"COMPLETION"},{name:"\u7B80\u7B54\u9898",value:"SUBJECTIVE"},{name:"\u7EC4\u5408\u9898",value:"COMBINATION"}],b=[{name:"\u7B80\u5355",value:1},{name:"\u9002\u4E2D",value:2},{name:"\u56F0\u96BE",value:3}],S=[{name:"\u968F\u673A\u7EC4\u5377",value:1},{name:"\u4EBA\u5DE5\u7EC4\u5377",value:2}],w=function(x){var _=x.showSelectAll,p=_===void 0?!1:_,n=x.disciplinesData,u=n===void 0?[]:n,l=x.knowledgeData,v=l===void 0?[]:l,d=x.directionValue,o=x.subDisciplineValue,m=x.typeValue,h=x.knowledgeValue,a=x.showKnowledge,r=a===void 0?!1:a,e=x.showRandomType,i=e===void 0?!1:e,g=x.difficultyValue,f=x.randomValue,y=x.selectAll,t=x.className,A=x.showShixun,U=A===void 0?!1:A,B=x.showItemType,G=B===void 0?!0:B,J=x.onShixunChange,F=J===void 0?function(){}:J,q=x.onDirectionChange,re=q===void 0?function(){}:q,ae=x.onTypeChange,ve=ae===void 0?function(){}:ae,de=x.onDifficultyChange,Z=de===void 0?function(){}:de,ee=x.onKnowledgeChange,pe=ee===void 0?function(){}:ee,Q=x.onRandomChange,V=Q===void 0?function(){}:Q,Ce=Object(R.useState)(0),De=Object(E.a)(Ce,2),Ne=De[0],we=De[1],ke=Object(R.useRef)(null),Se=Object(R.useState)(0),Ae=Object(E.a)(Se,2),je=Ae[0],Be=Ae[1],Ke=Object(R.useRef)(null);Object(R.useEffect)(function(){if(u.length!==0){var xe;(ke==null||((xe=ke.current)===null||xe===void 0)?void 0:xe.clientHeight)>90?we(1):we(0)}u.length===0&&we(0)},[u]),Object(R.useEffect)(function(){if(console.log(v.length===0,"\u6570\u91CF"),v.length!==0){var xe,Ge;console.log(Ke==null||((xe=Ke.current)===null||xe===void 0)?void 0:xe.clientHeight,"\u9AD8\u5EA6"),(Ke==null||((Ge=Ke.current)===null||Ge===void 0)?void 0:Ge.clientHeight)>90?Be(1):Be(0)}v.length===0&&Be(0)},[v]);var Ue=function(){var Ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],qe=arguments.length>1?arguments[1]:void 0;return I.a.createElement(N.a,{className:T.a.subMenu},Ge.map(function(lt){return I.a.createElement(N.a.Item,{key:lt.id},I.a.createElement("a",{className:"".concat(T.a.subItem," ").concat(o===lt.id?T.a.subActive:""),onClick:function(){return re(qe,lt.id)}},lt.name))}))};return I.a.createElement("aside",{className:t?"".concat(T.a.main," ").concat(t):T.a.main},I.a.createElement("div",{className:T.a.wrap},I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u65B9\u5411:"),I.a.createElement("span",null,I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d?"":T.a.active," "),onClick:function(){return re(null)}},"\u5168\u90E8")),I.a.createElement("div",{className:T.a.directionContentWrap,style:{overflow:"hidden",height:Ne===1?88:"auto"}},u.map(function(xe){var Ge;return I.a.createElement(I.a.Fragment,{key:xe.id},((Ge=xe.sub_disciplines)===null||Ge===void 0?void 0:Ge.length)>0?I.a.createElement(j.a,{placement:"bottomLeft",overlayStyle:{width:600},getPopupContainer:function(lt){return lt.parentNode},overlay:function(){return Ue(xe.sub_disciplines,xe.id)}},I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d===xe.id?T.a.active:""," "),onClick:function(){return re(xe.id)}},xe.name)):I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d===xe.id?T.a.active:""," "),onClick:function(){return re(xe.id)}},xe.name))})),I.a.createElement("div",{className:T.a.directionContentWrap,ref:ke,style:{height:"auto",position:"fixed",left:0,top:0,width:1024,visibility:"hidden"}},u.map(function(xe){var Ge;return I.a.createElement(I.a.Fragment,{key:xe.id},((Ge=xe.sub_disciplines)===null||Ge===void 0?void 0:Ge.length)>0?I.a.createElement(j.a,{placement:"bottomLeft",overlayStyle:{width:600},getPopupContainer:function(lt){return lt.parentNode},overlay:function(){return Ue(xe.sub_disciplines,xe.id)}},I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d===xe.id?T.a.active:""," "),onClick:function(){return re(xe.id)}},xe.name)):I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d===xe.id?T.a.active:""," "),onClick:function(){return re(xe.id)}},xe.name))})),!!Ne&&I.a.createElement("div",{className:T.a.action},Ne===1&&I.a.createElement("span",{onClick:function(){return we(2)}},"\u5C55\u5F00",I.a.createElement("i",{className:"iconfont icon-xiala"})),Ne===2&&I.a.createElement("span",{onClick:function(){return we(1)}},"\u6536\u8D77",I.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))),r&&I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u77E5\u8BC6\u70B9:"),I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(h===-1?T.a.active:""," "),onClick:function(){return pe(-1)}},"\u6211\u7684"),I.a.createElement("div",{className:T.a.directionContentWrap,style:{overflow:"hidden",height:je===1?88:"auto"}},v.map(function(xe){return I.a.createElement("li",{key:xe.id,className:"".concat(T.a.directionItem," ").concat(h===xe.id?T.a.active:""," "),onClick:function(){return pe(xe.id)}},xe.name)})),I.a.createElement("div",{ref:Ke,className:T.a.directionContentWrap,style:{height:"auto",position:"fixed",left:0,top:0,width:1010,visibility:"hidden"}},v.map(function(xe){return I.a.createElement("li",{key:xe.id,className:"".concat(T.a.directionItem," ").concat(h===xe.id?T.a.active:""," "),onClick:function(){return pe(xe.id)}},xe.name)})),!!je&&I.a.createElement("div",{className:T.a.action},je===1&&I.a.createElement("span",{onClick:function(){return Be(2)}},"\u5C55\u5F00",I.a.createElement("i",{className:"iconfont icon-xiala"})),je===2&&I.a.createElement("span",{onClick:function(){return Be(1)}},"\u6536\u8D77",I.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))),G&&I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u9898\u578B:"),I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(m?"":T.a.active," "),onClick:function(){return ve(null)}},"\u5168\u90E8"),I.a.createElement("div",{className:T.a.directionContentWrap},P.map(function(xe){return I.a.createElement("li",{key:xe.name,className:"".concat(T.a.directionItem," ").concat(m===xe.value?T.a.active:""," "),onClick:function(){return ve(xe.value)}},xe.name)}),U&&I.a.createElement("li",{key:"\u5B9E\u8BAD\u9898",className:T.a.directionItem,onClick:function(){return F()}},"\u5B9E\u8BAD\u9898"))),I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u96BE\u5EA6:"),I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(g?"":T.a.active," "),onClick:function(){return Z(null)}},"\u5168\u90E8"),I.a.createElement("div",{className:T.a.directionContentWrap},b.map(function(xe){return I.a.createElement("li",{key:xe.name,className:"".concat(T.a.directionItem," ").concat(g===xe.value?T.a.active:""," "),onClick:function(){return Z(xe.value)}},xe.name)}))),i&&I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u7C7B\u578B:"),I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(f?"":T.a.active," "),onClick:function(){return V(null)}},"\u5168\u90E8"),I.a.createElement("div",{className:T.a.directionContentWrap},S.map(function(xe){return I.a.createElement("li",{key:xe.name,className:"".concat(T.a.directionItem," ").concat(f===xe.value?T.a.active:""," "),onClick:function(){return V(xe.value)}},xe.name)})))))}},k3GJ:function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return ia});var Ee=K("rePB"),j=K("ODXe"),O=K("Ff2n"),N=K("VTBJ"),E=K("q1tI"),R=K("TSYQ"),I=K.n(R),L=K("Zm9Q"),T=K("6cGi"),P=K("KQm4"),b=K("xEkU"),S=K.n(b),w=K("t23M");function C(ne){var me=Object(E.useRef)(),ue=Object(E.useRef)(!1);function ie(){for(var H=arguments.length,Y=new Array(H),z=0;z<H;z++)Y[z]=arguments[z];ue.current||(S.a.cancel(me.current),me.current=S()(function(){ne.apply(void 0,Y)}))}return Object(E.useEffect)(function(){return function(){ue.current=!0,S.a.cancel(me.current)}},[]),ie}function x(ne){var me=Object(E.useRef)([]),ue=Object(E.useState)({}),ie=Object(j.a)(ue,2),H=ie[1],Y=Object(E.useRef)(typeof ne=="function"?ne():ne),z=C(function(){var le=Y.current;me.current.forEach(function(_e){le=_e(le)}),me.current=[],Y.current=le,H({})});function se(le){me.current.push(le),z()}return[Y.current,se]}var _=K("4IlW");function p(ne,me){var ue,ie=ne.prefixCls,H=ne.id,Y=ne.active,z=ne.rtl,se=ne.tab,le=se.key,_e=se.tab,be=se.disabled,Oe=se.closeIcon,Ie=ne.tabBarGutter,nt=ne.tabPosition,et=ne.closable,ct=ne.renderWrapper,Yt=ne.removeAriaLabel,dn=ne.editable,en=ne.onClick,sn=ne.onRemove,cn=ne.onFocus,ln="".concat(ie,"-tab");E.useEffect(function(){return sn},[]);var nn={};nt==="top"||nt==="bottom"?nn[z?"marginLeft":"marginRight"]=Ie:nn.marginBottom=Ie;var mn=dn&&et!==!1&&!be;function hn($t){if(be)return;en($t)}function Xn($t){$t.preventDefault(),$t.stopPropagation(),dn.onEdit("remove",{key:le,event:$t})}var En=E.createElement("div",{key:le,ref:me,className:I()(ln,(ue={},Object(Ee.a)(ue,"".concat(ln,"-with-remove"),mn),Object(Ee.a)(ue,"".concat(ln,"-active"),Y),Object(Ee.a)(ue,"".concat(ln,"-disabled"),be),ue)),style:nn,onClick:hn},E.createElement("div",{role:"tab","aria-selected":Y,id:H&&"".concat(H,"-tab-").concat(le),className:"".concat(ln,"-btn"),"aria-controls":H&&"".concat(H,"-panel-").concat(le),"aria-disabled":be,tabIndex:be?null:0,onClick:function(Vt){Vt.stopPropagation(),hn(Vt)},onKeyDown:function(Vt){[_.a.SPACE,_.a.ENTER].includes(Vt.which)&&(Vt.preventDefault(),hn(Vt))},onFocus:cn},_e),mn&&E.createElement("button",{type:"button","aria-label":Yt||"remove",tabIndex:0,className:"".concat(ln,"-remove"),onClick:function(Vt){Vt.stopPropagation(),Xn(Vt)}},Oe||dn.removeIcon||"\xD7"));return ct&&(En=ct(En)),En}var n=E.forwardRef(p),u={width:0,height:0,left:0,top:0};function l(ne,me,ue){return Object(E.useMemo)(function(){for(var ie,H=new Map,Y=me.get((ie=ne[0])===null||ie===void 0?void 0:ie.key)||u,z=Y.left+Y.width,se=0;se<ne.length;se+=1){var le=ne[se].key,_e=me.get(le);if(!_e){var be;_e=me.get((be=ne[se-1])===null||be===void 0?void 0:be.key)||u}var Oe=H.get(le)||Object(N.a)({},_e);Oe.right=z-Oe.left-Oe.width,H.set(le,Oe)}return H},[ne.map(function(ie){return ie.key}).join("_"),me,ue])}var v={width:0,height:0,left:0,top:0,right:0};function d(ne,me,ue,ie,H){var Y=H.tabs,z=H.tabPosition,se=H.rtl,le,_e,be;["top","bottom"].includes(z)?(le="width",_e=se?"right":"left",be=Math.abs(me.left)):(le="height",_e="top",be=-me.top);var Oe=me[le],Ie=ue[le],nt=ie[le],et=Oe;return Ie+nt>Oe&&(et=Oe-nt),Object(E.useMemo)(function(){if(!Y.length)return[0,0];for(var ct=Y.length,Yt=ct,dn=0;dn<ct;dn+=1){var en=ne.get(Y[dn].key)||v;if(en[_e]+en[le]>be+et){Yt=dn-1;break}}for(var sn=0,cn=ct-1;cn>=0;cn-=1){var ln=ne.get(Y[cn].key)||v;if(ln[_e]<be){sn=cn+1;break}}return[sn,Yt]},[ne,be,et,z,Y.map(function(ct){return ct.key}).join("_"),se])}var o=K("wx14"),m=K("1OyB"),h=K("vuIU"),a=K("JX7q"),r=K("Ji7U"),e=K("LK+K"),i=K("I8Z2"),g=K("bT9E"),f=K("2GS6"),y=K("Gytx"),t=K.n(y),A=K("U8pU"),U=/iPhone/i,B=/iPod/i,G=/iPad/i,J=/\bAndroid(?:.+)Mobile\b/i,F=/Android/i,q=/\bAndroid(?:.+)SD4930UR\b/i,re=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,ae=/Windows Phone/i,ve=/\bWindows(?:.+)ARM\b/i,de=/BlackBerry/i,Z=/BB10/i,ee=/Opera Mini/i,pe=/\b(CriOS|Chrome)(?:.+)Mobile/i,Q=/Mobile(?:.+)Firefox\b/i;function V(ne,me){return ne.test(me)}function Ce(ne){var me=ne||(typeof navigator!="undefined"?navigator.userAgent:""),ue=(me||"").split("[FBAN");if(typeof ue[1]!="undefined"){var ie=ue,H=Object(j.a)(ie,1);me=H[0]}if(ue=me.split("Twitter"),typeof ue[1]!="undefined"){var Y=ue,z=Object(j.a)(Y,1);me=z[0]}var se={apple:{phone:V(U,me)&&!V(ae,me),ipod:V(B,me),tablet:!V(U,me)&&V(G,me)&&!V(ae,me),device:(V(U,me)||V(B,me)||V(G,me))&&!V(ae,me)},amazon:{phone:V(q,me),tablet:!V(q,me)&&V(re,me),device:V(q,me)||V(re,me)},android:{phone:!V(ae,me)&&V(q,me)||!V(ae,me)&&V(J,me),tablet:!V(ae,me)&&!V(q,me)&&!V(J,me)&&(V(re,me)||V(F,me)),device:!V(ae,me)&&(V(q,me)||V(re,me)||V(J,me)||V(F,me))||V(/\bokhttp\b/i,me)},windows:{phone:V(ae,me),tablet:V(ve,me),device:V(ae,me)||V(ve,me)},other:{blackberry:V(de,me),blackberry10:V(Z,me),opera:V(ee,me),firefox:V(Q,me),chrome:V(pe,me),device:V(de,me)||V(Z,me)||V(ee,me)||V(Q,me)||V(pe,me)},any:null,phone:null,tablet:null};return se.any=se.apple.device||se.android.device||se.windows.device||se.other.device,se.phone=se.apple.phone||se.android.phone||se.windows.phone,se.tablet=se.apple.tablet||se.android.tablet||se.windows.tablet,se}var De=Object(N.a)(Object(N.a)({},Ce()),{},{isMobile:Ce}),Ne=De;function we(){}function ke(ne,me,ue){var ie=me||"";return ne.key||"".concat(ie,"item_").concat(ue)}function Se(ne){return"".concat(ne,"-menu-")}function Ae(ne,me){var ue=-1;E.Children.forEach(ne,function(ie){ue+=1,ie&&ie.type&&ie.type.isMenuItemGroup?E.Children.forEach(ie.props.children,function(H){ue+=1,me(H,ue)}):me(ie,ue)})}function je(ne,me,ue){if(!ne||ue.find)return;E.Children.forEach(ne,function(ie){if(ie){var H=ie.type;if(!H||!(H.isSubMenu||H.isMenuItem||H.isMenuItemGroup))return;me.indexOf(ie.key)!==-1?ue.find=!0:ie.props.children&&je(ie.props.children,me,ue)}})}var Be=["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"],Ke=function(me){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ie=me&&typeof me.getBoundingClientRect=="function"&&me.getBoundingClientRect().width;if(ie){if(ue){var H=getComputedStyle(me),Y=H.marginLeft,z=H.marginRight;ie+=+Y.replace("px","")+ +z.replace("px","")}ie=+ie.toFixed(6)}return ie||0},Ue=function(me,ue,ie){me&&Object(A.a)(me.style)==="object"&&(me.style[ue]=ie)},xe=function(){return Ne.any},Ge=K("bdgK"),qe=K("i8i4"),lt=K.n(qe),ot=K("wgJM"),bt=K("l4aY"),ht=K("m+aA"),ut=K("c+Xe"),Ze=K("zT1h"),Et=K("QC+M");function St(ne,me,ue){return ue?ne[0]===me[0]:ne[0]===me[0]&&ne[1]===me[1]}function He(ne,me,ue){var ie=ne[me]||{};return Object(N.a)(Object(N.a)({},ie),ue)}function it(ne,me,ue,ie){for(var H=ue.points,Y=Object.keys(ne),z=0;z<Y.length;z+=1){var se=Y[z];if(St(ne[se].points,H,ie))return"".concat(me,"-placement-").concat(se)}return""}var ye=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var ne=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(ne)||/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(ne==null?void 0:ne.substr(0,4)))},he=K("MNnm");function fe(ne,me){var ue={};return ue[ne.toLowerCase()]=me.toLowerCase(),ue["Webkit".concat(ne)]="webkit".concat(me),ue["Moz".concat(ne)]="moz".concat(me),ue["ms".concat(ne)]="MS".concat(me),ue["O".concat(ne)]="o".concat(me.toLowerCase()),ue}function X(ne,me){var ue={animationend:fe("Animation","AnimationEnd"),transitionend:fe("Transition","TransitionEnd")};return ne&&("AnimationEvent"in me||delete ue.animationend.animation,"TransitionEvent"in me||delete ue.transitionend.transition),ue}var $=X(Object(he.a)(),typeof window!="undefined"?window:{}),te={};if(Object(he.a)()){var oe=document.createElement("div");te=oe.style}var Te={};function Pe(ne){if(Te[ne])return Te[ne];var me=$[ne];if(me)for(var ue=Object.keys(me),ie=ue.length,H=0;H<ie;H+=1){var Y=ue[H];if(Object.prototype.hasOwnProperty.call(me,Y)&&Y in te)return Te[ne]=me[Y],Te[ne]}return""}var Je=Pe("animationend"),Wt=Pe("transitionend"),Zt=!!(Je&&Wt),Xt=Je||"animationend",an=Wt||"transitionend";function fn(ne,me){if(!ne)return null;if(Object(A.a)(ne)==="object"){var ue=me.replace(/-\w/g,function(ie){return ie[1].toUpperCase()});return ne[ue]}return"".concat(ne,"-").concat(me)}var It="none",Kn="appear",Sn="enter",Jn="leave",Dn="none",on="prepare",qn="start",Ft="active",Mt="end";function Rr(ne){var me=Object(E.useRef)(!1),ue=Object(E.useState)(ne),ie=Object(j.a)(ue,2),H=ie[0],Y=ie[1];function z(se){me.current||Y(se)}return Object(E.useEffect)(function(){return function(){me.current=!0}},[]),[H,z]}var kn=Object(he.a)()?E.useLayoutEffect:E.useEffect,Wn=kn,Vr=function(){var ne=E.useRef(null);function me(){ot.a.cancel(ne.current)}function ue(ie){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;me();var Y=Object(ot.a)(function(){H<=1?ie({isCanceled:function(){return Y!==ne.current}}):ue(ie,H-1)});ne.current=Y}return E.useEffect(function(){return function(){me()}},[]),[ue,me]},br=[on,qn,Ft,Mt],Pr=!1,nr=!0;function dr(ne){return ne===Ft||ne===Mt}var Ur=function(ne,me){var ue=E.useState(Dn),ie=Object(j.a)(ue,2),H=ie[0],Y=ie[1],z=Vr(),se=Object(j.a)(z,2),le=se[0],_e=se[1];function be(){Y(on)}return Wn(function(){if(H!==Dn&&H!==Mt){var Oe=br.indexOf(H),Ie=br[Oe+1],nt=me(H);nt===Pr?Y(Ie):le(function(et){function ct(){if(et.isCanceled())return;Y(Ie)}nt===!0?ct():Promise.resolve(nt).then(ct)})}},[ne,H]),E.useEffect(function(){return function(){_e()}},[]),[be,H]},Ar=function(ne){var me=Object(E.useRef)(),ue=Object(E.useRef)(ne);ue.current=ne;var ie=E.useCallback(function(z){ue.current(z)},[]);function H(z){z&&(z.removeEventListener(an,ie),z.removeEventListener(Xt,ie))}function Y(z){me.current&&me.current!==z&&H(me.current),z&&z!==me.current&&(z.addEventListener(an,ie),z.addEventListener(Xt,ie),me.current=z)}return E.useEffect(function(){return function(){H(me.current)}},[]),[Y,H]};function ua(ne,me,ue,ie){var H=ie.motionEnter,Y=H===void 0?!0:H,z=ie.motionAppear,se=z===void 0?!0:z,le=ie.motionLeave,_e=le===void 0?!0:le,be=ie.motionDeadline,Oe=ie.motionLeaveImmediately,Ie=ie.onAppearPrepare,nt=ie.onEnterPrepare,et=ie.onLeavePrepare,ct=ie.onAppearStart,Yt=ie.onEnterStart,dn=ie.onLeaveStart,en=ie.onAppearActive,sn=ie.onEnterActive,cn=ie.onLeaveActive,ln=ie.onAppearEnd,nn=ie.onEnterEnd,mn=ie.onLeaveEnd,hn=ie.onVisibleChanged,Xn=Rr(),En=Object(j.a)(Xn,2),$t=En[0],Vt=En[1],vn=Rr(It),pn=Object(j.a)(vn,2),Lt=pn[0],Cn=pn[1],Fn=Rr(null),qt=Object(j.a)(Fn,2),gn=qt[0],Gn=qt[1],hr=Object(E.useRef)(!1),Sr=Object(E.useRef)(null),Qn=Object(E.useRef)(!1),wr=Object(E.useRef)(null);function Kr(){var Ln=ue();return Ln||wr.current}var Dr=Object(E.useRef)(!1);function kr(Ln){var Tn=Kr();if(Ln&&!Ln.deadline&&Ln.target!==Tn)return;var lr;Lt===Kn&&Dr.current?lr=ln==null?void 0:ln(Tn,Ln):Lt===Sn&&Dr.current?lr=nn==null?void 0:nn(Tn,Ln):Lt===Jn&&Dr.current&&(lr=mn==null?void 0:mn(Tn,Ln)),lr!==!1&&!Qn.current&&(Cn(It),Gn(null))}var rn=Ar(kr),fr=Object(j.a)(rn,1),sr=fr[0],er=E.useMemo(function(){var Ln,Tn,lr;switch(Lt){case"appear":return Ln={},Object(Ee.a)(Ln,on,Ie),Object(Ee.a)(Ln,qn,ct),Object(Ee.a)(Ln,Ft,en),Ln;case"enter":return Tn={},Object(Ee.a)(Tn,on,nt),Object(Ee.a)(Tn,qn,Yt),Object(Ee.a)(Tn,Ft,sn),Tn;case"leave":return lr={},Object(Ee.a)(lr,on,et),Object(Ee.a)(lr,qn,dn),Object(Ee.a)(lr,Ft,cn),lr;default:return{}}},[Lt]),Wr=Ur(Lt,function(Ln){if(Ln===on){var Tn=er[on];return Tn?Tn(Kr()):Pr}if(Mn in er){var lr;Gn(((lr=er[Mn])===null||lr===void 0?void 0:lr.call(er,Kr(),null))||null)}return Mn===Ft&&(sr(Kr()),be>0&&(clearTimeout(Sr.current),Sr.current=setTimeout(function(){kr({deadline:!0})},be))),nr}),Hr=Object(j.a)(Wr,2),$r=Hr[0],Mn=Hr[1],Ir=dr(Mn);Dr.current=Ir,Wn(function(){Vt(me);var Ln=hr.current;if(hr.current=!0,!ne)return;var Tn;!Ln&&me&&se&&(Tn=Kn),Ln&&me&&Y&&(Tn=Sn),(Ln&&!me&&_e||!Ln&&Oe&&!me&&_e)&&(Tn=Jn),Tn&&(Cn(Tn),$r())},[me]),Object(E.useEffect)(function(){(Lt===Kn&&!se||Lt===Sn&&!Y||Lt===Jn&&!_e)&&Cn(It)},[se,Y,_e]),Object(E.useEffect)(function(){return function(){clearTimeout(Sr.current),Qn.current=!0}},[]),Object(E.useEffect)(function(){$t!==void 0&&Lt===It&&(hn==null||hn($t))},[$t,Lt]);var Xr=gn;return er[on]&&Mn===qn&&(Xr=Object(N.a)({transition:"none"},Xr)),[Lt,Mn,Xr,$t!=null?$t:me]}var Er=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(){return Object(m.a)(this,ue),me.apply(this,arguments)}return Object(h.a)(ue,[{key:"render",value:function(){return this.props.children}}]),ue}(E.Component),ya=Er;function da(ne){var me=ne;Object(A.a)(ne)==="object"&&(me=ne.transitionSupport);function ue(H){return!!(H.motionName&&me)}var ie=E.forwardRef(function(H,Y){var z=H.visible,se=z===void 0?!0:z,le=H.removeOnLeave,_e=le===void 0?!0:le,be=H.forceRender,Oe=H.children,Ie=H.motionName,nt=H.leavedClassName,et=H.eventProps,ct=ue(H),Yt=Object(E.useRef)(),dn=Object(E.useRef)();function en(){try{return Object(ht.a)(Yt.current||dn.current)}catch(Cn){return null}}var sn=ua(ct,se,en,H),cn=Object(j.a)(sn,4),ln=cn[0],nn=cn[1],mn=cn[2],hn=cn[3],Xn=E.useRef(hn);hn&&(Xn.current=!0);var En=Object(E.useRef)(Y);En.current=Y;var $t=E.useCallback(function(Cn){Yt.current=Cn,Object(ut.b)(En.current,Cn)},[]),Vt,vn=Object(N.a)(Object(N.a)({},et),{},{visible:se});if(!Oe)Vt=null;else if(ln===It||!ue(H))hn?Vt=Oe(Object(N.a)({},vn),$t):!_e&&Xn.current?Vt=Oe(Object(N.a)(Object(N.a)({},vn),{},{className:nt}),$t):be?Vt=Oe(Object(N.a)(Object(N.a)({},vn),{},{style:{display:"none"}}),$t):Vt=null;else{var pn,Lt;nn===on?Lt="prepare":dr(nn)?Lt="active":nn===qn&&(Lt="start"),Vt=Oe(Object(N.a)(Object(N.a)({},vn),{},{className:I()(fn(Ie,ln),(pn={},Object(Ee.a)(pn,fn(Ie,"".concat(ln,"-").concat(Lt)),Lt),Object(Ee.a)(pn,Ie,typeof Ie=="string"),pn)),style:mn}),$t)}return E.createElement(ya,{ref:dn},Vt)});return ie.displayName="CSSMotion",ie}var ba=da(Zt),ra="add",ca="keep",Zr="remove",Ea="removed";function ha(ne){var me;return ne&&Object(A.a)(ne)==="object"&&"key"in ne?me=ne:me={key:ne},Object(N.a)(Object(N.a)({},me),{},{key:String(me.key)})}function _a(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return ne.map(ha)}function M(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ue=[],ie=0,H=me.length,Y=_a(ne),z=_a(me);Y.forEach(function(_e){for(var be=!1,Oe=ie;Oe<H;Oe+=1){var Ie=z[Oe];if(Ie.key===_e.key){ie<Oe&&(ue=ue.concat(z.slice(ie,Oe).map(function(nt){return Object(N.a)(Object(N.a)({},nt),{},{status:ra})})),ie=Oe),ue.push(Object(N.a)(Object(N.a)({},Ie),{},{status:ca})),ie+=1,be=!0;break}}be||ue.push(Object(N.a)(Object(N.a)({},_e),{},{status:Zr}))}),ie<H&&(ue=ue.concat(z.slice(ie).map(function(_e){return Object(N.a)(Object(N.a)({},_e),{},{status:ra})})));var se={};ue.forEach(function(_e){var be=_e.key;se[be]=(se[be]||0)+1});var le=Object.keys(se).filter(function(_e){return se[_e]>1});return le.forEach(function(_e){ue=ue.filter(function(be){var Oe=be.key,Ie=be.status;return Oe!==_e||Ie!==Zr}),ue.forEach(function(be){be.key===_e&&(be.status=ca)})}),ue}var s=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function c(ne){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ba,ue=function(ie){Object(r.a)(Y,ie);var H=Object(e.a)(Y);function Y(){var z;return Object(m.a)(this,Y),z=H.apply(this,arguments),z.state={keyEntities:[]},z.removeKey=function(se){z.setState(function(le){var _e=le.keyEntities;return{keyEntities:_e.map(function(be){return be.key!==se?be:Object(N.a)(Object(N.a)({},be),{},{status:Ea})})}})},z}return Object(h.a)(Y,[{key:"render",value:function(){var se=this,le=this.state.keyEntities,_e=this.props,be=_e.component,Oe=_e.children,Ie=_e.onVisibleChanged,nt=Object(O.a)(_e,["component","children","onVisibleChanged"]),et=be||E.Fragment,ct={};return s.forEach(function(Yt){ct[Yt]=nt[Yt],delete nt[Yt]}),delete nt.keys,E.createElement(et,nt,le.map(function(Yt){var dn=Yt.status,en=Object(O.a)(Yt,["status"]),sn=dn===ra||dn===ca;return E.createElement(me,Object(o.a)({},ct,{key:en.key,visible:sn,eventProps:en,onVisibleChanged:function(ln){Ie==null||Ie(ln,{key:en.key}),ln||se.removeKey(en.key)}}),Oe)}))}}],[{key:"getDerivedStateFromProps",value:function(se,le){var _e=se.keys,be=le.keyEntities,Oe=_a(_e),Ie=M(be,Oe);return{keyEntities:Ie.filter(function(nt){var et=be.find(function(ct){var Yt=ct.key;return nt.key===Yt});return!(et&&et.status===Ea&&nt.status===Zr)})}}}]),Y}(E.Component);return ue.defaultProps={component:"div"},ue}var D=c(Zt),W=ba;function k(ne){var me=ne.prefixCls,ue=ne.motion,ie=ne.animation,H=ne.transitionName;return ue||(ie?{motionName:"".concat(me,"-").concat(ie)}:H?{motionName:H}:null)}function ce(ne){var me=ne.prefixCls,ue=ne.visible,ie=ne.zIndex,H=ne.mask,Y=ne.maskMotion,z=ne.maskAnimation,se=ne.maskTransitionName;if(!H)return null;var le={};return(Y||se||z)&&(le=Object(N.a)({motionAppear:!0},k({motion:Y,prefixCls:me,transitionName:se,animation:z}))),E.createElement(W,Object(o.a)({},le,{visible:ue,removeOnLeave:!0}),function(_e){var be=_e.className;return E.createElement("div",{style:{zIndex:ie},className:I()("".concat(me,"-mask"),be)})})}var ze=K("9mu1"),gt=K("o0o1"),Nt=K.n(gt),Xe=K("HaE+"),Jt=["measure","align",null,"motion"],Pn=function(ne,me){var ue=Object(E.useState)(null),ie=Object(j.a)(ue,2),H=ie[0],Y=ie[1],z=Object(E.useRef)(),se=Object(E.useRef)(!1);function le(Oe){se.current||Y(Oe)}function _e(){ot.a.cancel(z.current)}function be(Oe){_e(),z.current=Object(ot.a)(function(){le(function(Ie){switch(H){case"align":return"motion";case"motion":return"stable";default:}return Ie}),Oe==null||Oe()})}return Object(E.useEffect)(function(){le("measure")},[ne]),Object(E.useEffect)(function(){switch(H){case"measure":me();break;default:}H&&(z.current=Object(ot.a)(Object(Xe.a)(Nt.a.mark(function Oe(){var Ie,nt;return Nt.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:Ie=Jt.indexOf(H),nt=Jt[Ie+1],nt&&Ie!==-1&&le(nt);case 3:case"end":return ct.stop()}},Oe)}))))},[H]),Object(E.useEffect)(function(){return function(){se.current=!0,_e()}},[]),[H,be]},Bn=function(ne){var me=E.useState({width:0,height:0}),ue=Object(j.a)(me,2),ie=ue[0],H=ue[1];function Y(se){H({width:se.offsetWidth,height:se.offsetHeight})}var z=E.useMemo(function(){var se={};if(ne){var le=ie.width,_e=ie.height;ne.indexOf("height")!==-1&&_e?se.height=_e:ne.indexOf("minHeight")!==-1&&_e&&(se.minHeight=_e),ne.indexOf("width")!==-1&&le?se.width=le:ne.indexOf("minWidth")!==-1&&le&&(se.minWidth=le)}return se},[ne,ie]);return[z,Y]},jr=E.forwardRef(function(ne,me){var ue=ne.visible,ie=ne.prefixCls,H=ne.className,Y=ne.style,z=ne.children,se=ne.zIndex,le=ne.stretch,_e=ne.destroyPopupOnHide,be=ne.forceRender,Oe=ne.align,Ie=ne.point,nt=ne.getRootDomNode,et=ne.getClassNameFromAlign,ct=ne.onAlign,Yt=ne.onMouseEnter,dn=ne.onMouseLeave,en=ne.onMouseDown,sn=ne.onTouchStart,cn=Object(E.useRef)(),ln=Object(E.useRef)(),nn=Object(E.useState)(),mn=Object(j.a)(nn,2),hn=mn[0],Xn=mn[1],En=Bn(le),$t=Object(j.a)(En,2),Vt=$t[0],vn=$t[1];function pn(){le&&vn(nt())}var Lt=Pn(ue,pn),Cn=Object(j.a)(Lt,2),Fn=Cn[0],qt=Cn[1],gn=Object(E.useRef)();function Gn(){return Ie||nt}function hr(){var rn;(rn=cn.current)===null||rn===void 0||rn.forceAlign()}function Sr(rn,fr){var sr=et(fr);hn!==sr&&Xn(sr),Fn==="align"&&(hn!==sr?Promise.resolve().then(function(){hr()}):qt(function(){var er;(er=gn.current)===null||er===void 0||er.call(gn)}),ct==null||ct(rn,fr))}var Qn=Object(N.a)({},k(ne));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(rn){var fr=Qn[rn];Qn[rn]=function(sr,er){return qt(),fr==null?void 0:fr(sr,er)}});function wr(){return new Promise(function(rn){gn.current=rn})}E.useEffect(function(){!Qn.motionName&&Fn==="motion"&&qt()},[Qn.motionName,Fn]),E.useImperativeHandle(me,function(){return{forceAlign:hr,getElement:function(){return ln.current}}});var Kr=Object(N.a)(Object(N.a)({},Vt),{},{zIndex:se,opacity:Fn==="motion"||Fn==="stable"||!ue?void 0:0,pointerEvents:Fn==="stable"?void 0:"none"},Y),Dr=!0;(Oe==null?void 0:Oe.points)&&(Fn==="align"||Fn==="stable")&&(Dr=!1);var kr=z;return E.Children.count(z)>1&&(kr=E.createElement("div",{className:"".concat(ie,"-content")},z)),E.createElement(W,Object(o.a)({visible:ue,ref:ln,leavedClassName:"".concat(ie,"-hidden")},Qn,{onAppearPrepare:wr,onEnterPrepare:wr,removeOnLeave:_e,forceRender:be}),function(rn,fr){var sr=rn.className,er=rn.style,Wr=I()(ie,H,hn,sr);return E.createElement(ze.a,{target:Gn(),key:"popup",ref:cn,monitorWindowResize:!0,disabled:Dr,align:Oe,onAlign:Sr},E.createElement("div",{ref:fr,className:Wr,onMouseEnter:Yt,onMouseLeave:dn,onMouseDownCapture:en,onTouchStartCapture:sn,style:Object(N.a)(Object(N.a)({},er),Kr)},kr))})});jr.displayName="PopupInner";var Dt=jr,Re=E.forwardRef(function(ne,me){var ue=ne.prefixCls,ie=ne.visible,H=ne.zIndex,Y=ne.children,z=ne.mobile;z=z===void 0?{}:z;var se=z.popupClassName,le=z.popupStyle,_e=z.popupMotion,be=_e===void 0?{}:_e,Oe=z.popupRender,Ie=E.useRef();E.useImperativeHandle(me,function(){return{forceAlign:function(){},getElement:function(){return Ie.current}}});var nt=Object(N.a)({zIndex:H},le),et=Y;return E.Children.count(Y)>1&&(et=E.createElement("div",{className:"".concat(ue,"-content")},Y)),Oe&&(et=Oe(et)),E.createElement(W,Object(o.a)({visible:ie,ref:Ie,removeOnLeave:!0},be),function(ct,Yt){var dn=ct.className,en=ct.style,sn=I()(ue,se,dn);return E.createElement("div",{ref:Yt,className:sn,style:Object(N.a)(Object(N.a)({},en),nt)},et)})});Re.displayName="MobilePopupInner";var rt=Re,Ve=["visible","mobile"],Qe=E.forwardRef(function(ne,me){var ue=ne.visible,ie=ne.mobile,H=Object(O.a)(ne,Ve),Y=Object(E.useState)(ue),z=Object(j.a)(Y,2),se=z[0],le=z[1],_e=Object(E.useState)(!1),be=Object(j.a)(_e,2),Oe=be[0],Ie=be[1],nt=Object(N.a)(Object(N.a)({},H),{},{visible:se});Object(E.useEffect)(function(){le(ue),ue&&ie&&Ie(ye())},[ue,ie]);var et=Oe?E.createElement(rt,Object(o.a)({},nt,{mobile:ie,ref:me})):E.createElement(Dt,Object(o.a)({},nt,{ref:me}));return E.createElement("div",null,E.createElement(ce,nt),et)});Qe.displayName="Popup";var Ht=Qe,Ut=E.createContext(null),kt=Ut;function wt(){}function mt(){return""}function Rt(ne){return ne?ne.ownerDocument:window.document}var _t=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Kt(ne){var me=function(ue){Object(r.a)(H,ue);var ie=Object(e.a)(H);function H(Y){var z;Object(m.a)(this,H),z=ie.call(this,Y),z.popupRef=E.createRef(),z.triggerRef=E.createRef(),z.attachId=void 0,z.clickOutsideHandler=void 0,z.touchOutsideHandler=void 0,z.contextMenuOutsideHandler1=void 0,z.contextMenuOutsideHandler2=void 0,z.mouseDownTimeout=void 0,z.focusTime=void 0,z.preClickTime=void 0,z.preTouchTime=void 0,z.delayTimer=void 0,z.hasPopupMouseDown=void 0,z.onMouseEnter=function(le){var _e=z.props.mouseEnterDelay;z.fireEvents("onMouseEnter",le),z.delaySetPopupVisible(!0,_e,_e?null:le)},z.onMouseMove=function(le){z.fireEvents("onMouseMove",le),z.setPoint(le)},z.onMouseLeave=function(le){z.fireEvents("onMouseLeave",le),z.delaySetPopupVisible(!1,z.props.mouseLeaveDelay)},z.onPopupMouseEnter=function(){z.clearDelayTimer()},z.onPopupMouseLeave=function(le){var _e;if(le.relatedTarget&&!le.relatedTarget.setTimeout&&Object(bt.a)((_e=z.popupRef.current)===null||_e===void 0?void 0:_e.getElement(),le.relatedTarget))return;z.delaySetPopupVisible(!1,z.props.mouseLeaveDelay)},z.onFocus=function(le){z.fireEvents("onFocus",le),z.clearDelayTimer(),z.isFocusToShow()&&(z.focusTime=Date.now(),z.delaySetPopupVisible(!0,z.props.focusDelay))},z.onMouseDown=function(le){z.fireEvents("onMouseDown",le),z.preClickTime=Date.now()},z.onTouchStart=function(le){z.fireEvents("onTouchStart",le),z.preTouchTime=Date.now()},z.onBlur=function(le){z.fireEvents("onBlur",le),z.clearDelayTimer(),z.isBlurToHide()&&z.delaySetPopupVisible(!1,z.props.blurDelay)},z.onContextMenu=function(le){le.preventDefault(),z.fireEvents("onContextMenu",le),z.setPopupVisible(!0,le)},z.onContextMenuClose=function(){z.isContextMenuToShow()&&z.close()},z.onClick=function(le){if(z.fireEvents("onClick",le),z.focusTime){var _e;if(z.preClickTime&&z.preTouchTime?_e=Math.min(z.preClickTime,z.preTouchTime):z.preClickTime?_e=z.preClickTime:z.preTouchTime&&(_e=z.preTouchTime),Math.abs(_e-z.focusTime)<20)return;z.focusTime=0}z.preClickTime=0,z.preTouchTime=0,z.isClickToShow()&&(z.isClickToHide()||z.isBlurToHide())&&le&&le.preventDefault&&le.preventDefault();var be=!z.state.popupVisible;(z.isClickToHide()&&!be||be&&z.isClickToShow())&&z.setPopupVisible(!z.state.popupVisible,le)},z.onPopupMouseDown=function(){if(z.hasPopupMouseDown=!0,clearTimeout(z.mouseDownTimeout),z.mouseDownTimeout=window.setTimeout(function(){z.hasPopupMouseDown=!1},0),z.context){var le;(le=z.context).onPopupMouseDown.apply(le,arguments)}},z.onDocumentClick=function(le){if(z.props.mask&&!z.props.maskClosable)return;var _e=le.target,be=z.getRootDomNode(),Oe=z.getPopupDomNode();(!Object(bt.a)(be,_e)||z.isContextMenuOnly())&&!Object(bt.a)(Oe,_e)&&!z.hasPopupMouseDown&&z.close()},z.getRootDomNode=function(){var le=z.props.getTriggerDOMNode;if(le)return le(z.triggerRef.current);try{var _e=Object(ht.a)(z.triggerRef.current);if(_e)return _e}catch(be){}return lt.a.findDOMNode(Object(a.a)(z))},z.getPopupClassNameFromAlign=function(le){var _e=[],be=z.props,Oe=be.popupPlacement,Ie=be.builtinPlacements,nt=be.prefixCls,et=be.alignPoint,ct=be.getPopupClassNameFromAlign;return Oe&&Ie&&_e.push(it(Ie,nt,le,et)),ct&&_e.push(ct(le)),_e.join(" ")},z.getComponent=function(){var le=z.props,_e=le.prefixCls,be=le.destroyPopupOnHide,Oe=le.popupClassName,Ie=le.onPopupAlign,nt=le.popupMotion,et=le.popupAnimation,ct=le.popupTransitionName,Yt=le.popupStyle,dn=le.mask,en=le.maskAnimation,sn=le.maskTransitionName,cn=le.maskMotion,ln=le.zIndex,nn=le.popup,mn=le.stretch,hn=le.alignPoint,Xn=le.mobile,En=le.forceRender,$t=z.state,Vt=$t.popupVisible,vn=$t.point,pn=z.getPopupAlign(),Lt={};return z.isMouseEnterToShow()&&(Lt.onMouseEnter=z.onPopupMouseEnter),z.isMouseLeaveToHide()&&(Lt.onMouseLeave=z.onPopupMouseLeave),Lt.onMouseDown=z.onPopupMouseDown,Lt.onTouchStart=z.onPopupMouseDown,E.createElement(Ht,Object(o.a)({prefixCls:_e,destroyPopupOnHide:be,visible:Vt,point:hn&&vn,className:Oe,align:pn,onAlign:Ie,animation:et,getClassNameFromAlign:z.getPopupClassNameFromAlign},Lt,{stretch:mn,getRootDomNode:z.getRootDomNode,style:Yt,mask:dn,zIndex:ln,transitionName:ct,maskAnimation:en,maskTransitionName:sn,maskMotion:cn,ref:z.popupRef,motion:nt,mobile:Xn,forceRender:En}),typeof nn=="function"?nn():nn)},z.attachParent=function(le){ot.a.cancel(z.attachId);var _e=z.props,be=_e.getPopupContainer,Oe=_e.getDocument,Ie=z.getRootDomNode(),nt;be?(Ie||be.length===0)&&(nt=be(Ie)):nt=Oe(z.getRootDomNode()).body,nt?nt.appendChild(le):z.attachId=Object(ot.a)(function(){z.attachParent(le)})},z.getContainer=function(){var le=z.props.getDocument,_e=le(z.getRootDomNode()).createElement("div");return _e.style.position="absolute",_e.style.top="0",_e.style.left="0",_e.style.width="100%",z.attachParent(_e),_e},z.setPoint=function(le){var _e=z.props.alignPoint;if(!_e||!le)return;z.setState({point:{pageX:le.pageX,pageY:le.pageY}})},z.handlePortalUpdate=function(){z.state.prevPopupVisible!==z.state.popupVisible&&z.props.afterPopupVisibleChange(z.state.popupVisible)},z.triggerContextValue={onPopupMouseDown:z.onPopupMouseDown};var se;return"popupVisible"in Y?se=!!Y.popupVisible:se=!!Y.defaultPopupVisible,z.state={prevPopupVisible:se,popupVisible:se},_t.forEach(function(le){z["fire".concat(le)]=function(_e){z.fireEvents(le,_e)}}),z}return Object(h.a)(H,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var z=this.props,se=this.state;if(se.popupVisible){var le;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(le=z.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(Ze.a)(le,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(le=le||z.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(Ze.a)(le,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(le=le||z.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(Ze.a)(le,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(Ze.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),ot.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var z;return((z=this.popupRef.current)===null||z===void 0?void 0:z.getElement())||null}},{key:"getPopupAlign",value:function(){var z=this.props,se=z.popupPlacement,le=z.popupAlign,_e=z.builtinPlacements;return se&&_e?He(_e,se,le):le}},{key:"setPopupVisible",value:function(z,se){var le=this.props.alignPoint,_e=this.state.popupVisible;this.clearDelayTimer(),_e!==z&&("popupVisible"in this.props||this.setState({popupVisible:z,prevPopupVisible:_e}),this.props.onPopupVisibleChange(z)),le&&se&&z&&this.setPoint(se)}},{key:"delaySetPopupVisible",value:function(z,se,le){var _e=this,be=se*1e3;if(this.clearDelayTimer(),be){var Oe=le?{pageX:le.pageX,pageY:le.pageY}:null;this.delayTimer=window.setTimeout(function(){_e.setPopupVisible(z,Oe),_e.clearDelayTimer()},be)}else this.setPopupVisible(z,le)}},{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(z){var se=this.props.children.props,le=this.props;return se[z]&&le[z]?this["fire".concat(z)]:se[z]||le[z]}},{key:"isClickToShow",value:function(){var z=this.props,se=z.action,le=z.showAction;return se.indexOf("click")!==-1||le.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var z=this.props.action;return z==="contextMenu"||z.length===1&&z[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var z=this.props,se=z.action,le=z.showAction;return se.indexOf("contextMenu")!==-1||le.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var z=this.props,se=z.action,le=z.hideAction;return se.indexOf("click")!==-1||le.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var z=this.props,se=z.action,le=z.showAction;return se.indexOf("hover")!==-1||le.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var z=this.props,se=z.action,le=z.hideAction;return se.indexOf("hover")!==-1||le.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var z=this.props,se=z.action,le=z.showAction;return se.indexOf("focus")!==-1||le.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var z=this.props,se=z.action,le=z.hideAction;return se.indexOf("focus")!==-1||le.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var z;(z=this.popupRef.current)===null||z===void 0||z.forceAlign()}}},{key:"fireEvents",value:function(z,se){var le=this.props.children.props[z];le&&le(se);var _e=this.props[z];_e&&_e(se)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var z=this.state.popupVisible,se=this.props,le=se.children,_e=se.forceRender,be=se.alignPoint,Oe=se.className,Ie=se.autoDestroy,nt=E.Children.only(le),et={key:"trigger"};this.isContextMenuToShow()?et.onContextMenu=this.onContextMenu:et.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(et.onClick=this.onClick,et.onMouseDown=this.onMouseDown,et.onTouchStart=this.onTouchStart):(et.onClick=this.createTwoChains("onClick"),et.onMouseDown=this.createTwoChains("onMouseDown"),et.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(et.onMouseEnter=this.onMouseEnter,be&&(et.onMouseMove=this.onMouseMove)):et.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?et.onMouseLeave=this.onMouseLeave:et.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(et.onFocus=this.onFocus,et.onBlur=this.onBlur):(et.onFocus=this.createTwoChains("onFocus"),et.onBlur=this.createTwoChains("onBlur"));var ct=I()(nt&&nt.props&&nt.props.className,Oe);ct&&(et.className=ct);var Yt=Object(N.a)({},et);Object(ut.c)(nt)&&(Yt.ref=Object(ut.a)(this.triggerRef,nt.ref));var dn=E.cloneElement(nt,Yt),en;return(z||this.popupRef.current||_e)&&(en=E.createElement(ne,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!z&&Ie&&(en=null),E.createElement(kt.Provider,{value:this.triggerContextValue},dn,en)}}],[{key:"getDerivedStateFromProps",value:function(z,se){var le=z.popupVisible,_e={};return le!==void 0&&se.popupVisible!==le&&(_e.popupVisible=le,_e.prevPopupVisible=se.popupVisible),_e}}]),H}(E.Component);return me.contextType=kt,me.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:mt,getDocument:Rt,onPopupVisibleChange:wt,afterPopupVisibleChange:wt,onPopupAlign:wt,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},me}var Ot=Kt(Et.a),At={adjustX:1,adjustY:1},Bt={topLeft:{points:["bl","tl"],overflow:At,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:At,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:At,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:At,offset:[4,0]}},jt={topLeft:{points:["bl","tl"],overflow:At,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:At,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:At,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:At,offset:[4,0]}},xn=Bt,ge=0,We={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},tn=function(me,ue,ie){var H=Se(ue),Y=me.getState();me.setState({defaultActiveFirst:Object(N.a)(Object(N.a)({},Y.defaultActiveFirst),{},Object(Ee.a)({},H,ie))})},tt=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(ie){var H;Object(m.a)(this,ue),H=me.call(this,ie),H.onDestroy=function(be){H.props.onDestroy(be)},H.onKeyDown=function(be){var Oe=be.keyCode,Ie=H.menuInstance,nt=H.props.store,et=H.getVisible();if(Oe===_.a.ENTER)return H.onTitleClick(be),tn(nt,H.props.eventKey,!0),!0;if(Oe===_.a.RIGHT)return et?Ie.onKeyDown(be):(H.triggerOpenChange(!0),tn(nt,H.props.eventKey,!0)),!0;if(Oe===_.a.LEFT){var ct;if(et)ct=Ie.onKeyDown(be);else return;return ct||(H.triggerOpenChange(!1),ct=!0),ct}return et&&(Oe===_.a.UP||Oe===_.a.DOWN)?Ie.onKeyDown(be):void 0},H.onOpenChange=function(be){H.props.onOpenChange(be)},H.onPopupVisibleChange=function(be){H.triggerOpenChange(be,be?"mouseenter":"mouseleave")},H.onMouseEnter=function(be){var Oe=H.props,Ie=Oe.eventKey,nt=Oe.onMouseEnter,et=Oe.store;tn(et,H.props.eventKey,!1),nt({key:Ie,domEvent:be})},H.onMouseLeave=function(be){var Oe=H.props,Ie=Oe.parentMenu,nt=Oe.eventKey,et=Oe.onMouseLeave;Ie.subMenuInstance=Object(a.a)(H),et({key:nt,domEvent:be})},H.onTitleMouseEnter=function(be){var Oe=H.props,Ie=Oe.eventKey,nt=Oe.onItemHover,et=Oe.onTitleMouseEnter;nt({key:Ie,hover:!0}),et({key:Ie,domEvent:be})},H.onTitleMouseLeave=function(be){var Oe=H.props,Ie=Oe.parentMenu,nt=Oe.eventKey,et=Oe.onItemHover,ct=Oe.onTitleMouseLeave;Ie.subMenuInstance=Object(a.a)(H),et({key:nt,hover:!1}),ct({key:nt,domEvent:be})},H.onTitleClick=function(be){var Oe=Object(a.a)(H),Ie=Oe.props;if(Ie.onTitleClick({key:Ie.eventKey,domEvent:be}),Ie.triggerSubMenuAction==="hover")return;H.triggerOpenChange(!H.getVisible(),"click"),tn(Ie.store,H.props.eventKey,!1)},H.onSubMenuClick=function(be){typeof H.props.onClick=="function"&&H.props.onClick(H.addKeyPath(be))},H.onSelect=function(be){H.props.onSelect(be)},H.onDeselect=function(be){H.props.onDeselect(be)},H.getPrefixCls=function(){return"".concat(H.props.rootPrefixCls,"-submenu")},H.getActiveClassName=function(){return"".concat(H.getPrefixCls(),"-active")},H.getDisabledClassName=function(){return"".concat(H.getPrefixCls(),"-disabled")},H.getSelectedClassName=function(){return"".concat(H.getPrefixCls(),"-selected")},H.getOpenClassName=function(){return"".concat(H.props.rootPrefixCls,"-submenu-open")},H.getVisible=function(){return H.state.isOpen},H.getMode=function(){return H.state.mode},H.saveMenuInstance=function(be){H.menuInstance=be},H.addKeyPath=function(be){return Object(N.a)(Object(N.a)({},be),{},{keyPath:(be.keyPath||[]).concat(H.props.eventKey)})},H.triggerOpenChange=function(be,Oe){var Ie=H.props.eventKey,nt=function(){H.onOpenChange({key:Ie,item:Object(a.a)(H),trigger:Oe,open:be})};Oe==="mouseenter"?H.mouseenterTimeout=setTimeout(function(){nt()},0):nt()},H.isChildrenSelected=function(){var be={find:!1};return je(H.props.children,H.props.selectedKeys,be),be.find},H.isInlineMode=function(){return H.getMode()==="inline"},H.adjustWidth=function(){if(!H.subMenuTitle||!H.menuInstance)return;var be=qe.findDOMNode(H.menuInstance);if(be.offsetWidth>=H.subMenuTitle.offsetWidth)return;be.style.minWidth="".concat(H.subMenuTitle.offsetWidth,"px")},H.saveSubMenuTitle=function(be){H.subMenuTitle=be},H.getBaseProps=function(){var be=Object(a.a)(H),Oe=be.props,Ie=H.getMode();return{mode:Ie==="horizontal"?"vertical":Ie,visible:H.getVisible(),level:Oe.level+1,inlineIndent:Oe.inlineIndent,focusable:!1,onClick:H.onSubMenuClick,onSelect:H.onSelect,onDeselect:H.onDeselect,onDestroy:H.onDestroy,selectedKeys:Oe.selectedKeys,eventKey:"".concat(Oe.eventKey,"-menu-"),openKeys:Oe.openKeys,motion:Oe.motion,onOpenChange:H.onOpenChange,subMenuOpenDelay:Oe.subMenuOpenDelay,parentMenu:Object(a.a)(H),subMenuCloseDelay:Oe.subMenuCloseDelay,forceSubMenuRender:Oe.forceSubMenuRender,triggerSubMenuAction:Oe.triggerSubMenuAction,builtinPlacements:Oe.builtinPlacements,defaultActiveFirst:Oe.store.getState().defaultActiveFirst[Se(Oe.eventKey)],multiple:Oe.multiple,prefixCls:Oe.rootPrefixCls,id:H.internalMenuId,manualRef:H.saveMenuInstance,itemIcon:Oe.itemIcon,expandIcon:Oe.expandIcon,direction:Oe.direction}},H.getMotion=function(be,Oe){var Ie=Object(a.a)(H),nt=Ie.haveRendered,et=H.props,ct=et.motion,Yt=et.rootPrefixCls,dn=Object(N.a)(Object(N.a)({},ct),{},{leavedClassName:"".concat(Yt,"-hidden"),removeOnLeave:!1,motionAppear:nt||!Oe||be!=="inline"});return dn};var Y=ie.store,z=ie.eventKey,se=Y.getState(),le=se.defaultActiveFirst;H.isRootMenu=!1;var _e=!1;return le&&(_e=le[z]),tn(Y,z,_e),H.state={mode:ie.mode,isOpen:ie.isOpen},H}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var H=this,Y=this.props,z=Y.mode,se=Y.parentMenu,le=Y.manualRef,_e=Y.isOpen,be=function(){H.setState({mode:z,isOpen:_e})},Oe=_e!==this.state.isOpen,Ie=z!==this.state.mode;if((Ie||Oe)&&(ot.a.cancel(this.updateStateRaf),Ie?this.updateStateRaf=Object(ot.a)(be):be()),le&&le(this),z!=="horizontal"||!(se==null?void 0:se.isRootMenu)||!_e)return;this.minWidthTimeout=setTimeout(function(){return H.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var H=this.props,Y=H.onDestroy,z=H.eventKey;Y&&Y(z),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),ot.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(H,Y){var z=this.getBaseProps();return E.createElement(In,Object(o.a)({},z,{id:this.internalMenuId,className:H,style:Y}),this.props.children)}},{key:"renderChildren",value:function(){var H=this,Y=this.getBaseProps(),z=Y.mode,se=Y.visible,le=Y.forceSubMenuRender,_e=Y.direction,be=this.getMotion(z,se);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||se||le,!this.haveOpened)return E.createElement("div",null);var Oe=I()("".concat(Y.prefixCls,"-sub"),Object(Ee.a)({},"".concat(Y.prefixCls,"-rtl"),_e==="rtl"));return this.isInlineMode()?E.createElement(W,Object(o.a)({visible:Y.visible,forceRender:le},be),function(Ie){var nt=Ie.className,et=Ie.style,ct=I()(Oe,nt);return H.renderPopupMenu(ct,et)}):this.renderPopupMenu(Oe)}},{key:"render",value:function(){var H,Y,z,se=Object(N.a)({},this.props),le=this.getVisible(),_e=this.getPrefixCls(),be=this.isInlineMode(),Oe=this.getMode(),Ie=I()(_e,"".concat(_e,"-").concat(Oe),(H={},Object(Ee.a)(H,se.className,!!se.className),Object(Ee.a)(H,this.getOpenClassName(),le),Object(Ee.a)(H,this.getActiveClassName(),se.active||le&&!be),Object(Ee.a)(H,this.getDisabledClassName(),se.disabled),Object(Ee.a)(H,this.getSelectedClassName(),this.isChildrenSelected()),H));this.internalMenuId||(se.eventKey?this.internalMenuId="".concat(se.eventKey,"$Menu"):(ge+=1,this.internalMenuId="$__$".concat(ge,"$Menu")));var nt={},et={},ct={};se.disabled||(nt={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},et={onClick:this.onTitleClick},ct={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var Yt={},dn=se.direction,en=dn==="rtl";be&&(en?Yt.paddingRight=se.inlineIndent*se.level:Yt.paddingLeft=se.inlineIndent*se.level);var sn={};this.getVisible()&&(sn={"aria-owns":this.internalMenuId});var cn=null;Oe!=="horizontal"&&(cn=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(cn=E.createElement(this.props.expandIcon,Object(N.a)({},this.props))));var ln=E.createElement("div",Object(o.a)({ref:this.saveSubMenuTitle,style:Yt,className:"".concat(_e,"-title"),role:"button"},ct,et,{"aria-expanded":le},sn,{"aria-haspopup":"true",title:typeof se.title=="string"?se.title:void 0}),se.title,cn||E.createElement("i",{className:"".concat(_e,"-arrow")})),nn=this.renderChildren(),mn=((Y=se.parentMenu)===null||Y===void 0?void 0:Y.isRootMenu)?se.parentMenu.props.getPopupContainer:function(Gn){return Gn.parentNode},hn=We[Oe],Xn=se.popupOffset?{offset:se.popupOffset}:{},En=I()((z={},Object(Ee.a)(z,se.popupClassName,se.popupClassName&&!be),Object(Ee.a)(z,"".concat(_e,"-rtl"),en),z)),$t=se.disabled,Vt=se.triggerSubMenuAction,vn=se.subMenuOpenDelay,pn=se.forceSubMenuRender,Lt=se.subMenuCloseDelay,Cn=se.builtinPlacements;Be.forEach(function(Gn){return delete se[Gn]}),delete se.onClick;var Fn=en?Object(N.a)(Object(N.a)({},jt),Cn):Object(N.a)(Object(N.a)({},Bt),Cn);delete se.direction;var qt=this.getBaseProps(),gn=be?null:this.getMotion(qt.mode,qt.visible);return E.createElement("li",Object(o.a)({},se,nt,{className:Ie,role:"menuitem"}),E.createElement(Ot,{prefixCls:_e,popupClassName:I()("".concat(_e,"-popup"),En),getPopupContainer:mn,builtinPlacements:Fn,popupPlacement:hn,popupVisible:be?!1:le,popupAlign:Xn,popup:be?null:nn,action:$t||be?[]:[Vt],mouseEnterDelay:vn,mouseLeaveDelay:Lt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:pn,popupMotion:gn},ln),be?nn:null)}}]),ue}(E.Component);tt.defaultProps={onMouseEnter:we,onMouseLeave:we,onTitleMouseEnter:we,onTitleMouseLeave:we,onTitleClick:we,manualRef:we,mode:"vertical",title:""};var dt=Object(i.b)(function(ne,me){var ue=ne.openKeys,ie=ne.activeKey,H=ne.selectedKeys,Y=me.eventKey,z=me.subMenuKey;return{isOpen:ue.indexOf(Y)>-1,active:ie[z]===Y,selectedKeys:H}})(tt);dt.isSubMenu=!0;var at=dt,ft="menuitem-overflowed",yt=.5,vt=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(){var ie;return Object(m.a)(this,ue),ie=me.apply(this,arguments),ie.resizeObserver=null,ie.mutationObserver=null,ie.originalTotalWidth=0,ie.overflowedItems=[],ie.menuItemSizes=[],ie.cancelFrameId=null,ie.state={lastVisibleIndex:void 0},ie.childRef=E.createRef(),ie.getMenuItemNodes=function(){var H=ie.props.prefixCls,Y=ie.childRef.current;return Y?[].slice.call(Y.children).filter(function(z){return z.className.split(" ").indexOf("".concat(H,"-overflowed-submenu"))<0}):[]},ie.getOverflowedSubMenuItem=function(H,Y,z){var se=ie.props,le=se.overflowedIndicator,_e=se.level,be=se.mode,Oe=se.prefixCls,Ie=se.theme;if(_e!==1||be!=="horizontal")return null;var nt=ie.props.children[0],et=nt.props,ct=et.children,Yt=et.title,dn=et.style,en=Object(O.a)(et,["children","title","style"]),sn=Object(N.a)({},dn),cn="".concat(H,"-overflowed-indicator"),ln="".concat(H,"-overflowed-indicator");Y.length===0&&z!==!0?sn=Object(N.a)(Object(N.a)({},sn),{},{display:"none"}):z&&(sn=Object(N.a)(Object(N.a)({},sn),{},{visibility:"hidden",position:"absolute"}),cn="".concat(cn,"-placeholder"),ln="".concat(ln,"-placeholder"));var nn=Ie?"".concat(Oe,"-").concat(Ie):"",mn={};return Be.forEach(function(hn){en[hn]!==void 0&&(mn[hn]=en[hn])}),E.createElement(at,Object(o.a)({title:le,className:"".concat(Oe,"-overflowed-submenu"),popupClassName:nn},mn,{key:cn,eventKey:ln,disabled:!1,style:sn}),Y)},ie.setChildrenWidthAndResize=function(){if(ie.props.mode!=="horizontal")return;var H=ie.childRef.current;if(!H)return;var Y=H.children;if(!Y||Y.length===0)return;var z=H.children[Y.length-1];Ue(z,"display","inline-block");var se=ie.getMenuItemNodes(),le=se.filter(function(_e){return _e.className.split(" ").indexOf(ft)>=0});le.forEach(function(_e){Ue(_e,"display","inline-block")}),ie.menuItemSizes=se.map(function(_e){return Ke(_e,!0)}),le.forEach(function(_e){Ue(_e,"display","none")}),ie.overflowedIndicatorWidth=Ke(H.children[H.children.length-1],!0),ie.originalTotalWidth=ie.menuItemSizes.reduce(function(_e,be){return _e+be},0),ie.handleResize(),Ue(z,"display","none")},ie.handleResize=function(){if(ie.props.mode!=="horizontal")return;var H=ie.childRef.current;if(!H)return;var Y=Ke(H);ie.overflowedItems=[];var z=0,se;ie.originalTotalWidth>Y+yt&&(se=-1,ie.menuItemSizes.forEach(function(le){z+=le,z+ie.overflowedIndicatorWidth<=Y&&(se+=1)})),ie.setState({lastVisibleIndex:se})},ie}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){var H=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var Y=this.childRef.current;if(!Y)return;this.resizeObserver=new Ge.default(function(z){z.forEach(function(){var se=H.cancelFrameId;cancelAnimationFrame(se),H.cancelFrameId=requestAnimationFrame(H.setChildrenWidthAndResize)})}),[].slice.call(Y.children).concat(Y).forEach(function(z){H.resizeObserver.observe(z)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){H.resizeObserver.disconnect(),[].slice.call(Y.children).concat(Y).forEach(function(z){H.resizeObserver.observe(z)}),H.setChildrenWidthAndResize()}),this.mutationObserver.observe(Y,{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(H){var Y=this,z=this.state.lastVisibleIndex;return(H||[]).reduce(function(se,le,_e){var be=le;if(Y.props.mode==="horizontal"){var Oe=Y.getOverflowedSubMenuItem(le.props.eventKey,[]);z!==void 0&&Y.props.className.indexOf("".concat(Y.props.prefixCls,"-root"))!==-1&&(_e>z&&(be=E.cloneElement(le,{style:{display:"none"},eventKey:"".concat(le.props.eventKey,"-hidden"),className:"".concat(ft)})),_e===z+1&&(Y.overflowedItems=H.slice(z+1).map(function(nt){return E.cloneElement(nt,{key:nt.props.eventKey,mode:"vertical-left"})}),Oe=Y.getOverflowedSubMenuItem(le.props.eventKey,Y.overflowedItems)));var Ie=[].concat(Object(P.a)(se),[Oe,be]);return _e===H.length-1&&Ie.push(Y.getOverflowedSubMenuItem(le.props.eventKey,[],!0)),Ie}return[].concat(Object(P.a)(se),[be])},[])}},{key:"render",value:function(){var H=this.props,Y=H.visible,z=H.prefixCls,se=H.overflowedIndicator,le=H.mode,_e=H.level,be=H.tag,Oe=H.children,Ie=H.theme,nt=Object(O.a)(H,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),et=be;return E.createElement(et,Object(o.a)({ref:this.childRef},nt),this.renderChildren(Oe))}}]),ue}(E.Component);vt.defaultProps={tag:"div",className:""};var Qt=vt;function un(ne){return ne.length?ne.every(function(me){return!!me.props.disabled}):!0}function Gt(ne,me,ue){var ie=ne.getState();ne.setState({activeKey:Object(N.a)(Object(N.a)({},ie.activeKey),{},Object(Ee.a)({},me,ue))})}function zt(ne){return ne.eventKey||"0-menu-"}function _r(ne,me){var ue=me,ie=ne.children,H=ne.eventKey;if(ue){var Y;if(Ae(ie,function(z,se){z&&z.props&&!z.props.disabled&&ue===ke(z,H,se)&&(Y=!0)}),Y)return ue}return ue=null,ne.defaultActiveFirst&&Ae(ie,function(z,se){!ue&&z&&!z.props.disabled&&(ue=ke(z,H,se))}),ue}function gr(ne){if(!ne)return;var me=this.instanceArray.indexOf(ne);me!==-1?this.instanceArray[me]=ne:this.instanceArray.push(ne)}var xr=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(ie){var H;return Object(m.a)(this,ue),H=me.call(this,ie),H.onKeyDown=function(Y,z){var se=Y.keyCode,le;if(H.getFlatInstanceArray().forEach(function(be){be&&be.props.active&&be.onKeyDown&&(le=be.onKeyDown(Y))}),le)return 1;var _e=null;return(se===_.a.UP||se===_.a.DOWN)&&(_e=H.step(se===_.a.UP?-1:1)),_e?(Y.preventDefault(),Gt(H.props.store,zt(H.props),_e.props.eventKey),typeof z=="function"&&z(_e),1):void 0},H.onItemHover=function(Y){var z=Y.key,se=Y.hover;Gt(H.props.store,zt(H.props),se?z:null)},H.onDeselect=function(Y){H.props.onDeselect(Y)},H.onSelect=function(Y){H.props.onSelect(Y)},H.onClick=function(Y){H.props.onClick(Y)},H.onOpenChange=function(Y){H.props.onOpenChange(Y)},H.onDestroy=function(Y){H.props.onDestroy(Y)},H.getFlatInstanceArray=function(){return H.instanceArray},H.step=function(Y){var z=H.getFlatInstanceArray(),se=H.props.store.getState().activeKey[zt(H.props)],le=z.length;if(!le)return null;Y<0&&(z=z.concat().reverse());var _e=-1;if(z.every(function(nt,et){return nt&&nt.props.eventKey===se?(_e=et,!1):!0}),!H.props.defaultActiveFirst&&_e!==-1&&un(z.slice(_e,le-1)))return;var be=(_e+1)%le,Oe=be;do{var Ie=z[Oe];if(!Ie||Ie.props.disabled)Oe=(Oe+1)%le;else return Ie}while(Oe!==be);return null},H.renderCommonMenuItem=function(Y,z,se){var le=H.props.store.getState(),_e=Object(a.a)(H),be=_e.props,Oe=ke(Y,be.eventKey,z),Ie=Y.props;if(!Ie||typeof Y.type=="string")return Y;var nt=Oe===le.activeKey,et=Object(N.a)(Object(N.a)({mode:Ie.mode||be.mode,level:be.level,inlineIndent:be.inlineIndent,renderMenuItem:H.renderMenuItem,rootPrefixCls:be.prefixCls,index:z,parentMenu:be.parentMenu,manualRef:Ie.disabled?void 0:Object(f.a)(Y.ref,gr.bind(Object(a.a)(H))),eventKey:Oe,active:!Ie.disabled&&nt,multiple:be.multiple,onClick:function(Yt){(Ie.onClick||we)(Yt),H.onClick(Yt)},onItemHover:H.onItemHover,motion:be.motion,subMenuOpenDelay:be.subMenuOpenDelay,subMenuCloseDelay:be.subMenuCloseDelay,forceSubMenuRender:be.forceSubMenuRender,onOpenChange:H.onOpenChange,onDeselect:H.onDeselect,onSelect:H.onSelect,builtinPlacements:be.builtinPlacements,itemIcon:Ie.itemIcon||H.props.itemIcon,expandIcon:Ie.expandIcon||H.props.expandIcon},se),{},{direction:be.direction});return(be.mode==="inline"||xe())&&(et.triggerSubMenuAction="click"),E.cloneElement(Y,Object(N.a)(Object(N.a)({},et),{},{key:Oe||z}))},H.renderMenuItem=function(Y,z,se){if(!Y)return null;var le=H.props.store.getState(),_e={openKeys:le.openKeys,selectedKeys:le.selectedKeys,triggerSubMenuAction:H.props.triggerSubMenuAction,subMenuKey:se};return H.renderCommonMenuItem(Y,z,_e)},ie.store.setState({activeKey:Object(N.a)(Object(N.a)({},ie.store.getState().activeKey),{},Object(Ee.a)({},ie.eventKey,_r(ie,ie.activeKey)))}),H.instanceArray=[],H}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(H){return this.props.visible||H.visible||this.props.className!==H.className||!t()(this.props.style,H.style)}},{key:"componentDidUpdate",value:function(H){var Y=this.props,z="activeKey"in Y?Y.activeKey:Y.store.getState().activeKey[zt(Y)],se=_r(Y,z);if(se!==z)Gt(Y.store,zt(Y),se);else if("activeKey"in H){var le=_r(H,H.activeKey);se!==le&&Gt(Y.store,zt(Y),se)}}},{key:"render",value:function(){var H=this,Y=Object(o.a)({},this.props);this.instanceArray=[];var z=I()(Y.prefixCls,Y.className,"".concat(Y.prefixCls,"-").concat(Y.mode)),se={className:z,role:Y.role||"menu"};Y.id&&(se.id=Y.id),Y.focusable&&(se.tabIndex=0,se.onKeyDown=this.onKeyDown);var le=Y.prefixCls,_e=Y.eventKey,be=Y.visible,Oe=Y.level,Ie=Y.mode,nt=Y.overflowedIndicator,et=Y.theme;return Be.forEach(function(ct){return delete Y[ct]}),delete Y.onClick,E.createElement(Qt,Object(o.a)({},Y,{prefixCls:le,mode:Ie,tag:"ul",level:Oe,theme:et,visible:be,overflowedIndicator:nt},se),Object(L.a)(Y.children).map(function(ct,Yt){return H.renderMenuItem(ct,Yt,_e||"0-menu-")}))}}]),ue}(E.Component);xr.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:we};var xt=Object(i.b)()(xr),In=xt,bn=K("Kwbf");function Yn(ne,me,ue){var ie=ne.prefixCls,H=ne.motion,Y=ne.defaultMotions,z=Y===void 0?{}:Y,se=ne.openAnimation,le=ne.openTransitionName,_e=me.switchingModeFromInline;if(H)return H;if(Object(A.a)(se)==="object"&&se)Object(bn.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof se=="string")return{motionName:"".concat(ie,"-open-").concat(se)};if(le)return{motionName:le};var be=z[ue];return be||(_e?null:z.other)}var zn=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(ie){var H;Object(m.a)(this,ue),H=me.call(this,ie),H.onSelect=function(se){var le=Object(a.a)(H),_e=le.props;if(_e.selectable){var be=H.store.getState(),Oe=be.selectedKeys,Ie=se.key;_e.multiple?Oe=Oe.concat([Ie]):Oe=[Ie],"selectedKeys"in _e||H.store.setState({selectedKeys:Oe}),_e.onSelect(Object(N.a)(Object(N.a)({},se),{},{selectedKeys:Oe}))}},H.onClick=function(se){var le=H.getRealMenuMode(),_e=Object(a.a)(H),be=_e.store,Oe=_e.props.onOpenChange;le!=="inline"&&!("openKeys"in H.props)&&(be.setState({openKeys:[]}),Oe([])),H.props.onClick(se)},H.onKeyDown=function(se,le){H.innerMenu.getWrappedInstance().onKeyDown(se,le)},H.onOpenChange=function(se){var le=Object(a.a)(H),_e=le.props,be=H.store.getState().openKeys.concat(),Oe=!1,Ie=function(et){var ct=!1;if(et.open)ct=be.indexOf(et.key)===-1,ct&&be.push(et.key);else{var Yt=be.indexOf(et.key);ct=Yt!==-1,ct&&be.splice(Yt,1)}Oe=Oe||ct};Array.isArray(se)?se.forEach(Ie):Ie(se),Oe&&("openKeys"in H.props||H.store.setState({openKeys:be}),_e.onOpenChange(be))},H.onDeselect=function(se){var le=Object(a.a)(H),_e=le.props;if(_e.selectable){var be=H.store.getState().selectedKeys.concat(),Oe=se.key,Ie=be.indexOf(Oe);Ie!==-1&&be.splice(Ie,1),"selectedKeys"in _e||H.store.setState({selectedKeys:be}),_e.onDeselect(Object(N.a)(Object(N.a)({},se),{},{selectedKeys:be}))}},H.onMouseEnter=function(se){H.restoreModeVerticalFromInline();var le=H.props.onMouseEnter;le&&le(se)},H.onTransitionEnd=function(se){var le=se.propertyName==="width"&&se.target===se.currentTarget,_e=se.target.className,be=Object.prototype.toString.call(_e)==="[object SVGAnimatedString]"?_e.animVal:_e,Oe=se.propertyName==="font-size"&&be.indexOf("anticon")>=0;(le||Oe)&&H.restoreModeVerticalFromInline()},H.setInnerMenu=function(se){H.innerMenu=se},H.isRootMenu=!0;var Y=ie.defaultSelectedKeys,z=ie.defaultOpenKeys;return"selectedKeys"in ie&&(Y=ie.selectedKeys||[]),"openKeys"in ie&&(z=ie.openKeys||[]),H.store=Object(i.c)({selectedKeys:Y,openKeys:z,activeKey:{"0-menu-":_r(ie,ie.activeKey)}}),H.state={switchingModeFromInline:!1,prevProps:ie,inlineOpenKeys:[],store:H.store},H}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(H){var Y=this.props,z=Y.siderCollapsed,se=Y.inlineCollapsed,le=Y.onOpenChange;(!H.inlineCollapsed&&se||!H.siderCollapsed&&z)&&le([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var H=this.props.collapsedWidth,Y=this.store,z=this.prevOpenKeys,se=this.getInlineCollapsed()&&(H===0||H==="0"||H==="0px");se?(this.prevOpenKeys=Y.getState().openKeys.concat(),this.store.setState({openKeys:[]})):z&&(this.store.setState({openKeys:z}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var H=this.props.mode,Y=this.state.switchingModeFromInline,z=this.getInlineCollapsed();return Y&&z?"inline":z?"vertical":H}},{key:"getInlineCollapsed",value:function(){var H=this.props,Y=H.inlineCollapsed,z=H.siderCollapsed;return z!==void 0?z:Y}},{key:"restoreModeVerticalFromInline",value:function(){var H=this.state.switchingModeFromInline;H&&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 H=Object(N.a)({},Object(g.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),Y=this.getRealMenuMode();return H.className+=" ".concat(H.prefixCls,"-root"),H.direction==="rtl"&&(H.className+=" ".concat(H.prefixCls,"-rtl")),H=Object(N.a)(Object(N.a)({},H),{},{mode:Y,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Yn(this.props,this.state,Y)}),delete H.openAnimation,delete H.openTransitionName,E.createElement(i.a,{store:this.store},E.createElement(In,Object(o.a)({},H,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(H,Y){var z=Y.prevProps,se=Y.store,le=se.getState(),_e={},be={prevProps:H};return z.mode==="inline"&&H.mode!=="inline"&&(be.switchingModeFromInline=!0),"openKeys"in H?_e.openKeys=H.openKeys||[]:((H.inlineCollapsed&&!z.inlineCollapsed||H.siderCollapsed&&!z.siderCollapsed)&&(be.switchingModeFromInline=!0,be.inlineOpenKeys=le.openKeys,_e.openKeys=[]),(!H.inlineCollapsed&&z.inlineCollapsed||!H.siderCollapsed&&z.siderCollapsed)&&(_e.openKeys=Y.inlineOpenKeys,be.inlineOpenKeys=[])),Object.keys(_e).length&&se.setState(_e),be}}]),ue}(E.Component);zn.defaultProps={selectable:!0,onClick:we,onSelect:we,onOpenChange:we,onDeselect:we,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:E.createElement("span",null,"\xB7\xB7\xB7")};var Vn=zn,wn=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(){var ie;return Object(m.a)(this,ue),ie=me.apply(this,arguments),ie.onKeyDown=function(H){var Y=H.keyCode;return Y===_.a.ENTER?(ie.onClick(H),!0):void 0},ie.onMouseLeave=function(H){var Y=ie.props,z=Y.eventKey,se=Y.onItemHover,le=Y.onMouseLeave;se({key:z,hover:!1}),le({key:z,domEvent:H})},ie.onMouseEnter=function(H){var Y=ie.props,z=Y.eventKey,se=Y.onItemHover,le=Y.onMouseEnter;se({key:z,hover:!0}),le({key:z,domEvent:H})},ie.onClick=function(H){var Y=ie.props,z=Y.eventKey,se=Y.multiple,le=Y.onClick,_e=Y.onSelect,be=Y.onDeselect,Oe=Y.isSelected,Ie={key:z,keyPath:[z],item:Object(a.a)(ie),domEvent:H};le(Ie),se?Oe?be(Ie):_e(Ie):Oe||_e(Ie)},ie.saveNode=function(H){ie.node=H},ie}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var H=this.props;H.onDestroy&&H.onDestroy(H.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 H,Y=Object(N.a)({},this.props),z=I()(this.getPrefixCls(),Y.className,(H={},Object(Ee.a)(H,this.getActiveClassName(),!Y.disabled&&Y.active),Object(Ee.a)(H,this.getSelectedClassName(),Y.isSelected),Object(Ee.a)(H,this.getDisabledClassName(),Y.disabled),H)),se=Object(N.a)(Object(N.a)({},Y.attribute),{},{title:typeof Y.title=="string"?Y.title:void 0,className:z,role:Y.role||"menuitem","aria-disabled":Y.disabled});Y.role==="option"?se=Object(N.a)(Object(N.a)({},se),{},{role:"option","aria-selected":Y.isSelected}):(Y.role===null||Y.role==="none")&&(se.role="none");var le={onClick:Y.disabled?null:this.onClick,onMouseLeave:Y.disabled?null:this.onMouseLeave,onMouseEnter:Y.disabled?null:this.onMouseEnter},_e=Object(N.a)({},Y.style);Y.mode==="inline"&&(Y.direction==="rtl"?_e.paddingRight=Y.inlineIndent*Y.level:_e.paddingLeft=Y.inlineIndent*Y.level),Be.forEach(function(Oe){return delete Y[Oe]}),delete Y.direction;var be=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(be=E.createElement(this.props.itemIcon,this.props)),E.createElement("li",Object(o.a)({},Object(g.a)(Y,["onClick","onMouseEnter","onMouseLeave","onSelect"]),se,le,{style:_e,ref:this.saveNode}),Y.children,be)}}]),ue}(E.Component);wn.isMenuItem=!0,wn.defaultProps={onSelect:we,onMouseEnter:we,onMouseLeave:we,manualRef:we};var Nn=Object(i.b)(function(ne,me){var ue=ne.activeKey,ie=ne.selectedKeys,H=me.eventKey,Y=me.subMenuKey;return{active:ue[Y]===H,isSelected:Array.isArray(ie)?ie.indexOf(H)!==-1:ie===H}})(wn),jn=Nn,rr=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(){var ie;return Object(m.a)(this,ue),ie=me.apply(this,arguments),ie.renderInnerMenuItem=function(H){var Y=ie.props,z=Y.renderMenuItem,se=Y.index;return z(H,se,ie.props.subMenuKey)},ie}return Object(h.a)(ue,[{key:"render",value:function(){var H=Object(o.a)({},this.props),Y=H.className,z=Y===void 0?"":Y,se=H.rootPrefixCls,le="".concat(se,"-item-group-title"),_e="".concat(se,"-item-group-list"),be=H.title,Oe=H.children;return Be.forEach(function(Ie){return delete H[Ie]}),delete H.direction,E.createElement("li",Object(o.a)({},H,{onClick:function(nt){return nt.stopPropagation()},className:"".concat(z," ").concat(se,"-item-group")}),E.createElement("div",{className:le,title:typeof be=="string"?be:void 0},be),E.createElement("ul",{className:_e},E.Children.map(Oe,this.renderInnerMenuItem)))}}]),ue}(E.Component);rr.isMenuItemGroup=!0,rr.defaultProps={disabled:!0};var $n=rr,Br=function(me){var ue=me.className,ie=me.rootPrefixCls,H=me.style;return E.createElement("li",{className:"".concat(ue," ").concat(ie,"-item-divider"),style:H})};Br.defaultProps={disabled:!0,className:"",style:{}};var pr=Br,ar=Vn,Zn=K("eDIo");function Hn(ne,me){var ue=ne.prefixCls,ie=ne.editable,H=ne.locale,Y=ne.style;return!ie||ie.showAdd===!1?null:E.createElement("button",{ref:me,type:"button",className:"".concat(ue,"-nav-add"),style:Y,"aria-label":(H==null?void 0:H.addAriaLabel)||"Add tab",onClick:function(se){ie.onEdit("add",{event:se})}},ie.addIcon||"+")}var Cr=E.forwardRef(Hn);function Fr(ne,me){var ue=ne.prefixCls,ie=ne.id,H=ne.tabs,Y=ne.locale,z=ne.mobile,se=ne.moreIcon,le=se===void 0?"More":se,_e=ne.moreTransitionName,be=ne.style,Oe=ne.className,Ie=ne.editable,nt=ne.tabBarGutter,et=ne.rtl,ct=ne.onTabClick,Yt=Object(E.useState)(!1),dn=Object(j.a)(Yt,2),en=dn[0],sn=dn[1],cn=Object(E.useState)(null),ln=Object(j.a)(cn,2),nn=ln[0],mn=ln[1],hn="".concat(ie,"-more-popup"),Xn="".concat(ue,"-dropdown"),En=nn!==null?"".concat(hn,"-").concat(nn):null,$t=Y==null?void 0:Y.dropdownAriaLabel,Vt=E.createElement(ar,{onClick:function(gn){var Gn=gn.key,hr=gn.domEvent;ct(Gn,hr),sn(!1)},id:hn,tabIndex:-1,role:"listbox","aria-activedescendant":En,selectedKeys:[nn],"aria-label":$t!==void 0?$t:"expanded dropdown"},H.map(function(qt){return E.createElement(jn,{key:qt.key,id:"".concat(hn,"-").concat(qt.key),role:"option","aria-controls":ie&&"".concat(ie,"-panel-").concat(qt.key),disabled:qt.disabled},qt.tab)}));function vn(qt){for(var gn=H.filter(function(wr){return!wr.disabled}),Gn=gn.findIndex(function(wr){return wr.key===nn})||0,hr=gn.length,Sr=0;Sr<hr;Sr+=1){Gn=(Gn+qt+hr)%hr;var Qn=gn[Gn];if(!Qn.disabled){mn(Qn.key);return}}}function pn(qt){var gn=qt.which;if(!en){[_.a.DOWN,_.a.SPACE,_.a.ENTER].includes(gn)&&(sn(!0),qt.preventDefault());return}switch(gn){case _.a.UP:vn(-1),qt.preventDefault();break;case _.a.DOWN:vn(1),qt.preventDefault();break;case _.a.ESC:sn(!1);break;case _.a.SPACE:case _.a.ENTER:nn!==null&&ct(nn,qt);break}}Object(E.useEffect)(function(){var qt=document.getElementById(En);qt&&qt.scrollIntoView&&qt.scrollIntoView(!1)},[nn]),Object(E.useEffect)(function(){en||mn(null)},[en]);var Lt=Object(Ee.a)({},et?"marginLeft":"marginRight",nt);H.length||(Lt.visibility="hidden",Lt.order=1);var Cn=I()(Object(Ee.a)({},"".concat(Xn,"-rtl"),et)),Fn=z?null:E.createElement(Zn.a,{prefixCls:Xn,overlay:Vt,trigger:["hover"],visible:en,transitionName:_e,onVisibleChange:sn,overlayClassName:Cn,mouseEnterDelay:.1,mouseLeaveDelay:.1},E.createElement("button",{type:"button",className:"".concat(ue,"-nav-more"),style:Lt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":hn,id:"".concat(ie,"-more"),"aria-expanded":en,onKeyDown:pn},le));return E.createElement("div",{className:I()("".concat(ue,"-nav-operations"),Oe),style:be,ref:me},Fn,E.createElement(Cr,{prefixCls:ue,locale:Y,editable:Ie}))}var Jr=E.forwardRef(Fr),mr=Object(E.createContext)(null),Tr=.1,ir=.01,or=20,Lr=Math.pow(.995,or);function aa(){var ne=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(ne)||/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(ne.substr(0,4)))}function Na(ne,me){var ue=Object(E.useState)(),ie=Object(j.a)(ue,2),H=ie[0],Y=ie[1],z=Object(E.useState)(0),se=Object(j.a)(z,2),le=se[0],_e=se[1],be=Object(E.useState)(0),Oe=Object(j.a)(be,2),Ie=Oe[0],nt=Oe[1],et=Object(E.useState)(),ct=Object(j.a)(et,2),Yt=ct[0],dn=ct[1],en=Object(E.useRef)();function sn($t){var Vt=$t.touches[0],vn=Vt.screenX,pn=Vt.screenY;Y({x:vn,y:pn}),window.clearInterval(en.current)}function cn($t){if(!H)return;$t.preventDefault();var Vt=$t.touches[0],vn=Vt.screenX,pn=Vt.screenY;Y({x:vn,y:pn});var Lt=vn-H.x,Cn=pn-H.y;me(Lt,Cn);var Fn=Date.now();_e(Fn),nt(Fn-le),dn({x:Lt,y:Cn})}function ln(){if(!H)return;if(Y(null),dn(null),Yt){var $t=Yt.x/Ie,Vt=Yt.y/Ie,vn=Math.abs($t),pn=Math.abs(Vt);if(Math.max(vn,pn)<Tr)return;var Lt=$t,Cn=Vt;en.current=window.setInterval(function(){if(Math.abs(Lt)<ir&&Math.abs(Cn)<ir){window.clearInterval(en.current);return}Lt*=Lr,Cn*=Lr,me(Lt*or,Cn*or)},or)}}var nn=Object(E.useRef)(0),mn=Object(E.useRef)(!1),hn=Object(E.useRef)();function Xn($t){var Vt=$t.deltaX,vn=$t.deltaY,pn=0,Lt=Math.abs(Vt),Cn=Math.abs(vn);Lt===Cn?pn=hn.current==="x"?Vt:vn:Lt>Cn?(pn=Vt,hn.current="x"):(pn=vn,hn.current="y");var Fn=Date.now();Fn-nn.current>100&&(mn.current=!1),(me(-pn,-pn)||mn.current)&&($t.preventDefault(),mn.current=!0),nn.current=Fn}var En=Object(E.useRef)(null);En.current={onTouchStart:sn,onTouchMove:cn,onTouchEnd:ln,onWheel:Xn},E.useEffect(function(){function $t(Lt){En.current.onTouchStart(Lt)}function Vt(Lt){En.current.onTouchMove(Lt)}function vn(Lt){En.current.onTouchEnd(Lt)}function pn(Lt){En.current.onWheel(Lt)}return document.addEventListener("touchmove",Vt,{passive:!1}),document.addEventListener("touchend",vn,{passive:!1}),ne.current.addEventListener("touchstart",$t,{passive:!1}),ne.current.addEventListener("wheel",pn),function(){document.removeEventListener("touchmove",Vt),document.removeEventListener("touchend",vn)}},[])}function Va(){var ne=Object(E.useRef)(new Map);function me(ie){return ne.current.has(ie)||ne.current.set(ie,E.createRef()),ne.current.get(ie)}function ue(ie){ne.current.delete(ie)}return[me,ue]}function xa(ne,me){var ue=E.useRef(ne),ie=E.useState({}),H=Object(j.a)(ie,2),Y=H[1];function z(se){var le=typeof se=="function"?se(ue.current):se;le!==ue.current&&me(le,ue.current),ue.current=le,Y({})}return[ue.current,z]}var Ua=function(me){var ue=me.position,ie=me.prefixCls,H=me.extra;if(!H)return null;var Y,z=H;return ue==="right"&&(Y=z.right||!z.left&&z||null),ue==="left"&&(Y=z.left||null),Y?E.createElement("div",{className:"".concat(ie,"-extra-content")},Y):null};function Ca(ne,me){var ue,ie=E.useContext(mr),H=ie.prefixCls,Y=ie.tabs,z=ne.className,se=ne.style,le=ne.id,_e=ne.animated,be=ne.activeKey,Oe=ne.rtl,Ie=ne.extra,nt=ne.editable,et=ne.locale,ct=ne.tabPosition,Yt=ne.tabBarGutter,dn=ne.children,en=ne.onTabClick,sn=ne.onTabScroll,cn=Object(E.useRef)(),ln=Object(E.useRef)(),nn=Object(E.useRef)(),mn=Object(E.useRef)(),hn=Va(),Xn=Object(j.a)(hn,2),En=Xn[0],$t=Xn[1],Vt=ct==="top"||ct==="bottom",vn=xa(0,function(Rn,_n){Vt&&sn&&sn({direction:Rn>_n?"left":"right"})}),pn=Object(j.a)(vn,2),Lt=pn[0],Cn=pn[1],Fn=xa(0,function(Rn,_n){!Vt&&sn&&sn({direction:Rn>_n?"top":"bottom"})}),qt=Object(j.a)(Fn,2),gn=qt[0],Gn=qt[1],hr=Object(E.useState)(0),Sr=Object(j.a)(hr,2),Qn=Sr[0],wr=Sr[1],Kr=Object(E.useState)(0),Dr=Object(j.a)(Kr,2),kr=Dr[0],rn=Dr[1],fr=Object(E.useState)(0),sr=Object(j.a)(fr,2),er=sr[0],Wr=sr[1],Hr=Object(E.useState)(0),$r=Object(j.a)(Hr,2),Mn=$r[0],Ir=$r[1],Xr=Object(E.useState)(null),Ln=Object(j.a)(Xr,2),Tn=Ln[0],lr=Ln[1],fa=Object(E.useState)(null),ea=Object(j.a)(fa,2),Qr=ea[0],Ya=ea[1],Qa=Object(E.useState)(0),Ba=Object(j.a)(Qa,2),ta=Ba[0],Ja=Ba[1],Za=Object(E.useState)(0),Fa=Object(j.a)(Za,2),qa=Fa[0],Sa=Fa[1],Ka=x(new Map),wa=Object(j.a)(Ka,2),Oa=wa[0],Ra=wa[1],na=l(Y,Oa,Qn),Wa="".concat(H,"-nav-operations-hidden"),oa=0,sa=0;Vt?Oe?(oa=0,sa=Math.max(0,Qn-Tn)):(oa=Math.min(0,Tn-Qn),sa=0):(oa=Math.min(0,Qr-kr),sa=0);function Pa(Rn){return Rn<oa?[oa,!1]:Rn>sa?[sa,!1]:[Rn,!0]}var Ha=Object(E.useRef)(),ai=Object(E.useState)(),Ga=Object(j.a)(ai,2),pa=Ga[0],za=Ga[1];function ma(){za(Date.now())}function va(){window.clearTimeout(Ha.current)}Na(cn,function(Rn,_n){var vr=!1;function zr(Da,ka){Da(function(Ma){var La=Pa(Ma+ka),ga=Object(j.a)(La,2),ei=ga[0],ti=ga[1];return vr=ti,ei})}if(Vt){if(Tn>=Qn)return vr;zr(Cn,Rn)}else{if(Qr>=kr)return vr;zr(Gn,_n)}return va(),ma(),vr}),Object(E.useEffect)(function(){return va(),pa&&(Ha.current=window.setTimeout(function(){za(0)},100)),va},[pa]);function Aa(){var Rn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:be,_n=na.get(Rn);if(!_n)return;if(Vt){var vr=Lt;Oe?_n.right<Lt?vr=_n.right:_n.right+_n.width>Lt+Tn&&(vr=_n.right+_n.width-Tn):_n.left<-Lt?vr=-_n.left:_n.left+_n.width>-Lt+Tn&&(vr=-(_n.left+_n.width-Tn)),Gn(0),Cn(Pa(vr)[0])}else{var zr=gn;_n.top<-gn?zr=-_n.top:_n.top+_n.height>-gn+Qr&&(zr=-(_n.top+_n.height-Qr)),Cn(0),Gn(Pa(zr)[0])}}var ii=d(na,{width:Tn,height:Qr,left:Lt,top:gn},{width:er,height:Mn},{width:ta,height:qa},Object(N.a)(Object(N.a)({},ne),{},{tabs:Y})),Fe=Object(j.a)(ii,2),Me=Fe[0],Le=Fe[1],$e=Y.map(function(Rn){var _n=Rn.key;return E.createElement(n,{id:le,prefixCls:H,key:_n,rtl:Oe,tab:Rn,closable:Rn.closable,editable:nt,active:_n===be,tabPosition:ct,tabBarGutter:Yt,renderWrapper:dn,removeAriaLabel:et==null?void 0:et.removeAriaLabel,ref:En(_n),onClick:function(zr){en(_n,zr)},onRemove:function(){$t(_n)},onFocus:function(){Aa(_n),ma(),Oe||(cn.current.scrollLeft=0),cn.current.scrollTop=0}})}),st=C(function(){var Rn,_n,vr,zr,Da,ka,Ma,La,ga,ei=((Rn=cn.current)===null||Rn===void 0?void 0:Rn.offsetWidth)||0,ti=((_n=cn.current)===null||_n===void 0?void 0:_n.offsetHeight)||0,oi=((vr=mn.current)===null||vr===void 0?void 0:vr.offsetWidth)||0,si=((zr=mn.current)===null||zr===void 0?void 0:zr.offsetHeight)||0,fi=((Da=nn.current)===null||Da===void 0?void 0:Da.offsetWidth)||0,pi=((ka=nn.current)===null||ka===void 0?void 0:ka.offsetHeight)||0;lr(ei),Ya(ti),Ja(oi),Sa(si);var li=(((Ma=ln.current)===null||Ma===void 0?void 0:Ma.offsetWidth)||0)-oi,ui=(((La=ln.current)===null||La===void 0?void 0:La.offsetHeight)||0)-si;wr(li),rn(ui);var di=(ga=nn.current)===null||ga===void 0?void 0:ga.className.includes(Wa);Wr(li-(di?0:fi)),Ir(ui-(di?0:pi)),Ra(function(){var ci=new Map;return Y.forEach(function(mi){var hi=mi.key,Ia=En(hi).current;Ia&&ci.set(hi,{width:Ia.offsetWidth,height:Ia.offsetHeight,left:Ia.offsetLeft,top:Ia.offsetTop})}),ci})}),Ct=Y.slice(0,Me),pt=Y.slice(Le+1),Tt=[].concat(Object(P.a)(Ct),Object(P.a)(pt)),On=Object(E.useState)(),An=Object(j.a)(On,2),Gr=An[0],yn=An[1],tr=na.get(be),Nr=Object(E.useRef)();function ur(){S.a.cancel(Nr.current)}Object(E.useEffect)(function(){var Rn={};return tr&&(Vt?(Oe?Rn.right=tr.right:Rn.left=tr.left,Rn.width=tr.width):(Rn.top=tr.top,Rn.height=tr.height)),ur(),Nr.current=S()(function(){yn(Rn)}),ur},[tr,Vt,Oe]),Object(E.useEffect)(function(){Aa()},[be,tr,na,Vt]),Object(E.useEffect)(function(){st()},[Oe,Yt,be,Y.map(function(Rn){return Rn.key}).join("_")]);var Yr=!!Tt.length,Un="".concat(H,"-nav-wrap"),yr,Or,la,Mr;return Vt?Oe?(Or=Lt>0,yr=Lt+Tn<Qn):(yr=Lt<0,Or=-Lt+Tn<Qn):(la=gn<0,Mr=-gn+Qr<kr),E.createElement("div",{ref:me,role:"tablist",className:I()("".concat(H,"-nav"),z),style:se,onKeyDown:function(){ma()}},E.createElement(Ua,{position:"left",extra:Ie,prefixCls:H}),E.createElement(w.a,{onResize:st},E.createElement("div",{className:I()(Un,(ue={},Object(Ee.a)(ue,"".concat(Un,"-ping-left"),yr),Object(Ee.a)(ue,"".concat(Un,"-ping-right"),Or),Object(Ee.a)(ue,"".concat(Un,"-ping-top"),la),Object(Ee.a)(ue,"".concat(Un,"-ping-bottom"),Mr),ue)),ref:cn},E.createElement(w.a,{onResize:st},E.createElement("div",{ref:ln,className:"".concat(H,"-nav-list"),style:{transform:"translate(".concat(Lt,"px, ").concat(gn,"px)"),transition:pa?"none":void 0}},$e,E.createElement(Cr,{ref:mn,prefixCls:H,locale:et,editable:nt,style:{visibility:Yr?"hidden":null}}),E.createElement("div",{className:I()("".concat(H,"-ink-bar"),Object(Ee.a)({},"".concat(H,"-ink-bar-animated"),_e.inkBar)),style:Gr}))))),E.createElement(Jr,Object.assign({},ne,{ref:nn,prefixCls:H,tabs:Tt,className:!Yr&&Wa})),E.createElement(Ua,{position:"right",extra:Ie,prefixCls:H}))}var ja=E.forwardRef(Ca);function ni(ne){var me=ne.id,ue=ne.activeKey,ie=ne.animated,H=ne.tabPosition,Y=ne.rtl,z=ne.destroyInactiveTabPane,se=E.useContext(mr),le=se.prefixCls,_e=se.tabs,be=ie.tabPane,Oe=_e.findIndex(function(Ie){return Ie.key===ue});return E.createElement("div",{className:I()("".concat(le,"-content-holder"))},E.createElement("div",{className:I()("".concat(le,"-content"),"".concat(le,"-content-").concat(H),Object(Ee.a)({},"".concat(le,"-content-animated"),be)),style:Oe&&be?Object(Ee.a)({},Y?"marginRight":"marginLeft","-".concat(Oe,"00%")):null},_e.map(function(Ie){return E.cloneElement(Ie.node,{key:Ie.key,prefixCls:le,tabKey:Ie.key,id:me,animated:be,active:Ie.key===ue,destroyInactiveTabPane:z})})))}function ia(ne){var me=ne.prefixCls,ue=ne.forceRender,ie=ne.className,H=ne.style,Y=ne.id,z=ne.active,se=ne.animated,le=ne.destroyInactiveTabPane,_e=ne.tabKey,be=ne.children,Oe=E.useState(ue),Ie=Object(j.a)(Oe,2),nt=Ie[0],et=Ie[1];E.useEffect(function(){z?et(!0):le&&et(!1)},[z,le]);var ct={};return z||(se?(ct.visibility="hidden",ct.height=0,ct.overflowY="hidden"):ct.display="none"),E.createElement("div",{id:Y&&"".concat(Y,"-panel-").concat(_e),role:"tabpanel",tabIndex:z?0:-1,"aria-labelledby":Y&&"".concat(Y,"-tab-").concat(_e),"aria-hidden":!z,style:Object(N.a)(Object(N.a)({},ct),H),className:I()("".concat(me,"-tabpane"),z&&"".concat(me,"-tabpane-active"),ie)},(z||nt||ue)&&be)}var qr=0;function cr(ne){return Object(L.a)(ne).map(function(me){if(E.isValidElement(me)){var ue=me.key!==void 0?String(me.key):void 0;return Object(N.a)(Object(N.a)({key:ue},me.props),{},{node:me})}return null}).filter(function(me){return me})}function $a(ne,me){var ue,ie=ne.id,H=ne.prefixCls,Y=H===void 0?"rc-tabs":H,z=ne.className,se=ne.children,le=ne.direction,_e=ne.activeKey,be=ne.defaultActiveKey,Oe=ne.editable,Ie=ne.animated,nt=ne.tabPosition,et=nt===void 0?"top":nt,ct=ne.tabBarGutter,Yt=ne.tabBarStyle,dn=ne.tabBarExtraContent,en=ne.locale,sn=ne.moreIcon,cn=ne.moreTransitionName,ln=ne.destroyInactiveTabPane,nn=ne.renderTabBar,mn=ne.onChange,hn=ne.onTabClick,Xn=ne.onTabScroll,En=Object(O.a)(ne,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),$t=cr(se),Vt=le==="rtl",vn;Ie===!1?vn={inkBar:!1,tabPane:!1}:vn=Object(N.a)({inkBar:!0,tabPane:!1},Ie!==!0?Ie:null);var pn=Object(E.useState)(!1),Lt=Object(j.a)(pn,2),Cn=Lt[0],Fn=Lt[1];Object(E.useEffect)(function(){Fn(aa())},[]);var qt=Object(T.a)(function(){var Mn;return(Mn=$t[0])===null||Mn===void 0?void 0:Mn.key},{value:_e,defaultValue:be}),gn=Object(j.a)(qt,2),Gn=gn[0],hr=gn[1],Sr=Object(E.useState)(function(){return $t.findIndex(function(Mn){return Mn.key===Gn})}),Qn=Object(j.a)(Sr,2),wr=Qn[0],Kr=Qn[1];Object(E.useEffect)(function(){var Mn=$t.findIndex(function(Xr){return Xr.key===Gn});if(Mn===-1){var Ir;Mn=Math.max(0,Math.min(wr,$t.length-1)),hr((Ir=$t[Mn])===null||Ir===void 0?void 0:Ir.key)}Kr(Mn)},[$t.map(function(Mn){return Mn.key}).join("_"),Gn,wr]);var Dr=Object(T.a)(null,{value:ie}),kr=Object(j.a)(Dr,2),rn=kr[0],fr=kr[1],sr=et;Cn&&!["left","right"].includes(et)&&(sr="top"),Object(E.useEffect)(function(){ie||(fr("rc-tabs-".concat(qr)),qr+=1)},[]);function er(Mn,Ir){hn==null||hn(Mn,Ir),hr(Mn),mn==null||mn(Mn)}var Wr={id:rn,activeKey:Gn,animated:vn,tabPosition:sr,rtl:Vt,mobile:Cn},Hr,$r=Object(N.a)(Object(N.a)({},Wr),{},{editable:Oe,locale:en,moreIcon:sn,moreTransitionName:cn,tabBarGutter:ct,onTabClick:er,onTabScroll:Xn,extra:dn,style:Yt,panes:se});return nn?Hr=nn($r,ja):Hr=E.createElement(ja,Object.assign({},$r)),E.createElement(mr.Provider,{value:{tabs:$t,prefixCls:Y}},E.createElement("div",Object.assign({ref:me,id:ie,className:I()(Y,"".concat(Y,"-").concat(sr),(ue={},Object(Ee.a)(ue,"".concat(Y,"-mobile"),Cn),Object(Ee.a)(ue,"".concat(Y,"-editable"),Oe),Object(Ee.a)(ue,"".concat(Y,"-rtl"),Vt),ue),z)},En),Hr,E.createElement(ni,Object.assign({destroyInactiveTabPane:ln},Wr,{animated:vn}))))}var Ta=E.forwardRef($a);Ta.TabPane=ia;var Xa=Ta,ri=Ye.b=Xa},mOS8:function(Pt,Ye,K){Pt.exports=K.p+"static/403Qrcode.6c17b6f4.png"},mgmH:function(Pt,Ye,K){"use strict";K.d(Ye,"d",function(){return w}),K.d(Ye,"b",function(){return C}),K.d(Ye,"e",function(){return x}),K.d(Ye,"c",function(){return _}),K.d(Ye,"n",function(){return p}),K.d(Ye,"g",function(){return n}),K.d(Ye,"h",function(){return u}),K.d(Ye,"j",function(){return v}),K.d(Ye,"a",function(){return d}),K.d(Ye,"l",function(){return o}),K.d(Ye,"f",function(){return m}),K.d(Ye,"k",function(){return h}),K.d(Ye,"m",function(){return a}),K.d(Ye,"i",function(){return r}),K.d(Ye,"o",function(){return e}),K.d(Ye,"r",function(){return i}),K.d(Ye,"q",function(){return g}),K.d(Ye,"p",function(){return f});var Ee=K("miYZ"),j=K("tsqr"),O=K("k1fw"),N=K("9og8"),E=K("WmNS"),R=K.n(E),I=K("oUNq"),L=K("9kvl"),T=K("1vsH"),P=K("m3rI"),b=function(){Object(L.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u751F\u6210\u6587\u4EF6\uFF0C\u8BF7\u7A0D\u540E..."}})},S=function(){Object(L.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}})},w=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return b(),G.next=3,Object(I.s)(Object(O.a)({},A));case 3:if(U=G.sent,!(U.status===0)){G.next=7;break}return G.next=7,Object(T.u)("",Object(T.U)({url:P.a.API_SERVER+"/api/courses/".concat(A.coursesId,"/export_couser_info.json"),query:A}));case 7:S();case 8:case"end":return G.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),C=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return G.next=2,Object(I.q)(Object(O.a)({},A));case 2:if(U=G.sent,!(U.status===0)){G.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_member_act_score")),G.next=13;break;case 8:if(!(U.status===-2)){G.next=12;break}return G.abrupt("return",U);case 12:U.status===-3&&(Object(L.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_member_act_score")));case 13:case"end":return G.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),x=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return G.next=2,Object(I.t)(Object(O.a)({},A));case 2:if(U=G.sent,!(U.status===0)){G.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_score")),G.next=13;break;case 8:if(!(U.status===-2)){G.next=12;break}return G.abrupt("return",U);case 12:U.status===-3&&(Object(L.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_score")));case 13:case"end":return G.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),_=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return G.next=2,Object(I.r)(Object(O.a)({},A));case 2:if(U=G.sent,!(U.status===0)){G.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_exercise_and_other")),G.next=13;break;case 8:if(!(U.status===-2)){G.next=12;break}return G.abrupt("return",U);case 12:U.status===-3&&(Object(L.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return G.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),p=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return G.next=2,Object(I.y)(Object(O.a)({},A));case 2:if(U=G.sent,!(U.status===0)){G.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_exercise_and_other")),G.next=13;break;case 8:if(!(U.status===-2)){G.next=12;break}return G.abrupt("return",U);case 12:U.status===-3&&(Object(L.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return G.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),n=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return G.next=2,Object(I.u)(Object(O.a)({},A));case 2:if(U=G.sent,!(U.status===0)){G.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_homework")),G.next=13;break;case 8:if(!(U.status===-2)){G.next=12;break}return G.abrupt("return",U);case 12:U.status===-3&&(Object(L.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_homework")));case 13:case"end":return G.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),u=function(){var y=Object(N.a)(R.a.mark(function t(A,U){var B;return R.a.wrap(function(J){for(;;)switch(J.prev=J.next){case 0:return J.next=2,Object(I.w)(Object(O.a)({},A));case 2:B=J.sent,B.status===0?(j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/").concat(U))):B.status===-3&&(Object(L.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/").concat(U)));case 4:case"end":return J.stop()}},t)}));return function(A,U){return y.apply(this,arguments)}}(),l=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return b(),G.next=3,Object(I.v)(Object(O.a)({},A));case 3:if(U=G.sent,!(U.status===0)){G.next=7;break}return G.next=7,Object(T.u)("",Object(T.U)({url:P.a.API_SERVER+"/api/homework_commons/".concat(A.categoryId,"/works_list.zip"),query:A}));case 7:S();case 8:case"end":return G.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),v=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return b(),G.next=3,Object(I.z)(Object(O.a)({},A));case 3:if(U=G.sent,!(U.status===0)){G.next=7;break}return G.next=7,Object(T.u)("",Object(T.U)({url:P.a.API_SERVER+"/api/polls/".concat(A.categoryId,"/commit_result.xlsx"),query:A}));case 7:S();case 8:case"end":return G.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),d=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,Object(T.t)("",Object(T.U)({url:P.a.API_SERVER+"/api/courses/".concat(A.coursesId,"/attendances/export_xlsx_data.xlsx"),query:A}));case 2:case"end":return B.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),o=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,Object(T.t)("",Object(T.U)({url:P.a.API_SERVER+"/api/courses/".concat(A.coursesId,"/video_study_statics.xlsx"),query:A}));case 2:case"end":return B.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),m=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,Object(T.t)("",Object(T.U)({url:P.a.API_SERVER+"/api/courses/".concat(A.coursesId,"/export_course_students_info.xlsx"),query:A}));case 2:case"end":return B.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),h=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,Object(T.t)("",Object(T.U)({url:P.a.API_SERVER+"/api/item_banks/export.xlsx",query:A}));case 2:case"end":return B.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),a=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,Object(T.t)("",Object(T.U)({url:P.a.API_SERVER+"/api/competitions/region_reports.xlsx",query:A}));case 2:case"end":return B.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),r=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return G.next=2,Object(I.x)(Object(O.a)({},A));case 2:U=G.sent,U.status===0?(j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/exercise_score"))):U.status===-3&&(Object(L.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),L.d.push("/classrooms/".concat(A.coursesId,"/exportlist/exercise_score")));case 4:case"end":return G.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),e=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return console.log("----------","\u8C03\u7528\u4E0B\u8F7D"),B.next=3,Object(T.t)("",Object(T.U)({url:P.a.API_SERVER+"/api/export_records/".concat(A.id,".xlsx"),query:A}));case 3:case"end":return B.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),i=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,Object(T.t)("",Object(T.U)({url:P.a.API_SERVER+"/api/ec_major_schools/0/ec_years.xlsx",query:A}));case 2:case"end":return B.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),g=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,Object(T.t)("",Object(T.U)({url:P.a.API_SERVER+"/api/ec_years/".concat(A==null?void 0:A.ec_year_id,"/ec_training_objectives.xlsx"),query:A}));case 2:case"end":return B.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),f=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,Object(T.t)("",Object(T.U)({url:P.a.API_SERVER+"/api/ec_years/".concat(A==null?void 0:A.ec_year_id,"/ec_graduation_requirements.xlsx"),query:A}));case 2:case"end":return B.stop()}},t)}));return function(A){return y.apply(this,arguments)}}()},nSDg:function(Pt,Ye,K){Pt.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:function(Pt,Ye,K){"use strict";var Ee=K("+L6B"),j=K("2/Rp"),O=K("5Dmo"),N=K("3S7+"),E=K("k1fw"),R=K("9og8"),I=K("tJVT"),L=K("WmNS"),T=K.n(L),P=K("q1tI"),b=K.n(P),S=K("vHTk"),w=K.n(S),C=K("yEEn"),x=K("ZW9T"),_=K("1vsH"),p=K("V0Rq"),n=K("m3rI"),u=function(v){var d=v.name,o=v.data,m=v.theme,h=v.type,a=v.filename,r=v.monacoEditor,e=v.className,i=v.style,g=v.close,f=v.onClose,y=v.hasMask,t=v.otherData,A=t===void 0?{}:t,U=Object(P.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),B=Object(I.a)(U,2),G=B[0],J=B[1],F=Object(P.useState)(""),q=Object(I.a)(F,2),re=q[0],ae=q[1],ve=Object(P.useState)(),de=Object(I.a)(ve,2),Z=de[0],ee=de[1],pe=window.ENV==="build"?"/react/build/office.html":"/office.html",Q,V=1024*1024,Ce=10*V,De=Object(P.useRef)();h==="office"&&(Q=Object(_.P)(o).filesize,Q>Ce&&(h="other")),a&&(r.filename=a),Object(P.useEffect)(function(){var Se,Ae,je=(Se=document.cookie)===null||Se===void 0||((Ae=Se.replace(/\s/g,""))===null||Ae===void 0)?void 0:Ae.split(";");je==null||je.map(function(Be){var Ke=Be.split("=");Ke[0]==="_educoder_session"&&ae(Ke[1])})},[]),Object(P.useEffect)(function(){h==="office"&&Ne()},[h]);var Ne=function(){var Se=Object(R.a)(T.a.mark(function Ae(){var je,Be,Ke;return T.a.wrap(function(xe){for(;;)switch(xe.prev=xe.next){case 0:return console.log("data:",o),je=o,o.startsWith("http")||(je=location.origin+je),Be=new URL(je).pathname.split("/").pop(),xe.next=6,Object(p.U)({attachment_id:Be});case 6:Ke=xe.sent,ee(Ke);case 8:case"end":return xe.stop()}},Ae)}));return function(){return Se.apply(this,arguments)}}(),we=function(){if(o.startsWith("http")||o.startsWith("blob:")){ke();return}Object(_.x)(a||"educoder",o,a)},ke=function(){Object(_.v)(a||"educoder",decodeURIComponent(o))};return b.a.createElement("div",{style:Object(E.a)({},i||{}),className:"".concat(y&&w.a.bgBlack," ").concat(h?w.a.wrp:"hide")},g&&b.a.createElement("div",{className:w.a.close,ref:De},b.a.createElement(N.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return De.current}},b.a.createElement("span",{onClick:ke},b.a.createElement("i",{className:"icon-quxiaozhiding"}))),b.a.createElement(N.a,{title:"\u5173\u95ED",getPopupContainer:function(){return De.current}},b.a.createElement("span",{className:"",onClick:function(){f(),ee(null)}},b.a.createElement("i",{className:"icon-guanbi1"})))),b.a.createElement("div",{className:"".concat(w.a[e]," ").concat(e," ").concat(w.a.monaco," ").concat(h==="txt"?"show":"hide")},h==="txt"&&b.a.createElement(x.b,r)),h==="audio"&&b.a.createElement("audio",{src:"".concat((o==null?void 0:o.indexOf("http://"))>-1||(o==null?void 0:o.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(o),autoPlay:!0}),h==="video"&&b.a.createElement(b.a.Fragment,null,(o==null?void 0:o.indexOf("/api"))>-1?b.a.createElement("video",{controls:!0,src:"".concat(o),autoPlay:!0}):b.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(o),autoPlay:!0})),h==="office"&&Z&&b.a.createElement("iframe",{src:"".concat(pe,"?key=").concat(Z.key,"&url=").concat(n.a.API_SERVER+Z.url,"&callbackUrl=").concat(n.a.API_SERVER+Z.callbackUrl,"&fileType=").concat(Z.fileType,"&title=").concat(Z.title,"&model=view")}),(h==="xlsx"||h==="doc"||h==="pptx"||h==="docx")&&b.a.createElement("iframe",{src:"".concat(pe,"?key=").concat(A.key,"&url=").concat(n.a.API_SERVER+A.url,"&callbackUrl=").concat(n.a.API_SERVER+A.callbackUrl,"&fileType=").concat(A.fileType,"&title=").concat(A.title,"&model=").concat(A.model)}),h==="html"&&b.a.createElement("iframe",{src:o+"&disposition=inline"}),h==="pdf"&&b.a.createElement("embed",{className:w.a.embed,src:o,type:"application/pdf"}),h==="image"&&b.a.createElement("img",{src:"".concat((o==null?void 0:o.indexOf("http://"))>-1||(o==null?void 0:o.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(o)}),h==="other"&&b.a.createElement("div",null,b.a.createElement(j.a,{type:"primary",size:"large",onClick:we},b.a.createElement(C.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),h==="download"&&b.a.createElement(j.a,{type:"primary",size:"large",onClick:we},b.a.createElement(C.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};Ye.a=u},"rAM+":function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return j});var Ee=K("Qw5x");function j(O,N){var E;if(typeof Symbol=="undefined"||O[Symbol.iterator]==null){if(Array.isArray(O)||(E=Object(Ee.a)(O))||N&&O&&typeof O.length=="number"){E&&(O=E);var R=0,I=function(){};return{s:I,n:function(){return R>=O.length?{done:!0}:{done:!1,value:O[R++]}},e:function(S){throw S},f:I}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var L=!0,T=!1,P;return{s:function(){E=O[Symbol.iterator]()},n:function(){var S=E.next();return L=S.done,S},e:function(S){T=!0,P=S},f:function(){try{!L&&E.return!=null&&E.return()}finally{if(T)throw P}}}}},rCGY:function(Pt,Ye,K){Pt.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:function(Pt,Ye){const K=/[&<>"']/,Ee=/[&<>"']/g,j=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,N={"&":"&","<":"<",">":">",'"':""","'":"'"},E=h=>N[h];function R(h,a){if(a){if(K.test(h))return h.replace(Ee,E)}else if(j.test(h))return h.replace(O,E);return h}const I=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function L(h){return h.replace(I,(a,r)=>(r=r.toLowerCase(),r==="colon"?":":r.charAt(0)==="#"?r.charAt(1)==="x"?String.fromCharCode(parseInt(r.substring(2),16)):String.fromCharCode(+r.substring(1)):""))}const T=/(^|[^\[])\^/g;function P(h,a){h=h.source||h,a=a||"";const r={replace:(e,i)=>(i=i.source||i,i=i.replace(T,"$1"),h=h.replace(e,i),r),getRegex:()=>new RegExp(h,a)};return r}const b=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(h,a,r){if(h){let e;try{e=decodeURIComponent(L(r)).replace(b,"").toLowerCase()}catch(i){return null}if(e.indexOf("javascript:")===0||e.indexOf("vbscript:")===0||e.indexOf("data:")===0)return null}a&&!S.test(r)&&(r=n(a,r));try{r=encodeURI(r).replace(/%25/g,"%")}catch(e){return null}return r}const C={},x=/^[^:]+:\/*[^/]*$/,_=/^([^:]+:)[\s\S]*$/,p=/^([^:]+:\/*[^/]*)[\s\S]*$/;function n(h,a){C[" "+h]||(x.test(h)?C[" "+h]=h+"/":C[" "+h]=d(h,"/",!0)),h=C[" "+h];const r=h.indexOf(":")===-1;return a.substring(0,2)==="//"?r?a:h.replace(_,"$1")+a:a.charAt(0)==="/"?r?a:h.replace(p,"$1")+a:h+a}const u={exec:function(){}};function l(h){let a=1,r,e;for(;a<arguments.length;a++){r=arguments[a];for(e in r)Object.prototype.hasOwnProperty.call(r,e)&&(h[e]=r[e])}return h}function v(h,a){const r=h.replace(/\|/g,(g,f,y)=>{let t=!1,A=f;for(;--A>=0&&y[A]==="\\";)t=!t;return t?"|":" |"}),e=r.split(/ \|/);let i=0;if(e.length>a)e.splice(a);else for(;e.length<a;)e.push("");for(;i<e.length;i++)e[i]=e[i].trim().replace(/\\\|/g,"|");return e}function d(h,a,r){const e=h.length;if(e===0)return"";let i=0;for(;i<e;){const g=h.charAt(e-i-1);if(g===a&&!r)i++;else if(g!==a&&r)i++;else break}return h.substr(0,e-i)}function o(h,a){if(h.indexOf(a[1])===-1)return-1;const r=h.length;let e=0,i=0;for(;i<r;i++)if(h[i]==="\\")i++;else if(h[i]===a[0])e++;else if(h[i]===a[1]&&(e--,e<0))return i;return-1}function m(h){h&&h.sanitize&&!h.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")}Pt.exports={escape:R,unescape:L,edit:P,cleanUrl:w,resolveUrl:n,noopTest:u,merge:l,splitCells:v,rtrim:d,findClosingBracket:o,checkSanitizeDeprecation:m}},sboe:function(Pt,Ye,K){"use strict";K.d(Ye,"a",function(){return O});var Ee=K("q1tI"),j=K.n(Ee),O=Ee.createContext(null)},spXi:function(Pt,Ye,K){Pt.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:function(Pt,Ye,K){"use strict";var Ee=K("VTBJ"),j=K("1OyB"),O=K("vuIU"),N=K("Ji7U"),E=K("LK+K"),R=K("q1tI"),I=K.n(R),L=K("m+aA"),T=K("Zm9Q"),P=K("Kwbf"),b=K("c+Xe"),S=K("bdgK"),w="rc-observer-key",C=function(x){Object(N.a)(p,x);var _=Object(E.a)(p);function p(){var n;return Object(j.a)(this,p),n=_.apply(this,arguments),n.resizeObserver=null,n.childNode=null,n.currentElement=null,n.state={width:0,height:0,offsetHeight:0,offsetWidth:0},n.onResize=function(u){var l=n.props.onResize,v=u[0].target,d=v.getBoundingClientRect(),o=d.width,m=d.height,h=v.offsetWidth,a=v.offsetHeight,r=Math.floor(o),e=Math.floor(m);if(n.state.width!==r||n.state.height!==e||n.state.offsetWidth!==h||n.state.offsetHeight!==a){var i={width:r,height:e,offsetWidth:h,offsetHeight:a};n.setState(i),l&&Promise.resolve().then(function(){l(Object(Ee.a)(Object(Ee.a)({},i),{},{offsetWidth:h,offsetHeight:a}))})}},n.setChildNode=function(u){n.childNode=u},n}return Object(O.a)(p,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var u=this.props.disabled;if(u){this.destroyObserver();return}var l=Object(L.a)(this.childNode||this),v=l!==this.currentElement;v&&(this.destroyObserver(),this.currentElement=l),!this.resizeObserver&&l&&(this.resizeObserver=new S.default(this.onResize),this.resizeObserver.observe(l))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var u=this.props.children,l=Object(T.a)(u);if(l.length>1)Object(P.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(l.length===0)return Object(P.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var v=l[0];if(R.isValidElement(v)&&Object(b.c)(v)){var d=v.ref;l[0]=R.cloneElement(v,{ref:Object(b.a)(d,this.setChildNode)})}return l.length===1?l[0]:l.map(function(o,m){return!R.isValidElement(o)||"key"in o&&o.key!==null?o:R.cloneElement(o,{key:"".concat(w,"-").concat(m)})})}}]),p}(R.Component);C.displayName="ResizeObserver",Ye.a=C},tK3L:function(Pt,Ye,K){Pt.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:function(Pt,Ye,K){typeof window!="undefined"&&function(j,O){Pt.exports=O()}(this,function(){return function(Ee){var j={};function O(N){if(j[N])return j[N].exports;var E=j[N]={i:N,l:!1,exports:{}};return Ee[N].call(E.exports,E,E.exports,O),E.l=!0,E.exports}return O.m=Ee,O.c=j,O.d=function(N,E,R){O.o(N,E)||Object.defineProperty(N,E,{enumerable:!0,get:R})},O.r=function(N){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(N,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(N,"__esModule",{value:!0})},O.t=function(N,E){if(E&1&&(N=O(N)),E&8)return N;if(E&4&&typeof N=="object"&&N&&N.__esModule)return N;var R=Object.create(null);if(O.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:N}),E&2&&typeof N!="string")for(var I in N)O.d(R,I,function(L){return N[L]}.bind(null,I));return R},O.n=function(N){var E=N&&N.__esModule?function(){return N.default}:function(){return N};return O.d(E,"a",E),E},O.o=function(N,E){return Object.prototype.hasOwnProperty.call(N,E)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(Ee,j,O){"use strict";var N=Object.prototype.hasOwnProperty,E="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(E=!1));function I(b,S,w){this.fn=b,this.context=S,this.once=w||!1}function L(b,S,w,C,x){if(typeof w!="function")throw new TypeError("The listener must be a function");var _=new I(w,C||b,x),p=E?E+S:S;return b._events[p]?b._events[p].fn?b._events[p]=[b._events[p],_]:b._events[p].push(_):(b._events[p]=_,b._eventsCount++),b}function T(b,S){--b._eventsCount===0?b._events=new R:delete b._events[S]}function P(){this._events=new R,this._eventsCount=0}P.prototype.eventNames=function(){var S=[],w,C;if(this._eventsCount===0)return S;for(C in w=this._events)N.call(w,C)&&S.push(E?C.slice(1):C);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(w)):S},P.prototype.listeners=function(S){var w=E?E+S:S,C=this._events[w];if(!C)return[];if(C.fn)return[C.fn];for(var x=0,_=C.length,p=new Array(_);x<_;x++)p[x]=C[x].fn;return p},P.prototype.listenerCount=function(S){var w=E?E+S:S,C=this._events[w];return C?C.fn?1:C.length:0},P.prototype.emit=function(S,w,C,x,_,p){var n=E?E+S:S;if(!this._events[n])return!1;var u=this._events[n],l=arguments.length,v,d;if(u.fn){u.once&&this.removeListener(S,u.fn,void 0,!0);switch(l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,w),!0;case 3:return u.fn.call(u.context,w,C),!0;case 4:return u.fn.call(u.context,w,C,x),!0;case 5:return u.fn.call(u.context,w,C,x,_),!0;case 6:return u.fn.call(u.context,w,C,x,_,p),!0}for(d=1,v=new Array(l-1);d<l;d++)v[d-1]=arguments[d];u.fn.apply(u.context,v)}else{var o=u.length,m;for(d=0;d<o;d++){u[d].once&&this.removeListener(S,u[d].fn,void 0,!0);switch(l){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,w);break;case 3:u[d].fn.call(u[d].context,w,C);break;case 4:u[d].fn.call(u[d].context,w,C,x);break;default:if(!v)for(m=1,v=new Array(l-1);m<l;m++)v[m-1]=arguments[m];u[d].fn.apply(u[d].context,v)}}}return!0},P.prototype.on=function(S,w,C){return L(this,S,w,C,!1)},P.prototype.once=function(S,w,C){return L(this,S,w,C,!0)},P.prototype.removeListener=function(S,w,C,x){var _=E?E+S:S;if(!this._events[_])return this;if(!w)return T(this,_),this;var p=this._events[_];if(p.fn)p.fn===w&&(!x||p.once)&&(!C||p.context===C)&&T(this,_);else{for(var n=0,u=[],l=p.length;n<l;n++)(p[n].fn!==w||x&&!p[n].once||C&&p[n].context!==C)&&u.push(p[n]);u.length?this._events[_]=u.length===1?u[0]:u:T(this,_)}return this},P.prototype.removeAllListeners=function(S){var w;return S?(w=E?E+S:S,this._events[w]&&T(this,w)):(this._events=new R,this._eventsCount=0),this},P.prototype.off=P.prototype.removeListener,P.prototype.addListener=P.prototype.on,P.prefixed=E,P.EventEmitter=P,Ee.exports=P},"./node_modules/url-toolkit/src/url-toolkit.js":function(Ee,j,O){(function(N){var E=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,I=/(?:\/|^)\.(?=\/)/g,L=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,T={buildAbsoluteURL:function(P,b,S){if(S=S||{},P=P.trim(),b=b.trim(),!b){if(!S.alwaysNormalize)return P;var w=T.parseURL(P);if(!w)throw new Error("Error trying to parse base URL.");return w.path=T.normalizePath(w.path),T.buildURLFromParts(w)}var C=T.parseURL(b);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return S.alwaysNormalize?(C.path=T.normalizePath(C.path),T.buildURLFromParts(C)):b;var x=T.parseURL(P);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var _=R.exec(x.path);x.netLoc=_[1],x.path=_[2]}x.netLoc&&!x.path&&(x.path="/");var p={scheme:x.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(p.netLoc=x.netLoc,C.path[0]!=="/"))if(!C.path)p.path=x.path,C.params||(p.params=x.params,C.query||(p.query=x.query));else{var n=x.path,u=n.substring(0,n.lastIndexOf("/")+1)+C.path;p.path=T.normalizePath(u)}return p.path===null&&(p.path=S.alwaysNormalize?T.normalizePath(C.path):C.path),T.buildURLFromParts(p)},parseURL:function(P){var b=E.exec(P);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(P){for(P=P.split("").reverse().join("").replace(I,"");P.length!==(P=P.replace(L,"")).length;);return P.split("").reverse().join("")},buildURLFromParts:function(P){return P.scheme+P.netLoc+P.path+P.params+P.query+P.fragment}};Ee.exports=T})(this)},"./node_modules/webworkify-webpack/index.js":function(Ee,j,O){function N(S){var w={};function C(_){if(w[_])return w[_].exports;var p=w[_]={i:_,l:!1,exports:{}};return S[_].call(p.exports,p,p.exports,C),p.l=!0,p.exports}C.m=S,C.c=w,C.i=function(_){return _},C.d=function(_,p,n){C.o(_,p)||Object.defineProperty(_,p,{configurable:!1,enumerable:!0,get:n})},C.r=function(_){Object.defineProperty(_,"__esModule",{value:!0})},C.n=function(_){var p=_&&_.__esModule?function(){return _.default}:function(){return _};return C.d(p,"a",p),p},C.o=function(_,p){return Object.prototype.hasOwnProperty.call(_,p)},C.p="/",C.oe=function(_){throw console.error(_),_};var x=C(C.s=ENTRY_MODULE);return x.default||x}var E="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+E+").*?\\)";function I(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function L(S){return!isNaN(1*S)}function T(S,w,C){var x={};x[C]=[];var _=w.toString(),p=_.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!p)return x;for(var n=p[1],u=new RegExp("(\\\\n|\\W)"+I(n)+R,"g"),l;l=u.exec(_);){if(l[3]==="dll-reference")continue;x[C].push(l[3])}for(u=new RegExp("\\("+I(n)+'\\("(dll-reference\\s('+E+'))"\\)\\)'+R,"g");l=u.exec(_);)S[l[2]]||(x[C].push(l[1]),S[l[2]]=O(l[1]).m),x[l[2]]=x[l[2]]||[],x[l[2]].push(l[4]);for(var v=Object.keys(x),d=0;d<v.length;d++)for(var o=0;o<x[v[d]].length;o++)L(x[v[d]][o])&&(x[v[d]][o]=1*x[v[d]][o]);return x}function P(S){var w=Object.keys(S);return w.reduce(function(C,x){return C||S[x].length>0},!1)}function b(S,w){for(var C={main:[w]},x={main:[]},_={main:{}};P(C);)for(var p=Object.keys(C),n=0;n<p.length;n++){var u=p[n],l=C[u],v=l.pop();if(_[u]=_[u]||{},_[u][v]||!S[u][v])continue;_[u][v]=!0,x[u]=x[u]||[],x[u].push(v);for(var d=T(S,S[u][v],u),o=Object.keys(d),m=0;m<o.length;m++)C[o[m]]=C[o[m]]||[],C[o[m]]=C[o[m]].concat(d[o[m]])}return x}Ee.exports=function(S,w){w=w||{};var C={main:O.m},x=w.all?{main:Object.keys(C.main)}:b(C,S),_="";Object.keys(x).filter(function(v){return v!=="main"}).forEach(function(v){for(var d=0;x[v][d];)d++;x[v].push(d),C[v][d]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",_=_+"var "+v+" = ("+N.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+x[v].map(function(o){return""+JSON.stringify(o)+": "+C[v][o].toString()}).join(",")+`});
|
|
`}),_=_+"new (("+N.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+x.main.map(function(v){return""+JSON.stringify(v)+": "+C.main[v].toString()}).join(",")+"}))(self);";var p=new window.Blob([_],{type:"text/javascript"});if(w.bare)return p;var n=window.URL||window.webkitURL||window.mozURL||window.msURL,u=n.createObjectURL(p),l=new window.Worker(u);return l.objectURL=u,l}},"./src/config.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"hlsDefaultConfig",function(){return m}),O.d(j,"mergeConfig",function(){return a}),O.d(j,"enableStreamingMode",function(){return r});var N=O("./src/controller/abr-controller.ts"),E=O("./src/controller/audio-stream-controller.ts"),R=O("./src/controller/audio-track-controller.ts"),I=O("./src/controller/subtitle-stream-controller.ts"),L=O("./src/controller/subtitle-track-controller.ts"),T=O("./src/controller/buffer-controller.ts"),P=O("./src/controller/timeline-controller.ts"),b=O("./src/controller/cap-level-controller.ts"),S=O("./src/controller/fps-controller.ts"),w=O("./src/controller/eme-controller.ts"),C=O("./src/controller/cmcd-controller.ts"),x=O("./src/utils/xhr-loader.ts"),_=O("./src/utils/fetch-loader.ts"),p=O("./src/utils/cues.ts"),n=O("./src/utils/mediakeys-helper.ts"),u=O("./src/utils/logger.ts");function l(){return l=Object.assign||function(e){for(var i=1;i<arguments.length;i++){var g=arguments[i];for(var f in g)Object.prototype.hasOwnProperty.call(g,f)&&(e[f]=g[f])}return e},l.apply(this,arguments)}function v(e,i){var g=Object.keys(e);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);i&&(f=f.filter(function(y){return Object.getOwnPropertyDescriptor(e,y).enumerable})),g.push.apply(g,f)}return g}function d(e){for(var i=1;i<arguments.length;i++){var g=arguments[i]!=null?arguments[i]:{};i%2?v(Object(g),!0).forEach(function(f){o(e,f,g[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(g)):v(Object(g)).forEach(function(f){Object.defineProperty(e,f,Object.getOwnPropertyDescriptor(g,f))})}return e}function o(e,i,g){return i in e?Object.defineProperty(e,i,{value:g,enumerable:!0,configurable:!0,writable:!0}):e[i]=g,e}var m=d(d({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,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:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:N.default,bufferController:T.default,capLevelController:b.default,fpsController:S.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:n.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},h()),{},{subtitleStreamController:I.SubtitleStreamController,subtitleTrackController:L.default,timelineController:P.TimelineController,audioStreamController:E.default,audioTrackController:R.default,emeController:w.default,cmcdController:C.default});function h(){return{cueHandler:p.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}}function a(e,i){if((i.liveSyncDurationCount||i.liveMaxLatencyDurationCount)&&(i.liveSyncDuration||i.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(i.liveMaxLatencyDurationCount!==void 0&&(i.liveSyncDurationCount===void 0||i.liveMaxLatencyDurationCount<=i.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(i.liveMaxLatencyDuration!==void 0&&(i.liveSyncDuration===void 0||i.liveMaxLatencyDuration<=i.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},e,i)}function r(e){var i=e.loader;if(i!==_.default&&i!==x.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{var g=Object(_.fetchSupported)();g&&(e.loader=_.default,e.progressive=!0,e.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/polyfills/number.ts"),E=O("./src/utils/ewma-bandwidth-estimator.ts"),R=O("./src/events.ts"),I=O("./src/utils/buffer-helper.ts"),L=O("./src/errors.ts"),T=O("./src/types/loader.ts"),P=O("./src/utils/logger.ts");function b(C,x){for(var _=0;_<x.length;_++){var p=x[_];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(C,p.key,p)}}function S(C,x,_){return x&&b(C.prototype,x),_&&b(C,_),C}var w=function(){function C(_){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=_;var p=_.config;this.bwEstimator=new E.default(p.abrEwmaSlowVoD,p.abrEwmaFastVoD,p.abrEwmaDefaultEstimate),this.registerListeners()}var x=C.prototype;return x.registerListeners=function(){var p=this.hls;p.on(R.Events.FRAG_LOADING,this.onFragLoading,this),p.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(R.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var p=this.hls;p.off(R.Events.FRAG_LOADING,this.onFragLoading,this),p.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(R.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},x.onFragLoading=function(p,n){var u=n.frag;if(u.type===T.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=u,this.partCurrent=(l=n.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(p,n){var u=this.hls.config;n.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var p=this.fragCurrent,n=this.partCurrent,u=this.hls,l=u.autoLevelEnabled,v=u.config,d=u.media;if(!p||!d)return;var o=n?n.stats:p.stats,m=n?n.duration:p.duration;if(o.aborted){P.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||d.paused||!d.playbackRate||!d.readyState)return;var h=performance.now()-o.loading.start,a=Math.abs(d.playbackRate);if(h<=500*m/a)return;var r=u.levels,e=u.minAutoLevel,i=r[p.level],g=o.total||Math.max(o.loaded,Math.round(m*i.maxBitrate/8)),f=Math.max(1,o.bwEstimate?o.bwEstimate/8:o.loaded*1e3/h),y=(g-o.loaded)/f,t=d.currentTime,A=(I.BufferHelper.bufferInfo(d,t,v.maxBufferHole).end-t)/a;if(A>=2*m/a||y<=A)return;var U=Number.POSITIVE_INFINITY,B;for(B=p.level-1;B>e;B--){var G=r[B].maxBitrate;if(U=m*G/(8*.8*f),U<A)break}if(U>=y)return;var J=this.bwEstimator.getEstimate();P.logger.warn("Fragment "+p.sn+(n?" part "+n.index:"")+" of level "+p.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+B+`
|
|
Current BW estimate: `+(Object(N.isFiniteNumber)(J)?(J/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+y.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+U.toFixed(3)+` s
|
|
Time to underbuffer: `+A.toFixed(3)+" s"),u.nextLoadLevel=B,this.bwEstimator.sample(h,o.loaded),this.clearTimer(),p.loader&&(this.fragCurrent=this.partCurrent=null,p.loader.abort()),u.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:p,part:n,stats:o})},x.onFragLoaded=function(p,n){var u=n.frag,l=n.part;if(u.type===T.PlaylistLevelType.MAIN&&Object(N.isFiniteNumber)(u.sn)){var v=l?l.stats:u.stats,d=l?l.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var o=this.hls.levels[u.level],m=(o.loaded?o.loaded.bytes:0)+v.loaded,h=(o.loaded?o.loaded.duration:0)+d;o.loaded={bytes:m,duration:h},o.realBitrate=Math.round(8*m/h)}if(u.bitrateTest){var a={stats:v,frag:u,part:l,id:u.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,a),u.bitrateTest=!1}}},x.onFragBuffered=function(p,n){var u=n.frag,l=n.part,v=l?l.stats:u.stats;if(v.aborted)return;if(u.type!==T.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var d=v.parsing.end-v.loading.start;this.bwEstimator.sample(d,v.loaded),v.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=d/1e3:this.bitrateTestDelay=0},x.onError=function(p,n){switch(n.details){case L.ErrorDetails.FRAG_LOAD_ERROR:case L.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},x.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},x.getNextABRAutoLevel=function(){var p=this.fragCurrent,n=this.partCurrent,u=this.hls,l=u.maxAutoLevel,v=u.config,d=u.minAutoLevel,o=u.media,m=n?n.duration:p?p.duration:0,h=o?o.currentTime:0,a=o&&o.playbackRate!==0?Math.abs(o.playbackRate):1,r=this.bwEstimator?this.bwEstimator.getEstimate():v.abrEwmaDefaultEstimate,e=(I.BufferHelper.bufferInfo(o,h,v.maxBufferHole).end-h)/a,i=this.findBestLevel(r,d,l,e,v.abrBandWidthFactor,v.abrBandWidthUpFactor);if(i>=0)return i;P.logger.trace((e?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=m?Math.min(m,v.maxStarvationDelay):v.maxStarvationDelay,f=v.abrBandWidthFactor,y=v.abrBandWidthUpFactor;if(!e){var t=this.bitrateTestDelay;if(t){var A=m?Math.min(m,v.maxLoadingDelay):v.maxLoadingDelay;g=A-t,P.logger.trace("bitrate test took "+Math.round(1e3*t)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),f=y=1}}return i=this.findBestLevel(r,d,l,e+g,f,y),Math.max(i,0)},x.findBestLevel=function(p,n,u,l,v,d){for(var o,m=this.fragCurrent,h=this.partCurrent,a=this.lastLoadedFragLevel,r=this.hls.levels,e=r[a],i=!!(e!=null&&(o=e.details)!==null&&o!==void 0&&o.live),g=e==null?void 0:e.codecSet,f=h?h.duration:m?m.duration:0,y=u;y>=n;y--){var t=r[y];if(!t||g&&t.codecSet!==g)continue;var A=t.details,U=(h?A==null?void 0:A.partTarget:A==null?void 0:A.averagetargetduration)||f,B=void 0;y<=a?B=v*p:B=d*p;var G=r[y].maxBitrate,J=G*U/B;if(P.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(B)+"/"+G+"/"+U+"/"+l+"/"+J),B>G&&(!J||i&&!this.bitrateTestDelay||J<l))return y}return-1},S(C,[{key:"nextAutoLevel",get:function(){var p=this._nextAutoLevel,n=this.bwEstimator;if(p!==-1&&(!n||!n.canEstimate()))return p;var u=this.getNextABRAutoLevel();return p!==-1&&(u=Math.min(p,u)),u},set:function(p){this._nextAutoLevel=p}}]),C}();j.default=w},"./src/controller/audio-stream-controller.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/polyfills/number.ts"),E=O("./src/controller/base-stream-controller.ts"),R=O("./src/events.ts"),I=O("./src/utils/buffer-helper.ts"),L=O("./src/controller/fragment-tracker.ts"),T=O("./src/types/level.ts"),P=O("./src/types/loader.ts"),b=O("./src/loader/fragment.ts"),S=O("./src/demux/chunk-cache.ts"),w=O("./src/demux/transmuxer-interface.ts"),C=O("./src/types/transmuxer.ts"),x=O("./src/controller/fragment-finders.ts"),_=O("./src/utils/discontinuities.ts"),p=O("./src/errors.ts"),n=O("./src/utils/logger.ts");function u(){return u=Object.assign||function(m){for(var h=1;h<arguments.length;h++){var a=arguments[h];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(m[r]=a[r])}return m},u.apply(this,arguments)}function l(m,h){m.prototype=Object.create(h.prototype),m.prototype.constructor=m,v(m,h)}function v(m,h){return v=Object.setPrototypeOf||function(r,e){return r.__proto__=e,r},v(m,h)}var d=100,o=function(m){l(h,m);function h(r,e){var i;return i=m.call(this,r,e,"[audio-stream-controller]")||this,i.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}var a=h.prototype;return a.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},a._registerListeners=function(){var e=this.hls;e.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(R.Events.ERROR,this.onError,this),e.on(R.Events.BUFFER_RESET,this.onBufferReset,this),e.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a._unregisterListeners=function(){var e=this.hls;e.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(R.Events.ERROR,this.onError,this),e.off(R.Events.BUFFER_RESET,this.onBufferReset,this),e.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a.onInitPtsFound=function(e,i){var g=i.frag,f=i.id,y=i.initPTS;if(f==="main"){var t=g.cc;this.initPTS[g.cc]=y,this.log("InitPTS for cc: "+t+" found from main: "+y),this.videoTrackCC=t,this.state===E.State.WAITING_INIT_PTS&&this.tick()}},a.startLoad=function(e){if(!this.levels){this.startPosition=e,this.state=E.State.STOPPED;return}var i=this.lastCurrentTime;this.stopLoad(),this.setInterval(d),this.fragLoadError=0,i>0&&e===-1?(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),this.state=E.State.IDLE):(this.loadedmetadata=!1,this.state=E.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},a.doTick=function(){switch(this.state){case E.State.IDLE:this.doTickIdle();break;case E.State.WAITING_TRACK:{var e,i=this.levels,g=this.trackId,f=i==null||((e=i[g])===null||e===void 0)?void 0:e.details;if(f){if(this.waitForCdnTuneIn(f))break;this.state=E.State.WAITING_INIT_PTS}break}case E.State.FRAG_LOADING_WAITING_RETRY:{var y,t=performance.now(),A=this.retryDate;(!A||t>=A||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=E.State.IDLE);break}case E.State.WAITING_INIT_PTS:{var U=this.waitingData;if(U){var B=U.frag,G=U.part,J=U.cache,F=U.complete;if(this.initPTS[B.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=E.State.FRAG_LOADING;var q=J.flush(),re={frag:B,part:G,payload:q,networkDetails:null};this._handleFragmentLoadProgress(re),F&&m.prototype._handleFragmentLoadComplete.call(this,re)}else if(this.videoTrackCC!==this.waitingVideoCC)n.logger.log("Waiting fragment cc ("+B.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ae=this.getLoadPosition(),ve=I.BufferHelper.bufferInfo(this.mediaBuffer,ae,this.config.maxBufferHole),de=Object(x.fragmentWithinToleranceTest)(ve.end,this.config.maxFragLookUpTolerance,B);de<0&&(n.logger.log("Waiting fragment cc ("+B.cc+") @ "+B.start+" cancelled because another fragment at "+ve.end+" is needed"),this.clearWaitingFragment())}}else this.state=E.State.IDLE}}this.onTickEnd()},a.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=E.State.IDLE)},a.onTickEnd=function(){var e=this.media;if(!e||!e.readyState)return;var i=this.mediaBuffer?this.mediaBuffer:e,g=i.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=e.currentTime},a.doTickIdle=function(){var e,i,g=this.hls,f=this.levels,y=this.media,t=this.trackId,A=g.config;if(!f||!f[t])return;if(!y&&(this.startFragRequested||!A.startFragPrefetch))return;var U=f[t],B=U.details;if(!B||B.live&&this.levelLastLoaded!==t||this.waitForCdnTuneIn(B)){this.state=E.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,P.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,P.PlaylistLevelType.AUDIO);if(G===null)return;var J=G.len,F=this.getMaxBufferLength(),q=this.audioSwitch;if(J>=F&&!q)return;if(!q&&this._streamEnded(G,B)){g.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=E.State.ENDED;return}var re=B.fragments,ae=re[0].start,ve=G.end;if(q){var de=this.getLoadPosition();ve=de,B.PTSKnown&&de<ae&&((G.end>ae||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=ae+.05))}var Z=this.getNextFragment(ve,B);if(!Z){this.bufferFlushed=!0;return}((e=Z.decryptdata)===null||e===void 0?void 0:e.keyFormat)==="identity"&&!((i=Z.decryptdata)!==null&&i!==void 0&&i.key)?this.loadKey(Z,B):this.loadFragment(Z,B,ve)},a.getMaxBufferLength=function(){var e=m.prototype.getMaxBufferLength.call(this),i=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,P.PlaylistLevelType.MAIN);return i===null?e:Math.max(e,i.len)},a.onMediaDetaching=function(){this.videoBuffer=null,m.prototype.onMediaDetaching.call(this)},a.onAudioTracksUpdated=function(e,i){var g=i.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(f){return new T.Level(f)})},a.onAudioTrackSwitching=function(e,i){var g=!!i.url;this.trackId=i.id;var f=this.fragCurrent;f!=null&&f.loader&&f.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(d):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=E.State.IDLE):this.state=E.State.STOPPED,this.tick()},a.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},a.onLevelLoaded=function(e,i){this.mainDetails=i.details},a.onAudioTrackLoaded=function(e,i){var g,f=this.levels,y=i.details,t=i.id;if(!f){this.warn("Audio tracks were reset while loading level "+t);return}this.log("Track "+t+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var A=f[t],U=0;if(y.live||(g=A.details)!==null&&g!==void 0&&g.live){var B=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!B)return;!A.details&&y.hasProgramDateTime&&B.hasProgramDateTime?(Object(_.alignMediaPlaylistByPDT)(y,B),U=y.fragments[0].start):U=this.alignPlaylists(y,A.details)}A.details=y,this.levelLastLoaded=t,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(A.details,U),this.state===E.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=E.State.IDLE),this.tick()},a._handleFragmentLoadProgress=function(e){var i,g=e.frag,f=e.part,y=e.payload,t=this.config,A=this.trackId,U=this.levels;if(!U){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var B=U[A];console.assert(B,"Audio track is defined on fragment load progress");var G=B.details;console.assert(G,"Audio track details are defined on fragment load progress");var J=t.defaultAudioCodec||B.audioCodec||"mp4a.40.2",F=this.transmuxer;F||(F=this.transmuxer=new w.default(this.hls,P.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[g.cc],re=(i=g.initSegment)===null||i===void 0?void 0:i.data;if(q!==void 0){var ae=!1,ve=f?f.index:-1,de=ve!==-1,Z=new C.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,y.byteLength,ve,de);F.push(y,re,J,"",g,f,G.totalduration,ae,Z,q)}else{n.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+A);var ee=this.waitingData=this.waitingData||{frag:g,part:f,cache:new S.default,complete:!1},pe=ee.cache;pe.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=E.State.WAITING_INIT_PTS}},a._handleFragmentLoadComplete=function(e){if(this.waitingData){this.waitingData.complete=!0;return}m.prototype._handleFragmentLoadComplete.call(this,e)},a.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},a.onBufferCreated=function(e,i){var g=i.tracks.audio;g&&(this.mediaBuffer=g.buffer),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer)},a.onFragBuffered=function(e,i){var g=i.frag,f=i.part;if(g.type!==P.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(f?" p: "+f.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,f)},a.onError=function(e,i){switch(i.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(P.PlaylistLevelType.AUDIO,i);break;case p.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case p.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==E.State.ERROR&&this.state!==E.State.STOPPED&&(this.state=i.fatal?E.State.ERROR:E.State.IDLE,this.warn(i.details+" while loading frag, switching to "+this.state+" state"));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if(i.parent==="audio"&&(this.state===E.State.PARSING||this.state===E.State.PARSED)){var g=!0,f=this.getFwdBufferInfo(this.mediaBuffer,P.PlaylistLevelType.AUDIO);f&&f.len>.5&&(g=!this.reduceMaxBufferLength(f.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},a.onBufferFlushed=function(e,i){var g=i.type;g===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},a._handleTransmuxComplete=function(e){var i,g="audio",f=this.hls,y=e.remuxResult,t=e.chunkMeta,A=this.getCurrentContext(t);if(!A){this.warn("The loading context changed while buffering fragment "+t.sn+" of level "+t.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(t.level);return}var U=A.frag,B=A.part,G=y.audio,J=y.text,F=y.id3,q=y.initSegment;if(this.fragContextChanged(U))return;if(this.state=E.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,U,t),f.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:g,tracks:q.tracks})),G){var re=G.startPTS,ae=G.endPTS,ve=G.startDTS,de=G.endDTS;B&&(B.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:ae,startDTS:ve,endDTS:de}),U.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,re,ae,ve,de),this.bufferFragmentData(G,U,B,t)}if(F!=null&&(i=F.samples)!==null&&i!==void 0&&i.length){var Z=u({frag:U,id:g},F);f.trigger(R.Events.FRAG_PARSING_METADATA,Z)}if(J){var ee=u({frag:U,id:g},J);f.trigger(R.Events.FRAG_PARSING_USERDATA,ee)}},a._bufferInitSegment=function(e,i,g){if(this.state!==E.State.PARSING)return;e.video&&delete e.video;var f=e.audio;if(!f)return;f.levelCodec=f.codec,f.id="audio",this.log("Init audio buffer, container:"+f.container+", codecs[parsed]=["+f.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,e);var y=f.initSegment;if(y!=null&&y.byteLength){var t={type:"audio",frag:i,part:null,chunkMeta:g,parent:i.type,data:y};this.hls.trigger(R.Events.BUFFER_APPENDING,t)}this.tick()},a.loadFragment=function(e,i,g){var f=this.fragmentTracker.getState(e);this.fragCurrent=e,(this.audioSwitch||f===L.FragmentState.NOT_LOADED||f===L.FragmentState.PARTIAL)&&(e.sn==="initSegment"?this._loadInitSegment(e):i.live&&!Object(N.isFiniteNumber)(this.initPTS[e.cc])?(this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=E.State.WAITING_INIT_PTS):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,e,i,g)))},a.completeAudioSwitch=function(){var e=this.hls,i=this.media,g=this.trackId;i&&(this.log("Switching audio track : flushing all audio"),m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:g})},h}(E.default);j.default=o},"./src/controller/audio-track-controller.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/events.ts"),E=O("./src/errors.ts"),R=O("./src/controller/base-playlist-controller.ts"),I=O("./src/types/loader.ts");function L(w,C){for(var x=0;x<C.length;x++){var _=C[x];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(w,_.key,_)}}function T(w,C,x){return C&&L(w.prototype,C),x&&L(w,x),w}function P(w,C){w.prototype=Object.create(C.prototype),w.prototype.constructor=w,b(w,C)}function b(w,C){return b=Object.setPrototypeOf||function(_,p){return _.__proto__=p,_},b(w,C)}var S=function(w){P(C,w);function C(_){var p;return p=w.call(this,_,"[audio-track-controller]")||this,p.tracks=[],p.groupId=null,p.tracksInGroup=[],p.trackId=-1,p.trackName="",p.selectDefaultTrack=!0,p.registerListeners(),p}var x=C.prototype;return x.registerListeners=function(){var p=this.hls;p.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(N.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),p.on(N.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),p.on(N.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var p=this.hls;p.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),p.off(N.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),p.off(N.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),p.off(N.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,w.prototype.destroy.call(this)},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},x.onManifestParsed=function(p,n){this.tracks=n.audioTracks||[]},x.onAudioTrackLoaded=function(p,n){var u=n.id,l=n.details,v=this.tracksInGroup[u];if(!v){this.warn("Invalid audio track id "+u);return}var d=v.details;v.details=n.details,this.log("audioTrack "+u+" loaded ["+l.startSN+"-"+l.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,n,d))},x.onLevelLoading=function(p,n){this.switchLevel(n.level)},x.onLevelSwitching=function(p,n){this.switchLevel(n.level)},x.switchLevel=function(p){var n=this.hls.levels[p];if(!(n!=null&&n.audioGroupIds))return;var u=n.audioGroupIds[n.urlId];if(this.groupId!==u){this.groupId=u;var l=this.tracks.filter(function(d){return!u||d.groupId===u});this.selectDefaultTrack&&!l.some(function(d){return d.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var v={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(N.Events.AUDIO_TRACKS_UPDATED,v),this.selectInitialTrack()}},x.onError=function(p,n){if(w.prototype.onError.call(this,p,n),n.fatal||!n.context)return;n.context.type===I.PlaylistContextType.AUDIO_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},x.setAudioTrack=function(p){var n=this.tracksInGroup;if(p<0||p>=n.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=n[this.trackId];this.log("Now switching to audio-track index "+p);var l=n[p],v=l.id,d=l.groupId,o=d===void 0?"":d,m=l.name,h=l.type,a=l.url;if(this.trackId=p,this.trackName=m,this.selectDefaultTrack=!1,this.hls.trigger(N.Events.AUDIO_TRACK_SWITCHING,{id:v,groupId:o,name:m,type:h,url:a}),l.details&&!l.details.live)return;var r=this.switchParams(l.url,u==null?void 0:u.details);this.loadPlaylist(r)},x.selectInitialTrack=function(){var p=this.tracksInGroup;console.assert(p.length,"Initial audio track should be selected when tracks are known");var n=this.trackName,u=this.findTrackId(n)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(p){for(var n=this.tracksInGroup,u=0;u<n.length;u++){var l=n[u];if((!this.selectDefaultTrack||l.default)&&(!p||p===l.name))return l.id}return-1},x.loadPlaylist=function(p){var n=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(n)){var u=n.id,l=n.groupId,v=n.url;if(p)try{v=p.addDirectives(v)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(N.Events.AUDIO_TRACK_LOADING,{url:v,id:u,groupId:l,deliveryDirectives:p||null})}},T(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(p){this.selectDefaultTrack=!1,this.setAudioTrack(p)}}]),C}(R.default);j.default=S},"./src/controller/base-playlist-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return T});var N=O("./src/polyfills/number.ts"),E=O("./src/types/level.ts"),R=O("./src/controller/level-helper.ts"),I=O("./src/utils/logger.ts"),L=O("./src/errors.ts"),T=function(){function P(S,w){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=I.logger.log.bind(I.logger,w+":"),this.warn=I.logger.warn.bind(I.logger,w+":"),this.hls=S}var b=P.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(w,C){C.fatal&&C.type===L.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(w,C){var x=C==null?void 0:C.renditionReports;if(x)for(var _=0;_<x.length;_++){var p=x[_],n=""+p.URI;if(n===w.substr(-n.length)){var u=parseInt(p["LAST-MSN"]),l=parseInt(p["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var v=Math.min(C.age-C.partTarget,C.targetduration);l!==void 0&&v>C.partTarget&&(l+=1)}if(Object(N.isFiniteNumber)(u))return new E.HlsUrlParameters(u,Object(N.isFiniteNumber)(l)?l:void 0,E.HlsSkip.No)}}},b.loadPlaylist=function(w){},b.shouldLoadTrack=function(w){return this.canLoad&&w&&!!w.url&&(!w.details||w.details.live)},b.playlistLoaded=function(w,C,x){var _=this,p=C.details,n=C.stats,u=n.loading.end?Math.max(0,self.performance.now()-n.loading.end):0;if(p.advancedDateTime=Date.now()-u,p.live||x!=null&&x.live){if(p.reloaded(x),x&&this.log("live playlist "+w+" "+(p.advanced?"REFRESHED "+p.lastPartSn+"-"+p.lastPartIndex:"MISSED")),x&&p.fragments.length>0&&Object(R.mergeDetails)(x,p),!this.canLoad||!p.live)return;var l,v=void 0,d=void 0;if(p.canBlockReload&&p.endSN&&p.advanced){var o=this.hls.config.lowLatencyMode,m=p.lastPartSn,h=p.endSN,a=p.lastPartIndex,r=a!==-1,e=m===h,i=o?0:a;r?(v=e?h+1:m,d=e?i:a+1):v=h+1;var g=p.age,f=g+p.ageHeader,y=Math.min(f-p.partTarget,p.targetduration*1.5);if(y>0){if(x&&y>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+y+" with playlist age: "+p.age),y=0;else{var t=Math.floor(y/p.targetduration);if(v+=t,d!==void 0){var A=Math.round(y%p.targetduration/p.partTarget);d+=A}this.log("CDN Tune-in age: "+p.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+y+" skip sn "+t+" to part "+d)}p.tuneInGoal=y}if(l=this.getDeliveryDirectives(p,C.deliveryDirectives,v,d),o||!e){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(p,C.deliveryDirectives,v,d);var U=Object(R.computeReloadInterval)(p,n);v!==void 0&&p.canBlockReload&&(U-=p.partTarget||1),this.log("reload live playlist "+w+" in "+Math.round(U)+" ms"),this.timer=self.setTimeout(function(){return _.loadPlaylist(l)},U)}else this.clearTimer()},b.getDeliveryDirectives=function(w,C,x,_){var p=Object(E.getSkipValue)(w,x);return C!=null&&C.skip&&w.deltaUpdateFailed&&(x=C.msn,_=C.part,p=E.HlsSkip.No),new E.HlsUrlParameters(x,_,p)},b.retryLoadingOrFail=function(w){var C=this,x=this.hls.config,_=this.retryCount<x.levelLoadingMaxRetry;if(_){var p;if(this.retryCount++,w.details.indexOf("LoadTimeOut")>-1&&(p=w.context)!==null&&p!==void 0&&p.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+w.details+'"'),this.loadPlaylist();else{var n=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},n),this.warn("retry playlist loading #"+this.retryCount+" in "+n+' ms after "'+w.details+'"')}}else this.warn('cannot recover from error "'+w.details+'"'),this.clearTimer(),w.fatal=!0;return _},P}()},"./src/controller/base-stream-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"State",function(){return h}),O.d(j,"default",function(){return a});var N=O("./src/polyfills/number.ts"),E=O("./src/task-loop.ts"),R=O("./src/controller/fragment-tracker.ts"),I=O("./src/utils/buffer-helper.ts"),L=O("./src/utils/logger.ts"),T=O("./src/events.ts"),P=O("./src/errors.ts"),b=O("./src/types/transmuxer.ts"),S=O("./src/utils/mp4-tools.ts"),w=O("./src/utils/discontinuities.ts"),C=O("./src/controller/fragment-finders.ts"),x=O("./src/controller/level-helper.ts"),_=O("./src/loader/fragment-loader.ts"),p=O("./src/crypt/decrypter.ts"),n=O("./src/utils/time-ranges.ts"),u=O("./src/types/loader.ts");function l(r,e){for(var i=0;i<e.length;i++){var g=e[i];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(r,g.key,g)}}function v(r,e,i){return e&&l(r.prototype,e),i&&l(r,i),r}function d(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function o(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,m(r,e)}function m(r,e){return m=Object.setPrototypeOf||function(g,f){return g.__proto__=f,g},m(r,e)}var h={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"},a=function(r){o(e,r);function e(g,f,y){var t;return t=r.call(this)||this,t.hls=void 0,t.fragPrevious=null,t.fragCurrent=null,t.fragmentTracker=void 0,t.transmuxer=null,t._state=h.STOPPED,t.media=void 0,t.mediaBuffer=void 0,t.config=void 0,t.bitrateTest=!1,t.lastCurrentTime=0,t.nextLoadPosition=0,t.startPosition=0,t.loadedmetadata=!1,t.fragLoadError=0,t.retryDate=0,t.levels=null,t.fragmentLoader=void 0,t.levelLastLoaded=null,t.startFragRequested=!1,t.decrypter=void 0,t.initPTS=[],t.onvseeking=null,t.onvended=null,t.logPrefix="",t.log=void 0,t.warn=void 0,t.logPrefix=y,t.log=L.logger.log.bind(L.logger,y+":"),t.warn=L.logger.warn.bind(L.logger,y+":"),t.hls=g,t.fragmentLoader=new _.default(g.config),t.fragmentTracker=f,t.config=g.config,t.decrypter=new p.default(g,g.config),g.on(T.Events.KEY_LOADED,t.onKeyLoaded,d(t)),t}var i=e.prototype;return i.doTick=function(){this.onTickEnd()},i.onTickEnd=function(){},i.startLoad=function(f){},i.stopLoad=function(){this.fragmentLoader.abort();var f=this.fragCurrent;f&&this.fragmentTracker.removeFragment(f),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=h.STOPPED},i._streamEnded=function(f,y){var t=this.fragCurrent,A=this.fragmentTracker;if(!y.live&&t&&t.sn===y.endSN&&!f.nextStart){var U=A.getState(t);return U===R.FragmentState.PARTIAL||U===R.FragmentState.OK}return!1},i.onMediaAttached=function(f,y){var t=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var A=this.config;this.levels&&A.autoStartLoad&&this.state===h.STOPPED&&this.startLoad(A.startPosition)},i.onMediaDetaching=function(){var f=this.media;f!=null&&f.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),f&&(f.removeEventListener("seeking",this.onvseeking),f.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},i.onMediaSeeking=function(){var f=this.config,y=this.fragCurrent,t=this.media,A=this.mediaBuffer,U=this.state,B=t?t.currentTime:0,G=I.BufferHelper.bufferInfo(A||t,B,f.maxBufferHole);if(this.log("media seeking to "+(Object(N.isFiniteNumber)(B)?B.toFixed(3):B)+", state: "+U),U===h.ENDED)this.resetLoadingState();else if(y&&!G.len){var J=f.maxFragLookUpTolerance,F=y.start-J,q=y.start+y.duration+J,re=B>q;(B<F||re)&&(re&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}t&&(this.lastCurrentTime=B),!this.loadedmetadata&&!G.len&&(this.nextLoadPosition=this.startPosition=B),this.tickImmediate()},i.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},i.onKeyLoaded=function(f,y){if(this.state!==h.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=h.IDLE;var t=this.levels[y.frag.level].details;t&&this.loadFragment(y.frag,t,y.frag.start)},i.onHandlerDestroying=function(){this.stopLoad(),r.prototype.onHandlerDestroying.call(this)},i.onHandlerDestroyed=function(){this.state=h.STOPPED,this.hls.off(T.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,r.prototype.onHandlerDestroyed.call(this)},i.loadKey=function(f,y){this.log("Loading key for "+f.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level),this.state=h.KEY_LOADING,this.fragCurrent=f,this.hls.trigger(T.Events.KEY_LOADING,{frag:f})},i.loadFragment=function(f,y,t){this._loadFragForPlayback(f,y,t)},i._loadFragForPlayback=function(f,y,t){var A=this,U=function(G){if(A.fragContextChanged(f)){A.warn("Fragment "+f.sn+(G.part?" p: "+G.part.index:"")+" of level "+f.level+" was dropped during download."),A.fragmentTracker.removeFragment(f);return}f.stats.chunkCount++,A._handleFragmentLoadProgress(G)};this._doFragLoad(f,y,t,U).then(function(B){if(!B)return;A.fragLoadError=0;var G=A.state;if(A.fragContextChanged(f)){(G===h.FRAG_LOADING||G===h.BACKTRACKING||!A.fragCurrent&&G===h.PARSING)&&(A.fragmentTracker.removeFragment(f),A.state=h.IDLE);return}if("payload"in B&&(A.log("Loaded fragment "+f.sn+" of level "+f.level),A.hls.trigger(T.Events.FRAG_LOADED,B),A.state===h.BACKTRACKING)){A.fragmentTracker.backtrack(f,B),A.resetFragmentLoading(f);return}A._handleFragmentLoadComplete(B)}).catch(function(B){A.warn(B),A.resetFragmentLoading(f)})},i.flushMainBuffer=function(f,y,t){if(t===void 0&&(t=null),!(f-y))return;var A={startOffset:f,endOffset:y,type:t};this.fragLoadError=0,this.hls.trigger(T.Events.BUFFER_FLUSHING,A)},i._loadInitSegment=function(f){var y=this;this._doFragLoad(f).then(function(t){if(!t||y.fragContextChanged(f)||!y.levels)throw new Error("init load aborted");return t}).then(function(t){var A=y.hls,U=t.payload,B=f.decryptdata;if(U&&U.byteLength>0&&B&&B.key&&B.iv&&B.method==="AES-128"){var G=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(U),B.key.buffer,B.iv.buffer).then(function(J){var F=self.performance.now();return A.trigger(T.Events.FRAG_DECRYPTED,{frag:f,payload:J,stats:{tstart:G,tdecrypt:F}}),t.payload=J,t})}return t}).then(function(t){var A=y.fragCurrent,U=y.hls,B=y.levels;if(!B)throw new Error("init load aborted, missing levels");var G=B[f.level].details;console.assert(G,"Level details are defined when init segment is loaded");var J=f.stats;y.state=h.IDLE,y.fragLoadError=0,f.data=new Uint8Array(t.payload),J.parsing.start=J.buffering.start=self.performance.now(),J.parsing.end=J.buffering.end=self.performance.now(),t.frag===A&&U.trigger(T.Events.FRAG_BUFFERED,{stats:J,frag:A,part:null,id:f.type}),y.tick()}).catch(function(t){y.warn(t),y.resetFragmentLoading(f)})},i.fragContextChanged=function(f){var y=this.fragCurrent;return!f||!y||f.level!==y.level||f.sn!==y.sn||f.urlId!==y.urlId},i.fragBufferedComplete=function(f,y){var t=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+f.type+" sn: "+f.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level+" "+n.default.toString(I.BufferHelper.getBuffered(t))),this.state=h.IDLE,this.tick()},i._handleFragmentLoadComplete=function(f){var y=this.transmuxer;if(!y)return;var t=f.frag,A=f.part,U=f.partsLoaded,B=!U||U.length===0||U.some(function(J){return!J}),G=new b.ChunkMetadata(t.level,t.sn,t.stats.chunkCount+1,0,A?A.index:-1,!B);y.flush(G)},i._handleFragmentLoadProgress=function(f){},i._doFragLoad=function(f,y,t,A){var U=this;if(t===void 0&&(t=null),!this.levels)throw new Error("frag load aborted, missing levels");if(t=Math.max(f.start,t||0),this.config.lowLatencyMode&&y){var B=y.partList;if(B&&A){t>f.end&&y.fragmentHint&&(f=y.fragmentHint);var G=this.getNextPart(B,f,t);if(G>-1){var J=B[G];return this.log("Loading part sn: "+f.sn+" p: "+J.index+" cc: "+f.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+G+"-"+(B.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(t.toFixed(3))),this.nextLoadPosition=J.start+J.duration,this.state=h.FRAG_LOADING,this.hls.trigger(T.Events.FRAG_LOADING,{frag:f,part:B[G],targetBufferTime:t}),this.doFragPartsLoad(f,B,G,A).catch(function(F){return U.handleFragLoadError(F)})}else if(!f.url||this.loadedEndOfParts(B,t))return Promise.resolve(null)}}return this.log("Loading fragment "+f.sn+" cc: "+f.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(t.toFixed(3))),Object(N.isFiniteNumber)(f.sn)&&!this.bitrateTest&&(this.nextLoadPosition=f.start+f.duration),this.state=h.FRAG_LOADING,this.hls.trigger(T.Events.FRAG_LOADING,{frag:f,targetBufferTime:t}),this.fragmentLoader.load(f,A).catch(function(F){return U.handleFragLoadError(F)})},i.doFragPartsLoad=function(f,y,t,A){var U=this;return new Promise(function(B,G){var J=[],F=function q(re){var ae=y[re];U.fragmentLoader.loadPart(f,ae,A).then(function(ve){J[ae.index]=ve;var de=ve.part;U.hls.trigger(T.Events.FRAG_LOADED,ve);var Z=y[re+1];if(Z&&Z.fragment===f)q(re+1);else return B({frag:f,part:de,partsLoaded:J})}).catch(G)};F(t)})},i.handleFragLoadError=function(f){var y=f.data;return y&&y.details===P.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(T.Events.ERROR,y),null},i._handleTransmuxerFlush=function(f){var y=this.getCurrentContext(f);if(!y||this.state!==h.PARSING){this.fragCurrent||(this.state=h.IDLE);return}var t=y.frag,A=y.part,U=y.level,B=self.performance.now();t.stats.parsing.end=B,A&&(A.stats.parsing.end=B),this.updateLevelTiming(t,A,U,f.partial)},i.getCurrentContext=function(f){var y=this.levels,t=f.level,A=f.sn,U=f.part;if(!y||!y[t])return this.warn("Levels object was unset while buffering fragment "+A+" of level "+t+". The current chunk will not be buffered."),null;var B=y[t],G=U>-1?Object(x.getPartWith)(B,A,U):null,J=G?G.fragment:Object(x.getFragmentWithSN)(B,A,this.fragCurrent);return J?{frag:J,part:G,level:B}:null},i.bufferFragmentData=function(f,y,t,A){if(!f||this.state!==h.PARSING)return;var U=f.data1,B=f.data2,G=U;if(U&&B&&(G=Object(S.appendUint8Array)(U,B)),!G||!G.length)return;var J={type:f.type,frag:y,part:t,chunkMeta:A,parent:y.type,data:G};this.hls.trigger(T.Events.BUFFER_APPENDING,J),f.dropped&&f.independent&&!t&&this.flushBufferGap(y)},i.flushBufferGap=function(f){var y=this.media;if(!y)return;if(!I.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,f.start);return}var t=y.currentTime,A=I.BufferHelper.bufferInfo(y,t,0),U=f.duration,B=Math.min(this.config.maxFragLookUpTolerance*2,U*.25),G=Math.max(Math.min(f.start-B,A.end-B),t+B);f.start-G>B&&this.flushMainBuffer(G,f.start)},i.getFwdBufferInfo=function(f,y){var t=this.config,A=this.getLoadPosition();if(!Object(N.isFiniteNumber)(A))return null;var U=I.BufferHelper.bufferInfo(f,A,t.maxBufferHole);if(U.len===0&&U.nextStart!==void 0){var B=this.fragmentTracker.getBufferedFrag(A,y);if(B&&U.nextStart<B.end)return I.BufferHelper.bufferInfo(f,A,Math.max(U.nextStart,t.maxBufferHole))}return U},i.getMaxBufferLength=function(f){var y=this.config,t;return f?t=Math.max(8*y.maxBufferSize/f,y.maxBufferLength):t=y.maxBufferLength,Math.min(t,y.maxMaxBufferLength)},i.reduceMaxBufferLength=function(f){var y=this.config,t=f||y.maxBufferLength;return y.maxMaxBufferLength>=t?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},i.getNextFragment=function(f,y){var t,A,U=y.fragments,B=U.length;if(!B)return null;var G=this.config,J=U[0].start,F;if(y.live){var q=G.initialLiveManifestSize;if(B<q)return this.warn("Not enough fragments to start playback (have: "+B+", need: "+q+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(F=this.getInitialLiveFragment(y,U),this.startPosition=F?this.hls.liveSyncPosition||F.start:f)}else f<=J&&(F=U[0]);if(!F){var re=G.lowLatencyMode?y.partEnd:y.fragmentEnd;F=this.getFragmentAtPosition(f,re,y)}return(t=F)!==null&&t!==void 0&&t.initSegment&&!((A=F)!==null&&A!==void 0&&A.initSegment.data)&&!this.bitrateTest&&(F=F.initSegment),F},i.getNextPart=function(f,y,t){for(var A=-1,U=!1,B=!0,G=0,J=f.length;G<J;G++){var F=f[G];if(B=B&&!F.independent,A>-1&&t<F.start)break;var q=F.loaded;!q&&(U||F.independent||B)&&F.fragment===y&&(A=G),U=q}return A},i.loadedEndOfParts=function(f,y){var t=f[f.length-1];return t&&y>t.start&&t.loaded},i.getInitialLiveFragment=function(f,y){var t=this.fragPrevious,A=null;if(t){if(f.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+t.programDateTime),A=Object(C.findFragmentByPDT)(y,t.endProgramDateTime,this.config.maxFragLookUpTolerance)),!A){var U=t.sn+1;if(U>=f.startSN&&U<=f.endSN){var B=y[U-f.startSN];t.cc===B.cc&&(A=B,this.log("Live playlist, switching playlist, load frag with next SN: "+A.sn))}A||(A=Object(C.findFragWithCC)(y,t.cc),A&&this.log("Live playlist, switching playlist, load frag with same CC: "+A.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(A=this.getFragmentAtPosition(G,this.bitrateTest?f.fragmentEnd:f.edge,f))}return A},i.getFragmentAtPosition=function(f,y,t){var A=this.config,U=this.fragPrevious,B=t.fragments,G=t.endSN,J=t.fragmentHint,F=A.maxFragLookUpTolerance,q=!!(A.lowLatencyMode&&t.partList&&J);q&&J&&!this.bitrateTest&&(B=B.concat(J),G=J.sn);var re;if(f<y){var ae=f>y-F?0:F;re=Object(C.findFragmentByPTS)(U,B,f,ae)}else re=B[B.length-1];if(re){var ve=re.sn-t.startSN,de=U&&re.level===U.level,Z=B[ve+1],ee=this.fragmentTracker.getState(re);if(ee===R.FragmentState.BACKTRACKED){re=null;for(var pe=ve;B[pe]&&this.fragmentTracker.getState(B[pe])===R.FragmentState.BACKTRACKED;)U?re=B[pe--]:re=B[--pe];re||(re=Z)}else U&&re.sn===U.sn&&!q&&(de&&(re.sn<G&&this.fragmentTracker.getState(Z)!==R.FragmentState.OK?(this.log("SN "+re.sn+" just loaded, load next one: "+Z.sn),re=Z):re=null))}return re},i.synchronizeToLiveEdge=function(f){var y=this.config,t=this.media;if(!t)return;var A=this.hls.liveSyncPosition,U=t.currentTime,B=f.fragments[0].start,G=f.edge,J=U>=B-y.maxFragLookUpTolerance&&U<=G;if(A!==null&&t.duration>A&&(U<A||!J)){var F=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*f.targetduration;(!J&&t.readyState<4||U<G-F)&&(this.loadedmetadata||(this.nextLoadPosition=A),t.readyState&&(this.warn("Playback: "+U.toFixed(3)+" is located too far from the end of live sliding playlist: "+G+", reset currentTime to : "+A.toFixed(3)),t.currentTime=A))}},i.alignPlaylists=function(f,y){var t=this.levels,A=this.levelLastLoaded,U=this.fragPrevious,B=A!==null?t[A]:null,G=f.fragments.length;if(!G)return this.warn("No fragments in live playlist"),0;var J=f.fragments[0].start,F=!y,q=f.alignedSliding&&Object(N.isFiniteNumber)(J);if(F||!q&&!J){Object(w.alignStream)(U,B,f);var re=f.fragments[0].start;return this.log("Live playlist sliding: "+re.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+f.startSN+" prev-sn: "+(U?U.sn:"na")+" fragments: "+G),re}return J},i.waitForCdnTuneIn=function(f){var y=3;return f.live&&f.canBlockReload&&f.tuneInGoal>Math.max(f.partHoldBack,f.partTarget*y)},i.setStartPosition=function(f,y){var t=this.startPosition;if(t<y&&(t=-1),t===-1||this.lastCurrentTime===-1){var A=f.startTimeOffset;Object(N.isFiniteNumber)(A)?(t=y+A,A<0&&(t+=f.totalduration),t=Math.min(Math.max(y,t),y+f.totalduration),this.log("Start time offset "+A+" found in playlist, adjust startPosition to "+t),this.startPosition=t):f.live?t=this.hls.liveSyncPosition||y:this.startPosition=t=0,this.lastCurrentTime=t}this.nextLoadPosition=t},i.getLoadPosition=function(){var f=this.media,y=0;return this.loadedmetadata&&f?y=f.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},i.handleFragLoadAborted=function(f,y){this.transmuxer&&f.sn!=="initSegment"&&f.stats.aborted&&(this.warn("Fragment "+f.sn+(y?" part"+y.index:"")+" of level "+f.level+" was aborted"),this.resetFragmentLoading(f))},i.resetFragmentLoading=function(f){(!this.fragCurrent||!this.fragContextChanged(f))&&(this.state=h.IDLE)},i.onFragmentOrKeyLoadError=function(f,y){if(y.fatal)return;var t=y.frag;if(!t||t.type!==f)return;var A=this.fragCurrent;console.assert(A&&t.sn===A.sn&&t.level===A.level&&t.urlId===A.urlId,"Frag load error must match current frag to retry");var U=this.config;if(this.fragLoadError+1<=U.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(t.level))return;var B=Math.min(Math.pow(2,this.fragLoadError)*U.fragLoadingRetryDelay,U.fragLoadingMaxRetryTimeout);this.warn("Fragment "+t.sn+" of "+f+" "+t.level+" failed to load, retrying in "+B+"ms"),this.retryDate=self.performance.now()+B,this.fragLoadError++,this.state=h.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(f===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=h.IDLE):(L.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=h.ERROR)},i.afterBufferFlushed=function(f,y,t){if(!f)return;var A=I.BufferHelper.getBuffered(f);this.fragmentTracker.detectEvictedFragments(y,A,t),this.state===h.ENDED&&this.resetLoadingState()},i.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=h.IDLE},i.resetLiveStartWhenNotLoaded=function(f){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[f].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},i.updateLevelTiming=function(f,y,t,A){var U=this,B=t.details;console.assert(!!B,"level.details must be defined");var G=Object.keys(f.elementaryStreams).reduce(function(J,F){var q=f.elementaryStreams[F];if(q){var re=q.endPTS-q.startPTS;if(re<=0)return U.warn("Could not parse fragment "+f.sn+" "+F+" duration reliably ("+re+") resetting transmuxer to fallback to playlist timing"),U.resetTransmuxer(),J||!1;var ae=A?0:Object(x.updateFragPTSDTS)(B,f,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return U.hls.trigger(T.Events.LEVEL_PTS_UPDATED,{details:B,level:t,drift:ae,type:F,frag:f,start:q.startPTS,end:q.endPTS}),!0}return J},!1);G?(this.state=h.PARSED,this.hls.trigger(T.Events.FRAG_PARSED,{frag:f,part:y})):this.resetLoadingState()},i.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},v(e,[{key:"state",get:function(){return this._state},set:function(f){var y=this._state;y!==f&&(this._state=f,this.log(y+"->"+f))}}]),e}(E.default)},"./src/controller/buffer-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return C});var N=O("./src/polyfills/number.ts"),E=O("./src/events.ts"),R=O("./src/utils/logger.ts"),I=O("./src/errors.ts"),L=O("./src/utils/buffer-helper.ts"),T=O("./src/utils/mediasource-helper.ts"),P=O("./src/loader/fragment.ts"),b=O("./src/controller/buffer-operation-queue.ts"),S=Object(T.getMediaSource)(),w=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function x(p){var n=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 u=n.hls,l=n.media,v=n.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),l&&(n.updateMediaElementDuration(),u.trigger(E.Events.MEDIA_ATTACHED,{media:l})),v&&v.removeEventListener("sourceopen",n._onMediaSourceOpen),n.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=p,this._initSourceBuffer(),this.registerListeners()}var _=x.prototype;return _.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},_.destroy=function(){this.unregisterListeners(),this.details=null},_.registerListeners=function(){var n=this.hls;n.on(E.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(E.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(E.Events.BUFFER_RESET,this.onBufferReset,this),n.on(E.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.on(E.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.on(E.Events.BUFFER_EOS,this.onBufferEos,this),n.on(E.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(E.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.on(E.Events.FRAG_PARSED,this.onFragParsed,this),n.on(E.Events.FRAG_CHANGED,this.onFragChanged,this)},_.unregisterListeners=function(){var n=this.hls;n.off(E.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(E.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(E.Events.BUFFER_RESET,this.onBufferReset,this),n.off(E.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.off(E.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.off(E.Events.BUFFER_EOS,this.onBufferEos,this),n.off(E.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(E.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.off(E.Events.FRAG_PARSED,this.onFragParsed,this),n.off(E.Events.FRAG_CHANGED,this.onFragChanged,this)},_._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},_.onManifestParsed=function(n,u){var l=2;(u.audio&&!u.video||!u.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},_.onMediaAttaching=function(n,u){var l=this.media=u.media;if(l&&S){var v=this.mediaSource=new S;v.addEventListener("sourceopen",this._onMediaSourceOpen),v.addEventListener("sourceended",this._onMediaSourceEnded),v.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(v),this._objectUrl=l.src}},_.onMediaDetaching=function(){var n=this.media,u=this.mediaSource,l=this._objectUrl;if(u){if(R.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(v){R.logger.warn("[buffer-controller]: onMediaDetaching: "+v.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),n&&(l&&self.URL.revokeObjectURL(l),n.src===l?(n.removeAttribute("src"),n.load()):R.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(E.Events.MEDIA_DETACHED,void 0)},_.onBufferReset=function(){var n=this;this.getSourceBufferTypes().forEach(function(u){var l=n.sourceBuffer[u];try{l&&(n.removeBufferListeners(u),n.mediaSource&&n.mediaSource.removeSourceBuffer(l),n.sourceBuffer[u]=void 0)}catch(v){R.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",v)}}),this._initSourceBuffer()},_.onBufferCodecs=function(n,u){var l=this,v=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(d){if(v){var o=l.tracks[d];if(o&&typeof o.buffer.changeType=="function"){var m=u[d],h=m.codec,a=m.levelCodec,r=m.container,e=(o.levelCodec||o.codec).replace(w,"$1"),i=(a||h).replace(w,"$1");if(e!==i){var g=r+";codecs="+(a||h);l.appendChangeType(d,g)}}}else l.pendingTracks[d]=u[d]}),v)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},_.appendChangeType=function(n,u){var l=this,v=this.operationQueue,d={execute:function(){var m=l.sourceBuffer[n];m&&(R.logger.log("[buffer-controller]: changing "+n+" sourceBuffer type to "+u),m.changeType(u)),v.shiftAndExecuteNext(n)},onStart:function(){},onComplete:function(){},onError:function(m){R.logger.warn("[buffer-controller]: Failed to change "+n+" SourceBuffer type",m)}};v.append(d,n)},_.onBufferAppending=function(n,u){var l=this,v=this.hls,d=this.operationQueue,o=this.tracks,m=u.data,h=u.type,a=u.frag,r=u.part,e=u.chunkMeta,i=e.buffering[h],g=self.performance.now();i.start=g;var f=a.stats.buffering,y=r?r.stats.buffering:null;f.start===0&&(f.start=g),y&&y.start===0&&(y.start=g);var t=o.audio,A=h==="audio"&&e.id===1&&(t==null?void 0:t.container)==="audio/mpeg",U={execute:function(){if(i.executeStart=self.performance.now(),A){var G=l.sourceBuffer[h];if(G){var J=a.start-G.timestampOffset;Math.abs(J)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+a.start+" (delta: "+J+") sn: "+a.sn+")"),G.timestampOffset=a.start)}}l.appendExecutor(m,h)},onStart:function(){},onComplete:function(){var G=self.performance.now();i.executeEnd=i.end=G,f.first===0&&(f.first=G),y&&y.first===0&&(y.first=G);var J=l.sourceBuffer,F={};for(var q in J)F[q]=L.BufferHelper.getBuffered(J[q]);l.appendError=0,l.hls.trigger(E.Events.BUFFER_APPENDED,{type:h,frag:a,part:r,chunkMeta:e,parent:a.type,timeRanges:F})},onError:function(G){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+h+" SourceBuffer",G);var J={type:I.ErrorTypes.MEDIA_ERROR,parent:a.type,details:I.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?J.details=I.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,J.details=I.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>v.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+v.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),J.fatal=!0)),v.trigger(E.Events.ERROR,J)}};d.append(U,h)},_.onBufferFlushing=function(n,u){var l=this,v=this.operationQueue,d=function(m){return{execute:l.removeExecutor.bind(l,m,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(E.Events.BUFFER_FLUSHED,{type:m})},onError:function(a){R.logger.warn("[buffer-controller]: Failed to remove from "+m+" SourceBuffer",a)}}};u.type?v.append(d(u.type),u.type):this.getSourceBufferTypes().forEach(function(o){v.append(d(o),o)})},_.onFragParsed=function(n,u){var l=this,v=u.frag,d=u.part,o=[],m=d?d.elementaryStreams:v.elementaryStreams;m[P.ElementaryStreamTypes.AUDIOVIDEO]?o.push("audiovideo"):(m[P.ElementaryStreamTypes.AUDIO]&&o.push("audio"),m[P.ElementaryStreamTypes.VIDEO]&&o.push("video"));var h=function(){var r=self.performance.now();v.stats.buffering.end=r,d&&(d.stats.buffering.end=r);var e=d?d.stats:v.stats;l.hls.trigger(E.Events.FRAG_BUFFERED,{frag:v,part:d,stats:e,id:v.type})};o.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+v.type+" level: "+v.level+" sn: "+v.sn),this.blockBuffers(h,o)},_.onFragChanged=function(n,u){this.flushBackBuffer()},_.onBufferEos=function(n,u){var l=this,v=this.getSourceBufferTypes().reduce(function(d,o){var m=l.sourceBuffer[o];return(!u.type||u.type===o)&&(m&&!m.ended&&(m.ended=!0,R.logger.log("[buffer-controller]: "+o+" sourceBuffer now EOS"))),d&&!!(!m||m.ended)},!0);v&&this.blockBuffers(function(){var d=l.mediaSource;if(!d||d.readyState!=="open")return;d.endOfStream()})},_.onLevelUpdated=function(n,u){var l=u.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},_.flushBackBuffer=function(){var n=this.hls,u=this.details,l=this.media,v=this.sourceBuffer;if(!l||u===null)return;var d=this.getSourceBufferTypes();if(!d.length)return;var o=u.live&&n.config.liveBackBufferLength!==null?n.config.liveBackBufferLength:n.config.backBufferLength;if(!Object(N.isFiniteNumber)(o)||o<0)return;var m=l.currentTime,h=u.levelTargetDuration,a=Math.max(o,h),r=Math.floor(m/h)*h-a;d.forEach(function(e){var i=v[e];if(i){var g=L.BufferHelper.getBuffered(i);g.length>0&&r>g.start(0)&&(n.trigger(E.Events.BACK_BUFFER_REACHED,{bufferEnd:r}),u.live&&n.trigger(E.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r}),n.trigger(E.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:e}))}})},_.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var n=this.details,u=this.hls,l=this.media,v=this.mediaSource,d=n.fragments[0].start+n.totalduration,o=l.duration,m=Object(N.isFiniteNumber)(v.duration)?v.duration:0;n.live&&u.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),v.duration=Infinity,this.updateSeekableRange(n)):(d>m&&d>o||!Object(N.isFiniteNumber)(o))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+d.toFixed(3)),v.duration=d)},_.updateSeekableRange=function(n){var u=this.mediaSource,l=n.fragments,v=l.length;if(v&&n.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var d=Math.max(0,l[0].start),o=Math.max(d,d+n.totalduration);u.setLiveSeekableRange(d,o)}},_.checkPendingTracks=function(){var n=this.bufferCodecEventsExpected,u=this.operationQueue,l=this.pendingTracks,v=Object.keys(l).length;if(v&&!n||v===2){this.createSourceBuffers(l),this.pendingTracks={};var d=this.getSourceBufferTypes();if(d.length===0){this.hls.trigger(E.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}d.forEach(function(o){u.executeNext(o)})}},_.createSourceBuffers=function(n){var u=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var v=0;for(var d in n)if(!u[d]){var o=n[d];if(!o)throw Error("source buffer exists for track "+d+", however track does not");var m=o.levelCodec||o.codec,h=o.container+";codecs="+m;R.logger.log("[buffer-controller]: creating sourceBuffer("+h+")");try{var a=u[d]=l.addSourceBuffer(h),r=d;this.addBufferListener(r,"updatestart",this._onSBUpdateStart),this.addBufferListener(r,"updateend",this._onSBUpdateEnd),this.addBufferListener(r,"error",this._onSBUpdateError),this.tracks[d]={buffer:a,codec:m,container:o.container,levelCodec:o.levelCodec,id:o.id},v++}catch(e){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(E.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:h})}}v&&this.hls.trigger(E.Events.BUFFER_CREATED,{tracks:this.tracks})},_._onSBUpdateStart=function(n){var u=this.operationQueue,l=u.current(n);l.onStart()},_._onSBUpdateEnd=function(n){var u=this.operationQueue,l=u.current(n);l.onComplete(),u.shiftAndExecuteNext(n)},_._onSBUpdateError=function(n,u){R.logger.error("[buffer-controller]: "+n+" SourceBuffer error",u),this.hls.trigger(E.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(n);l&&l.onError(u)},_.removeExecutor=function(n,u,l){var v=this.media,d=this.mediaSource,o=this.operationQueue,m=this.sourceBuffer,h=m[n];if(!v||!d||!h){R.logger.warn("[buffer-controller]: Attempting to remove from the "+n+" SourceBuffer, but it does not exist"),o.shiftAndExecuteNext(n);return}var a=Object(N.isFiniteNumber)(v.duration)?v.duration:Infinity,r=Object(N.isFiniteNumber)(d.duration)?d.duration:Infinity,e=Math.max(0,u),i=Math.min(l,a,r);i>e?(R.logger.log("[buffer-controller]: Removing ["+e+","+i+"] from the "+n+" SourceBuffer"),console.assert(!h.updating,n+" sourceBuffer must not be updating"),h.remove(e,i)):o.shiftAndExecuteNext(n)},_.appendExecutor=function(n,u){var l=this.operationQueue,v=this.sourceBuffer,d=v[u];if(!d){R.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(u);return}d.ended=!1,console.assert(!d.updating,u+" sourceBuffer must not be updating"),d.appendBuffer(n)},_.blockBuffers=function(n,u){var l=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(n);return}var v=this.operationQueue,d=u.map(function(o){return v.appendBlocker(o)});Promise.all(d).then(function(){n(),u.forEach(function(o){var m=l.sourceBuffer[o];(!m||!m.updating)&&v.shiftAndExecuteNext(o)})})},_.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},_.addBufferListener=function(n,u,l){var v=this.sourceBuffer[n];if(!v)return;var d=l.bind(this,n);this.listeners[n].push({event:u,listener:d}),v.addEventListener(u,d)},_.removeBufferListeners=function(n){var u=this.sourceBuffer[n];if(!u)return;this.listeners[n].forEach(function(l){u.removeEventListener(l.event,l.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return E});var N=O("./src/utils/logger.ts"),E=function(){function R(L){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=L}var I=R.prototype;return I.append=function(T,P){var b=this.queues[P];b.push(T),b.length===1&&this.buffers[P]&&this.executeNext(P)},I.insertAbort=function(T,P){var b=this.queues[P];b.unshift(T),this.executeNext(P)},I.appendBlocker=function(T){var P,b=new Promise(function(w){P=w}),S={execute:P,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,T),b},I.executeNext=function(T){var P=this.buffers,b=this.queues,S=P[T],w=b[T];if(w.length){var C=w[0];try{C.execute()}catch(x){N.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(x),(!S||!S.updating)&&(w.shift(),this.executeNext(T))}}},I.shiftAndExecuteNext=function(T){this.queues[T].shift(),this.executeNext(T)},I.current=function(T){return this.queues[T][0]},R}()},"./src/controller/cap-level-controller.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/events.ts");function E(L,T){for(var P=0;P<T.length;P++){var b=T[P];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(L,b.key,b)}}function R(L,T,P){return T&&E(L.prototype,T),P&&E(L,P),L}var I=function(){function L(P){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=P,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var T=L.prototype;return T.setStreamController=function(b){this.streamController=b},T.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},T.registerListeners=function(){var b=this.hls;b.on(N.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},T.unregisterListener=function(){var b=this.hls;b.off(N.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},T.onFpsDropLevelCapping=function(b,S){L.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},T.onMediaAttaching=function(b,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},T.onManifestParsed=function(b,S){var w=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,w.config.capLevelToPlayerSize&&S.video&&this.startCapping()},T.onBufferCodecs=function(b,S){var w=this.hls;w.config.capLevelToPlayerSize&&S.video&&this.startCapping()},T.onMediaDetaching=function(){this.stopCapping()},T.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(b.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},T.getMaxLevel=function(b){var S=this,w=this.hls.levels;if(!w.length)return-1;var C=w.filter(function(x,_){return L.isLevelAllowed(_,S.restrictedLevels)&&_<=b});return this.clientRect=null,L.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},T.startCapping=function(){if(this.timer)return;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()},T.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},T.getDimensions=function(){if(this.clientRect)return this.clientRect;var b=this.media,S={width:0,height:0};if(b){var w=b.getBoundingClientRect();S.width=w.width,S.height=w.height,!S.width&&!S.height&&(S.width=w.right-w.left||b.width||0,S.height=w.bottom-w.top||b.height||0)}return this.clientRect=S,S},L.isLevelAllowed=function(b,S){return S===void 0&&(S=[]),S.indexOf(b)===-1},L.getMaxLevelByMediaSize=function(b,S,w){if(!b||!b.length)return-1;for(var C=function(u,l){return l?u.width!==l.width||u.height!==l.height:!0},x=b.length-1,_=0;_<b.length;_+=1){var p=b[_];if((p.width>=S||p.height>=w)&&C(p,b[_+1])){x=_;break}}return x},R(L,[{key:"mediaWidth",get:function(){return this.getDimensions().width*L.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*L.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var b=1;try{b=self.devicePixelRatio}catch(S){}return b}}]),L}();j.default=I},"./src/controller/cmcd-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return C});var N=O("./src/events.ts"),E=O("./src/types/cmcd.ts"),R=O("./src/utils/buffer-helper.ts"),I=O("./src/utils/logger.ts");function L(x,_){for(var p=0;p<_.length;p++){var n=_[p];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(x,n.key,n)}}function T(x,_,p){return _&&L(x.prototype,_),p&&L(x,p),x}function P(x,_){var p=typeof Symbol!="undefined"&&x[Symbol.iterator]||x["@@iterator"];if(p)return(p=p.call(x)).next.bind(p);if(Array.isArray(x)||(p=b(x))||_&&x&&typeof x.length=="number"){p&&(x=p);var n=0;return function(){return n>=x.length?{done:!0}:{done:!1,value:x[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(x,_){if(!x)return;if(typeof x=="string")return S(x,_);var p=Object.prototype.toString.call(x).slice(8,-1);if(p==="Object"&&x.constructor&&(p=x.constructor.name),p==="Map"||p==="Set")return Array.from(x);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return S(x,_)}function S(x,_){(_==null||_>x.length)&&(_=x.length);for(var p=0,n=new Array(_);p<_;p++)n[p]=x[p];return n}function w(){return w=Object.assign||function(x){for(var _=1;_<arguments.length;_++){var p=arguments[_];for(var n in p)Object.prototype.hasOwnProperty.call(p,n)&&(x[n]=p[n])}return x},w.apply(this,arguments)}var C=function(){function x(p){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(v){try{n.apply(v,{ot:E.CMCDObjectType.MANIFEST,su:!n.initialized})}catch(d){I.logger.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(v){try{var d=v.frag,o=n.hls.levels[d.level],m=n.getObjectType(d),h={d:d.duration*1e3,ot:m};(m===E.CMCDObjectType.VIDEO||m===E.CMCDObjectType.AUDIO||m==E.CMCDObjectType.MUXED)&&(h.br=o.bitrate/1e3,h.tb=n.getTopBandwidth(m),h.bl=n.getBufferLength(m)),n.apply(v,h)}catch(a){I.logger.warn("Could not generate segment CMCD data.",a)}},this.hls=p;var u=this.config=p.config,l=u.cmcd;l!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||x.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var _=x.prototype;return _.registerListeners=function(){var n=this.hls;n.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(N.Events.MEDIA_DETACHED,this.onMediaDetached,this),n.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this)},_.unregisterListeners=function(){var n=this.hls;n.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(N.Events.MEDIA_DETACHED,this.onMediaDetached,this),n.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},_.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},_.onMediaAttached=function(n,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},_.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},_.onBufferCreated=function(n,u){var l,v;this.audioBuffer=(l=u.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(v=u.tracks.video)===null||v===void 0?void 0:v.buffer},_.createData=function(){var n;return{v:E.CMCDVersion,sf:E.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(n=this.media)===null||n===void 0?void 0:n.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},_.apply=function(n,u){u===void 0&&(u={}),w(u,this.createData());var l=u.ot===E.CMCDObjectType.INIT||u.ot===E.CMCDObjectType.VIDEO||u.ot===E.CMCDObjectType.MUXED;if(this.starved&&l&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var v=x.toHeaders(u);if(!Object.keys(v).length)return;n.headers||(n.headers={}),w(n.headers,v)}else{var d=x.toQuery(u);if(!d)return;n.url=x.appendQueryToUri(n.url,d)}},_.getObjectType=function(n){var u=n.type;return u==="subtitle"?E.CMCDObjectType.TIMED_TEXT:n.sn==="initSegment"?E.CMCDObjectType.INIT:u==="audio"?E.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?E.CMCDObjectType.VIDEO:E.CMCDObjectType.MUXED:void 0},_.getTopBandwidth=function(n){for(var u=0,l=n===E.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,v=P(l),d;!(d=v()).done;){var o=d.value;o.bitrate>u&&(u=o.bitrate)}return u>0?u:NaN},_.getBufferLength=function(n){var u=this.hls.media,l=n===E.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!u)return NaN;var v=R.BufferHelper.bufferInfo(l,u.currentTime,this.config.maxBufferHole);return v.len*1e3},_.createPlaylistLoader=function(){var n=this.config.pLoader,u=this.applyPlaylistData,l=n||this.config.loader;return function(){function v(o){this.loader=void 0,this.loader=new l(o)}var d=v.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(m,h,a){u(m),this.loader.load(m,h,a)},T(v,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),v}()},_.createFragmentLoader=function(){var n=this.config.fLoader,u=this.applyFragmentData,l=n||this.config.loader;return function(){function v(o){this.loader=void 0,this.loader=new l(o)}var d=v.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(m,h,a){u(m),this.loader.load(m,h,a)},T(v,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),v}()},x.uuid=function(){var n=URL.createObjectURL(new Blob),u=n.toString();return URL.revokeObjectURL(n),u.substr(u.lastIndexOf("/")+1)},x.serialize=function(n){for(var u=[],l=function(A){return!Number.isNaN(A)&&A!=null&&A!==""&&A!==!1},v=function(A){return Math.round(A)},d=function(A){return v(A/100)*100},o=function(A){return encodeURIComponent(A)},m={br:v,d:v,bl:d,dl:d,mtp:d,nor:o,rtp:d,tb:v},h=Object.keys(n||{}).sort(),a=P(h),r;!(r=a()).done;){var e=r.value,i=n[e];if(!l(i))continue;if(e==="v"&&i===1)continue;if(e=="pr"&&i===1)continue;var g=m[e];g&&(i=g(i));var f=typeof i,y=void 0;e==="ot"||e==="sf"||e==="st"?y=e+"="+i:f==="boolean"?y=e:f==="number"?y=e+"="+i:y=e+"="+JSON.stringify(i),u.push(y)}return u.join(",")},x.toHeaders=function(n){for(var u=Object.keys(n),l={},v=["Object","Request","Session","Status"],d=[{},{},{},{}],o={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},m=0,h=u;m<h.length;m++){var a=h[m],r=o[a]!=null?o[a]:1;d[r][a]=n[a]}for(var e=0;e<d.length;e++){var i=x.serialize(d[e]);i&&(l["CMCD-"+v[e]]=i)}return l},x.toQuery=function(n){return"CMCD="+encodeURIComponent(x.serialize(n))},x.appendQueryToUri=function(n,u){if(!u)return n;var l=n.includes("?")?"&":"?";return""+n+l+u},x}()},"./src/controller/eme-controller.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/events.ts"),E=O("./src/errors.ts"),R=O("./src/utils/logger.ts"),I=O("./src/utils/mediakeys-helper.ts");function L(C,x){for(var _=0;_<x.length;_++){var p=x[_];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(C,p.key,p)}}function T(C,x,_){return x&&L(C.prototype,x),_&&L(C,_),C}var P=3,b=function(x,_,p){var n={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(u){n.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:p.audioRobustness||""})}),_.forEach(function(u){n.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:p.videoRobustness||""})}),[n]},S=function(x,_,p,n){switch(x){case I.KeySystems.WIDEVINE:return b(_,p,n);default:throw new Error("Unknown key-system: "+x)}},w=function(){function C(_){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=_,this._config=_.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 x=C.prototype;return x.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},x._registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(N.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x._unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(N.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x.getLicenseServerUrl=function(p){switch(p){case I.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+p+'"')},x._attemptKeySystemAccess=function(p,n,u){var l=this,v=S(p,n,u,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var d=this.requestMediaKeySystemAccess(p,v);this.mediaKeysPromise=d.then(function(o){return l._onMediaKeySystemAccessObtained(p,o)}),d.catch(function(o){R.logger.error('Failed to obtain key-system "'+p+'" access:',o)})},x._onMediaKeySystemAccessObtained=function(p,n){var u=this;R.logger.log('Access for key-system "'+p+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:n,mediaKeySystemDomain:p};this._mediaKeysList.push(l);var v=Promise.resolve().then(function(){return n.createMediaKeys()}).then(function(d){return l.mediaKeys=d,R.logger.log('Media-keys created for key-system "'+p+'"'),u._onMediaKeysCreated(),d});return v.catch(function(d){R.logger.error("Failed to create media-keys:",d)}),v},x._onMediaKeysCreated=function(){var p=this;this._mediaKeysList.forEach(function(n){n.mediaKeysSession||(n.mediaKeysSession=n.mediaKeys.createSession(),p._onNewMediaKeySession(n.mediaKeysSession))})},x._onNewMediaKeySession=function(p){var n=this;R.logger.log("New key-system session "+p.sessionId),p.addEventListener("message",function(u){n._onKeySessionMessage(p,u.message)},!1)},x._onKeySessionMessage=function(p,n){R.logger.log("Got EME message event, creating license request"),this._requestLicense(n,function(u){R.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),p.update(u)})},x.onMediaEncrypted=function(p){var n=this;if(R.logger.log('Media is encrypted using "'+p.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(v){if(!n._media)return;n._attemptSetMediaKeys(v),n._generateRequestWithPreferredKeySession(p.initDataType,p.initData)};this.mediaKeysPromise.then(u).catch(u)},x._attemptSetMediaKeys=function(p){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var n=this._mediaKeysList[0];if(!n||!n.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(n.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(p,n){var u=this,l=this._mediaKeysList[0];if(!l){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var v=l.mediaKeysSession;if(!v){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!n){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+p+'" init data type'),l.mediaKeysSessionInitialized=!0,v.generateRequest(p,n).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(d){R.logger.error("Error generating key-session request:",d),u.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(p,n,u){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,p,n,u);var v=this._licenseXhrSetup;if(v)try{v.call(this.hls,l,p),v=void 0}catch(d){R.logger.error(d)}try{l.readyState||l.open("POST",p,!0),v&&v.call(this.hls,l,p)}catch(d){throw new Error("issue setting up KeySystem license XHR "+d)}return l},x._onLicenseRequestReadyStageChange=function(p,n,u,l){switch(p.readyState){case 4:if(p.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var v=p.response,d=this._licenseResponseCallback;if(d)try{v=d.call(this.hls,p,n)}catch(m){R.logger.error(m)}l(v)}else{if(R.logger.error("License Request XHR failed ("+n+"). Status: "+p.status+" ("+p.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>P){this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var o=P-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+o+" attempts left"),this._requestLicense(u,l)}break}},x._generateLicenseRequestChallenge=function(p,n){switch(p.mediaKeySystemDomain){case I.KeySystems.WIDEVINE:return n}throw new Error("unsupported key-system: "+p.mediaKeySystemDomain)},x._requestLicense=function(p,n){R.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(u.mediaKeySystemDomain),v=this._createLicenseXhr(l,p,n);R.logger.log("Sending license request to URL: "+l);var d=this._generateLicenseRequestChallenge(u,p);v.send(d)}catch(o){R.logger.error("Failure requesting DRM license: "+o),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(p,n){if(!this._emeEnabled)return;var u=n.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},x.onMediaDetached=function(){var p=this._media,n=this._mediaKeysList;if(!p)return;p.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(n.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return p.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(p,n){if(!this._emeEnabled)return;var u=n.levels.map(function(v){return v.audioCodec}).filter(function(v){return!!v}),l=n.levels.map(function(v){return v.videoCodec}).filter(function(v){return!!v});this._attemptKeySystemAccess(I.KeySystems.WIDEVINE,u,l)},T(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();j.default=w},"./src/controller/fps-controller.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/events.ts"),E=O("./src/utils/logger.ts"),R=function(){function I(T){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=T,this.registerListeners()}var L=I.prototype;return L.setStreamController=function(P){this.streamController=P},L.registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},L.unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching)},L.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},L.onMediaAttaching=function(P,b){var S=this.hls.config;if(S.capLevelOnFPSDrop){var w=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=w,w&&typeof w.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),S.fpsDroppedMonitoringPeriod)}},L.checkFPS=function(P,b,S){var w=performance.now();if(b){if(this.lastTime){var C=w-this.lastTime,x=S-this.lastDroppedFrames,_=b-this.lastDecodedFrames,p=1e3*x/C,n=this.hls;if(n.trigger(N.Events.FPS_DROP,{currentDropped:x,currentDecoded:_,totalDroppedFrames:S}),p>0&&x>n.config.fpsDroppedMonitoringThreshold*_){var u=n.currentLevel;E.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(n.autoLevelCapping===-1||n.autoLevelCapping>=u)&&(u=u-1,n.trigger(N.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:n.currentLevel}),n.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=w,this.lastDroppedFrames=S,this.lastDecodedFrames=b}},L.checkFPSInterval=function(){var P=this.media;if(P)if(this.isVideoPlaybackQualityAvailable){var b=P.getVideoPlaybackQuality();this.checkFPS(P,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(P,P.webkitDecodedFrameCount,P.webkitDroppedFrameCount)},I}();j.default=R},"./src/controller/fragment-finders.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"findFragmentByPDT",function(){return R}),O.d(j,"findFragmentByPTS",function(){return I}),O.d(j,"fragmentWithinToleranceTest",function(){return L}),O.d(j,"pdtWithinToleranceTest",function(){return T}),O.d(j,"findFragWithCC",function(){return P});var N=O("./src/polyfills/number.ts"),E=O("./src/utils/binary-search.ts");function R(b,S,w){if(S===null||!Array.isArray(b)||!b.length||!Object(N.isFiniteNumber)(S))return null;var C=b[0].programDateTime;if(S<(C||0))return null;var x=b[b.length-1].endProgramDateTime;if(S>=(x||0))return null;w=w||0;for(var _=0;_<b.length;++_){var p=b[_];if(T(S,w,p))return p}return null}function I(b,S,w,C){w===void 0&&(w=0),C===void 0&&(C=0);var x=null;if(b?x=S[b.sn-S[0].sn+1]||null:w===0&&S[0].start===0&&(x=S[0]),x&&L(w,C,x)===0)return x;var _=E.default.search(S,L.bind(null,w,C));return _||x}function L(b,S,w){b===void 0&&(b=0),S===void 0&&(S=0);var C=Math.min(S,w.duration+(w.deltaPTS?w.deltaPTS:0));return w.start+w.duration-C<=b?1:w.start-C>b&&w.start?-1:0}function T(b,S,w){var C=Math.min(S,w.duration+(w.deltaPTS?w.deltaPTS:0))*1e3,x=w.endProgramDateTime||0;return x-C>b}function P(b,S){return E.default.search(b,function(w){return w.cc<S?1:w.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"FragmentState",function(){return R}),O.d(j,"FragmentTracker",function(){return I});var N=O("./src/events.ts"),E=O("./src/types/loader.ts"),R;(function(P){P.NOT_LOADED="NOT_LOADED",P.BACKTRACKED="BACKTRACKED",P.APPENDING="APPENDING",P.PARTIAL="PARTIAL",P.OK="OK"})(R||(R={}));var I=function(){function P(S){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=S,this._registerListeners()}var b=P.prototype;return b._registerListeners=function(){var w=this.hls;w.on(N.Events.BUFFER_APPENDED,this.onBufferAppended,this),w.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this),w.on(N.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var w=this.hls;w.off(N.Events.BUFFER_APPENDED,this.onBufferAppended,this),w.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this),w.off(N.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(w,C){if(C===E.PlaylistLevelType.MAIN){var x=this.activeFragment,_=this.activeParts;if(!x)return null;if(_)for(var p=_.length;p--;){var n=_[p],u=n?n.end:x.appendedPTS;if(n.start<=w&&u!==void 0&&w<=u)return p>9&&(this.activeParts=_.slice(p-9)),n}else if(x.start<=w&&x.appendedPTS!==void 0&&w<=x.appendedPTS)return x}return this.getBufferedFrag(w,C)},b.getBufferedFrag=function(w,C){for(var x=this.fragments,_=Object.keys(x),p=_.length;p--;){var n=x[_[p]];if((n==null?void 0:n.body.type)===C&&n.buffered){var u=n.body;if(u.start<=w&&w<=u.end)return u}}return null},b.detectEvictedFragments=function(w,C,x){var _=this;Object.keys(this.fragments).forEach(function(p){var n=_.fragments[p];if(!n)return;if(!n.buffered){n.body.type===x&&_.removeFragment(n.body);return}var u=n.range[w];if(!u)return;u.time.some(function(l){var v=!_.isTimeBuffered(l.startPTS,l.endPTS,C);return v&&_.removeFragment(n.body),v})})},b.detectPartialFragments=function(w){var C=this,x=this.timeRanges,_=w.frag,p=w.part;if(!x||_.sn==="initSegment")return;var n=T(_),u=this.fragments[n];if(!u)return;Object.keys(x).forEach(function(l){var v=_.elementaryStreams[l];if(!v)return;var d=x[l],o=p!==null||v.partial===!0;u.range[l]=C.getBufferedTimes(_,p,o,d)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},b.fragBuffered=function(w){var C=T(w),x=this.fragments[C];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},b.getBufferedTimes=function(w,C,x,_){for(var p={time:[],partial:x},n=C?C.start:w.start,u=C?C.end:w.end,l=w.minEndPTS||u,v=w.maxStartPTS||n,d=0;d<_.length;d++){var o=_.start(d)-this.bufferPadding,m=_.end(d)+this.bufferPadding;if(v>=o&&l<=m){p.time.push({startPTS:Math.max(n,_.start(d)),endPTS:Math.min(u,_.end(d))});break}else if(n<m&&u>o)p.partial=!0,p.time.push({startPTS:Math.max(n,_.start(d)),endPTS:Math.min(u,_.end(d))});else if(u<=o)break}return p},b.getPartialFragment=function(w){var C=null,x,_,p,n=0,u=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(v){var d=l[v];if(!d)return;L(d)&&(_=d.body.start-u,p=d.body.end+u,w>=_&&w<=p&&(x=Math.min(w-_,p-w),n<=x&&(C=d.body,n=x)))}),C},b.getState=function(w){var C=T(w),x=this.fragments[C];return x?x.buffered?L(x)?R.PARTIAL:R.OK:x.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},b.backtrack=function(w,C){var x=T(w),_=this.fragments[x];if(!_||_.backtrack)return null;var p=_.backtrack=C||_.loaded;return _.loaded=null,p},b.getBacktrackData=function(w){var C=T(w),x=this.fragments[C];if(x){var _,p=x.backtrack;if(p!=null&&(_=p.payload)!==null&&_!==void 0&&_.byteLength)return p;this.removeFragment(w)}return null},b.isTimeBuffered=function(w,C,x){for(var _,p,n=0;n<x.length;n++){if(_=x.start(n)-this.bufferPadding,p=x.end(n)+this.bufferPadding,w>=_&&C<=p)return!0;if(C<=_)return!1}return!1},b.onFragLoaded=function(w,C){var x=C.frag,_=C.part;if(x.sn==="initSegment"||x.bitrateTest||_)return;var p=T(x);this.fragments[p]={body:x,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(w,C){var x=this,_=C.frag,p=C.part,n=C.timeRanges;if(_.type===E.PlaylistLevelType.MAIN)if(this.activeFragment=_,p){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(p)}else this.activeParts=null;this.timeRanges=n,Object.keys(n).forEach(function(l){var v=n[l];if(x.detectEvictedFragments(l,v),!p)for(var d=0;d<v.length;d++)_.appendedPTS=Math.max(v.end(d),_.appendedPTS||0)})},b.onFragBuffered=function(w,C){this.detectPartialFragments(C)},b.hasFragment=function(w){var C=T(w);return!!this.fragments[C]},b.removeFragmentsInRange=function(w,C,x){var _=this;Object.keys(this.fragments).forEach(function(p){var n=_.fragments[p];if(!n)return;if(n.buffered){var u=n.body;u.type===x&&u.start<C&&u.end>w&&_.removeFragment(u)}})},b.removeFragment=function(w){var C=T(w);w.stats.loaded=0,w.clearElementaryStreamInfo(),delete this.fragments[C]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},P}();function L(P){var b,S;return P.buffered&&(((b=P.range.video)===null||b===void 0?void 0:b.partial)||((S=P.range.audio)===null||S===void 0?void 0:S.partial))}function T(P){return P.type+"_"+P.level+"_"+P.urlId+"_"+P.sn}},"./src/controller/gap-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"STALL_MINIMUM_DURATION_MS",function(){return L}),O.d(j,"MAX_START_GAP_JUMP",function(){return T}),O.d(j,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return P}),O.d(j,"SKIP_BUFFER_RANGE_START",function(){return b}),O.d(j,"default",function(){return S});var N=O("./src/utils/buffer-helper.ts"),E=O("./src/errors.ts"),R=O("./src/events.ts"),I=O("./src/utils/logger.ts"),L=250,T=2,P=.1,b=.05,S=function(){function w(x,_,p,n){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=x,this.media=_,this.fragmentTracker=p,this.hls=n}var C=w.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(_){var p=this.config,n=this.media,u=this.stalled,l=n.currentTime,v=n.seeking,d=this.seeking&&!v,o=!this.seeking&&v;if(this.seeking=v,l!==_){if(this.moved=!0,u!==null){if(this.stallReported){var m=self.performance.now()-u;I.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(m)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((o||d)&&(this.stalled=null),n.paused||n.ended||n.playbackRate===0||!N.BufferHelper.getBuffered(n).length)return;var h=N.BufferHelper.bufferInfo(n,l,0),a=h.len>0,r=h.nextStart||0;if(!a&&!r)return;if(v){var e=h.len>T,i=!r||r-l>T&&!this.fragmentTracker.getPartialFragment(l);if(e||i)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,f=Math.max(r,h.start||0)-l,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,t=y==null||((g=y.details)===null||g===void 0)?void 0:g.live,A=t?y.details.targetduration*2:T;if(f>0&&f<=A){this._trySkipBufferHole(null);return}}var U=self.performance.now();if(u===null){this.stalled=U;return}var B=U-u;!v&&B>=L&&this._reportStall(h.len);var G=N.BufferHelper.bufferInfo(n,l,p.maxBufferHole);this._tryFixBufferStall(G,B)},C._tryFixBufferStall=function(_,p){var n=this.config,u=this.fragmentTracker,l=this.media,v=l.currentTime,d=u.getPartialFragment(v);if(d){var o=this._trySkipBufferHole(d);if(o)return}_.len>n.maxBufferHole&&p>n.highBufferWatchdogPeriod*1e3&&(I.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(_){var p=this.hls,n=this.media,u=this.stallReported;u||(this.stallReported=!0,I.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer (buffer="+_+")"),p.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:_}))},C._trySkipBufferHole=function(_){for(var p=this.config,n=this.hls,u=this.media,l=u.currentTime,v=0,d=N.BufferHelper.getBuffered(u),o=0;o<d.length;o++){var m=d.start(o);if(l+p.maxBufferHole>=v&&l<m){var h=Math.max(m+b,u.currentTime+P);return I.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+h),this.moved=!0,this.stalled=null,u.currentTime=h,_&&n.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+h,frag:_}),h}v=d.end(o)}return 0},C._tryNudgeBuffer=function(){var _=this.config,p=this.hls,n=this.media,u=n.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<_.nudgeMaxRetry){var v=u+l*_.nudgeOffset;I.logger.warn("Nudging 'currentTime' from "+u+" to "+v),n.currentTime=v,p.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else I.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+_.nudgeMaxRetry+" nudges"),p.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},w}()},"./src/controller/id3-track-controller.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/events.ts"),E=O("./src/utils/texttrack-utils.ts"),R=O("./src/demux/id3.ts"),I=.25,L=function(){function T(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var P=T.prototype;return P.destroy=function(){this._unregisterListeners()},P._registerListeners=function(){var S=this.hls;S.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(N.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},P._unregisterListeners=function(){var S=this.hls;S.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(N.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},P.onMediaAttached=function(S,w){this.media=w.media},P.onMediaDetaching=function(){if(!this.id3Track)return;Object(E.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},P.getID3Track=function(S){if(!this.media)return;for(var w=0;w<S.length;w++){var C=S[w];if(C.kind==="metadata"&&C.label==="id3")return Object(E.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},P.onFragParsingMetadata=function(S,w){if(!this.media)return;var C=w.frag,x=w.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var _=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,p=0;p<x.length;p++){var n=R.getID3Frames(x[p].data);if(n){var u=x[p].pts,l=p<x.length-1?x[p+1].pts:C.end,v=l-u;v<=0&&(l=u+I);for(var d=0;d<n.length;d++){var o=n[d];if(!R.isTimeStampFrame(o)){var m=new _(u,l,"");m.value=o,this.id3Track.addCue(m)}}}}},P.onBufferFlushing=function(S,w){var C=w.startOffset,x=w.endOffset,_=w.type;if(!_||_==="audio"){var p=this.id3Track;p&&Object(E.removeCuesInRange)(p,C,x)}},T}();j.default=L},"./src/controller/latency-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return T});var N=O("./src/errors.ts"),E=O("./src/events.ts"),R=O("./src/utils/logger.ts");function I(P,b){for(var S=0;S<b.length;S++){var w=b[S];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(P,w.key,w)}}function L(P,b,S){return b&&I(P.prototype,b),S&&I(P,S),P}var T=function(){function P(S){var w=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 w.timeupdate()},this.hls=S,this.config=S.config,this.registerListeners()}var b=P.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(E.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(E.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(E.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(E.Events.ERROR,this.onError)},b.onMediaAttached=function(w,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(w,C){var x=C.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(w,C){if(C.details!==N.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var w=this.media,C=this.levelDetails;if(!w||!C)return;this.currentTime=w.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var _=this.config,p=_.lowLatencyMode,n=_.maxLiveSyncPlaybackRate;if(!p||n===1)return;var u=this.targetLatency;if(u===null)return;var l=x-u,v=Math.min(this.maxLatency,u+C.targetduration),d=l<v;if(C.live&&d&&l>.05&&this.forwardBufferLength>1){var o=Math.min(2,Math.max(1,n)),m=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;w.playbackRate=Math.min(o,Math.max(1,m))}else w.playbackRate!==1&&w.playbackRate!==0&&(w.playbackRate=1)},b.estimateLiveEdge=function(){var w=this.levelDetails;return w===null?null:w.edge+w.age},b.computeLatency=function(){var w=this.estimateLiveEdge();return w===null?null:w-this.currentTime},L(P,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var w=this.config,C=this.levelDetails;return w.liveMaxLatencyDuration!==void 0?w.liveMaxLatencyDuration:C?w.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var w=this.levelDetails;if(w===null)return null;var C=w.holdBack,x=w.partHoldBack,_=w.targetduration,p=this.config,n=p.liveSyncDuration,u=p.liveSyncDurationCount,l=p.lowLatencyMode,v=this.hls.userConfig,d=l&&x||C;(v.liveSyncDuration||v.liveSyncDurationCount||d===0)&&(d=n!==void 0?n:u*_);var o=_,m=1;return d+Math.min(this.stallCount*m,o)}},{key:"liveSyncPosition",get:function(){var w=this.estimateLiveEdge(),C=this.targetLatency,x=this.levelDetails;if(w===null||C===null||x===null)return null;var _=x.edge,p=w-C-this.edgeStalled,n=_-x.totalduration,u=_-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(n,p),u)}},{key:"drift",get:function(){var w=this.levelDetails;return w===null?1:w.drift}},{key:"edgeStalled",get:function(){var w=this.levelDetails;if(w===null)return 0;var C=(this.config.lowLatencyMode&&w.partTarget||w.targetduration)*3;return Math.max(w.age-C,0)}},{key:"forwardBufferLength",get:function(){var w=this.media,C=this.levelDetails;if(!w||!C)return 0;var x=w.buffered.length;return x?w.buffered.end(x-1):C.edge-this.currentTime}}]),P}()},"./src/controller/level-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return p});var N=O("./src/types/level.ts"),E=O("./src/events.ts"),R=O("./src/errors.ts"),I=O("./src/utils/codecs.ts"),L=O("./src/controller/level-helper.ts"),T=O("./src/controller/base-playlist-controller.ts"),P=O("./src/types/loader.ts");function b(){return b=Object.assign||function(n){for(var u=1;u<arguments.length;u++){var l=arguments[u];for(var v in l)Object.prototype.hasOwnProperty.call(l,v)&&(n[v]=l[v])}return n},b.apply(this,arguments)}function S(n,u){for(var l=0;l<u.length;l++){var v=u[l];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(n,v.key,v)}}function w(n,u,l){return u&&S(n.prototype,u),l&&S(n,l),n}function C(n,u){n.prototype=Object.create(u.prototype),n.prototype.constructor=n,x(n,u)}function x(n,u){return x=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},x(n,u)}var _=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=function(n){C(u,n);function u(v){var d;return d=n.call(this,v,"[level-controller]")||this,d._levels=[],d._firstLevel=-1,d._startLevel=void 0,d.currentLevelIndex=-1,d.manualLevelIndex=-1,d.onParsedComplete=void 0,d._registerListeners(),d}var l=u.prototype;return l._registerListeners=function(){var d=this.hls;d.on(E.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(E.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(E.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(E.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var d=this.hls;d.off(E.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(E.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(E.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(E.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,n.prototype.destroy.call(this)},l.startLoad=function(){var d=this._levels;d.forEach(function(o){o.loadError=0}),n.prototype.startLoad.call(this)},l.onManifestLoaded=function(d,o){var m=[],h=[],a=[],r,e={},i,g=!1,f=!1,y=!1;if(o.levels.forEach(function(B){var G=B.attrs;g=g||!!(B.width&&B.height),f=f||!!B.videoCodec,y=y||!!B.audioCodec,_&&B.audioCodec&&B.audioCodec.indexOf("mp4a.40.34")!==-1&&(B.audioCodec=void 0);var J=B.bitrate+"-"+B.attrs.RESOLUTION+"-"+B.attrs.CODECS;i=e[J],i?i.url.push(B.url):(i=new N.Level(B),e[J]=i,m.push(i)),G&&(G.AUDIO&&Object(L.addGroupId)(i,"audio",G.AUDIO),G.SUBTITLES&&Object(L.addGroupId)(i,"text",G.SUBTITLES))}),(g||f)&&y&&(m=m.filter(function(B){var G=B.videoCodec,J=B.width,F=B.height;return!!G||!!(J&&F)})),m=m.filter(function(B){var G=B.audioCodec,J=B.videoCodec;return(!G||Object(I.isCodecSupportedInMp4)(G,"audio"))&&(!J||Object(I.isCodecSupportedInMp4)(J,"video"))}),o.audioTracks&&(h=o.audioTracks.filter(function(B){return!B.audioCodec||Object(I.isCodecSupportedInMp4)(B.audioCodec,"audio")}),Object(L.assignTrackIdsByGroup)(h)),o.subtitles&&(a=o.subtitles,Object(L.assignTrackIdsByGroup)(a)),m.length>0){r=m[0].bitrate,m.sort(function(B,G){return B.bitrate-G.bitrate}),this._levels=m;for(var t=0;t<m.length;t++)if(m[t].bitrate===r){this._firstLevel=t,this.log("manifest loaded, "+m.length+" level(s) found, first bitrate: "+r);break}var A=y&&!f,U={levels:m,audioTracks:h,subtitleTracks:a,firstLevel:this._firstLevel,stats:o.stats,audio:y,video:f,altAudio:!A&&h.some(function(B){return!!B.url})};this.hls.trigger(E.Events.MANIFEST_PARSED,U),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(E.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:o.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(d,o){if(n.prototype.onError.call(this,d,o),o.fatal)return;var m=o.context,h=this._levels[this.currentLevelIndex];if(m&&(m.type===P.PlaylistContextType.AUDIO_TRACK&&h.audioGroupIds&&m.groupId===h.audioGroupIds[h.urlId]||m.type===P.PlaylistContextType.SUBTITLE_TRACK&&h.textGroupIds&&m.groupId===h.textGroupIds[h.urlId])){this.redundantFailover(this.currentLevelIndex);return}var a=!1,r=!0,e;switch(o.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(o.frag){var i=this._levels[o.frag.level];i?(i.fragmentError++,i.fragmentError>this.hls.config.fragLoadingMaxRetry&&(e=o.frag.level)):e=o.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:m&&(m.deliveryDirectives&&(r=!1),e=m.level),a=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:e=o.level,a=!0;break}e!==void 0&&this.recoverLevel(o,e,a,r)},l.recoverLevel=function(d,o,m,h){var a=d.details,r=this._levels[o];if(r.loadError++,m){var e=this.retryLoadingOrFail(d);if(e)d.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(h){var i=r.url.length;if(i>1&&r.loadError<i)d.levelRetry=!0,this.redundantFailover(o);else if(this.manualLevelIndex===-1){var g=o===0?this._levels.length-1:o-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(a+": switch to "+g),d.levelRetry=!0,this.hls.nextAutoLevel=g)}}},l.redundantFailover=function(d){var o=this._levels[d],m=o.url.length;if(m>1){var h=(o.urlId+1)%m;this.warn("Switching to redundant URL-id "+h),this._levels.forEach(function(a){a.urlId=h}),this.level=d}},l.onFragLoaded=function(d,o){var m=o.frag;if(m!==void 0&&m.type===P.PlaylistLevelType.MAIN){var h=this._levels[m.level];h!==void 0&&(h.fragmentError=0,h.loadError=0)}},l.onLevelLoaded=function(d,o){var m,h=o.level,a=o.details,r=this._levels[h];if(!r){var e;this.warn("Invalid level index "+h),(e=o.deliveryDirectives)!==null&&e!==void 0&&e.skip&&(a.deltaUpdateFailed=!0);return}h===this.currentLevelIndex?(r.fragmentError===0&&(r.loadError=0,this.retryCount=0),this.playlistLoaded(h,o,r.details)):(m=o.deliveryDirectives)!==null&&m!==void 0&&m.skip&&(a.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(d,o){var m=this.hls.levels[this.currentLevelIndex];if(!m)return;if(m.audioGroupIds){for(var h=-1,a=this.hls.audioTracks[o.id].groupId,r=0;r<m.audioGroupIds.length;r++)if(m.audioGroupIds[r]===a){h=r;break}h!==m.urlId&&(m.urlId=h,this.startLoad())}},l.loadPlaylist=function(d){var o=this.currentLevelIndex,m=this._levels[o];if(this.canLoad&&m&&m.url.length>0){var h=m.urlId,a=m.url[h];if(d)try{a=d.addDirectives(a)}catch(r){this.warn("Could not construct new URL with HLS Delivery Directives: "+r)}this.log("Attempt loading level index "+o+(d?" at sn "+d.msn+" part "+d.part:"")+" with URL-id "+h+" "+a),this.clearTimer(),this.hls.trigger(E.Events.LEVEL_LOADING,{url:a,level:o,id:h,deliveryDirectives:d||null})}},l.removeLevel=function(d,o){var m=function(r,e){return e!==o},h=this._levels.filter(function(a,r){return r!==d?!0:a.url.length>1&&o!==void 0?(a.url=a.url.filter(m),a.audioGroupIds&&(a.audioGroupIds=a.audioGroupIds.filter(m)),a.textGroupIds&&(a.textGroupIds=a.textGroupIds.filter(m)),a.urlId=0,!0):!1}).map(function(a,r){var e=a.details;return e!=null&&e.fragments&&e.fragments.forEach(function(i){i.level=r}),a});this._levels=h,this.hls.trigger(E.Events.LEVELS_UPDATED,{levels:h})},w(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(d){var o,m=this._levels;if(m.length===0)return;if(this.currentLevelIndex===d&&(o=m[d])!==null&&o!==void 0&&o.details)return;if(d<0||d>=m.length){var h=d<0;if(this.hls.trigger(E.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:d,fatal:h,reason:"invalid level idx"}),h)return;d=Math.min(d,m.length-1)}this.clearTimer();var a=this.currentLevelIndex,r=m[a],e=m[d];this.log("switching to level "+d+" from "+a),this.currentLevelIndex=d;var i=b({},e,{level:d,maxBitrate:e.maxBitrate,uri:e.uri,urlId:e.urlId});delete i._urlId,this.hls.trigger(E.Events.LEVEL_SWITCHING,i);var g=e.details;if(!g||g.live){var f=this.switchParams(e.uri,r==null?void 0:r.details);this.loadPlaylist(f)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(d){this.manualLevelIndex=d,this._startLevel===void 0&&(this._startLevel=d),d!==-1&&(this.level=d)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(d){this._firstLevel=d}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var d=this.hls.config.startLevel;return d!==void 0?d:this._firstLevel}else return this._startLevel},set:function(d){this._startLevel=d}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(d){this.level=d,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=d)}}]),u}(T.default)},"./src/controller/level-helper.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"addGroupId",function(){return R}),O.d(j,"assignTrackIdsByGroup",function(){return I}),O.d(j,"updatePTS",function(){return L}),O.d(j,"updateFragPTSDTS",function(){return P}),O.d(j,"mergeDetails",function(){return b}),O.d(j,"mapPartIntersection",function(){return S}),O.d(j,"mapFragmentIntersection",function(){return w}),O.d(j,"adjustSliding",function(){return C}),O.d(j,"addSliding",function(){return x}),O.d(j,"computeReloadInterval",function(){return _}),O.d(j,"getFragmentWithSN",function(){return p}),O.d(j,"getPartWith",function(){return n});var N=O("./src/polyfills/number.ts"),E=O("./src/utils/logger.ts");function R(u,l,v){switch(l){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(v);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(v);break}}function I(u){var l={};u.forEach(function(v){var d=v.groupId||"";v.id=l[d]=l[d]||0,l[d]++})}function L(u,l,v){var d=u[l],o=u[v];T(d,o)}function T(u,l){var v=l.startPTS;if(Object(N.isFiniteNumber)(v)){var d=0,o;l.sn>u.sn?(d=v-u.start,o=u):(d=u.start-v,o=l),o.duration!==d&&(o.duration=d)}else if(l.sn>u.sn){var m=u.cc===l.cc;m&&u.minEndPTS?l.start=u.start+(u.minEndPTS-u.start):l.start=u.start+u.duration}else l.start=Math.max(u.start-l.duration,0)}function P(u,l,v,d,o,m){var h=d-v;h<=0&&(E.logger.warn("Fragment should have a positive duration",l),d=v+l.duration,m=o+l.duration);var a=v,r=d,e=l.startPTS,i=l.endPTS;if(Object(N.isFiniteNumber)(e)){var g=Math.abs(e-v);Object(N.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(g,l.deltaPTS):l.deltaPTS=g,a=Math.max(v,e),v=Math.min(v,e),o=Math.min(o,l.startDTS),r=Math.min(d,i),d=Math.max(d,i),m=Math.max(m,l.endDTS)}l.duration=d-v;var f=v-l.start;l.appendedPTS=d,l.start=l.startPTS=v,l.maxStartPTS=a,l.startDTS=o,l.endPTS=d,l.minEndPTS=r,l.endDTS=m;var y=l.sn;if(!u||y<u.startSN||y>u.endSN)return 0;var t,A=y-u.startSN,U=u.fragments;for(U[A]=l,t=A;t>0;t--)T(U[t],U[t-1]);for(t=A;t<U.length-1;t++)T(U[t],U[t+1]);return u.fragmentHint&&T(U[U.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,f}function b(u,l){for(var v=null,d=u.fragments,o=d.length-1;o>=0;o--){var m=d[o].initSegment;if(m){v=m;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var h=0,a;if(w(u,l,function(t,A){t.relurl&&(h=t.cc-A.cc),Object(N.isFiniteNumber)(t.startPTS)&&Object(N.isFiniteNumber)(t.endPTS)&&(A.start=A.startPTS=t.startPTS,A.startDTS=t.startDTS,A.appendedPTS=t.appendedPTS,A.maxStartPTS=t.maxStartPTS,A.endPTS=t.endPTS,A.endDTS=t.endDTS,A.minEndPTS=t.minEndPTS,A.duration=t.endPTS-t.startPTS,A.duration&&(a=A),l.PTSKnown=l.alignedSliding=!0),A.elementaryStreams=t.elementaryStreams,A.loader=t.loader,A.stats=t.stats,A.urlId=t.urlId,t.initSegment&&(A.initSegment=t.initSegment,v=t.initSegment)}),v){var r=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;r.forEach(function(t){var A;(!t.initSegment||t.initSegment.relurl===((A=v)===null||A===void 0?void 0:A.relurl))&&(t.initSegment=v)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(t){return!t}),l.deltaUpdateFailed)){E.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var e=l.skippedSegments;e--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var i=l.fragments;if(h){E.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<i.length;g++)i[g].cc+=h}l.skippedSegments&&(l.startCC=l.fragments[0].cc),S(u.partList,l.partList,function(t,A){A.elementaryStreams=t.elementaryStreams,A.stats=t.stats}),a?P(l,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS):C(u,l),i.length&&(l.totalduration=l.edge-i[0].start),l.driftStartTime=u.driftStartTime,l.driftStart=u.driftStart;var f=l.advancedDateTime;if(l.advanced&&f){var y=l.edge;l.driftStart||(l.driftStartTime=f,l.driftStart=y),l.driftEndTime=f,l.driftEnd=y}else l.driftEndTime=u.driftEndTime,l.driftEnd=u.driftEnd,l.advancedDateTime=u.advancedDateTime}function S(u,l,v){if(u&&l)for(var d=0,o=0,m=u.length;o<=m;o++){var h=u[o],a=l[o+d];h&&a&&h.index===a.index&&h.fragment.sn===a.fragment.sn?v(h,a):d--}}function w(u,l,v){for(var d=l.skippedSegments,o=Math.max(u.startSN,l.startSN)-l.startSN,m=(u.fragmentHint?1:0)+(d?l.endSN:Math.min(u.endSN,l.endSN))-l.startSN,h=l.startSN-u.startSN,a=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,r=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,e=o;e<=m;e++){var i=r[h+e],g=a[e];d&&!g&&e<d&&(g=l.fragments[e]=i),i&&g&&v(i,g)}}function C(u,l){var v=l.startSN+l.skippedSegments-u.startSN,d=u.fragments;if(v<0||v>=d.length)return;x(l,d[v].start)}function x(u,l){if(l){for(var v=u.fragments,d=u.skippedSegments;d<v.length;d++)v[d].start+=l;u.fragmentHint&&(u.fragmentHint.start+=l)}}function _(u,l){var v=1e3*u.levelTargetDuration,d=v/2,o=u.age,m=o>0&&o<v*3,h=l.loading.end-l.loading.start,a,r=u.availabilityDelay;if(u.updated===!1)if(m){var e=333*u.misses;a=Math.max(Math.min(d,h*2),e),u.availabilityDelay=(u.availabilityDelay||0)+a}else a=d;else m?(r=Math.min(r||v/2,o),u.availabilityDelay=r,a=r+v-o):a=v-h;return Math.round(a)}function p(u,l,v){if(!u||!u.details)return null;var d=u.details,o=d.fragments[l-d.startSN];return o||(o=d.fragmentHint,o&&o.sn===l?o:l<d.startSN&&v&&v.sn===l?v:null)}function n(u,l,v){if(!u||!u.details)return null;var d=u.details.partList;if(d)for(var o=d.length;o--;){var m=d[o];if(m.index===v&&m.fragment.sn===l)return m}return null}},"./src/controller/stream-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return d});var N=O("./src/polyfills/number.ts"),E=O("./src/controller/base-stream-controller.ts"),R=O("./src/is-supported.ts"),I=O("./src/events.ts"),L=O("./src/utils/buffer-helper.ts"),T=O("./src/controller/fragment-tracker.ts"),P=O("./src/types/loader.ts"),b=O("./src/loader/fragment.ts"),S=O("./src/demux/transmuxer-interface.ts"),w=O("./src/types/transmuxer.ts"),C=O("./src/controller/gap-controller.ts"),x=O("./src/errors.ts"),_=O("./src/utils/logger.ts");function p(o,m){for(var h=0;h<m.length;h++){var a=m[h];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(o,a.key,a)}}function n(o,m,h){return m&&p(o.prototype,m),h&&p(o,h),o}function u(o,m){o.prototype=Object.create(m.prototype),o.prototype.constructor=o,l(o,m)}function l(o,m){return l=Object.setPrototypeOf||function(a,r){return a.__proto__=r,a},l(o,m)}var v=100,d=function(o){u(m,o);function m(a,r){var e;return e=o.call(this,a,r,"[stream-controller]")||this,e.audioCodecSwap=!1,e.gapController=null,e.level=-1,e._forceStartLoad=!1,e.altAudio=!1,e.audioOnly=!1,e.fragPlaying=null,e.onvplaying=null,e.onvseeked=null,e.fragLastKbps=0,e.stalled=!1,e.couldBacktrack=!1,e.audioCodecSwitch=!1,e.videoBuffer=null,e._registerListeners(),e}var h=m.prototype;return h._registerListeners=function(){var r=this.hls;r.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.on(I.Events.ERROR,this.onError,this),r.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),r.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.on(I.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var r=this.hls;r.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.off(I.Events.ERROR,this.onError,this),r.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),r.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.off(I.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},h.startLoad=function(r){if(this.levels){var e=this.lastCurrentTime,i=this.hls;if(this.stopLoad(),this.setInterval(v),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=i.startLevel;g===-1&&(i.config.testBandwidth?(g=0,this.bitrateTest=!0):g=i.nextAutoLevel),this.level=i.nextLoadLevel=g,this.loadedmetadata=!1}e>0&&r===-1&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),r=e),this.state=E.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()}else this._forceStartLoad=!0,this.state=E.State.STOPPED},h.stopLoad=function(){this._forceStartLoad=!1,o.prototype.stopLoad.call(this)},h.doTick=function(){switch(this.state){case E.State.IDLE:this.doTickIdle();break;case E.State.WAITING_LEVEL:{var r,e=this.levels,i=this.level,g=e==null||((r=e[i])===null||r===void 0)?void 0:r.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=E.State.IDLE;break}break}case E.State.FRAG_LOADING_WAITING_RETRY:{var f,y=self.performance.now(),t=this.retryDate;(!t||y>=t||(f=this.media)!==null&&f!==void 0&&f.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=E.State.IDLE)}break;default:break}this.onTickEnd()},h.onTickEnd=function(){o.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},h.doTickIdle=function(){var r,e,i=this.hls,g=this.levelLastLoaded,f=this.levels,y=this.media,t=i.config,A=i.nextLoadLevel;if(g===null||!y&&(this.startFragRequested||!t.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!f||!f[A])return;var U=f[A];this.level=i.nextLoadLevel=A;var B=U.details;if(!B||this.state===E.State.WAITING_LEVEL||B.live&&this.levelLastLoaded!==A){this.state=E.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,P.PlaylistLevelType.MAIN);if(G===null)return;var J=G.len,F=this.getMaxBufferLength(U.maxBitrate);if(J>=F)return;if(this._streamEnded(G,B)){var q={};this.altAudio&&(q.type="video"),this.hls.trigger(I.Events.BUFFER_EOS,q),this.state=E.State.ENDED;return}var re=G.end,ae=this.getNextFragment(re,B);if(this.couldBacktrack&&!this.fragPrevious&&ae&&ae.sn!=="initSegment"){var ve=ae.sn-B.startSN;ve>1&&(ae=B.fragments[ve-1],this.fragmentTracker.removeFragment(ae))}if(ae&&this.fragmentTracker.getState(ae)===T.FragmentState.OK&&this.nextLoadPosition>re){var de=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,de,P.PlaylistLevelType.MAIN),ae=this.getNextFragment(this.nextLoadPosition,B)}if(!ae)return;ae.initSegment&&!ae.initSegment.data&&!this.bitrateTest&&(ae=ae.initSegment),((r=ae.decryptdata)===null||r===void 0?void 0:r.keyFormat)==="identity"&&!((e=ae.decryptdata)!==null&&e!==void 0&&e.key)?this.loadKey(ae,B):this.loadFragment(ae,B,re)},h.loadFragment=function(r,e,i){var g,f=this.fragmentTracker.getState(r);if(this.fragCurrent=r,f===T.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(r);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else f=T.FragmentState.NOT_LOADED}f===T.FragmentState.NOT_LOADED||f===T.FragmentState.PARTIAL?r.sn==="initSegment"?this._loadInitSegment(r):this.bitrateTest?(r.bitrateTest=!0,this.log("Fragment "+r.sn+" of level "+r.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(r)):(this.startFragRequested=!0,o.prototype.loadFragment.call(this,r,e,i)):f===T.FragmentState.APPENDING?this.reduceMaxBufferLength(r.duration)&&this.fragmentTracker.removeFragment(r):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},h.getAppendedFrag=function(r){var e=this.fragmentTracker.getAppendedFrag(r,P.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},h.getBufferedFrag=function(r){return this.fragmentTracker.getBufferedFrag(r,P.PlaylistLevelType.MAIN)},h.followingBufferedFrag=function(r){return r?this.getBufferedFrag(r.end+.5):null},h.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},h.nextLevelSwitch=function(){var r=this.levels,e=this.media;if(e!=null&&e.readyState){var i,g=this.getAppendedFrag(e.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!e.paused&&r){var f=this.hls.nextLoadLevel,y=r[f],t=this.fragLastKbps;t&&this.fragCurrent?i=this.fragCurrent.duration*y.maxBitrate/(1e3*t)+1:i=0}else i=0;var A=this.getBufferedFrag(e.currentTime+i);if(A){var U=this.followingBufferedFrag(A);if(U){this.abortCurrentFrag();var B=U.maxStartPTS?U.maxStartPTS:U.start,G=U.duration,J=Math.max(A.end,B+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(J,Number.POSITIVE_INFINITY)}}}},h.abortCurrentFrag=function(){var r=this.fragCurrent;this.fragCurrent=null,r!=null&&r.loader&&r.loader.abort(),this.state===E.State.KEY_LOADING&&(this.state=E.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},h.flushMainBuffer=function(r,e){o.prototype.flushMainBuffer.call(this,r,e,this.altAudio?"video":null)},h.onMediaAttached=function(r,e){o.prototype.onMediaAttached.call(this,r,e);var i=e.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 C.default(this.config,i,this.fragmentTracker,this.hls)},h.onMediaDetaching=function(){var r=this.media;r&&(r.removeEventListener("playing",this.onvplaying),r.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),o.prototype.onMediaDetaching.call(this)},h.onMediaPlaying=function(){this.tick()},h.onMediaSeeked=function(){var r=this.media,e=r?r.currentTime:null;Object(N.isFiniteNumber)(e)&&this.log("Media seeked to "+e.toFixed(3)),this.tick()},h.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},h.onManifestParsed=function(r,e){var i=!1,g=!1,f;e.levels.forEach(function(y){f=y.audioCodec,f&&(f.indexOf("mp4a.40.2")!==-1&&(i=!0),f.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=i&&g&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1},h.onLevelLoading=function(r,e){var i=this.levels;if(!i||this.state!==E.State.IDLE)return;var g=i[e.level];(!g.details||g.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(g.details))&&(this.state=E.State.WAITING_LEVEL)},h.onLevelLoaded=function(r,e){var i,g=this.levels,f=e.level,y=e.details,t=y.totalduration;if(!g){this.warn("Levels were reset while loading level "+f);return}this.log("Level "+f+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+t);var A=this.fragCurrent;A&&(this.state===E.State.FRAG_LOADING||this.state===E.State.FRAG_LOADING_WAITING_RETRY)&&(A.level!==e.level&&A.loader&&(this.state=E.State.IDLE,A.loader.abort()));var U=g[f],B=0;if(y.live||(i=U.details)!==null&&i!==void 0&&i.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;B=this.alignPlaylists(y,U.details)}if(U.details=y,this.levelLastLoaded=f,this.hls.trigger(I.Events.LEVEL_UPDATED,{details:y,level:f}),this.state===E.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=E.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,B),this.tick()},h._handleFragmentLoadProgress=function(r){var e,i=r.frag,g=r.part,f=r.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered");return}var t=y[i.level],A=t.details;if(!A){this.warn("Dropping fragment "+i.sn+" of level "+i.level+" after level details were reset");return}var U=t.videoCodec,B=A.PTSKnown||!A.live,G=(e=i.initSegment)===null||e===void 0?void 0:e.data,J=this._getAudioCodec(t),F=this.transmuxer=this.transmuxer||new S.default(this.hls,P.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=g?g.index:-1,re=q!==-1,ae=new w.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,f.byteLength,q,re),ve=this.initPTS[i.cc];F.push(f,G,J,U,i,g,A.totalduration,B,ae,ve)},h.onAudioTrackSwitching=function(r,e){var i=this.altAudio,g=!!e.url,f=e.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var t=this.hls;i&&t.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),t.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:f})}},h.onAudioTrackSwitched=function(r,e){var i=e.id,g=!!this.hls.audioTracks[i].url;if(g){var f=this.videoBuffer;f&&this.mediaBuffer!==f&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=f)}this.altAudio=g,this.tick()},h.onBufferCreated=function(r,e){var i=e.tracks,g,f,y=!1;for(var t in i){var A=i[t];if(A.id==="main"){if(f=t,g=A,t==="video"){var U=i[t];U&&(this.videoBuffer=U.buffer)}}else y=!0}y&&g?(this.log("Alternate track found, use "+f+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},h.onFragBuffered=function(r,e){var i=e.frag,g=e.part;if(i&&i.type!==P.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(i)){this.warn("Fragment "+i.sn+(g?" p: "+g.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state),this.state===E.State.PARSED&&(this.state=E.State.IDLE);return}var f=g?g.stats:i.stats;this.fragLastKbps=Math.round(8*f.total/(f.buffering.end-f.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,g)},h.onError=function(r,e){switch(e.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.PlaylistLevelType.MAIN,e);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==E.State.ERROR&&(e.fatal?(this.warn(""+e.details),this.state=E.State.ERROR):!e.levelRetry&&this.state===E.State.WAITING_LEVEL&&(this.state=E.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(e.parent==="main"&&(this.state===E.State.PARSING||this.state===E.State.PARSED)){var i=!0,g=this.getFwdBufferInfo(this.media,P.PlaylistLevelType.MAIN);g&&g.len>.5&&(i=!this.reduceMaxBufferLength(g.len)),i&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},h.checkBuffer=function(){var r=this.media,e=this.gapController;if(!r||!e||!r.readyState)return;var i=L.BufferHelper.getBuffered(r);!this.loadedmetadata&&i.length?(this.loadedmetadata=!0,this.seekToStartPos()):e.poll(this.lastCurrentTime),this.lastCurrentTime=r.currentTime},h.onFragLoadEmergencyAborted=function(){this.state=E.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},h.onBufferFlushed=function(r,e){var i=e.type;if(i!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(i===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,i,P.PlaylistLevelType.MAIN)}},h.onLevelsUpdated=function(r,e){this.levels=e.levels},h.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},h.seekToStartPos=function(){var r=this.media,e=r.currentTime,i=this.startPosition;if(i>=0&&e<i){if(r.seeking){_.logger.log("could not seek to "+i+", already seeking at "+e);return}var g=L.BufferHelper.getBuffered(r),f=g.length?g.start(0):0,y=f-i;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(_.logger.log("adjusting start position by "+y+" to match buffer start"),i+=y,this.startPosition=i),this.log("seek to target start position "+i+" from current time "+e),r.currentTime=i}},h._getAudioCodec=function(r){var e=this.config.defaultAudioCodec||r.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e.indexOf("mp4a.40.5")!==-1?e="mp4a.40.2":e="mp4a.40.5"),e},h._loadBitrateTestFrag=function(r){var e=this;this._doFragLoad(r).then(function(i){var g=e.hls;if(!i||g.nextLoadLevel||e.fragContextChanged(r))return;e.fragLoadError=0,e.state=E.State.IDLE,e.startFragRequested=!1,e.bitrateTest=!1;var f=r.stats;f.parsing.start=f.parsing.end=f.buffering.start=f.buffering.end=self.performance.now(),g.trigger(I.Events.FRAG_LOADED,i)})},h._handleTransmuxComplete=function(r){var e,i="main",g=this.hls,f=r.remuxResult,y=r.chunkMeta,t=this.getCurrentContext(y);if(!t){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var A=t.frag,U=t.part,B=t.level,G=f.video,J=f.text,F=f.id3,q=f.initSegment,re=this.altAudio?void 0:f.audio;if(this.fragContextChanged(A))return;if(this.state=E.State.PARSING,q){q.tracks&&(this._bufferInitSegment(B,q.tracks,A,y),g.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:A,id:i,tracks:q.tracks}));var ae=q.initPTS,ve=q.timescale;Object(N.isFiniteNumber)(ae)&&(this.initPTS[A.cc]=ae,g.trigger(I.Events.INIT_PTS_FOUND,{frag:A,id:i,initPTS:ae,timescale:ve}))}if(G&&f.independent!==!1){if(B.details){var de=G.startPTS,Z=G.endPTS,ee=G.startDTS,pe=G.endDTS;if(U)U.elementaryStreams[G.type]={startPTS:de,endPTS:Z,startDTS:ee,endDTS:pe};else if(G.firstKeyFrame&&G.independent&&(this.couldBacktrack=!0),G.dropped&&G.independent){var Q=this.getLoadPosition()+this.config.maxBufferHole;if(Q<de){this.backtrack(A);return}A.setElementaryStreamInfo(G.type,A.start,Z,A.start,pe,!0)}A.setElementaryStreamInfo(G.type,de,Z,ee,pe),this.bufferFragmentData(G,A,U,y)}}else if(f.independent===!1){this.backtrack(A);return}if(re){var V=re.startPTS,Ce=re.endPTS,De=re.startDTS,Ne=re.endDTS;U&&(U.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:V,endPTS:Ce,startDTS:De,endDTS:Ne}),A.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,V,Ce,De,Ne),this.bufferFragmentData(re,A,U,y)}if(F!=null&&(e=F.samples)!==null&&e!==void 0&&e.length){var we={frag:A,id:i,samples:F.samples};g.trigger(I.Events.FRAG_PARSING_METADATA,we)}if(J){var ke={frag:A,id:i,samples:J.samples};g.trigger(I.Events.FRAG_PARSING_USERDATA,ke)}},h._bufferInitSegment=function(r,e,i,g){var f=this;if(this.state!==E.State.PARSING)return;this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;var y=e.audio,t=e.video,A=e.audiovideo;if(y){var U=r.audioCodec,B=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(U&&(U.indexOf("mp4a.40.5")!==-1?U="mp4a.40.2":U="mp4a.40.5"),y.metadata.channelCount!==1&&B.indexOf("firefox")===-1&&(U="mp4a.40.5")),B.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(U="mp4a.40.2",this.log("Android: force audio codec to "+U)),r.audioCodec&&r.audioCodec!==U&&this.log('Swapping manifest audio codec "'+r.audioCodec+'" for "'+U+'"'),y.levelCodec=U,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(U||"")+"/"+(r.audioCodec||"")+"/"+y.codec+"]")}t&&(t.levelCodec=r.videoCodec,t.id="main",this.log("Init video buffer, container:"+t.container+", codecs[level/parsed]=["+(r.videoCodec||"")+"/"+t.codec+"]")),A&&this.log("Init audiovideo buffer, container:"+A.container+", codecs[level/parsed]=["+(r.attrs.CODECS||"")+"/"+A.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,e),Object.keys(e).forEach(function(G){var J=e[G],F=J.initSegment;F!=null&&F.byteLength&&f.hls.trigger(I.Events.BUFFER_APPENDING,{type:G,data:F,frag:i,part:null,chunkMeta:g,parent:i.type})}),this.tick()},h.backtrack=function(r){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(r);var e=this.fragmentTracker.backtrack(r);this.fragPrevious=null,this.nextLoadPosition=r.start,e?this.resetFragmentLoading(r):this.state=E.State.BACKTRACKING},h.checkFragmentChanged=function(){var r=this.media,e=null;if(r&&r.readyState>1&&r.seeking===!1){var i=r.currentTime;if(L.BufferHelper.isBuffered(r,i)?e=this.getAppendedFrag(i):L.BufferHelper.isBuffered(r,i+.1)&&(e=this.getAppendedFrag(i+.1)),e){var g=this.fragPlaying,f=e.level;(!g||e.sn!==g.sn||g.level!==f||e.urlId!==g.urlId)&&(this.hls.trigger(I.Events.FRAG_CHANGED,{frag:e}),(!g||g.level!==f)&&this.hls.trigger(I.Events.LEVEL_SWITCHED,{level:f}),this.fragPlaying=e)}}},n(m,[{key:"nextLevel",get:function(){var r=this.nextBufferedFrag;return r?r.level:-1}},{key:"currentLevel",get:function(){var r=this.media;if(r){var e=this.getAppendedFrag(r.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var r=this.media;if(r){var e=this.getAppendedFrag(r.currentTime);return this.followingBufferedFrag(e)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),m}(E.default)},"./src/controller/subtitle-stream-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"SubtitleStreamController",function(){return u});var N=O("./src/events.ts"),E=O("./src/utils/logger.ts"),R=O("./src/utils/buffer-helper.ts"),I=O("./src/controller/fragment-finders.ts"),L=O("./src/utils/discontinuities.ts"),T=O("./src/controller/level-helper.ts"),P=O("./src/controller/fragment-tracker.ts"),b=O("./src/controller/base-stream-controller.ts"),S=O("./src/types/loader.ts"),w=O("./src/types/level.ts");function C(l,v){for(var d=0;d<v.length;d++){var o=v[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(l,o.key,o)}}function x(l,v,d){return v&&C(l.prototype,v),d&&C(l,d),l}function _(l,v){l.prototype=Object.create(v.prototype),l.prototype.constructor=l,p(l,v)}function p(l,v){return p=Object.setPrototypeOf||function(o,m){return o.__proto__=m,o},p(l,v)}var n=500,u=function(l){_(v,l);function v(o,m){var h;return h=l.call(this,o,m,"[subtitle-stream-controller]")||this,h.levels=[],h.currentTrackId=-1,h.tracksBuffered=[],h.mainDetails=null,h._registerListeners(),h}var d=v.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var m=this.hls;m.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(N.Events.ERROR,this.onError,this),m.on(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.on(N.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.on(N.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.on(N.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d._unregisterListeners=function(){var m=this.hls;m.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(N.Events.ERROR,this.onError,this),m.off(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.off(N.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.off(N.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.off(N.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(n),this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},d.onLevelLoaded=function(m,h){this.mainDetails=h.details},d.onSubtitleFragProcessed=function(m,h){var a=h.frag,r=h.success;if(this.fragPrevious=a,this.state=b.State.IDLE,!r)return;var e=this.tracksBuffered[this.currentTrackId];if(!e)return;for(var i,g=a.start,f=0;f<e.length;f++)if(g>=e[f].start&&g<=e[f].end){i=e[f];break}var y=a.start+a.duration;i?i.end=y:(i={start:g,end:y},e.push(i)),this.fragmentTracker.fragBuffered(a)},d.onBufferFlushing=function(m,h){var a=h.startOffset,r=h.endOffset;if(a===0&&r!==Number.POSITIVE_INFINITY){var e=this.currentTrackId,i=this.levels;if(!i.length||!i[e]||!i[e].details)return;var g=i[e].details,f=g.targetduration,y=r-f;if(y<=0)return;h.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(t){for(var A=0;A<t.length;){if(t[A].end<=y){t.shift();continue}else if(t[A].start<y)t[A].start=y;else break;A++}}),this.fragmentTracker.removeFragmentsInRange(a,y,S.PlaylistLevelType.SUBTITLE)}},d.onError=function(m,h){var a,r=h.frag;if(!r||r.type!==S.PlaylistLevelType.SUBTITLE)return;(a=this.fragCurrent)!==null&&a!==void 0&&a.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},d.onSubtitleTracksUpdated=function(m,h){var a=this,r=h.subtitleTracks;this.tracksBuffered=[],this.levels=r.map(function(e){return new w.Level(e)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(e){a.tracksBuffered[e.id]=[]}),this.mediaBuffer=null},d.onSubtitleTrackSwitch=function(m,h){if(this.currentTrackId=h.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var a=this.levels[this.currentTrackId];a!=null&&a.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,a&&this.setInterval(n)},d.onSubtitleTrackLoaded=function(m,h){var a,r=h.details,e=h.id,i=this.currentTrackId,g=this.levels;if(!g.length)return;var f=g[i];if(e>=g.length||e!==i||!f)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,r.live||(a=f.details)!==null&&a!==void 0&&a.live){var y=this.mainDetails;if(r.deltaUpdateFailed||!y)return;var t=y.fragments[0];if(!f.details)r.hasProgramDateTime&&y.hasProgramDateTime?Object(L.alignMediaPlaylistByPDT)(r,y):t&&Object(T.addSliding)(r,t.start);else{var A=this.alignPlaylists(r,f.details);A===0&&t&&Object(T.addSliding)(r,t.start)}}if(f.details=r,this.levelLastLoaded=e,this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var U=Object(I.findFragmentByPTS)(null,r.fragments,this.media.currentTime,0);U||(this.warn("Subtitle playlist not aligned with playback"),f.details=void 0)}},d._handleFragmentLoadComplete=function(m){var h=m.frag,a=m.payload,r=h.decryptdata,e=this.hls;if(this.fragContextChanged(h))return;if(a&&a.byteLength>0&&r&&r.key&&r.iv&&r.method==="AES-128"){var i=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(a),r.key.buffer,r.iv.buffer).then(function(g){var f=performance.now();e.trigger(N.Events.FRAG_DECRYPTED,{frag:h,payload:g,stats:{tstart:i,tdecrypt:f}})})}},d.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var m,h=this.currentTrackId,a=this.levels;if(!a.length||!a[h]||!a[h].details)return;var r=a[h].details,e=r.targetduration,i=this.config,g=this.media,f=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-e,i.maxBufferHole),y=f.end,t=f.len,A=this.getMaxBufferLength()+e;if(t>A)return;console.assert(r,"Subtitle track details are defined on idle subtitle stream controller tick");var U=r.fragments,B=U.length,G=r.edge,J,F=this.fragPrevious;if(y<G){var q=i.maxFragLookUpTolerance;F&&r.hasProgramDateTime&&(J=Object(I.findFragmentByPDT)(U,F.endProgramDateTime,q)),J||(J=Object(I.findFragmentByPTS)(F,U,y,q),!J&&F&&F.start<U[0].start&&(J=U[0]))}else J=U[B-1];(m=J)!==null&&m!==void 0&&m.encrypted?(E.logger.log("Loading key for "+J.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(N.Events.KEY_LOADING,{frag:J})):J&&this.fragmentTracker.getState(J)===P.FragmentState.NOT_LOADED&&this.loadFragment(J,r,y)}},d.loadFragment=function(m,h,a){this.fragCurrent=m,l.prototype.loadFragment.call(this,m,h,a)},x(v,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),v}(b.default)},"./src/controller/subtitle-track-controller.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/events.ts"),E=O("./src/utils/texttrack-utils.ts"),R=O("./src/controller/base-playlist-controller.ts"),I=O("./src/types/loader.ts");function L(C,x){for(var _=0;_<x.length;_++){var p=x[_];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(C,p.key,p)}}function T(C,x,_){return x&&L(C.prototype,x),_&&L(C,_),C}function P(C,x){C.prototype=Object.create(x.prototype),C.prototype.constructor=C,b(C,x)}function b(C,x){return b=Object.setPrototypeOf||function(p,n){return p.__proto__=n,p},b(C,x)}var S=function(C){P(x,C);function x(p){var n;return n=C.call(this,p,"[subtitle-track-controller]")||this,n.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}var _=x.prototype;return _.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},_.registerListeners=function(){var n=this.hls;n.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(N.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(N.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(N.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var n=this.hls;n.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(N.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(N.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(N.Events.ERROR,this.onError,this)},_.onMediaAttached=function(n,u){if(this.media=u.media,!this.media)return;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)},_.pollTrackChange=function(n){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,n)},_.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var n=w(this.media.textTracks);n.forEach(function(u){Object(E.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},_.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},_.onManifestParsed=function(n,u){this.tracks=u.subtitleTracks},_.onSubtitleTrackLoaded=function(n,u){var l=u.id,v=u.details,d=this.trackId,o=this.tracksInGroup[d];if(!o){this.warn("Invalid subtitle track id "+l);return}var m=o.details;o.details=u.details,this.log("subtitle track "+l+" loaded ["+v.startSN+"-"+v.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,u,m))},_.onLevelLoading=function(n,u){this.switchLevel(u.level)},_.onLevelSwitching=function(n,u){this.switchLevel(u.level)},_.switchLevel=function(n){var u=this.hls.levels[n];if(!(u!=null&&u.textGroupIds))return;var l=u.textGroupIds[u.urlId];if(this.groupId!==l){var v=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,d=this.tracks.filter(function(h){return!l||h.groupId===l});this.tracksInGroup=d;var o=this.findTrackId(v==null?void 0:v.name)||this.findTrackId();this.groupId=l;var m={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(N.Events.SUBTITLE_TRACKS_UPDATED,m),o!==-1&&this.setSubtitleTrack(o,v)}},_.findTrackId=function(n){for(var u=this.tracksInGroup,l=0;l<u.length;l++){var v=u[l];if((!this.selectDefaultTrack||v.default)&&(!n||n===v.name))return v.id}return-1},_.onError=function(n,u){if(C.prototype.onError.call(this,n,u),u.fatal||!u.context)return;u.context.type===I.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},_.loadPlaylist=function(n){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var l=u.id,v=u.groupId,d=u.url;if(n)try{d=n.addDirectives(d)}catch(o){this.warn("Could not construct new URL with HLS Delivery Directives: "+o)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADING,{url:d,id:l,groupId:v,deliveryDirectives:n||null})}},_.toggleTrackModes=function(n){var u=this,l=this.media,v=this.subtitleDisplay,d=this.trackId;if(!l)return;var o=w(l.textTracks),m=o.filter(function(r){return r.groupId===u.groupId});if(n===-1)[].slice.call(o).forEach(function(r){r.mode="disabled"});else{var h=m[d];h&&(h.mode="disabled")}var a=m[n];a&&(a.mode=v?"showing":"hidden")},_.setSubtitleTrack=function(n,u){var l,v=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=n;return}if(this.trackId!==n&&this.toggleTrackModes(n),this.trackId===n&&(n===-1||(l=v[n])!==null&&l!==void 0&&l.details)||n<-1||n>=v.length)return;this.clearTimer();var d=v[n];if(this.log("Switching to subtitle track "+n),this.trackId=n,d){var o=d.id,m=d.groupId,h=m===void 0?"":m,a=d.name,r=d.type,e=d.url;this.hls.trigger(N.Events.SUBTITLE_TRACK_SWITCH,{id:o,groupId:h,name:a,type:r,url:e});var i=this.switchParams(d.url,u==null?void 0:u.details);this.loadPlaylist(i)}else this.hls.trigger(N.Events.SUBTITLE_TRACK_SWITCH,{id:n})},_.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var n=-1,u=w(this.media.textTracks),l=0;l<u.length;l++)if(u[l].mode==="hidden")n=l;else if(u[l].mode==="showing"){n=l;break}this.subtitleTrack!==n&&(this.subtitleTrack=n)},T(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(n,u)}}]),x}(R.default);function w(C){for(var x=[],_=0;_<C.length;_++){var p=C[_];p.kind==="subtitles"&&p.label&&x.push(C[_])}return x}j.default=S},"./src/controller/timeline-controller.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"TimelineController",function(){return w});var N=O("./src/polyfills/number.ts"),E=O("./src/events.ts"),R=O("./src/utils/cea-608-parser.ts"),I=O("./src/utils/output-filter.ts"),L=O("./src/utils/webvtt-parser.ts"),T=O("./src/utils/texttrack-utils.ts"),P=O("./src/utils/imsc1-ttml-parser.ts"),b=O("./src/types/loader.ts"),S=O("./src/utils/logger.ts"),w=function(){function p(u){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=_(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.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 l=new I.default(this,"textTrack1"),v=new I.default(this,"textTrack2"),d=new I.default(this,"textTrack3"),o=new I.default(this,"textTrack4");this.cea608Parser1=new R.default(1,l,v),this.cea608Parser2=new R.default(3,d,o)}u.on(E.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(E.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(E.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(E.Events.FRAG_LOADING,this.onFragLoading,this),u.on(E.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(E.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(E.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(E.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(E.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var n=p.prototype;return n.destroy=function(){var l=this.hls;l.off(E.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(E.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(E.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(E.Events.FRAG_LOADING,this.onFragLoading,this),l.off(E.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(E.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(E.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(E.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(E.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},n.addCues=function(l,v,d,o,m){for(var h=!1,a=m.length;a--;){var r=m[a],e=x(r[0],r[1],v,d);if(e>=0&&(r[0]=Math.min(r[0],v),r[1]=Math.max(r[1],d),h=!0,e/(d-v)>.5))return}if(h||m.push([v,d]),this.config.renderTextTracksNatively){var i=this.captionsTracks[l];this.Cues.newCue(i,v,d,o)}else{var g=this.Cues.newCue(null,v,d,o);this.hls.trigger(E.Events.CUES_PARSED,{type:"captions",cues:g,track:l})}},n.onInitPtsFound=function(l,v){var d=this,o=v.frag,m=v.id,h=v.initPTS,a=v.timescale,r=this.unparsedVttFrags;m==="main"&&(this.initPTS[o.cc]=h,this.timescale[o.cc]=a),r.length&&(this.unparsedVttFrags=[],r.forEach(function(e){d.onFragLoaded(E.Events.FRAG_LOADED,e)}))},n.getExistingTrack=function(l){var v=this.media;if(v)for(var d=0;d<v.textTracks.length;d++){var o=v.textTracks[d];if(o[l])return o}return null},n.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},n.createNativeTrack=function(l){if(this.captionsTracks[l])return;var v=this.captionsProperties,d=this.captionsTracks,o=this.media,m=v[l],h=m.label,a=m.languageCode,r=this.getExistingTrack(l);if(r)d[l]=r,Object(T.clearCurrentCues)(d[l]),Object(T.sendAddTrackEvent)(d[l],o);else{var e=this.createTextTrack("captions",h,a);e&&(e[l]=!0,d[l]=e)}},n.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var v=this.captionsProperties[l];if(!v)return;var d=v.label,o={_id:l,label:d,kind:"captions",default:v.media?!!v.media.default:!1,closedCaptions:v.media};this.nonNativeCaptionsTracks[l]=o,this.hls.trigger(E.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[o]})},n.createTextTrack=function(l,v,d){var o=this.media;return o?o.addTextTrack(l,v,d):void 0},n.onMediaAttaching=function(l,v){this.media=v.media,this._cleanTracks()},n.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(v){Object(T.clearCurrentCues)(l[v]),delete l[v]}),this.nonNativeCaptionsTracks={}},n.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=_(),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())},n._cleanTracks=function(){var l=this.media;if(!l)return;var v=l.textTracks;if(v)for(var d=0;d<v.length;d++)Object(T.clearCurrentCues)(v[d])},n.onSubtitleTracksUpdated=function(l,v){var d=this;this.textTracks=[];var o=v.subtitleTracks||[],m=o.some(function(e){return e.textCodec===P.IMSC1_CODEC});if(this.config.enableWebVTT||m&&this.config.enableIMSC1){var h=this.tracks&&o&&this.tracks.length===o.length;if(this.tracks=o||[],this.config.renderTextTracksNatively){var a=this.media?this.media.textTracks:[];this.tracks.forEach(function(e,i){var g;if(i<a.length){for(var f=null,y=0;y<a.length;y++)if(C(a[y],e)){f=a[y];break}f&&(g=f)}g?Object(T.clearCurrentCues)(g):(g=d.createTextTrack("subtitles",e.name,e.lang),g&&(g.mode="disabled")),g&&(g.groupId=e.groupId,d.textTracks.push(g))})}else if(!h&&this.tracks&&this.tracks.length){var r=this.tracks.map(function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}});this.hls.trigger(E.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}},n.onManifestLoaded=function(l,v){var d=this;this.config.enableCEA708Captions&&v.captions&&v.captions.forEach(function(o){var m=/(?:CC|SERVICE)([1-4])/.exec(o.instreamId);if(!m)return;var h="textTrack"+m[1],a=d.captionsProperties[h];if(!a)return;a.label=o.name,o.lang&&(a.languageCode=o.lang),a.media=o})},n.onFragLoading=function(l,v){var d=this.cea608Parser1,o=this.cea608Parser2,m=this.lastSn,h=this.lastPartIndex;if(!this.enabled||!(d&&o))return;if(v.frag.type===b.PlaylistLevelType.MAIN){var a,r,e=v.frag.sn,i=(a=v==null||((r=v.part)===null||r===void 0)?void 0:r.index)!=null?a:-1;e===m+1||e===m&&i===h+1||(d.reset(),o.reset()),this.lastSn=e,this.lastPartIndex=i}},n.onFragLoaded=function(l,v){var d=v.frag,o=v.payload,m=this.initPTS,h=this.unparsedVttFrags;if(d.type===b.PlaylistLevelType.SUBTITLE)if(o.byteLength){if(!Object(N.isFiniteNumber)(m[d.cc])){h.push(v),m.length&&this.hls.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Missing initial subtitle PTS")});return}var a=d.decryptdata;if(a==null||a.key==null||a.method!=="AES-128"){var r=this.tracks[d.level],e=this.vttCCs;e[d.cc]||(e[d.cc]={start:d.start,prevCC:this.prevCC,new:!0},this.prevCC=d.cc),r&&r.textCodec===P.IMSC1_CODEC?this._parseIMSC1(d,o):this._parseVTTs(d,o,e)}}else this.hls.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Empty subtitle payload")})},n._parseIMSC1=function(l,v){var d=this,o=this.hls;Object(P.parseIMSC1)(v,this.initPTS[l.cc],this.timescale[l.cc],function(m){d._appendCues(m,l.level),o.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(m){S.logger.log("Failed to parse IMSC1: "+m),o.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:m})})},n._parseVTTs=function(l,v,d){var o=this,m=this.hls;Object(L.parseWebVTT)(v,this.initPTS[l.cc],this.timescale[l.cc],d,l.cc,l.start,function(h){o._appendCues(h,l.level),m.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(h){o._fallbackToIMSC1(l,v),S.logger.log("Failed to parse VTT cue: "+h),m.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:h})})},n._fallbackToIMSC1=function(l,v){var d=this,o=this.tracks[l.level];o.textCodec||Object(P.parseIMSC1)(v,this.initPTS[l.cc],this.timescale[l.cc],function(){o.textCodec=P.IMSC1_CODEC,d._parseIMSC1(l,v)},function(){o.textCodec="wvtt"})},n._appendCues=function(l,v){var d=this.hls;if(this.config.renderTextTracksNatively){var o=this.textTracks[v];if(o.mode==="disabled")return;l.forEach(function(a){return Object(T.addCueToTrack)(o,a)})}else{var m=this.tracks[v],h=m.default?"default":"subtitles"+v;d.trigger(E.Events.CUES_PARSED,{type:"subtitles",cues:l,track:h})}},n.onFragDecrypted=function(l,v){var d=v.frag;if(d.type===b.PlaylistLevelType.SUBTITLE){if(!Object(N.isFiniteNumber)(this.initPTS[d.cc])){this.unparsedVttFrags.push(v);return}this.onFragLoaded(E.Events.FRAG_LOADED,v)}},n.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},n.onFragParsingUserdata=function(l,v){var d=this.cea608Parser1,o=this.cea608Parser2;if(!this.enabled||!(d&&o))return;for(var m=0;m<v.samples.length;m++){var h=v.samples[m].bytes;if(h){var a=this.extractCea608Data(h);d.addData(v.samples[m].pts,a[0]),o.addData(v.samples[m].pts,a[1])}}},n.onBufferFlushing=function(l,v){var d=v.startOffset,o=v.endOffset,m=v.endOffsetSubtitles,h=v.type,a=this.media;if(!a||a.currentTime<o)return;if(!h||h==="video"){var r=this.captionsTracks;Object.keys(r).forEach(function(i){return Object(T.removeCuesInRange)(r[i],d,o)})}if(this.config.renderTextTracksNatively&&(d===0&&m!==void 0)){var e=this.textTracks;Object.keys(e).forEach(function(i){return Object(T.removeCuesInRange)(e[i],d,m)})}},n.extractCea608Data=function(l){for(var v=l[0]&31,d=2,o=[[],[]],m=0;m<v;m++){var h=l[d++],a=127&l[d++],r=127&l[d++],e=(4&h)!==0,i=3&h;if(a===0&&r===0)continue;e&&((i===0||i===1)&&(o[i].push(a),o[i].push(r)))}return o},p}();function C(p,n){return p&&p.label===n.name&&!(p.textTrack1||p.textTrack2)}function x(p,n,u,l){return Math.min(n,l)-Math.max(p,u)}function _(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return N});var N=function(){function E(I,L){this.subtle=void 0,this.aesIV=void 0,this.subtle=I,this.aesIV=L}var R=E.prototype;return R.decrypt=function(L,T){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},T,L)},E}()},"./src/crypt/aes-decryptor.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"removePadding",function(){return E}),O.d(j,"default",function(){return R});var N=O("./src/utils/typed-array.ts");function E(I){var L=I.byteLength,T=L&&new DataView(I.buffer).getUint8(L-1);return T?Object(N.sliceUint8)(I,0,L-T):I}var R=function(){function I(){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 L=I.prototype;return L.uint8ArrayToUint32Array_=function(P){for(var b=new DataView(P),S=new Uint32Array(4),w=0;w<4;w++)S[w]=b.getUint32(w*4);return S},L.initTable=function(){var P=this.sBox,b=this.invSBox,S=this.subMix,w=S[0],C=S[1],x=S[2],_=S[3],p=this.invSubMix,n=p[0],u=p[1],l=p[2],v=p[3],d=new Uint32Array(256),o=0,m=0,h=0;for(h=0;h<256;h++)h<128?d[h]=h<<1:d[h]=h<<1^283;for(h=0;h<256;h++){var a=m^m<<1^m<<2^m<<3^m<<4;a=a>>>8^a&255^99,P[o]=a,b[a]=o;var r=d[o],e=d[r],i=d[e],g=d[a]*257^a*16843008;w[o]=g<<24|g>>>8,C[o]=g<<16|g>>>16,x[o]=g<<8|g>>>24,_[o]=g,g=i*16843009^e*65537^r*257^o*16843008,n[a]=g<<24|g>>>8,u[a]=g<<16|g>>>16,l[a]=g<<8|g>>>24,v[a]=g,o?(o=r^d[d[d[i^r]]],m^=d[d[m]]):o=m=1}},L.expandKey=function(P){for(var b=this.uint8ArrayToUint32Array_(P),S=!0,w=0;w<b.length&&S;)S=b[w]===this.key[w],w++;if(S)return;this.key=b;var C=this.keySize=b.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var x=this.ksRows=(C+6+1)*4,_,p,n=this.keySchedule=new Uint32Array(x),u=this.invKeySchedule=new Uint32Array(x),l=this.sBox,v=this.rcon,d=this.invSubMix,o=d[0],m=d[1],h=d[2],a=d[3],r,e;for(_=0;_<x;_++){if(_<C){r=n[_]=b[_];continue}e=r,_%C===0?(e=e<<8|e>>>24,e=l[e>>>24]<<24|l[e>>>16&255]<<16|l[e>>>8&255]<<8|l[e&255],e^=v[_/C|0]<<24):C>6&&_%C===4&&(e=l[e>>>24]<<24|l[e>>>16&255]<<16|l[e>>>8&255]<<8|l[e&255]),n[_]=r=(n[_-C]^e)>>>0}for(p=0;p<x;p++)_=x-p,p&3?e=n[_]:e=n[_-4],p<4||_<=4?u[p]=e:u[p]=o[l[e>>>24]]^m[l[e>>>16&255]]^h[l[e>>>8&255]]^a[l[e&255]],u[p]=u[p]>>>0},L.networkToHostOrderSwap=function(P){return P<<24|(P&65280)<<8|(P&16711680)>>8|P>>>24},L.decrypt=function(P,b,S){for(var w=this.keySize+6,C=this.invKeySchedule,x=this.invSBox,_=this.invSubMix,p=_[0],n=_[1],u=_[2],l=_[3],v=this.uint8ArrayToUint32Array_(S),d=v[0],o=v[1],m=v[2],h=v[3],a=new Int32Array(P),r=new Int32Array(a.length),e,i,g,f,y,t,A,U,B,G,J,F,q,re,ae=this.networkToHostOrderSwap;b<a.length;){for(B=ae(a[b]),G=ae(a[b+1]),J=ae(a[b+2]),F=ae(a[b+3]),y=B^C[0],t=F^C[1],A=J^C[2],U=G^C[3],q=4,re=1;re<w;re++)e=p[y>>>24]^n[t>>16&255]^u[A>>8&255]^l[U&255]^C[q],i=p[t>>>24]^n[A>>16&255]^u[U>>8&255]^l[y&255]^C[q+1],g=p[A>>>24]^n[U>>16&255]^u[y>>8&255]^l[t&255]^C[q+2],f=p[U>>>24]^n[y>>16&255]^u[t>>8&255]^l[A&255]^C[q+3],y=e,t=i,A=g,U=f,q=q+4;e=x[y>>>24]<<24^x[t>>16&255]<<16^x[A>>8&255]<<8^x[U&255]^C[q],i=x[t>>>24]<<24^x[A>>16&255]<<16^x[U>>8&255]<<8^x[y&255]^C[q+1],g=x[A>>>24]<<24^x[U>>16&255]<<16^x[y>>8&255]<<8^x[t&255]^C[q+2],f=x[U>>>24]<<24^x[y>>16&255]<<16^x[t>>8&255]<<8^x[A&255]^C[q+3],r[b]=ae(e^d),r[b+1]=ae(f^o),r[b+2]=ae(g^m),r[b+3]=ae(i^h),d=B,o=G,m=J,h=F,b=b+4}return r.buffer},I}()},"./src/crypt/decrypter.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return b});var N=O("./src/crypt/aes-crypto.ts"),E=O("./src/crypt/fast-aes-key.ts"),R=O("./src/crypt/aes-decryptor.ts"),I=O("./src/utils/logger.ts"),L=O("./src/utils/mp4-tools.ts"),T=O("./src/utils/typed-array.ts"),P=16,b=function(){function S(C,x,_){var p=_===void 0?{}:_,n=p.removePKCS7Padding,u=n===void 0?!0:n;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=x,this.removePKCS7Padding=u,u)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(v){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var w=S.prototype;return w.destroy=function(){this.observer=null},w.isSync=function(){return this.config.enableSoftwareAES},w.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var _=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(_):_},w.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},w.decrypt=function(x,_,p,n){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),_,p);var u=this.flush();u&&n(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),_,p).then(n)},w.softwareDecrypt=function(x,_,p){var n=this.currentIV,u=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(x=Object(L.appendUint8Array)(l,x),this.remainderData=null);var v=this.getValidChunk(x);if(!v.length)return null;n&&(p=n);var d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new R.default),d.expandKey(_);var o=u;return this.currentResult=d.decrypt(v.buffer,0,p),this.currentIV=Object(T.sliceUint8)(v,-16).buffer,o||null},w.webCryptoDecrypt=function(x,_,p){var n=this,u=this.subtle;return(this.key!==_||!this.fastAesKey)&&(this.key=_,this.fastAesKey=new E.default(u,_)),this.fastAesKey.expandKey().then(function(l){if(!u)return Promise.reject(new Error("web crypto not initialized"));var v=new N.default(u,p);return v.decrypt(x.buffer,l)}).catch(function(l){return n.onWebCryptoError(l,x,_,p)})},w.onWebCryptoError=function(x,_,p,n){return I.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(_,p,n)},w.getValidChunk=function(x){var _=x,p=x.length-x.length%P;return p!==x.length&&(_=Object(T.sliceUint8)(x,0,p),this.remainderData=Object(T.sliceUint8)(x,p)),_},w.logOnce=function(x){if(!this.logEnabled)return;I.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return N});var N=function(){function E(I,L){this.subtle=void 0,this.key=void 0,this.subtle=I,this.key=L}var R=E.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},E}()},"./src/demux/aacdemuxer.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/demux/base-audio-demuxer.ts"),E=O("./src/demux/adts.ts"),R=O("./src/utils/logger.ts"),I=O("./src/demux/id3.ts");function L(b,S){b.prototype=Object.create(S.prototype),b.prototype.constructor=b,T(b,S)}function T(b,S){return T=Object.setPrototypeOf||function(C,x){return C.__proto__=x,C},T(b,S)}var P=function(b){L(S,b);function S(C,x){var _;return _=b.call(this)||this,_.observer=void 0,_.config=void 0,_.observer=C,_.config=x,_}var w=S.prototype;return w.resetInitSegment=function(x,_,p){b.prototype.resetInitSegment.call(this,x,_,p),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:x,duration:p,inputTimeScale:9e4,dropped:0}},S.probe=function(x){if(!x)return!1;for(var _=I.getID3Data(x,0)||[],p=_.length,n=x.length;p<n;p++)if(E.probe(x,p))return R.logger.log("ADTS sync word found !"),!0;return!1},w.canParse=function(x,_){return E.canParse(x,_)},w.appendFrame=function(x,_,p){E.initTrackConfig(x,this.observer,_,p,x.manifestCodec);var n=E.appendFrame(x,_,p,this.initPTS,this.frameIndex);if(n&&n.missing===0)return n},S}(N.default);P.minProbeByteLength=9,j.default=P},"./src/demux/adts.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"getAudioConfig",function(){return I}),O.d(j,"isHeaderPattern",function(){return L}),O.d(j,"getHeaderLength",function(){return T}),O.d(j,"getFullFrameLength",function(){return P}),O.d(j,"canGetFrameLength",function(){return b}),O.d(j,"isHeader",function(){return S}),O.d(j,"canParse",function(){return w}),O.d(j,"probe",function(){return C}),O.d(j,"initTrackConfig",function(){return x}),O.d(j,"getFrameDuration",function(){return _}),O.d(j,"parseFrameHeader",function(){return p}),O.d(j,"appendFrame",function(){return n});var N=O("./src/utils/logger.ts"),E=O("./src/errors.ts"),R=O("./src/events.ts");function I(u,l,v,d){var o,m,h,a,r=navigator.userAgent.toLowerCase(),e=d,i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=((l[v+2]&192)>>>6)+1;var g=(l[v+2]&60)>>>2;if(g>i.length-1){u.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return h=(l[v+2]&1)<<2,h|=(l[v+3]&192)>>>6,N.logger.log("manifest codec:"+d+", ADTS type:"+o+", samplingIndex:"+g),/firefox/i.test(r)?g>=6?(o=5,a=new Array(4),m=g-3):(o=2,a=new Array(2),m=g):r.indexOf("android")!==-1?(o=2,a=new Array(2),m=g):(o=5,a=new Array(4),d&&(d.indexOf("mp4a.40.29")!==-1||d.indexOf("mp4a.40.5")!==-1)||!d&&g>=6?m=g-3:((d&&d.indexOf("mp4a.40.2")!==-1&&(g>=6&&h===1||/vivaldi/i.test(r))||!d&&h===1)&&(o=2,a=new Array(2)),m=g)),a[0]=o<<3,a[0]|=(g&14)>>1,a[1]|=(g&1)<<7,a[1]|=h<<3,o===5&&(a[1]|=(m&14)>>1,a[2]=(m&1)<<7,a[2]|=2<<2,a[3]=0),{config:a,samplerate:i[g],channelCount:h,codec:"mp4a.40."+o,manifestCodec:e}}function L(u,l){return u[l]===255&&(u[l+1]&246)===240}function T(u,l){return u[l+1]&1?7:9}function P(u,l){return(u[l+3]&3)<<11|u[l+4]<<3|(u[l+5]&224)>>>5}function b(u,l){return l+5<u.length}function S(u,l){return l+1<u.length&&L(u,l)}function w(u,l){return b(u,l)&&L(u,l)&&P(u,l)<=u.length-l}function C(u,l){if(S(u,l)){var v=T(u,l);if(l+v>=u.length)return!1;var d=P(u,l);if(d<=v)return!1;var o=l+d;return o===u.length||S(u,o)}return!1}function x(u,l,v,d,o){if(!u.samplerate){var m=I(l,v,d,o);if(!m)return;u.config=m.config,u.samplerate=m.samplerate,u.channelCount=m.channelCount,u.codec=m.codec,u.manifestCodec=m.manifestCodec,N.logger.log("parsed codec:"+u.codec+", rate:"+m.samplerate+", channels:"+m.channelCount)}}function _(u){return 1024*9e4/u}function p(u,l,v,d,o){var m=T(u,l),h=P(u,l);if(h-=m,h>0){var a=v+d*o;return{headerLength:m,frameLength:h,stamp:a}}}function n(u,l,v,d,o){var m=_(u.samplerate),h=p(l,v,d,o,m);if(h){var a=h.frameLength,r=h.headerLength,e=h.stamp,i=r+a,g=Math.max(0,v+i-l.length),f;g?(f=new Uint8Array(i-r),f.set(l.subarray(v+r,l.length),0)):f=l.subarray(v+r,v+i);var y={unit:f,pts:e};return g||u.samples.push(y),{sample:y,length:i,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"initPTSFn",function(){return P});var N=O("./src/polyfills/number.ts"),E=O("./src/demux/id3.ts"),R=O("./src/demux/dummy-demuxed-track.ts"),I=O("./src/utils/mp4-tools.ts"),L=O("./src/utils/typed-array.ts"),T=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=b.prototype;return S.resetInitSegment=function(C,x,_){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(C,x){return!1},S.appendFrame=function(C,x,_){},S.demux=function(C,x){this.cachedData&&(C=Object(I.appendUint8Array)(this.cachedData,C),this.cachedData=null);var _=E.getID3Data(C,0),p=_?_.length:0,n,u,l=this._audioTrack,v=this._id3Track,d=_?E.getTimeStamp(_):void 0,o=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=P(d,x)),_&&_.length>0&&v.samples.push({pts:this.initPTS,dts:this.initPTS,data:_}),u=this.initPTS;p<o;){if(this.canParse(C,p)){var m=this.appendFrame(l,C,p);m?(this.frameIndex++,u=m.sample.pts,p+=m.length,n=p):p=o}else E.canParse(C,p)?(_=E.getID3Data(C,p),v.samples.push({pts:u,dts:u,data:_}),p+=_.length,n=p):p++;if(p===o&&n!==o){var h=Object(L.sliceUint8)(C,n);this.cachedData?this.cachedData=Object(I.appendUint8Array)(this.cachedData,h):this.cachedData=h}}return{audioTrack:l,avcTrack:Object(R.dummyTrack)(),id3Track:v,textTrack:Object(R.dummyTrack)()}},S.demuxSampleAes=function(C,x,_){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(C){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},S.destroy=function(){},b}(),P=function(S,w){return Object(N.isFiniteNumber)(S)?S*90:w*9e4};j.default=T},"./src/demux/chunk-cache.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return N});var N=function(){function R(){this.chunks=[],this.dataLength=0}var I=R.prototype;return I.push=function(T){this.chunks.push(T),this.dataLength+=T.length},I.flush=function(){var T=this.chunks,P=this.dataLength,b;if(T.length)T.length===1?b=T[0]:b=E(T,P);else return new Uint8Array(0);return this.reset(),b},I.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function E(R,I){for(var L=new Uint8Array(I),T=0,P=0;P<R.length;P++){var b=R[P];L.set(b,T),T+=b.length}return L}},"./src/demux/dummy-demuxed-track.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"dummyTrack",function(){return N});function N(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/utils/logger.ts"),E=function(){function R(L){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=L,this.bytesAvailable=L.byteLength,this.word=0,this.bitsAvailable=0}var I=R.prototype;return I.loadWord=function(){var T=this.data,P=this.bytesAvailable,b=T.byteLength-P,S=new Uint8Array(4),w=Math.min(4,P);if(w===0)throw new Error("no bytes available");S.set(T.subarray(b,b+w)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=w*8,this.bytesAvailable-=w},I.skipBits=function(T){var P;this.bitsAvailable>T?(this.word<<=T,this.bitsAvailable-=T):(T-=this.bitsAvailable,P=T>>3,T-=P>>3,this.bytesAvailable-=P,this.loadWord(),this.word<<=T,this.bitsAvailable-=T)},I.readBits=function(T){var P=Math.min(this.bitsAvailable,T),b=this.word>>>32-P;return T>32&&N.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=P,this.bitsAvailable>0?this.word<<=P:this.bytesAvailable>0&&this.loadWord(),P=T-P,P>0&&this.bitsAvailable?b<<P|this.readBits(P):b},I.skipLZ=function(){var T;for(T=0;T<this.bitsAvailable;++T)if((this.word&2147483648>>>T)!==0)return this.word<<=T,this.bitsAvailable-=T,T;return this.loadWord(),T+this.skipLZ()},I.skipUEG=function(){this.skipBits(1+this.skipLZ())},I.skipEG=function(){this.skipBits(1+this.skipLZ())},I.readUEG=function(){var T=this.skipLZ();return this.readBits(T+1)-1},I.readEG=function(){var T=this.readUEG();return 1&T?1+T>>>1:-1*(T>>>1)},I.readBoolean=function(){return this.readBits(1)===1},I.readUByte=function(){return this.readBits(8)},I.readUShort=function(){return this.readBits(16)},I.readUInt=function(){return this.readBits(32)},I.skipScalingList=function(T){for(var P=8,b=8,S,w=0;w<T;w++)b!==0&&(S=this.readEG(),b=(P+S+256)%256),P=b===0?P:b},I.readSPS=function(){var T=0,P=0,b=0,S=0,w,C,x,_=this.readUByte.bind(this),p=this.readBits.bind(this),n=this.readUEG.bind(this),u=this.readBoolean.bind(this),l=this.skipBits.bind(this),v=this.skipEG.bind(this),d=this.skipUEG.bind(this),o=this.skipScalingList.bind(this);_();var m=_();if(p(5),l(3),_(),d(),m===100||m===110||m===122||m===244||m===44||m===83||m===86||m===118||m===128){var h=n();if(h===3&&l(1),d(),d(),l(1),u())for(C=h!==3?8:12,x=0;x<C;x++)u()&&(x<6?o(16):o(64))}d();var a=n();if(a===0)n();else if(a===1)for(l(1),v(),v(),w=n(),x=0;x<w;x++)v();d(),l(1);var r=n(),e=n(),i=p(1);i===0&&l(1),l(1),u()&&(T=n(),P=n(),b=n(),S=n());var g=[1,1];if(u()&&u()){var f=_();switch(f){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[_()<<8|_(),_()<<8|_()];break}}}return{width:Math.ceil((r+1)*16-T*2-P*2),height:(2-i)*(e+1)*16-(i?2:4)*(b+S),pixelRatio:g}},I.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();j.default=E},"./src/demux/id3.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"isHeader",function(){return N}),O.d(j,"isFooter",function(){return E}),O.d(j,"getID3Data",function(){return R}),O.d(j,"canParse",function(){return L}),O.d(j,"getTimeStamp",function(){return T}),O.d(j,"isTimeStampFrame",function(){return P}),O.d(j,"getID3Frames",function(){return S}),O.d(j,"decodeFrame",function(){return w}),O.d(j,"utf8ArrayToStr",function(){return n}),O.d(j,"testables",function(){return u});var N=function(o,m){return m+10<=o.length&&(o[m]===73&&o[m+1]===68&&o[m+2]===51&&(o[m+3]<255&&o[m+4]<255&&(o[m+6]<128&&o[m+7]<128&&o[m+8]<128&&o[m+9]<128)))},E=function(o,m){return m+10<=o.length&&(o[m]===51&&o[m+1]===68&&o[m+2]===73&&(o[m+3]<255&&o[m+4]<255&&(o[m+6]<128&&o[m+7]<128&&o[m+8]<128&&o[m+9]<128)))},R=function(o,m){for(var h=m,a=0;N(o,m);){a+=10;var r=I(o,m+6);a+=r,E(o,m+10)&&(a+=10),m+=a}return a>0?o.subarray(h,h+a):void 0},I=function(o,m){var h=0;return h=(o[m]&127)<<21,h|=(o[m+1]&127)<<14,h|=(o[m+2]&127)<<7,h|=o[m+3]&127,h},L=function(o,m){return N(o,m)&&I(o,m+6)+10<=o.length-m},T=function(o){for(var m=S(o),h=0;h<m.length;h++){var a=m[h];if(P(a))return p(a)}return},P=function(o){return o&&o.key==="PRIV"&&o.info==="com.apple.streaming.transportStreamTimestamp"},b=function(o){var m=String.fromCharCode(o[0],o[1],o[2],o[3]),h=I(o,4),a=10;return{type:m,size:h,data:o.subarray(a,a+h)}},S=function(o){for(var m=0,h=[];N(o,m);){var a=I(o,m+6);m+=10;for(var r=m+a;m+8<r;){var e=b(o.subarray(m)),i=w(e);i&&h.push(i),m+=e.size+10}E(o,m)&&(m+=10)}return h},w=function(o){return o.type==="PRIV"?C(o):o.type[0]==="W"?_(o):x(o)},C=function(o){if(o.size<2)return;var m=n(o.data,!0),h=new Uint8Array(o.data.subarray(m.length+1));return{key:o.type,info:m,data:h.buffer}},x=function(o){if(o.size<2)return;if(o.type==="TXXX"){var m=1,h=n(o.data.subarray(m),!0);m+=h.length+1;var a=n(o.data.subarray(m));return{key:o.type,info:h,data:a}}var r=n(o.data.subarray(1));return{key:o.type,data:r}},_=function(o){if(o.type==="WXXX"){if(o.size<2)return;var m=1,h=n(o.data.subarray(m),!0);m+=h.length+1;var a=n(o.data.subarray(m));return{key:o.type,info:h,data:a}}var r=n(o.data);return{key:o.type,data:r}},p=function(o){if(o.data.byteLength===8){var m=new Uint8Array(o.data),h=m[3]&1,a=(m[4]<<23)+(m[5]<<15)+(m[6]<<7)+m[7];return a/=45,h&&(a+=4772185884e-2),Math.round(a)}return},n=function(o,m){m===void 0&&(m=!1);var h=v();if(h){var a=h.decode(o);if(m){var r=a.indexOf("\0");return r!==-1?a.substring(0,r):a}return a.replace(/\0/g,"")}for(var e=o.length,i,g,f,y="",t=0;t<e;){if(i=o[t++],i===0&&m)return y;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(i);break;case 12:case 13:g=o[t++],y+=String.fromCharCode((i&31)<<6|g&63);break;case 14:g=o[t++],f=o[t++],y+=String.fromCharCode((i&15)<<12|(g&63)<<6|(f&63)<<0);break;default:}}return y},u={decodeTextFrame:x},l;function v(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/demux/base-audio-demuxer.ts"),E=O("./src/demux/id3.ts"),R=O("./src/utils/logger.ts"),I=O("./src/demux/mpegaudio.ts");function L(b,S){b.prototype=Object.create(S.prototype),b.prototype.constructor=b,T(b,S)}function T(b,S){return T=Object.setPrototypeOf||function(C,x){return C.__proto__=x,C},T(b,S)}var P=function(b){L(S,b);function S(){return b.apply(this,arguments)||this}var w=S.prototype;return w.resetInitSegment=function(x,_,p){b.prototype.resetInitSegment.call(this,x,_,p),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:x,duration:p,inputTimeScale:9e4,dropped:0}},S.probe=function(x){if(!x)return!1;for(var _=E.getID3Data(x,0)||[],p=_.length,n=x.length;p<n;p++)if(I.probe(x,p))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},w.canParse=function(x,_){return I.canParse(x,_)},w.appendFrame=function(x,_,p){return this.initPTS===null?void 0:I.appendFrame(x,_,p,this.initPTS,this.frameIndex)},S}(N.default);P.minProbeByteLength=4,j.default=P},"./src/demux/mp4demuxer.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/utils/mp4-tools.ts"),E=O("./src/demux/dummy-demuxed-track.ts"),R=function(){function I(T,P){this.remainderData=null,this.config=void 0,this.config=P}var L=I.prototype;return L.resetTimeStamp=function(){},L.resetInitSegment=function(){},L.resetContiguity=function(){},I.probe=function(P){return Object(N.findBox)({data:P,start:0,end:Math.min(P.length,16384)},["moof"]).length>0},L.demux=function(P){var b=P,S=Object(E.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(N.appendUint8Array)(this.remainderData,P));var w=Object(N.segmentValidRange)(b);this.remainderData=w.remainder,S.samples=w.valid||new Uint8Array}else S.samples=b;return{audioTrack:Object(E.dummyTrack)(),avcTrack:S,id3Track:Object(E.dummyTrack)(),textTrack:Object(E.dummyTrack)()}},L.flush=function(){var P=Object(E.dummyTrack)();return P.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(E.dummyTrack)(),avcTrack:P,id3Track:Object(E.dummyTrack)(),textTrack:Object(E.dummyTrack)()}},L.demuxSampleAes=function(P,b,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},L.destroy=function(){},I}();R.minProbeByteLength=1024,j.default=R},"./src/demux/mpegaudio.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"appendFrame",function(){return T}),O.d(j,"parseHeader",function(){return P}),O.d(j,"isHeaderPattern",function(){return b}),O.d(j,"isHeader",function(){return S}),O.d(j,"canParse",function(){return w}),O.d(j,"probe",function(){return C});var N=null,E=[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],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],I=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],L=[0,1,1,4];function T(x,_,p,n,u){if(p+24>_.length)return;var l=P(_,p);if(l&&p+l.frameLength<=_.length){var v=l.samplesPerFrame*9e4/l.sampleRate,d=n+u*v,o={unit:_.subarray(p,p+l.frameLength),pts:d,dts:d};return x.config=[],x.channelCount=l.channelCount,x.samplerate=l.sampleRate,x.samples.push(o),{sample:o,length:l.frameLength,missing:0}}}function P(x,_){var p=x[_+1]>>3&3,n=x[_+1]>>1&3,u=x[_+2]>>4&15,l=x[_+2]>>2&3;if(p!==1&&u!==0&&u!==15&&l!==3){var v=x[_+2]>>1&1,d=x[_+3]>>6,o=p===3?3-n:n===3?3:4,m=E[o*14+u-1]*1e3,h=p===3?0:p===2?1:2,a=R[h*3+l],r=d===3?1:2,e=I[p][n],i=L[n],g=e*8*i,f=Math.floor(e*m/a+v)*i;if(N===null){var y=navigator.userAgent||"",t=y.match(/Chrome\/(\d+)/i);N=t?parseInt(t[1]):0}var A=!!N&&N<=87;return A&&n===2&&m>=224e3&&d===0&&(x[_+3]=x[_+3]|128),{sampleRate:a,channelCount:r,frameLength:f,samplesPerFrame:g}}}function b(x,_){return x[_]===255&&(x[_+1]&224)===224&&(x[_+1]&6)!==0}function S(x,_){return _+1<x.length&&b(x,_)}function w(x,_){var p=4;return b(x,_)&&p<=x.length-_}function C(x,_){if(_+1<x.length&&b(x,_)){var p=4,n=P(x,_),u=p;n!=null&&n.frameLength&&(u=n.frameLength);var l=_+u;return l===x.length||S(x,l)}return!1}},"./src/demux/sample-aes.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/crypt/decrypter.ts"),E=O("./src/demux/tsdemuxer.ts"),R=function(){function I(T,P,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new N.default(T,P,{removePKCS7Padding:!1})}var L=I.prototype;return L.decryptBuffer=function(P,b){this.decrypter.decrypt(P,this.keyData.key.buffer,this.keyData.iv.buffer,b)},L.decryptAacSample=function(P,b,S,w){var C=P[b].unit,x=C.subarray(16,C.length-C.length%16),_=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),p=this;this.decryptBuffer(_,function(n){var u=new Uint8Array(n);C.set(u,16),w||p.decryptAacSamples(P,b+1,S)})},L.decryptAacSamples=function(P,b,S){for(;;b++){if(b>=P.length){S();return}if(P[b].unit.length<32)continue;var w=this.decrypter.isSync();if(this.decryptAacSample(P,b,S,w),!w)return}},L.getAvcEncryptedData=function(P){for(var b=Math.floor((P.length-48)/160)*16+16,S=new Int8Array(b),w=0,C=32;C<=P.length-16;C+=160,w+=16)S.set(P.subarray(C,C+16),w);return S},L.getAvcDecryptedUnit=function(P,b){for(var S=new Uint8Array(b),w=0,C=32;C<=P.length-16;C+=160,w+=16)P.set(S.subarray(w,w+16),C);return P},L.decryptAvcSample=function(P,b,S,w,C,x){var _=Object(E.discardEPB)(C.data),p=this.getAvcEncryptedData(_),n=this;this.decryptBuffer(p.buffer,function(u){C.data=n.getAvcDecryptedUnit(_,u),x||n.decryptAvcSamples(P,b,S+1,w)})},L.decryptAvcSamples=function(P,b,S,w){if(P instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,S=0){if(b>=P.length){w();return}for(var C=P[b].units;!(S>=C.length);S++){var x=C[S];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var _=this.decrypter.isSync();if(this.decryptAvcSample(P,b,S,w,x,_),!_)return}}},I}();j.default=R},"./src/demux/transmuxer-interface.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return C});var N=O("./node_modules/webworkify-webpack/index.js"),E=O.n(N),R=O("./src/events.ts"),I=O("./src/demux/transmuxer.ts"),L=O("./src/utils/logger.ts"),T=O("./src/errors.ts"),P=O("./src/utils/mediasource-helper.ts"),b=O("./node_modules/eventemitter3/index.js"),S=O.n(b),w=Object(P.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function x(p,n,u,l){var v=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=p,this.id=n,this.onTransmuxComplete=u,this.onFlush=l;var d=p.config,o=function(e,i){i=i||{},i.frag=v.frag,i.id=v.id,p.trigger(e,i)};this.observer=new b.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,o),this.observer.on(R.Events.ERROR,o);var m={mp4:w.isTypeSupported("video/mp4"),mpeg:w.isTypeSupported("audio/mpeg"),mp3:w.isTypeSupported('audio/mp4; codecs="mp3"')},h=navigator.vendor;if(d.enableWorker&&typeof Worker!="undefined"){L.logger.log("demuxing in webworker");var a;try{a=this.worker=N("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),a.addEventListener("message",this.onwmsg),a.onerror=function(r){p.trigger(R.Events.ERROR,{type:T.ErrorTypes.OTHER_ERROR,details:T.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(r.message+" ("+r.filename+":"+r.lineno+")")})},a.postMessage({cmd:"init",typeSupported:m,vendor:h,id:n,config:JSON.stringify(d)})}catch(r){L.logger.warn("Error in worker:",r),L.logger.error("Error while initializing DemuxerWorker, fallback to inline"),a&&self.URL.revokeObjectURL(a.objectURL),this.transmuxer=new I.default(this.observer,m,d,h,n),this.worker=null}}else this.transmuxer=new I.default(this.observer,m,d,h,n)}var _=x.prototype;return _.destroy=function(){var n=this.worker;if(n)n.removeEventListener("message",this.onwmsg),n.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},_.push=function(n,u,l,v,d,o,m,h,a,r){var e=this;a.transmuxing.start=self.performance.now();var i=this.transmuxer,g=this.worker,f=o?o.start:d.start,y=d.decryptdata,t=this.frag,A=!(t&&d.cc===t.cc),U=!(t&&a.level===t.level),B=t?a.sn-t.sn:-1,G=this.part?a.part-this.part.index:1,J=!U&&(B===1||B===0&&G===1),F=self.performance.now();(U||B||d.stats.parsing.start===0)&&(d.stats.parsing.start=F),o&&(G||!J)&&(o.stats.parsing.start=F);var q=new I.TransmuxState(A,J,h,U,f);if(!J||A){L.logger.log("[transmuxer-interface, "+d.type+"]: Starting new transmux session for sn: "+a.sn+" p: "+a.part+" level: "+a.level+" id: "+a.id+`
|
|
discontinuity: `+A+`
|
|
trackSwitch: `+U+`
|
|
contiguous: `+J+`
|
|
accurateTimeOffset: `+h+`
|
|
timeOffset: `+f);var re=new I.TransmuxConfig(l,v,u,m,r);this.configureTransmuxer(re)}if(this.frag=d,this.part=o,g)g.postMessage({cmd:"demux",data:n,decryptdata:y,chunkMeta:a,state:q},n instanceof ArrayBuffer?[n]:[]);else if(i){var ae=i.push(n,y,a,q);Object(I.isPromise)(ae)?ae.then(function(ve){e.handleTransmuxComplete(ve)}):this.handleTransmuxComplete(ae)}},_.flush=function(n){var u=this;n.transmuxing.start=self.performance.now();var l=this.transmuxer,v=this.worker;if(v)v.postMessage({cmd:"flush",chunkMeta:n});else if(l){var d=l.flush(n);Object(I.isPromise)(d)?d.then(function(o){u.handleFlushResult(o,n)}):this.handleFlushResult(d,n)}},_.handleFlushResult=function(n,u){var l=this;n.forEach(function(v){l.handleTransmuxComplete(v)}),this.onFlush(u)},_.onWorkerMessage=function(n){var u=n.data,l=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,l.trigger(u.event,u.data);break}}},_.configureTransmuxer=function(n){var u=this.worker,l=this.transmuxer;u?u.postMessage({cmd:"configure",config:n}):l&&l.configure(n)},_.handleTransmuxComplete=function(n){n.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(n)},x}()},"./src/demux/transmuxer-worker.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return T});var N=O("./src/demux/transmuxer.ts"),E=O("./src/events.ts"),R=O("./src/utils/logger.ts"),I=O("./node_modules/eventemitter3/index.js"),L=O.n(I);function T(C){var x=new I.EventEmitter,_=function(n,u){C.postMessage({event:n,data:u})};x.on(E.Events.FRAG_DECRYPTED,_),x.on(E.Events.ERROR,_),C.addEventListener("message",function(p){var n=p.data;switch(n.cmd){case"init":{var u=JSON.parse(n.config);C.transmuxer=new N.default(x,n.typeSupported,u,n.vendor,n.id),Object(R.enableLogs)(u.debug),_("init",null);break}case"configure":{C.transmuxer.configure(n.config);break}case"demux":{var l=C.transmuxer.push(n.data,n.decryptdata,n.chunkMeta,n.state);Object(N.isPromise)(l)?l.then(function(o){P(C,o)}):P(C,l);break}case"flush":{var v=n.chunkMeta,d=C.transmuxer.flush(v);Object(N.isPromise)(d)?d.then(function(o){S(C,o,v)}):S(C,d,v);break}default:break}})}function P(C,x){if(w(x.remuxResult))return;var _=[],p=x.remuxResult,n=p.audio,u=p.video;n&&b(_,n),u&&b(_,u),C.postMessage({event:"transmuxComplete",data:x},_)}function b(C,x){x.data1&&C.push(x.data1.buffer),x.data2&&C.push(x.data2.buffer)}function S(C,x,_){x.forEach(function(p){P(C,p)}),C.postMessage({event:"flush",data:_})}function w(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return u}),O.d(j,"isPromise",function(){return d}),O.d(j,"TransmuxConfig",function(){return o}),O.d(j,"TransmuxState",function(){return m});var N=O("./src/events.ts"),E=O("./src/errors.ts"),R=O("./src/crypt/decrypter.ts"),I=O("./src/demux/aacdemuxer.ts"),L=O("./src/demux/mp4demuxer.ts"),T=O("./src/demux/tsdemuxer.ts"),P=O("./src/demux/mp3demuxer.ts"),b=O("./src/remux/mp4-remuxer.ts"),S=O("./src/remux/passthrough-remuxer.ts"),w=O("./src/demux/chunk-cache.ts"),C=O("./src/utils/mp4-tools.ts"),x=O("./src/utils/logger.ts"),_;try{_=self.performance.now.bind(self.performance)}catch(h){x.logger.debug("Unable to use Performance API on this environment"),_=self.Date.now}var p=[{demux:T.default,remux:b.default},{demux:L.default,remux:S.default},{demux:I.default,remux:b.default},{demux:P.default,remux:b.default}],n=1024;p.forEach(function(h){var a=h.demux;n=Math.max(n,a.minProbeByteLength)});var u=function(){function h(r,e,i,g,f){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 w.default,this.observer=r,this.typeSupported=e,this.config=i,this.vendor=g,this.id=f}var a=h.prototype;return a.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},a.push=function(e,i,g,f){var y=this,t=g.transmuxing;t.executeStart=_();var A=new Uint8Array(e),U=this.cache,B=this.config,G=this.currentTransmuxState,J=this.transmuxConfig;f&&(this.currentTransmuxState=f);var F=l(A,i);if(F&&F.method==="AES-128"){var q=this.getDecrypter();if(B.enableSoftwareAES){var re=q.softwareDecrypt(A,F.key.buffer,F.iv.buffer);if(!re)return t.executeEnd=_(),v(g);A=new Uint8Array(re)}else return this.decryptionPromise=q.webCryptoDecrypt(A,F.key.buffer,F.iv.buffer).then(function(Ae){var je=y.push(Ae,null,g);return y.decryptionPromise=null,je}),this.decryptionPromise}var ae=f||G,ve=ae.contiguous,de=ae.discontinuity,Z=ae.trackSwitch,ee=ae.accurateTimeOffset,pe=ae.timeOffset,Q=J.audioCodec,V=J.videoCodec,Ce=J.defaultInitPts,De=J.duration,Ne=J.initSegmentData;if((de||Z)&&this.resetInitSegment(Ne,Q,V,De),de&&this.resetInitialTimestamp(Ce),ve||this.resetContiguity(),this.needsProbing(A,de,Z)){if(U.dataLength){var we=U.flush();A=Object(C.appendUint8Array)(we,A)}this.configureTransmuxer(A,J)}var ke=this.transmux(A,F,pe,ee,g),Se=this.currentTransmuxState;return Se.contiguous=!0,Se.discontinuity=!1,Se.trackSwitch=!1,t.executeEnd=_(),ke},a.flush=function(e){var i=this,g=e.transmuxing;g.executeStart=_();var f=this.decrypter,y=this.cache,t=this.currentTransmuxState,A=this.decryptionPromise;if(A)return A.then(function(){return i.flush(e)});var U=[],B=t.timeOffset;if(f){var G=f.flush();G&&U.push(this.push(G,null,e))}var J=y.dataLength;y.reset();var F=this.demuxer,q=this.remuxer;if(!F||!q)return J>=n&&this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=_(),[v(e)];var re=F.flush(B);return d(re)?re.then(function(ae){return i.flushRemux(U,ae,e),U}):(this.flushRemux(U,re,e),U)},a.flushRemux=function(e,i,g){var f=i.audioTrack,y=i.avcTrack,t=i.id3Track,A=i.textTrack,U=this.currentTransmuxState,B=U.accurateTimeOffset,G=U.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var J=this.remuxer.remux(f,y,t,A,G,B,!0,this.id);e.push({remuxResult:J,chunkMeta:g}),g.transmuxing.executeEnd=_()},a.resetInitialTimestamp=function(e){var i=this.demuxer,g=this.remuxer;if(!i||!g)return;i.resetTimeStamp(e),g.resetTimeStamp(e)},a.resetContiguity=function(){var e=this.demuxer,i=this.remuxer;if(!e||!i)return;e.resetContiguity(),i.resetNextTimestamp()},a.resetInitSegment=function(e,i,g,f){var y=this.demuxer,t=this.remuxer;if(!y||!t)return;y.resetInitSegment(i,g,f),t.resetInitSegment(e,i,g)},a.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},a.transmux=function(e,i,g,f,y){var t;return i&&i.method==="SAMPLE-AES"?t=this.transmuxSampleAes(e,i,g,f,y):t=this.transmuxUnencrypted(e,g,f,y),t},a.transmuxUnencrypted=function(e,i,g,f){var y=this.demuxer.demux(e,i,!1,!this.config.progressive),t=y.audioTrack,A=y.avcTrack,U=y.id3Track,B=y.textTrack,G=this.remuxer.remux(t,A,U,B,i,g,!1,this.id);return{remuxResult:G,chunkMeta:f}},a.transmuxSampleAes=function(e,i,g,f,y){var t=this;return this.demuxer.demuxSampleAes(e,i,g).then(function(A){var U=t.remuxer.remux(A.audioTrack,A.avcTrack,A.id3Track,A.textTrack,g,f,!1,t.id);return{remuxResult:U,chunkMeta:y}})},a.configureTransmuxer=function(e,i){for(var g=this.config,f=this.observer,y=this.typeSupported,t=this.vendor,A=i.audioCodec,U=i.defaultInitPts,B=i.duration,G=i.initSegmentData,J=i.videoCodec,F,q=0,re=p.length;q<re;q++)if(p[q].demux.probe(e)){F=p[q];break}F||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),F={demux:L.default,remux:S.default});var ae=this.demuxer,ve=this.remuxer,de=F.remux,Z=F.demux;(!ve||!(ve instanceof de))&&(this.remuxer=new de(f,g,y,t)),(!ae||!(ae instanceof Z))&&(this.demuxer=new Z(f,g,y),this.probe=Z.probe),this.resetInitSegment(G,A,J,B),this.resetInitialTimestamp(U)},a.needsProbing=function(e,i,g){return!this.demuxer||!this.remuxer||i||g},a.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new R.default(this.observer,this.config)),e},h}();function l(h,a){var r=null;return h.byteLength>0&&a!=null&&a.key!=null&&a.iv!==null&&a.method!=null&&(r=a),r}var v=function(a){return{remuxResult:{},chunkMeta:a}};function d(h){return"then"in h&&h.then instanceof Function}var o=function(a,r,e,i,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=a,this.videoCodec=r,this.initSegmentData=e,this.duration=i,this.defaultInitPts=g},m=function(a,r,e,i,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=a,this.contiguous=r,this.accurateTimeOffset=e,this.trackSwitch=i,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"discardEPB",function(){return v});var N=O("./src/demux/adts.ts"),E=O("./src/demux/mpegaudio.ts"),R=O("./src/demux/exp-golomb.ts"),I=O("./src/demux/id3.ts"),L=O("./src/demux/sample-aes.ts"),T=O("./src/events.ts"),P=O("./src/utils/mp4-tools.ts"),b=O("./src/utils/logger.ts"),S=O("./src/errors.ts"),w={video:1,audio:2,id3:3,text:4},C=function(){function d(m,h,a){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=m,this.config=h,this.typeSupported=a}d.probe=function(h){var a=d.syncOffset(h);return a<0?!1:(a&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+a+", junk ahead ?"),!0)},d.syncOffset=function(h){for(var a=Math.min(1e3,h.length-3*188),r=0;r<a;){if(h[r]===71&&h[r+188]===71&&h[r+2*188]===71)return r;r++}return-1},d.createTrack=function(h,a){return{container:h==="video"||h==="audio"?"video/mp2t":void 0,type:h,id:w[h],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:h==="audio"?a:void 0}};var o=d.prototype;return o.resetInitSegment=function(h,a,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video",r),this._audioTrack=d.createTrack("audio",r),this._id3Track=d.createTrack("id3",r),this._txtTrack=d.createTrack("text",r),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=h,this.videoCodec=a,this._duration=r},o.resetTimeStamp=function(){},o.resetContiguity=function(){var h=this._audioTrack,a=this._avcTrack,r=this._id3Track;h&&(h.pesData=null),a&&(a.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},o.demux=function(h,a,r,e){r===void 0&&(r=!1),e===void 0&&(e=!1),r||(this.sampleAes=null);var i,g=this._avcTrack,f=this._audioTrack,y=this._id3Track,t=g.pid,A=g.pesData,U=f.pid,B=y.pid,G=f.pesData,J=y.pesData,F=!1,q=this.pmtParsed,re=this._pmtId,ae=h.length;if(this.remainderData&&(h=Object(P.appendUint8Array)(this.remainderData,h),ae=h.length,this.remainderData=null),ae<188&&!e)return this.remainderData=h,{audioTrack:f,avcTrack:g,id3Track:y,textTrack:this._txtTrack};var ve=Math.max(0,d.syncOffset(h));ae-=(ae+ve)%188,ae<h.byteLength&&!e&&(this.remainderData=new Uint8Array(h.buffer,ae,h.buffer.byteLength-ae));for(var de=ve;de<ae;de+=188)if(h[de]===71){var Z=!!(h[de+1]&64),ee=((h[de+1]&31)<<8)+h[de+2],pe=(h[de+3]&48)>>4,Q=void 0;if(pe>1){if(Q=de+5+h[de+4],Q===de+188)continue}else Q=de+4;switch(ee){case t:Z&&(A&&(i=n(A))&&this.parseAVCPES(i,!1),A={data:[],size:0}),A&&(A.data.push(h.subarray(Q,de+188)),A.size+=de+188-Q);break;case U:Z&&(G&&(i=n(G))&&(f.isAAC?this.parseAACPES(i):this.parseMPEGPES(i)),G={data:[],size:0}),G&&(G.data.push(h.subarray(Q,de+188)),G.size+=de+188-Q);break;case B:Z&&(J&&(i=n(J))&&this.parseID3PES(i),J={data:[],size:0}),J&&(J.data.push(h.subarray(Q,de+188)),J.size+=de+188-Q);break;case 0:Z&&(Q+=h[Q]+1),re=this._pmtId=_(h,Q);break;case re:{Z&&(Q+=h[Q]+1);var V=p(h,Q,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,r);t=V.avc,t>0&&(g.pid=t),U=V.audio,U>0&&(f.pid=U,f.isAAC=V.isAAC),B=V.id3,B>0&&(y.pid=B),F&&!q&&(b.logger.log("reparse from beginning"),F=!1,de=ve-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:F=!0;break}}else this.observer.emit(T.Events.ERROR,T.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=A,f.pesData=G,y.pesData=J;var Ce={audioTrack:f,avcTrack:g,id3Track:y,textTrack:this._txtTrack};return e&&this.extractRemainingSamples(Ce),Ce},o.flush=function(){var h=this.remainderData;this.remainderData=null;var a;return h?a=this.demux(h,-1,!1,!0):a={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(a),this.sampleAes?this.decrypt(a,this.sampleAes):a},o.extractRemainingSamples=function(h){var a=h.audioTrack,r=h.avcTrack,e=h.id3Track,i=r.pesData,g=a.pesData,f=e.pesData,y;i&&(y=n(i))?(this.parseAVCPES(y,!0),r.pesData=null):r.pesData=i,g&&(y=n(g))?(a.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),a.pesData=null):(g!=null&&g.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),a.pesData=g),f&&(y=n(f))?(this.parseID3PES(y),e.pesData=null):e.pesData=f},o.demuxSampleAes=function(h,a,r){var e=this.demux(h,r,!0,!this.config.progressive),i=this.sampleAes=new L.default(this.observer,this.config,a);return this.decrypt(e,i)},o.decrypt=function(h,a){return new Promise(function(r){var e=h.audioTrack,i=h.avcTrack;e.samples&&e.isAAC?a.decryptAacSamples(e.samples,0,function(){i.samples?a.decryptAvcSamples(i.samples,0,0,function(){r(h)}):r(h)}):i.samples&&a.decryptAvcSamples(i.samples,0,0,function(){r(h)})})},o.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},o.parseAVCPES=function(h,a){var r=this,e=this._avcTrack,i=this.parseAVCNALu(h.data),g=!1,f=this.avcSample,y,t=!1;h.data=null,f&&i.length&&!e.audFound&&(u(f,e),f=this.avcSample=x(!1,h.pts,h.dts,"")),i.forEach(function(A){switch(A.type){case 1:{y=!0,f||(f=r.avcSample=x(!0,h.pts,h.dts,"")),g&&(f.debug+="NDR "),f.frame=!0;var U=A.data;if(t&&U.length>4){var B=new R.default(U).readSliceType();(B===2||B===4||B===7||B===9)&&(f.key=!0)}break}case 5:y=!0,f||(f=r.avcSample=x(!0,h.pts,h.dts,"")),g&&(f.debug+="IDR "),f.key=!0,f.frame=!0;break;case 6:{y=!0,g&&f&&(f.debug+="SEI ");var G=new R.default(v(A.data));G.readUByte();for(var J=0,F=0,q=!1,re=0;!q&&G.bytesAvailable>1;){J=0;do re=G.readUByte(),J+=re;while(re===255);F=0;do re=G.readUByte(),F+=re;while(re===255);if(J===4&&G.bytesAvailable!==0){q=!0;var ae=G.readUByte();if(ae===181){var ve=G.readUShort();if(ve===49){var de=G.readUInt();if(de===1195456820){var Z=G.readUByte();if(Z===3){for(var ee=G.readUByte(),pe=G.readUByte(),Q=31&ee,V=[ee,pe],Ce=0;Ce<Q;Ce++)V.push(G.readUByte()),V.push(G.readUByte()),V.push(G.readUByte());l(r._txtTrack.samples,{type:3,pts:h.pts,bytes:V})}}}}}else if(J===5&&G.bytesAvailable!==0){if(q=!0,F>16){for(var De=[],Ne=0;Ne<16;Ne++)De.push(G.readUByte().toString(16)),(Ne===3||Ne===5||Ne===7||Ne===9)&&De.push("-");for(var we=F-16,ke=new Uint8Array(we),Se=0;Se<we;Se++)ke[Se]=G.readUByte();l(r._txtTrack.samples,{pts:h.pts,payloadType:J,uuid:De.join(""),userData:Object(I.utf8ArrayToStr)(ke),userDataBytes:ke})}}else if(F<G.bytesAvailable)for(var Ae=0;Ae<F;Ae++)G.readUByte()}break}case 7:if(y=!0,t=!0,g&&f&&(f.debug+="SPS "),!e.sps){var je=new R.default(A.data),Be=je.readSPS();e.width=Be.width,e.height=Be.height,e.pixelRatio=Be.pixelRatio,e.sps=[A.data],e.duration=r._duration;for(var Ke=A.data.subarray(1,4),Ue="avc1.",xe=0;xe<3;xe++){var Ge=Ke[xe].toString(16);Ge.length<2&&(Ge="0"+Ge),Ue+=Ge}e.codec=Ue}break;case 8:y=!0,g&&f&&(f.debug+="PPS "),e.pps||(e.pps=[A.data]);break;case 9:y=!1,e.audFound=!0,f&&u(f,e),f=r.avcSample=x(!1,h.pts,h.dts,g?"AUD ":"");break;case 12:y=!1;break;default:y=!1,f&&(f.debug+="unknown NAL "+A.type+" ");break}if(f&&y){var qe=f.units;qe.push(A)}}),a&&f&&(u(f,e),this.avcSample=null)},o.getLastNalUnit=function(){var h,a=this.avcSample,r;if(!a||a.units.length===0){var e=this._avcTrack.samples;a=e[e.length-1]}if((h=a)!==null&&h!==void 0&&h.units){var i=a.units;r=i[i.length-1]}return r},o.parseAVCNALu=function(h){var a=h.byteLength,r=this._avcTrack,e=r.naluState||0,i=e,g=[],f=0,y,t,A,U=-1,B=0;for(e===-1&&(U=0,B=h[0]&31,e=0,f=1);f<a;){if(y=h[f++],!e){e=y?0:1;continue}if(e===1){e=y?0:2;continue}if(!y)e=3;else if(y===1){if(U>=0){var G={data:h.subarray(U,f-e-1),type:B};g.push(G)}else{var J=this.getLastNalUnit();if(J&&(i&&f<=4-i&&(J.state&&(J.data=J.data.subarray(0,J.data.byteLength-i))),t=f-e-1,t>0)){var F=new Uint8Array(J.data.byteLength+t);F.set(J.data,0),F.set(h.subarray(0,t),J.data.byteLength),J.data=F,J.state=0}}f<a?(A=h[f]&31,U=f,B=A,e=0):e=-1}else e=0}if(U>=0&&e>=0){var q={data:h.subarray(U,a),type:B,state:e};g.push(q)}if(g.length===0){var re=this.getLastNalUnit();if(re){var ae=new Uint8Array(re.data.byteLength+h.byteLength);ae.set(re.data,0),ae.set(h,re.data.byteLength),re.data=ae}}return r.naluState=e,g},o.parseAACPES=function(h){var a=0,r=this._audioTrack,e=this.aacOverFlow,i=h.data;if(e){this.aacOverFlow=null;var g=e.sample.unit.byteLength,f=Math.min(e.missing,g),y=g-f;e.sample.unit.set(i.subarray(0,f),y),r.samples.push(e.sample),a=e.missing}var t,A;for(t=a,A=i.length;t<A-1&&!N.isHeader(i,t);t++);if(t!==a){var U,B;if(t<A-1?(U="AAC PES did not start with ADTS header,offset:"+t,B=!1):(U="no ADTS header found in AAC PES",B=!0),b.logger.warn("parsing error:"+U),this.observer.emit(T.Events.ERROR,T.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:B,reason:U}),B)return}N.initTrackConfig(r,this.observer,i,t,this.audioCodec);var G;if(h.pts!==void 0)G=h.pts;else if(e){var J=N.getFrameDuration(r.samplerate);G=e.sample.pts+J}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var F=0;t<A;)if(N.isHeader(i,t)){if(t+5<A){var q=N.appendFrame(r,i,t,G,F);if(q)if(q.missing)this.aacOverFlow=q;else{t+=q.length,F++;continue}}break}else t++},o.parseMPEGPES=function(h){var a=h.data,r=a.length,e=0,i=0,g=h.pts;if(g===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;i<r;)if(E.isHeader(a,i)){var f=E.appendFrame(this._audioTrack,a,i,g,e);if(f)i+=f.length,e++;else break}else i++},o.parseID3PES=function(h){if(h.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(h)},d}();C.minProbeByteLength=188;function x(d,o,m,h){return{key:d,frame:!1,pts:o,dts:m,units:[],debug:h,length:0}}function _(d,o){return(d[o+10]&31)<<8|d[o+11]}function p(d,o,m,h){var a={audio:-1,avc:-1,id3:-1,isAAC:!0},r=(d[o+1]&15)<<8|d[o+2],e=o+3+r-4,i=(d[o+10]&15)<<8|d[o+11];for(o+=12+i;o<e;){var g=(d[o+1]&31)<<8|d[o+2];switch(d[o]){case 207:if(!h){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:a.audio===-1&&(a.audio=g);break;case 21:a.id3===-1&&(a.id3=g);break;case 219:if(!h){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:a.avc===-1&&(a.avc=g);break;case 3:case 4:m?a.audio===-1&&(a.audio=g,a.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}o+=((d[o+3]&15)<<8|d[o+4])+5}return a}function n(d){var o=0,m,h,a,r,e,i=d.data;if(!d||d.size===0)return null;for(;i[0].length<19&&i.length>1;){var g=new Uint8Array(i[0].length+i[1].length);g.set(i[0]),g.set(i[1],i[0].length),i[0]=g,i.splice(1,1)}m=i[0];var f=(m[0]<<16)+(m[1]<<8)+m[2];if(f===1){if(h=(m[4]<<8)+m[5],h&&h>d.size-6)return null;var y=m[7];y&192&&(r=(m[9]&14)*536870912+(m[10]&255)*4194304+(m[11]&254)*16384+(m[12]&255)*128+(m[13]&254)/2,y&64?(e=(m[14]&14)*536870912+(m[15]&255)*4194304+(m[16]&254)*16384+(m[17]&255)*128+(m[18]&254)/2,r-e>60*9e4&&(b.logger.warn(Math.round((r-e)/9e4)+"s delta between PTS and DTS, align them"),r=e)):e=r),a=m[8];var t=a+9;if(d.size<=t)return null;d.size-=t;for(var A=new Uint8Array(d.size),U=0,B=i.length;U<B;U++){m=i[U];var G=m.byteLength;if(t)if(t>G){t-=G;continue}else m=m.subarray(t),G-=t,t=0;A.set(m,o),o+=G}return h&&(h-=a+3),{data:A,pts:r,dts:e,len:h}}return null}function u(d,o){if(d.units.length&&d.frame){if(d.pts===void 0){var m=o.samples,h=m.length;if(h){var a=m[h-1];d.pts=a.pts,d.dts=a.dts}else{o.dropped++;return}}o.samples.push(d)}d.debug.length&&b.logger.log(d.pts+"/"+d.dts+":"+d.debug)}function l(d,o){var m=d.length;if(m>0){if(o.pts>=d[m-1].pts)d.push(o);else for(var h=m-1;h>=0;h--)if(o.pts<d[h].pts){d.splice(h,0,o);break}}else d.push(o)}function v(d){for(var o=d.byteLength,m=[],h=1;h<o-2;)d[h]===0&&d[h+1]===0&&d[h+2]===3?(m.push(h+2),h+=2):h++;if(m.length===0)return d;var a=o-m.length,r=new Uint8Array(a),e=0;for(h=0;h<a;e++,h++)e===m[0]&&(e++,m.shift()),r[h]=d[e];return r}j.default=C},"./src/errors.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"ErrorTypes",function(){return N}),O.d(j,"ErrorDetails",function(){return E});var N;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(N||(N={}));var E;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(E||(E={}))},"./src/events.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"Events",function(){return N});var N;(function(E){E.MEDIA_ATTACHING="hlsMediaAttaching",E.MEDIA_ATTACHED="hlsMediaAttached",E.MEDIA_DETACHING="hlsMediaDetaching",E.MEDIA_DETACHED="hlsMediaDetached",E.BUFFER_RESET="hlsBufferReset",E.BUFFER_CODECS="hlsBufferCodecs",E.BUFFER_CREATED="hlsBufferCreated",E.BUFFER_APPENDING="hlsBufferAppending",E.BUFFER_APPENDED="hlsBufferAppended",E.BUFFER_EOS="hlsBufferEos",E.BUFFER_FLUSHING="hlsBufferFlushing",E.BUFFER_FLUSHED="hlsBufferFlushed",E.MANIFEST_LOADING="hlsManifestLoading",E.MANIFEST_LOADED="hlsManifestLoaded",E.MANIFEST_PARSED="hlsManifestParsed",E.LEVEL_SWITCHING="hlsLevelSwitching",E.LEVEL_SWITCHED="hlsLevelSwitched",E.LEVEL_LOADING="hlsLevelLoading",E.LEVEL_LOADED="hlsLevelLoaded",E.LEVEL_UPDATED="hlsLevelUpdated",E.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",E.LEVELS_UPDATED="hlsLevelsUpdated",E.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",E.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",E.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",E.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",E.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",E.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",E.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",E.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",E.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",E.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",E.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",E.CUES_PARSED="hlsCuesParsed",E.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",E.INIT_PTS_FOUND="hlsInitPtsFound",E.FRAG_LOADING="hlsFragLoading",E.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",E.FRAG_LOADED="hlsFragLoaded",E.FRAG_DECRYPTED="hlsFragDecrypted",E.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",E.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",E.FRAG_PARSING_METADATA="hlsFragParsingMetadata",E.FRAG_PARSED="hlsFragParsed",E.FRAG_BUFFERED="hlsFragBuffered",E.FRAG_CHANGED="hlsFragChanged",E.FPS_DROP="hlsFpsDrop",E.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",E.ERROR="hlsError",E.DESTROYING="hlsDestroying",E.KEY_LOADING="hlsKeyLoading",E.KEY_LOADED="hlsKeyLoaded",E.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",E.BACK_BUFFER_REACHED="hlsBackBufferReached"})(N||(N={}))},"./src/hls.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return d});var N=O("./node_modules/url-toolkit/src/url-toolkit.js"),E=O.n(N),R=O("./src/loader/playlist-loader.ts"),I=O("./src/loader/key-loader.ts"),L=O("./src/controller/id3-track-controller.ts"),T=O("./src/controller/latency-controller.ts"),P=O("./src/controller/level-controller.ts"),b=O("./src/controller/fragment-tracker.ts"),S=O("./src/controller/stream-controller.ts"),w=O("./src/is-supported.ts"),C=O("./src/utils/logger.ts"),x=O("./src/config.ts"),_=O("./node_modules/eventemitter3/index.js"),p=O.n(_),n=O("./src/events.ts"),u=O("./src/errors.ts");function l(o,m){for(var h=0;h<m.length;h++){var a=m[h];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(o,a.key,a)}}function v(o,m,h){return m&&l(o.prototype,m),h&&l(o,h),o}var d=function(){o.isSupported=function(){return Object(w.isSupported)()};function o(h){h===void 0&&(h={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new _.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 a=this.config=Object(x.mergeConfig)(o.DefaultConfig,h);this.userConfig=h,Object(C.enableLogs)(a.debug),this._autoLevelCapping=-1,a.progressive&&Object(x.enableStreamingMode)(a);var r=a.abrController,e=a.bufferController,i=a.capLevelController,g=a.fpsController,f=this.abrController=new r(this),y=this.bufferController=new e(this),t=this.capLevelController=new i(this),A=new g(this),U=new R.default(this),B=new I.default(this),G=new L.default(this),J=this.levelController=new P.default(this),F=new b.FragmentTracker(this),q=this.streamController=new S.default(this,F);t.setStreamController(q),A.setStreamController(q);var re=[J,q];this.networkControllers=re;var ae=[U,B,f,y,t,A,G,F];this.audioTrackController=this.createController(a.audioTrackController,null,re),this.createController(a.audioStreamController,F,re),this.subtitleTrackController=this.createController(a.subtitleTrackController,null,re),this.createController(a.subtitleStreamController,F,re),this.createController(a.timelineController,null,ae),this.emeController=this.createController(a.emeController,null,ae),this.cmcdController=this.createController(a.cmcdController,null,ae),this.latencyController=this.createController(T.default,null,ae),this.coreComponents=ae}var m=o.prototype;return m.createController=function(a,r,e){if(a){var i=r?new a(this,r):new a(this);return e&&e.push(i),i}return null},m.on=function(a,r,e){e===void 0&&(e=this),this._emitter.on(a,r,e)},m.once=function(a,r,e){e===void 0&&(e=this),this._emitter.once(a,r,e)},m.removeAllListeners=function(a){this._emitter.removeAllListeners(a)},m.off=function(a,r,e,i){e===void 0&&(e=this),this._emitter.off(a,r,e,i)},m.listeners=function(a){return this._emitter.listeners(a)},m.emit=function(a,r,e){return this._emitter.emit(a,r,e)},m.trigger=function(a,r){if(this.config.debug)return this.emit(a,a,r);try{return this.emit(a,a,r)}catch(e){C.logger.error("An internal error happened while handling event "+a+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.trigger(n.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:a,error:e})}return!1},m.listenerCount=function(a){return this._emitter.listenerCount(a)},m.destroy=function(){C.logger.log("destroy"),this.trigger(n.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(a){return a.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(a){return a.destroy()}),this.coreComponents.length=0},m.attachMedia=function(a){C.logger.log("attachMedia"),this._media=a,this.trigger(n.Events.MEDIA_ATTACHING,{media:a})},m.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(n.Events.MEDIA_DETACHING,void 0),this._media=null},m.loadSource=function(a){this.stopLoad();var r=this.media,e=this.url,i=this.url=N.buildAbsoluteURL(self.location.href,a,{alwaysNormalize:!0});C.logger.log("loadSource:"+i),r&&e&&e!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(r)),this.trigger(n.Events.MANIFEST_LOADING,{url:a})},m.startLoad=function(a){a===void 0&&(a=-1),C.logger.log("startLoad("+a+")"),this.networkControllers.forEach(function(r){r.startLoad(a)})},m.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(a){a.stopLoad()})},m.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},m.recoverMediaError=function(){C.logger.log("recoverMediaError");var a=this._media;this.detachMedia(),a&&this.attachMedia(a)},m.removeLevel=function(a,r){r===void 0&&(r=0),this.levelController.removeLevel(a,r)},v(o,[{key:"levels",get:function(){var a=this.levelController.levels;return a||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(a){C.logger.log("set currentLevel:"+a),this.loadLevel=a,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(a){C.logger.log("set nextLevel:"+a),this.levelController.manualLevel=a,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(a){C.logger.log("set loadLevel:"+a),this.levelController.manualLevel=a}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(a){this.levelController.nextLoadLevel=a}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(a){C.logger.log("set firstLevel:"+a),this.levelController.firstLevel=a}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(a){C.logger.log("set startLevel:"+a),a!==-1&&(a=Math.max(a,this.minAutoLevel)),this.levelController.startLevel=a}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(a){var r=!!a;r!==this.config.capLevelToPlayerSize&&(r?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=r)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(a){this._autoLevelCapping!==a&&(C.logger.log("set autoLevelCapping:"+a),this._autoLevelCapping=a)}},{key:"bandwidthEstimate",get:function(){var a=this.abrController.bwEstimator;return a?a.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var a=this.levels,r=this.config.minAutoBitrate;if(!a)return 0;for(var e=a.length,i=0;i<e;i++)if(a[i].maxBitrate>r)return i;return 0}},{key:"maxAutoLevel",get:function(){var a=this.levels,r=this.autoLevelCapping,e;return r===-1&&a&&a.length?e=a.length-1:e=r,e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(a){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,a)}},{key:"audioTracks",get:function(){var a=this.audioTrackController;return a?a.audioTracks:[]}},{key:"audioTrack",get:function(){var a=this.audioTrackController;return a?a.audioTrack:-1},set:function(a){var r=this.audioTrackController;r&&(r.audioTrack=a)}},{key:"subtitleTracks",get:function(){var a=this.subtitleTrackController;return a?a.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var a=this.subtitleTrackController;return a?a.subtitleTrack:-1},set:function(a){var r=this.subtitleTrackController;r&&(r.subtitleTrack=a)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var a=this.subtitleTrackController;return a?a.subtitleDisplay:!1},set:function(a){var r=this.subtitleTrackController;r&&(r.subtitleDisplay=a)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(a){this.config.lowLatencyMode=a}},{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}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return n.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return o.defaultConfig?o.defaultConfig:x.hlsDefaultConfig},set:function(a){o.defaultConfig=a}}]),o}();d.defaultConfig=void 0},"./src/is-supported.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"isSupported",function(){return R}),O.d(j,"changeTypeSupported",function(){return I});var N=O("./src/utils/mediasource-helper.ts");function E(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var L=Object(N.getMediaSource)();if(!L)return!1;var T=E(),P=L&&typeof L.isTypeSupported=="function"&&L.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!T||T.prototype&&typeof T.prototype.appendBuffer=="function"&&typeof T.prototype.remove=="function";return!!P&&!!b}function I(){var L,T=E();return typeof(T==null||((L=T.prototype)===null||L===void 0)?void 0:L.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return C}),O.d(j,"LoadError",function(){return _});var N=O("./src/polyfills/number.ts"),E=O("./src/errors.ts");function R(p,n){p.prototype=Object.create(n.prototype),p.prototype.constructor=p,b(p,n)}function I(p){var n=typeof Map=="function"?new Map:void 0;return I=function(l){if(l===null||!P(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n!="undefined"){if(n.has(l))return n.get(l);n.set(l,v)}function v(){return L(l,arguments,S(this).constructor)}return v.prototype=Object.create(l.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),b(v,l)},I(p)}function L(p,n,u){return T()?L=Reflect.construct:L=function(v,d,o){var m=[null];m.push.apply(m,d);var h=Function.bind.apply(v,m),a=new h;return o&&b(a,o.prototype),a},L.apply(null,arguments)}function T(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(p){return!1}}function P(p){return Function.toString.call(p).indexOf("[native code]")!==-1}function b(p,n){return b=Object.setPrototypeOf||function(l,v){return l.__proto__=v,l},b(p,n)}function S(p){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},S(p)}var w=Math.pow(2,17),C=function(){function p(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var n=p.prototype;return n.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},n.abort=function(){this.loader&&this.loader.abort()},n.load=function(l,v){var d=this,o=l.url;if(!o)return Promise.reject(new _({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(o?"part list":"url")));this.abort();var m=this.config,h=m.fLoader,a=m.loader;return new Promise(function(r,e){d.loader&&d.loader.destroy();var i=d.loader=l.loader=h?new h(m):new a(m),g=x(l),f={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:w};l.stats=i.stats,i.load(g,f,{onSuccess:function(t,A,U,B){d.resetLoader(l,i),r({frag:l,part:null,payload:t.data,networkDetails:B})},onError:function(t,A,U){d.resetLoader(l,i),e(new _({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:t,networkDetails:U}))},onAbort:function(t,A,U){d.resetLoader(l,i),e(new _({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:U}))},onTimeout:function(t,A,U){d.resetLoader(l,i),e(new _({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:U}))},onProgress:function(t,A,U,B){v&&v({frag:l,part:null,payload:U,networkDetails:B})}})})},n.loadPart=function(l,v,d){var o=this;this.abort();var m=this.config,h=m.fLoader,a=m.loader;return new Promise(function(r,e){o.loader&&o.loader.destroy();var i=o.loader=l.loader=h?new h(m):new a(m),g=x(l,v),f={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:w};v.stats=i.stats,i.load(g,f,{onSuccess:function(t,A,U,B){o.resetLoader(l,i),o.updateStatsFromPart(l,v);var G={frag:l,part:v,payload:t.data,networkDetails:B};d(G),r(G)},onError:function(t,A,U){o.resetLoader(l,i),e(new _({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:v,response:t,networkDetails:U}))},onAbort:function(t,A,U){l.stats.aborted=v.stats.aborted,o.resetLoader(l,i),e(new _({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:v,networkDetails:U}))},onTimeout:function(t,A,U){o.resetLoader(l,i),e(new _({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:v,networkDetails:U}))}})})},n.updateStatsFromPart=function(l,v){var d=l.stats,o=v.stats,m=o.total;if(d.loaded+=o.loaded,m){var h=Math.round(l.duration/v.duration),a=Math.min(Math.round(d.loaded/m),h),r=h-a,e=r*Math.round(d.loaded/a);d.total=d.loaded+e}else d.total=Math.max(d.loaded,d.total);var i=d.loading,g=o.loading;i.start?i.first+=g.first-g.start:(i.start=g.start,i.first=g.first),i.end=g.end},n.resetLoader=function(l,v){l.loader=null,this.loader===v&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),v.destroy()},p}();function x(p,n){n===void 0&&(n=null);var u=n||p,l={frag:p,part:n,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},v=u.byteRangeStartOffset,d=u.byteRangeEndOffset;return Object(N.isFiniteNumber)(v)&&Object(N.isFiniteNumber)(d)&&(l.rangeStart=v,l.rangeEnd=d),l}var _=function(p){R(n,p);function n(u){for(var l,v=arguments.length,d=new Array(v>1?v-1:0),o=1;o<v;o++)d[o-1]=arguments[o];return l=p.call.apply(p,[this].concat(d))||this,l.data=void 0,l.data=u,l}return n}(I(Error))},"./src/loader/fragment.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"ElementaryStreamTypes",function(){return C}),O.d(j,"BaseSegment",function(){return x}),O.d(j,"Fragment",function(){return _}),O.d(j,"Part",function(){return p});var N=O("./src/polyfills/number.ts"),E=O("./node_modules/url-toolkit/src/url-toolkit.js"),R=O.n(E),I=O("./src/utils/logger.ts"),L=O("./src/loader/level-key.ts"),T=O("./src/loader/load-stats.ts");function P(n,u){n.prototype=Object.create(u.prototype),n.prototype.constructor=n,b(n,u)}function b(n,u){return b=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},b(n,u)}function S(n,u){for(var l=0;l<u.length;l++){var v=u[l];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(n,v.key,v)}}function w(n,u,l){return u&&S(n.prototype,u),l&&S(n,l),n}var C;(function(n){n.AUDIO="audio",n.VIDEO="video",n.AUDIOVIDEO="audiovideo"})(C||(C={}));var x=function(){function n(l){var v;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(v={},v[C.AUDIO]=null,v[C.VIDEO]=null,v[C.AUDIOVIDEO]=null,v),this.baseurl=l}var u=n.prototype;return u.setByteRange=function(v,d){var o=v.split("@",2),m=[];o.length===1?m[0]=d?d.byteRangeEndOffset:0:m[0]=parseInt(o[1]),m[1]=parseInt(o[0])+m[0],this._byteRange=m},w(n,[{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(E.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(v){this._url=v}}]),n}(),_=function(n){P(u,n);function u(v,d){var o;return o=n.call(this,d)||this,o._decryptdata=null,o.rawProgramDateTime=null,o.programDateTime=null,o.tagList=[],o.duration=0,o.sn=0,o.levelkey=void 0,o.type=void 0,o.loader=null,o.level=-1,o.cc=0,o.startPTS=void 0,o.endPTS=void 0,o.appendedPTS=void 0,o.startDTS=void 0,o.endDTS=void 0,o.start=0,o.deltaPTS=void 0,o.maxStartPTS=void 0,o.minEndPTS=void 0,o.stats=new T.LoadStats,o.urlId=0,o.data=void 0,o.bitrateTest=!1,o.title=null,o.initSegment=null,o.type=v,o}var l=u.prototype;return l.createInitializationVector=function(d){for(var o=new Uint8Array(16),m=12;m<16;m++)o[m]=d>>8*(15-m)&255;return o},l.setDecryptDataFromLevelKey=function(d,o){var m=d;return(d==null?void 0:d.method)==="AES-128"&&d.uri&&!d.iv&&(m=L.LevelKey.fromURI(d.uri),m.method=d.method,m.iv=this.createInitializationVector(o),m.keyFormat="identity"),m},l.setElementaryStreamInfo=function(d,o,m,h,a,r){r===void 0&&(r=!1);var e=this.elementaryStreams,i=e[d];if(!i){e[d]={startPTS:o,endPTS:m,startDTS:h,endDTS:a,partial:r};return}i.startPTS=Math.min(i.startPTS,o),i.endPTS=Math.max(i.endPTS,m),i.startDTS=Math.min(i.startDTS,h),i.endDTS=Math.max(i.endDTS,a)},l.clearElementaryStreamInfo=function(){var d=this.elementaryStreams;d[C.AUDIO]=null,d[C.VIDEO]=null,d[C.AUDIOVIDEO]=null},w(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var d=this.sn;typeof d!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&I.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),d=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,d)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(N.isFiniteNumber)(this.programDateTime))return null;var d=Object(N.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+d*1e3}},{key:"encrypted",get:function(){var d;return!!((d=this.decryptdata)!==null&&d!==void 0&&d.keyFormat&&this.decryptdata.uri)}}]),u}(x),p=function(n){P(u,n);function u(l,v,d,o,m){var h;h=n.call(this,d)||this,h.fragOffset=0,h.duration=0,h.gap=!1,h.independent=!1,h.relurl=void 0,h.fragment=void 0,h.index=void 0,h.stats=new T.LoadStats,h.duration=l.decimalFloatingPoint("DURATION"),h.gap=l.bool("GAP"),h.independent=l.bool("INDEPENDENT"),h.relurl=l.enumeratedString("URI"),h.fragment=v,h.index=o;var a=l.enumeratedString("BYTERANGE");return a&&h.setByteRange(a,m),m&&(h.fragOffset=m.fragOffset+m.duration),h}return w(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var v=this.elementaryStreams;return!!(v.audio||v.video||v.audiovideo)}}]),u}(x)},"./src/loader/key-loader.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return I});var N=O("./src/events.ts"),E=O("./src/errors.ts"),R=O("./src/utils/logger.ts"),I=function(){function L(P){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=P,this._registerListeners()}var T=L.prototype;return T._registerListeners=function(){this.hls.on(N.Events.KEY_LOADING,this.onKeyLoading,this)},T._unregisterListeners=function(){this.hls.off(N.Events.KEY_LOADING,this.onKeyLoading)},T.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var S=this.loaders[b];S&&S.destroy()}this.loaders={}},T.onKeyLoading=function(b,S){var w=S.frag,C=w.type,x=this.loaders[C];if(!w.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var _=w.decryptdata.uri;if(_!==this.decrypturl||this.decryptkey===null){var p=this.hls.config;if(x&&(R.logger.warn("abort previous key loader for type:"+C),x.abort()),!_){R.logger.warn("key uri is falsy");return}var n=p.loader,u=w.loader=this.loaders[C]=new n(p);this.decrypturl=_,this.decryptkey=null;var l={url:_,frag:w,responseType:"arraybuffer"},v={timeout:p.fragLoadingTimeOut,maxRetry:0,retryDelay:p.fragLoadingRetryDelay,maxRetryDelay:p.fragLoadingMaxRetryTimeout,highWaterMark:0},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(l,v,d)}else this.decryptkey&&(w.decryptdata.key=this.decryptkey,this.hls.trigger(N.Events.KEY_LOADED,{frag:w}))},T.loadsuccess=function(b,S,w){var C=w.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(b.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(N.Events.KEY_LOADED,{frag:C})},T.loaderror=function(b,S){var w=S.frag,C=w.loader;C&&C.abort(),delete this.loaders[w.type],this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:w,response:b})},T.loadtimeout=function(b,S){var w=S.frag,C=w.loader;C&&C.abort(),delete this.loaders[w.type],this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:w})},L}()},"./src/loader/level-details.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"LevelDetails",function(){return L});var N=O("./src/polyfills/number.ts");function E(T,P){for(var b=0;b<P.length;b++){var S=P[b];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(T,S.key,S)}}function R(T,P,b){return P&&E(T.prototype,P),b&&E(T,b),T}var I=10,L=function(){function T(b){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=b}var P=T.prototype;return P.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var w=this.lastPartSn-S.lastPartSn,C=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!C||!!w,this.advanced=this.endSN>S.endSN||w>0||w===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(S.misses*.6):this.misses=S.misses+1,this.availabilityDelay=S.availabilityDelay},R(T,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(N.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||I}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var w=this.driftEnd-this.driftStart;return w*1e3/S}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var S;return(S=this.fragments)!==null&&S!==void 0&&S.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 S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),T}()},"./src/loader/level-key.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"LevelKey",function(){return L});var N=O("./node_modules/url-toolkit/src/url-toolkit.js"),E=O.n(N);function R(T,P){for(var b=0;b<P.length;b++){var S=P[b];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(T,S.key,S)}}function I(T,P,b){return P&&R(T.prototype,P),b&&R(T,b),T}var L=function(){T.fromURL=function(b,S){return new T(b,S)},T.fromURI=function(b){return new T(b)};function T(P,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(N.buildAbsoluteURL)(P,b,{alwaysNormalize:!0}):this._uri=P}return I(T,[{key:"uri",get:function(){return this._uri}}]),T}()},"./src/loader/load-stats.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"LoadStats",function(){return N});var N=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return u});var N=O("./src/polyfills/number.ts"),E=O("./node_modules/url-toolkit/src/url-toolkit.js"),R=O.n(E),I=O("./src/loader/fragment.ts"),L=O("./src/loader/level-details.ts"),T=O("./src/loader/level-key.ts"),P=O("./src/utils/attr-list.ts"),b=O("./src/utils/logger.ts"),S=O("./src/utils/codecs.ts"),w=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,x=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),_=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("|")),p=/\.(mp4|m4s|m4v|m4a)$/i;function n(m){var h,a;return p.test((h=(a=E.parseURL(m))===null||a===void 0?void 0:a.path)!=null?h:"")}var u=function(){function m(){}return m.findGroup=function(a,r){for(var e=0;e<a.length;e++){var i=a[e];if(i.id===r)return i}},m.convertAVC1ToAVCOTI=function(a){var r=a.split(".");if(r.length>2){var e=r.shift()+".";return e+=parseInt(r.shift()).toString(16),e+=("000"+parseInt(r.shift()).toString(16)).substr(-4),e}return a},m.resolve=function(a,r){return E.buildAbsoluteURL(r,a,{alwaysNormalize:!0})},m.parseMasterPlaylist=function(a,r){var e=[],i={},g=!1;w.lastIndex=0;for(var f;(f=w.exec(a))!=null;)if(f[1]){var y=new P.AttrList(f[1]),t={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:m.resolve(f[2],r)},A=y.decimalResolution("RESOLUTION");A&&(t.width=A.width,t.height=A.height),l((y.CODECS||"").split(/[ ,]+/).filter(function(B){return B}),t),t.videoCodec&&t.videoCodec.indexOf("avc1")!==-1&&(t.videoCodec=m.convertAVC1ToAVCOTI(t.videoCodec)),e.push(t)}else if(f[3]){var U=new P.AttrList(f[3]);U["DATA-ID"]&&(g=!0,i[U["DATA-ID"]]=U)}return{levels:e,sessionData:g?i:null}},m.parseMasterPlaylistMedia=function(a,r,e,i){i===void 0&&(i=[]);var g,f=[],y=0;for(C.lastIndex=0;(g=C.exec(a))!==null;){var t=new P.AttrList(g[1]);if(t.TYPE===e){var A={attrs:t,bitrate:0,id:y++,groupId:t["GROUP-ID"],instreamId:t["INSTREAM-ID"],name:t.NAME||t.LANGUAGE||"",type:e,default:t.bool("DEFAULT"),autoselect:t.bool("AUTOSELECT"),forced:t.bool("FORCED"),lang:t.LANGUAGE,url:t.URI?m.resolve(t.URI,r):""};if(i.length){var U=m.findGroup(i,A.groupId)||i[0];v(A,U,"audioCodec"),v(A,U,"textCodec")}f.push(A)}}return f},m.parseLevelPlaylist=function(a,r,e,i,g){var f=new L.LevelDetails(r),y=f.fragments,t=null,A=0,U=0,B=0,G=0,J=null,F=new I.Fragment(i,r),q,re,ae,ve=-1,de=!1;for(x.lastIndex=0,f.m3u8=a;(q=x.exec(a))!==null;){de&&(de=!1,F=new I.Fragment(i,r),F.start=B,F.sn=A,F.cc=G,F.level=e,t&&(F.initSegment=t,F.rawProgramDateTime=t.rawProgramDateTime));var Z=q[1];if(Z){F.duration=parseFloat(Z);var ee=(" "+q[2]).slice(1);F.title=ee||null,F.tagList.push(ee?["INF",Z,ee]:["INF",Z])}else if(q[3])Object(N.isFiniteNumber)(F.duration)&&(F.start=B,ae&&(F.levelkey=ae),F.sn=A,F.level=e,F.cc=G,F.urlId=g,y.push(F),F.relurl=(" "+q[3]).slice(1),o(F,J),J=F,B+=F.duration,A++,U=0,de=!0);else if(q[4]){var pe=(" "+q[4]).slice(1);J?F.setByteRange(pe,J):F.setByteRange(pe)}else if(q[5])F.rawProgramDateTime=(" "+q[5]).slice(1),F.tagList.push(["PROGRAM-DATE-TIME",F.rawProgramDateTime]),ve===-1&&(ve=y.length);else{if(q=q[0].match(_),!q){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(re=1;re<q.length&&!(typeof q[re]!="undefined");re++);var Q=(" "+q[re]).slice(1),V=(" "+q[re+1]).slice(1),Ce=q[re+2]?(" "+q[re+2]).slice(1):"";switch(Q){case"PLAYLIST-TYPE":f.type=V.toUpperCase();break;case"MEDIA-SEQUENCE":A=f.startSN=parseInt(V);break;case"SKIP":{var De=new P.AttrList(V),Ne=De.decimalInteger("SKIPPED-SEGMENTS");if(Object(N.isFiniteNumber)(Ne)){f.skippedSegments=Ne;for(var we=Ne;we--;)y.unshift(null);A+=Ne}var ke=De.enumeratedString("RECENTLY-REMOVED-DATERANGES");ke&&(f.recentlyRemovedDateranges=ke.split(" "));break}case"TARGETDURATION":f.targetduration=parseFloat(V);break;case"VERSION":f.version=parseInt(V);break;case"EXTM3U":break;case"ENDLIST":f.live=!1;break;case"#":(V||Ce)&&F.tagList.push(Ce?[V,Ce]:[V]);break;case"DIS":G++;case"GAP":F.tagList.push([Q]);break;case"BITRATE":F.tagList.push([Q,V]);break;case"DISCONTINUITY-SEQ":G=parseInt(V);break;case"KEY":{var Se,Ae=new P.AttrList(V),je=Ae.enumeratedString("METHOD"),Be=Ae.URI,Ke=Ae.hexadecimalInteger("IV"),Ue=Ae.enumeratedString("KEYFORMATVERSIONS"),xe=Ae.enumeratedString("KEYID"),Ge=(Se=Ae.enumeratedString("KEYFORMAT"))!=null?Se:"identity",qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(qe.indexOf(Ge)>-1){b.logger.warn("Keyformat "+Ge+" is not supported from the manifest");continue}else if(Ge!=="identity")continue;je&&(ae=T.LevelKey.fromURL(r,Be),Be&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(je)>=0&&(ae.method=je,ae.keyFormat=Ge,xe&&(ae.keyID=xe),Ue&&(ae.keyFormatVersions=Ue),ae.iv=Ke));break}case"START":{var lt=new P.AttrList(V),ot=lt.decimalFloatingPoint("TIME-OFFSET");Object(N.isFiniteNumber)(ot)&&(f.startTimeOffset=ot);break}case"MAP":{var bt=new P.AttrList(V);F.relurl=bt.URI,bt.BYTERANGE&&F.setByteRange(bt.BYTERANGE),F.level=e,F.sn="initSegment",ae&&(F.levelkey=ae),F.initSegment=null,t=F,de=!0;break}case"SERVER-CONTROL":{var ht=new P.AttrList(V);f.canBlockReload=ht.bool("CAN-BLOCK-RELOAD"),f.canSkipUntil=ht.optionalFloat("CAN-SKIP-UNTIL",0),f.canSkipDateRanges=f.canSkipUntil>0&&ht.bool("CAN-SKIP-DATERANGES"),f.partHoldBack=ht.optionalFloat("PART-HOLD-BACK",0),f.holdBack=ht.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ut=new P.AttrList(V);f.partTarget=ut.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ze=f.partList;Ze||(Ze=f.partList=[]);var Et=U>0?Ze[Ze.length-1]:void 0,St=U++,He=new I.Part(new P.AttrList(V),F,r,St,Et);Ze.push(He),F.duration+=He.duration;break}case"PRELOAD-HINT":{var it=new P.AttrList(V);f.preloadHint=it;break}case"RENDITION-REPORT":{var ye=new P.AttrList(V);f.renditionReports=f.renditionReports||[],f.renditionReports.push(ye);break}default:b.logger.warn("line parsed but not handled: "+q);break}}}J&&!J.relurl?(y.pop(),B-=J.duration,f.partList&&(f.fragmentHint=J)):f.partList&&(o(F,J),F.cc=G,f.fragmentHint=F);var he=y.length,fe=y[0],X=y[he-1];if(B+=f.skippedSegments*f.targetduration,B>0&&he&&X){f.averagetargetduration=B/he;var $=X.sn;f.endSN=$!=="initSegment"?$:0,fe&&(f.startCC=fe.cc,fe.initSegment||f.fragments.every(function(te){return te.relurl&&n(te.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),F=new I.Fragment(i,r),F.relurl=X.relurl,F.level=e,F.sn="initSegment",fe.initSegment=F,f.needSidxRanges=!0))}else f.endSN=0,f.startCC=0;return f.fragmentHint&&(B+=f.fragmentHint.duration),f.totalduration=B,f.endCC=G,ve>0&&d(y,ve),f},m}();function l(m,h){["video","audio","text"].forEach(function(a){var r=m.filter(function(i){return Object(S.isCodecType)(i,a)});if(r.length){var e=r.filter(function(i){return i.lastIndexOf("avc1",0)===0||i.lastIndexOf("mp4a",0)===0});h[a+"Codec"]=e.length>0?e[0]:r[0],m=m.filter(function(i){return r.indexOf(i)===-1})}}),h.unknownCodecs=m}function v(m,h,a){var r=h[a];r&&(m[a]=r)}function d(m,h){for(var a=m[h],r=h;r--;){var e=m[r];if(!e)return;e.programDateTime=a.programDateTime-e.duration*1e3,a=e}}function o(m,h){m.rawProgramDateTime?m.programDateTime=Date.parse(m.rawProgramDateTime):h!=null&&h.programDateTime&&(m.programDateTime=h.endProgramDateTime),Object(N.isFiniteNumber)(m.programDateTime)||(m.programDateTime=null,m.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/polyfills/number.ts"),E=O("./src/events.ts"),R=O("./src/errors.ts"),I=O("./src/utils/logger.ts"),L=O("./src/utils/mp4-tools.ts"),T=O("./src/loader/m3u8-parser.ts"),P=O("./src/types/loader.ts"),b=O("./src/utils/attr-list.ts");function S(x){var _=x.type;switch(_){case P.PlaylistContextType.AUDIO_TRACK:return P.PlaylistLevelType.AUDIO;case P.PlaylistContextType.SUBTITLE_TRACK:return P.PlaylistLevelType.SUBTITLE;default:return P.PlaylistLevelType.MAIN}}function w(x,_){var p=x.url;return(p===void 0||p.indexOf("data:")===0)&&(p=_.url),p}var C=function(){function x(p){this.hls=void 0,this.loaders=Object.create(null),this.hls=p,this.registerListeners()}var _=x.prototype;return _.registerListeners=function(){var n=this.hls;n.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(E.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(E.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.on(E.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},_.unregisterListeners=function(){var n=this.hls;n.off(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(E.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(E.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.off(E.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},_.createInternalLoader=function(n){var u=this.hls.config,l=u.pLoader,v=u.loader,d=l||v,o=new d(u);return n.loader=o,this.loaders[n.type]=o,o},_.getInternalLoader=function(n){return this.loaders[n.type]},_.resetInternalLoader=function(n){this.loaders[n]&&delete this.loaders[n]},_.destroyInternalLoaders=function(){for(var n in this.loaders){var u=this.loaders[n];u&&u.destroy(),this.resetInternalLoader(n)}},_.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},_.onManifestLoading=function(n,u){var l=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:P.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},_.onLevelLoading=function(n,u){var l=u.id,v=u.level,d=u.url,o=u.deliveryDirectives;this.load({id:l,groupId:null,level:v,responseType:"text",type:P.PlaylistContextType.LEVEL,url:d,deliveryDirectives:o})},_.onAudioTrackLoading=function(n,u){var l=u.id,v=u.groupId,d=u.url,o=u.deliveryDirectives;this.load({id:l,groupId:v,level:null,responseType:"text",type:P.PlaylistContextType.AUDIO_TRACK,url:d,deliveryDirectives:o})},_.onSubtitleTrackLoading=function(n,u){var l=u.id,v=u.groupId,d=u.url,o=u.deliveryDirectives;this.load({id:l,groupId:v,level:null,responseType:"text",type:P.PlaylistContextType.SUBTITLE_TRACK,url:d,deliveryDirectives:o})},_.load=function(n){var u,l=this.hls.config,v=this.getInternalLoader(n);if(v){var d=v.context;if(d&&d.url===n.url){I.logger.trace("[playlist-loader]: playlist request ongoing");return}I.logger.log("[playlist-loader]: aborting previous loader for type: "+n.type),v.abort()}var o,m,h,a;switch(n.type){case P.PlaylistContextType.MANIFEST:o=l.manifestLoadingMaxRetry,m=l.manifestLoadingTimeOut,h=l.manifestLoadingRetryDelay,a=l.manifestLoadingMaxRetryTimeout;break;case P.PlaylistContextType.LEVEL:case P.PlaylistContextType.AUDIO_TRACK:case P.PlaylistContextType.SUBTITLE_TRACK:o=0,m=l.levelLoadingTimeOut;break;default:o=l.levelLoadingMaxRetry,m=l.levelLoadingTimeOut,h=l.levelLoadingRetryDelay,a=l.levelLoadingMaxRetryTimeout;break}if(v=this.createInternalLoader(n),(u=n.deliveryDirectives)!==null&&u!==void 0&&u.part){var r;if(n.type===P.PlaylistContextType.LEVEL&&n.level!==null?r=this.hls.levels[n.level].details:n.type===P.PlaylistContextType.AUDIO_TRACK&&n.id!==null?r=this.hls.audioTracks[n.id].details:n.type===P.PlaylistContextType.SUBTITLE_TRACK&&n.id!==null&&(r=this.hls.subtitleTracks[n.id].details),r){var e=r.partTarget,i=r.targetduration;e&&i&&(m=Math.min(Math.max(e*3,i*.8)*1e3,m))}}var g={timeout:m,maxRetry:o,retryDelay:h,maxRetryDelay:a,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};v.load(n,g,f)},_.loadsuccess=function(n,u,l,v){if(v===void 0&&(v=null),l.isSidxRequest){this.handleSidxRequest(n,l),this.handlePlaylistLoaded(n,u,l,v);return}this.resetInternalLoader(l.type);var d=n.data;if(d.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(n,l,"no EXTM3U delimiter",v);return}u.parsing.start=performance.now(),d.indexOf("#EXTINF:")>0||d.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(n,u,l,v):this.handleMasterPlaylist(n,u,l,v)},_.loaderror=function(n,u,l){l===void 0&&(l=null),this.handleNetworkError(u,l,!1,n)},_.loadtimeout=function(n,u,l){l===void 0&&(l=null),this.handleNetworkError(u,l,!0)},_.handleMasterPlaylist=function(n,u,l,v){var d=this.hls,o=n.data,m=w(n,l),h=T.default.parseMasterPlaylist(o,m),a=h.levels,r=h.sessionData;if(!a.length){this.handleManifestParsingError(n,l,"no level found in manifest",v);return}var e=a.map(function(A){return{id:A.attrs.AUDIO,audioCodec:A.audioCodec}}),i=a.map(function(A){return{id:A.attrs.SUBTITLES,textCodec:A.textCodec}}),g=T.default.parseMasterPlaylistMedia(o,m,"AUDIO",e),f=T.default.parseMasterPlaylistMedia(o,m,"SUBTITLES",i),y=T.default.parseMasterPlaylistMedia(o,m,"CLOSED-CAPTIONS");if(g.length){var t=g.some(function(A){return!A.url});!t&&a[0].audioCodec&&!a[0].attrs.AUDIO&&(I.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}d.trigger(E.Events.MANIFEST_LOADED,{levels:a,audioTracks:g,subtitles:f,captions:y,url:m,stats:u,networkDetails:v,sessionData:r})},_.handleTrackOrLevelPlaylist=function(n,u,l,v){var d=this.hls,o=l.id,m=l.level,h=l.type,a=w(n,l),r=Object(N.isFiniteNumber)(o)?o:0,e=Object(N.isFiniteNumber)(m)?m:r,i=S(l),g=T.default.parseLevelPlaylist(n.data,a,e,i,r);if(!g.fragments.length){d.trigger(E.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:a,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(h===P.PlaylistContextType.MANIFEST){var f={attrs:new b.AttrList({}),bitrate:0,details:g,name:"",url:a};d.trigger(E.Events.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:a,stats:u,networkDetails:v,sessionData:null})}if(u.parsing.end=performance.now(),g.needSidxRanges){var y,t=(y=g.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:t,isSidxRequest:!0,type:h,level:m,levelDetails:g,id:o,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=g,this.handlePlaylistLoaded(n,u,l,v)},_.handleSidxRequest=function(n,u){var l=Object(L.parseSegmentIndex)(new Uint8Array(n.data));if(!l)return;var v=l.references,d=u.levelDetails;v.forEach(function(o,m){var h=o.info,a=d.fragments[m];a.byteRange.length===0&&a.setByteRange(String(1+h.end-h.start)+"@"+String(h.start)),a.initSegment&&a.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},_.handleManifestParsingError=function(n,u,l,v){this.hls.trigger(E.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===P.PlaylistContextType.MANIFEST,url:n.url,reason:l,response:n,context:u,networkDetails:v})},_.handleNetworkError=function(n,u,l,v){l===void 0&&(l=!1),I.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+n.type+" level: "+n.level+" id: "+n.id+' group-id: "'+n.groupId+'"');var d=R.ErrorDetails.UNKNOWN,o=!1,m=this.getInternalLoader(n);switch(n.type){case P.PlaylistContextType.MANIFEST:d=l?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,o=!0;break;case P.PlaylistContextType.LEVEL:d=l?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,o=!1;break;case P.PlaylistContextType.AUDIO_TRACK:d=l?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,o=!1;break;case P.PlaylistContextType.SUBTITLE_TRACK:d=l?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,o=!1;break}m&&this.resetInternalLoader(n.type);var h={type:R.ErrorTypes.NETWORK_ERROR,details:d,fatal:o,url:n.url,loader:m,context:n,networkDetails:u};v&&(h.response=v),this.hls.trigger(E.Events.ERROR,h)},_.handlePlaylistLoaded=function(n,u,l,v){var d=l.type,o=l.level,m=l.id,h=l.groupId,a=l.loader,r=l.levelDetails,e=l.deliveryDirectives;if(!(r!=null&&r.targetduration)){this.handleManifestParsingError(n,l,"invalid target duration",v);return}if(!a)return;r.live&&(a.getCacheAge&&(r.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(r.ageHeader))&&(r.ageHeader=0));switch(d){case P.PlaylistContextType.MANIFEST:case P.PlaylistContextType.LEVEL:this.hls.trigger(E.Events.LEVEL_LOADED,{details:r,level:o||0,id:m||0,stats:u,networkDetails:v,deliveryDirectives:e});break;case P.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(E.Events.AUDIO_TRACK_LOADED,{details:r,id:m||0,groupId:h||"",stats:u,networkDetails:v,deliveryDirectives:e});break;case P.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(E.Events.SUBTITLE_TRACK_LOADED,{details:r,id:m||0,groupId:h||"",stats:u,networkDetails:v,deliveryDirectives:e});break}},x}();j.default=C},"./src/polyfills/number.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"isFiniteNumber",function(){return N}),O.d(j,"MAX_SAFE_INTEGER",function(){return E});var N=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},E=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(Ee,j,O){"use strict";O.r(j);var N=function(){function E(){}return E.getSilentFrame=function(I,L){switch(I){case"mp4a.40.2":if(L===1)return new Uint8Array([0,200,0,128,35,128]);if(L===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(L===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(L===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(L===5)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(L===6)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(L===1)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(L===2)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(L===3)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]);break}return},E}();j.default=N},"./src/remux/mp4-generator.ts":function(Ee,j,O){"use strict";O.r(j);var N=Math.pow(2,32)-1,E=function(){function R(){}return R.init=function(){R.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:[]};var L;for(L in R.types)R.types.hasOwnProperty(L)&&(R.types[L]=[L.charCodeAt(0),L.charCodeAt(1),L.charCodeAt(2),L.charCodeAt(3)]);var T=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]),P=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]);R.HDLR_TYPES={video:T,audio:P};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),S=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=S,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var w=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,w,x,w,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,b))},R.box=function(L){for(var T=8,P=arguments.length,b=new Array(P>1?P-1:0),S=1;S<P;S++)b[S-1]=arguments[S];for(var w=b.length,C=w;w--;)T+=b[w].byteLength;var x=new Uint8Array(T);for(x[0]=T>>24&255,x[1]=T>>16&255,x[2]=T>>8&255,x[3]=T&255,x.set(L,4),w=0,T=8;w<C;w++)x.set(b[w],T),T+=b[w].byteLength;return x},R.hdlr=function(L){return R.box(R.types.hdlr,R.HDLR_TYPES[L])},R.mdat=function(L){return R.box(R.types.mdat,L)},R.mdhd=function(L,T){T*=L;var P=Math.floor(T/(N+1)),b=Math.floor(T%(N+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,L>>24&255,L>>16&255,L>>8&255,L&255,P>>24,P>>16&255,P>>8&255,P&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},R.mdia=function(L){return R.box(R.types.mdia,R.mdhd(L.timescale,L.duration),R.hdlr(L.type),R.minf(L))},R.mfhd=function(L){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,L>>24,L>>16&255,L>>8&255,L&255]))},R.minf=function(L){return L.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(L)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(L))},R.moof=function(L,T,P){return R.box(R.types.moof,R.mfhd(L),R.traf(P,T))},R.moov=function(L){for(var T=L.length,P=[];T--;)P[T]=R.trak(L[T]);return R.box.apply(null,[R.types.moov,R.mvhd(L[0].timescale,L[0].duration)].concat(P).concat(R.mvex(L)))},R.mvex=function(L){for(var T=L.length,P=[];T--;)P[T]=R.trex(L[T]);return R.box.apply(null,[R.types.mvex].concat(P))},R.mvhd=function(L,T){T*=L;var P=Math.floor(T/(N+1)),b=Math.floor(T%(N+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,L>>24&255,L>>16&255,L>>8&255,L&255,P>>24,P>>16&255,P>>8&255,P&255,b>>24,b>>16&255,b>>8&255,b&255,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 R.box(R.types.mvhd,S)},R.sdtp=function(L){var T=L.samples||[],P=new Uint8Array(4+T.length),b,S;for(b=0;b<T.length;b++)S=T[b].flags,P[b+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return R.box(R.types.sdtp,P)},R.stbl=function(L){return R.box(R.types.stbl,R.stsd(L),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(L){var T=[],P=[],b,S,w;for(b=0;b<L.sps.length;b++)S=L.sps[b],w=S.byteLength,T.push(w>>>8&255),T.push(w&255),T=T.concat(Array.prototype.slice.call(S));for(b=0;b<L.pps.length;b++)S=L.pps[b],w=S.byteLength,P.push(w>>>8&255),P.push(w&255),P=P.concat(Array.prototype.slice.call(S));var C=R.box(R.types.avcC,new Uint8Array([1,T[3],T[4],T[5],252|3,224|L.sps.length].concat(T).concat([L.pps.length]).concat(P))),x=L.width,_=L.height,p=L.pixelRatio[0],n=L.pixelRatio[1];return R.box(R.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,x>>8&255,x&255,_>>8&255,_&255,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]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([p>>24,p>>16&255,p>>8&255,p&255,n>>24,n>>16&255,n>>8&255,n&255])))},R.esds=function(L){var T=L.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(L.config).concat([6,1,2]))},R.mp4a=function(L){var T=L.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,L.channelCount,0,16,0,0,0,0,T>>8&255,T&255,0,0]),R.box(R.types.esds,R.esds(L)))},R.mp3=function(L){var T=L.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,L.channelCount,0,16,0,0,0,0,T>>8&255,T&255,0,0]))},R.stsd=function(L){return L.type==="audio"?!L.isAAC&&L.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(L)):R.box(R.types.stsd,R.STSD,R.mp4a(L)):R.box(R.types.stsd,R.STSD,R.avc1(L))},R.tkhd=function(L){var T=L.id,P=L.duration*L.timescale,b=L.width,S=L.height,w=Math.floor(P/(N+1)),C=Math.floor(P%(N+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,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,T&255,0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,C>>24,C>>16&255,C>>8&255,C&255,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,b>>8&255,b&255,0,0,S>>8&255,S&255,0,0]))},R.traf=function(L,T){var P=R.sdtp(L),b=L.id,S=Math.floor(T/(N+1)),w=Math.floor(T%(N+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,w>>24,w>>16&255,w>>8&255,w&255])),R.trun(L,P.length+16+20+8+16+8+8),P)},R.trak=function(L){return L.duration=L.duration||4294967295,R.box(R.types.trak,R.tkhd(L),R.mdia(L))},R.trex=function(L){var T=L.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(L,T){var P=L.samples||[],b=P.length,S=12+16*b,w=new Uint8Array(S),C,x,_,p,n,u;for(T+=8+S,w.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,T>>>24&255,T>>>16&255,T>>>8&255,T&255],0),C=0;C<b;C++)x=P[C],_=x.duration,p=x.size,n=x.flags,u=x.cts,w.set([_>>>24&255,_>>>16&255,_>>>8&255,_&255,p>>>24&255,p>>>16&255,p>>>8&255,p&255,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.paddingValue<<1|n.isNonSync,n.degradPrio&240<<8,n.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*C);return R.box(R.types.trun,w)},R.initSegment=function(L){R.types||R.init();var T=R.moov(L),P=new Uint8Array(R.FTYP.byteLength+T.byteLength);return P.set(R.FTYP),P.set(T,R.FTYP.byteLength),P},R}();E.types=void 0,E.HDLR_TYPES=void 0,E.STTS=void 0,E.STSC=void 0,E.STCO=void 0,E.STSZ=void 0,E.VMHD=void 0,E.SMHD=void 0,E.STSD=void 0,E.FTYP=void 0,E.DINF=void 0,j.default=E},"./src/remux/mp4-remuxer.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return u}),O.d(j,"normalizePts",function(){return l});var N=O("./src/polyfills/number.ts"),E=O("./src/remux/aac-helper.ts"),R=O("./src/remux/mp4-generator.ts"),I=O("./src/events.ts"),L=O("./src/errors.ts"),T=O("./src/utils/logger.ts"),P=O("./src/types/loader.ts"),b=O("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(m){for(var h=1;h<arguments.length;h++){var a=arguments[h];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(m[r]=a[r])}return m},S.apply(this,arguments)}var w=10*1e3,C=1024,x=1152,_=null,p=null,n=!1,u=function(){function m(a,r,e,i){if(i===void 0&&(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=a,this.config=r,this.typeSupported=e,this.ISGenerated=!1,_===null){var g=navigator.userAgent||"",f=g.match(/Chrome\/(\d+)/i);_=f?parseInt(f[1]):0}if(p===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);p=y?parseInt(y[1]):0}n=!!_&&_<75||!!p&&p<600}var h=m.prototype;return h.destroy=function(){},h.resetTimeStamp=function(r){T.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=r},h.resetNextTimestamp=function(){T.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},h.resetInitSegment=function(){T.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},h.getVideoStartPts=function(r){var e=!1,i=r.reduce(function(g,f){var y=f.pts-g;return y<-4294967296?(e=!0,l(g,f.pts)):y>0?g:f.pts},r[0].pts);return e&&T.logger.debug("PTS rollover detected"),i},h.remux=function(r,e,i,g,f,y,t,A){var U,B,G,J,F,q,re=f,ae=f,ve=r.pid>-1,de=e.pid>-1,Z=e.samples.length,ee=r.samples.length>0,pe=Z>1,Q=(!ve||ee)&&(!de||pe)||this.ISGenerated||t;if(Q){this.ISGenerated||(G=this.generateIS(r,e,f));var V=this.isVideoContiguous,Ce=-1;if(pe&&(Ce=v(e.samples),!V&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,Ce>0){T.logger.warn("[mp4-remuxer]: Dropped "+Ce+" out of "+Z+" video samples due to a missing keyframe");var De=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(Ce),e.dropped+=Ce,ae+=(e.samples[0].pts-De)/(e.timescale||9e4)}else Ce===-1&&(T.logger.warn("[mp4-remuxer]: No keyframe found out of "+Z+" video samples"),q=!1);if(this.ISGenerated){if(ee&&pe){var Ne=this.getVideoStartPts(e.samples),we=l(r.samples[0].pts,Ne)-Ne,ke=we/e.inputTimeScale;re+=Math.max(0,ke),ae+=Math.max(0,-ke)}if(ee){if(r.samplerate||(T.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(r,e,f)),B=this.remuxAudio(r,re,this.isAudioContiguous,y,de||pe||A===P.PlaylistLevelType.AUDIO?ae:void 0),pe){var Se=B?B.endPTS-B.startPTS:0;e.inputTimeScale||(T.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(r,e,f)),U=this.remuxVideo(e,ae,V,Se)}}else pe&&(U=this.remuxVideo(e,ae,V,0));U&&(U.firstKeyFrame=Ce,U.independent=Ce!==-1)}}return this.ISGenerated&&(i.samples.length&&(F=this.remuxID3(i,f)),g.samples.length&&(J=this.remuxText(g,f))),{audio:B,video:U,initSegment:G,independent:q,text:J,id3:F}},h.generateIS=function(r,e,i){var g=r.samples,f=e.samples,y=this.typeSupported,t={},A=!Object(N.isFiniteNumber)(this._initPTS),U="audio/mp4",B,G,J;if(A&&(B=G=Infinity),r.config&&g.length&&(r.timescale=r.samplerate,r.isAAC||(y.mpeg?(U="audio/mpeg",r.codec=""):y.mp3&&(r.codec="mp3")),t.audio={id:"audio",container:U,codec:r.codec,initSegment:!r.isAAC&&y.mpeg?new Uint8Array(0):R.default.initSegment([r]),metadata:{channelCount:r.channelCount}},A&&(J=r.inputTimeScale,B=G=g[0].pts-Math.round(J*i))),e.sps&&e.pps&&f.length&&(e.timescale=e.inputTimeScale,t.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:R.default.initSegment([e]),metadata:{width:e.width,height:e.height}},A)){J=e.inputTimeScale;var F=this.getVideoStartPts(f),q=Math.round(J*i);G=Math.min(G,l(f[0].dts,F)-q),B=Math.min(B,F-q)}if(Object.keys(t).length)return this.ISGenerated=!0,A&&(this._initPTS=B,this._initDTS=G),{tracks:t,initPTS:B,timescale:J}},h.remuxVideo=function(r,e,i,g){var f=r.inputTimeScale,y=r.samples,t=[],A=y.length,U=this._initPTS,B=this.nextAvcDts,G=8,J,F,q,re=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,ve=0,de=!1;if(!i||B===null){var Z=e*f,ee=y[0].pts-l(y[0].dts,y[0].pts);B=Z-ee}for(var pe=0;pe<A;pe++){var Q=y[pe];if(Q.pts=l(Q.pts-U,B),Q.dts=l(Q.dts-U,B),Q.dts>Q.pts){var V=9e4*.2;ve=Math.max(Math.min(ve,Q.pts-Q.dts),-1*V)}Q.dts<y[pe>0?pe-1:pe].dts&&(de=!0)}de&&y.sort(function(an,fn){var It=an.dts-fn.dts,Kn=an.pts-fn.pts;return It||Kn}),F=y[0].dts,q=y[y.length-1].dts;var Ce=Math.round((q-F)/(A-1));if(ve<0){if(ve<Ce*-2){T.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-Ce,!0)+" ms");for(var De=ve,Ne=0;Ne<A;Ne++)y[Ne].dts=De=Math.max(De,y[Ne].pts-Ce),y[Ne].pts=Math.max(De,y[Ne].pts)}else{T.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(ve,!0)+" ms to overcome this issue");for(var we=0;we<A;we++)y[we].dts=y[we].dts+ve}F=y[0].dts}if(i){var ke=F-B,Se=ke>Ce,Ae=ke<-1;if(Se||Ae){Se?T.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(ke,!0)+" ms ("+ke+"dts) hole between fragments detected, filling it"):T.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-ke,!0)+" ms ("+ke+"dts) overlapping between fragments detected"),F=B;var je=y[0].pts-ke;y[0].dts=F,y[0].pts=je,T.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(je,!0)+"/"+Object(b.toMsFromMpegTsClock)(F,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(ke,!0)+" ms")}}n&&(F=Math.max(0,F));for(var Be=0,Ke=0,Ue=0;Ue<A;Ue++){for(var xe=y[Ue],Ge=xe.units,qe=Ge.length,lt=0,ot=0;ot<qe;ot++)lt+=Ge[ot].data.length;Ke+=lt,Be+=qe,xe.length=lt,xe.dts=Math.max(xe.dts,F),xe.pts=Math.max(xe.pts,xe.dts,0),re=Math.min(xe.pts,re),ae=Math.max(xe.pts,ae)}q=y[A-1].dts;var bt=Ke+4*Be+8,ht;try{ht=new Uint8Array(bt)}catch(an){this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:L.ErrorTypes.MUX_ERROR,details:L.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:bt,reason:"fail allocating video mdat "+bt});return}var ut=new DataView(ht.buffer);ut.setUint32(0,bt),ht.set(R.default.types.mdat,4);for(var Ze=0;Ze<A;Ze++){for(var Et=y[Ze],St=Et.units,He=0,it=0,ye=St.length;it<ye;it++){var he=St[it],fe=he.data,X=he.data.byteLength;ut.setUint32(G,X),G+=4,ht.set(fe,G),G+=X,He+=4+X}if(Ze<A-1)J=y[Ze+1].dts-Et.dts;else{var $=this.config,te=Et.dts-y[Ze>0?Ze-1:Ze].dts;if($.stretchShortVideoTrack&&this.nextAudioPts!==null){var oe=Math.floor($.maxBufferHole*f),Te=(g?re+g*f:this.nextAudioPts)-Et.pts;Te>oe?(J=Te-te,J<0&&(J=te),T.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+J/90+" ms for the last video frame.")):J=te}else J=te}var Pe=Math.round(Et.pts-Et.dts);t.push(new d(Et.key,J,He,Pe))}if(t.length&&_&&_<70){var Je=t[0].flags;Je.dependsOn=2,Je.isNonSync=0}console.assert(J!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=B=q+J,this.isVideoContiguous=!0;var Wt=R.default.moof(r.sequenceNumber++,F,S({},r,{samples:t})),Zt="video",Xt={data1:Wt,data2:ht,startPTS:re/f,endPTS:(ae+J)/f,startDTS:F/f,endDTS:B/f,type:Zt,hasAudio:!1,hasVideo:!0,nb:t.length,dropped:r.dropped};return r.samples=[],r.dropped=0,console.assert(ht.length,"MDAT length must not be zero"),Xt},h.remuxAudio=function(r,e,i,g,f){var y=r.inputTimeScale,t=r.samplerate?r.samplerate:y,A=y/t,U=r.isAAC?C:x,B=U*A,G=this._initPTS,J=!r.isAAC&&this.typeSupported.mpeg,F=[],q=r.samples,re=J?0:8,ae=this.nextAudioPts||-1,ve=e*y;if(this.isAudioContiguous=i=i||q.length&&ae>0&&(g&&Math.abs(ve-ae)<9e3||Math.abs(l(q[0].pts-G,ve)-ae)<20*B),q.forEach(function(fe){fe.pts=l(fe.pts-G,ve)}),!i||ae<0){if(q=q.filter(function(fe){return fe.pts>=0}),!q.length)return;f===0?ae=0:g?ae=Math.max(0,ve):ae=q[0].pts}if(r.isAAC)for(var de=f!==void 0,Z=this.config.maxAudioFramesDrift,ee=0,pe=ae;ee<q.length;ee++){var Q=q[ee],V=Q.pts,Ce=V-pe,De=Math.abs(1e3*Ce/y);if(Ce<=-Z*B&&de)ee===0&&(T.logger.warn("Audio frame @ "+(V/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Ce/y)+" ms."),this.nextAudioPts=ae=pe=V);else if(Ce>=Z*B&&De<w&&de){var Ne=Math.round(Ce/B);pe=V-Ne*B,pe<0&&(Ne--,pe+=B),ee===0&&(this.nextAudioPts=ae=pe),T.logger.warn("[mp4-remuxer]: Injecting "+Ne+" audio frame @ "+(pe/y).toFixed(3)+"s due to "+Math.round(1e3*Ce/y)+" ms gap.");for(var we=0;we<Ne;we++){var ke=Math.max(pe,0),Se=E.default.getSilentFrame(r.manifestCodec||r.codec,r.channelCount);Se||(T.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Se=Q.unit.subarray()),q.splice(ee,0,{unit:Se,pts:ke}),pe+=B,ee++}}Q.pts=pe,pe+=B}for(var Ae=null,je=null,Be,Ke=0,Ue=q.length;Ue--;)Ke+=q[Ue].unit.byteLength;for(var xe=0,Ge=q.length;xe<Ge;xe++){var qe=q[xe],lt=qe.unit,ot=qe.pts;if(je!==null){var bt=F[xe-1];bt.duration=Math.round((ot-je)/A)}else if(i&&r.isAAC&&(ot=ae),Ae=ot,Ke>0){Ke+=re;try{Be=new Uint8Array(Ke)}catch(fe){this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:L.ErrorTypes.MUX_ERROR,details:L.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ke,reason:"fail allocating audio mdat "+Ke});return}if(!J){var ht=new DataView(Be.buffer);ht.setUint32(0,Ke),Be.set(R.default.types.mdat,4)}}else return;Be.set(lt,re);var ut=lt.byteLength;re+=ut,F.push(new d(!0,U,ut,0)),je=ot}var Ze=F.length;if(!Ze)return;var Et=F[F.length-1];this.nextAudioPts=ae=je+A*Et.duration;var St=J?new Uint8Array(0):R.default.moof(r.sequenceNumber++,Ae/A,S({},r,{samples:F}));r.samples=[];var He=Ae/y,it=ae/y,ye="audio",he={data1:St,data2:Be,startPTS:He,endPTS:it,startDTS:He,endDTS:it,type:ye,hasAudio:!0,hasVideo:!1,nb:Ze};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),he},h.remuxEmptyAudio=function(r,e,i,g){var f=r.inputTimeScale,y=r.samplerate?r.samplerate:f,t=f/y,A=this.nextAudioPts,U=(A!==null?A:g.startDTS*f)+this._initDTS,B=g.endDTS*f+this._initDTS,G=t*C,J=Math.ceil((B-U)/G),F=E.default.getSilentFrame(r.manifestCodec||r.codec,r.channelCount);if(T.logger.warn("[mp4-remuxer]: remux empty Audio"),!F){T.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var q=[],re=0;re<J;re++){var ae=U+re*G;q.push({unit:F,pts:ae,dts:ae})}return r.samples=q,this.remuxAudio(r,e,i,!1)},h.remuxID3=function(r,e){var i=r.samples.length;if(!i)return;for(var g=r.inputTimeScale,f=this._initPTS,y=this._initDTS,t=0;t<i;t++){var A=r.samples[t];A.pts=l(A.pts-f,e*g)/g,A.dts=l(A.dts-y,e*g)/g}var U=r.samples;return r.samples=[],{samples:U}},h.remuxText=function(r,e){var i=r.samples.length;if(!i)return;for(var g=r.inputTimeScale,f=this._initPTS,y=0;y<i;y++){var t=r.samples[y];t.pts=l(t.pts-f,e*g)/g}r.samples.sort(function(U,B){return U.pts-B.pts});var A=r.samples;return r.samples=[],{samples:A}},m}();function l(m,h){var a;if(h===null)return m;for(h<m?a=-8589934592:a=8589934592;Math.abs(m-h)>4294967296;)m+=a;return m}function v(m){for(var h=0;h<m.length;h++)if(m[h].key)return h;return-1}var d=function(h,a,r,e){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=a,this.size=r,this.cts=e,this.flags=new o(h)},o=function(h){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=h?2:1,this.isNonSync=h?0:1}},"./src/remux/passthrough-remuxer.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/polyfills/number.ts"),E=O("./src/utils/mp4-tools.ts"),R=O("./src/loader/fragment.ts"),I=O("./src/utils/logger.ts"),L=function(){function b(){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 S=b.prototype;return S.destroy=function(){},S.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(C,x,_){this.audioCodec=x,this.videoCodec=_,this.generateInitSegment(C),this.emitInitSegment=!0},S.generateInitSegment=function(C){var x=this.audioCodec,_=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var p=this.initData=Object(E.parseInitSegment)(C);x||(x=P(p.audio,R.ElementaryStreamTypes.AUDIO)),_||(_=P(p.video,R.ElementaryStreamTypes.VIDEO));var n={};p.audio&&p.video?n.audiovideo={container:"video/mp4",codec:x+","+_,initSegment:C,id:"main"}:p.audio?n.audio={container:"audio/mp4",codec:x,initSegment:C,id:"audio"}:p.video?n.video={container:"video/mp4",codec:_,initSegment:C,id:"main"}:I.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n},S.remux=function(C,x,_,p,n){var u=this.initPTS,l=this.lastEndDTS,v={audio:void 0,video:void 0,text:p,id3:_,initSegment:void 0};Object(N.isFiniteNumber)(l)||(l=this.lastEndDTS=n||0);var d=x.samples;if(!d||!d.length)return v;var o={initPTS:void 0,timescale:1},m=this.initData;if((!m||!m.length)&&(this.generateInitSegment(d),m=this.initData),!m||!m.length)return I.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),v;this.emitInitSegment&&(o.tracks=this.initTracks,this.emitInitSegment=!1),Object(N.isFiniteNumber)(u)||(this.initPTS=o.initPTS=u=T(m,d,l));var h=Object(E.getDuration)(d,m),a=l,r=h+a;Object(E.offsetStartDTS)(m,d,u),h>0?this.lastEndDTS=r:(I.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var e=!!m.audio,i=!!m.video,g="";e&&(g+="audio"),i&&(g+="video");var f={data1:d,startPTS:a,startDTS:a,endPTS:r,endDTS:r,type:g,hasAudio:e,hasVideo:i,nb:1,dropped:0};return v.audio=f.type==="audio"?f:void 0,v.video=f.type!=="audio"?f:void 0,v.text=p,v.id3=_,v.initSegment=o,v},b}(),T=function(S,w,C){return Object(E.getStartDTS)(S,w)-C};function P(b,S){var w=b==null?void 0:b.codec;return w&&w.length>4?w:w==="hvc1"?"hvc1.1.c.L120.90":w==="av01"?"av01.0.04M.08":w==="avc1"||S===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}j.default=L},"./src/task-loop.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return N});var N=function(){function E(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=E.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(L){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,L),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},E}()},"./src/types/cmcd.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"CMCDVersion",function(){return N}),O.d(j,"CMCDObjectType",function(){return E}),O.d(j,"CMCDStreamingFormat",function(){return R}),O.d(j,"CMCDStreamType",function(){return I});var N=1,E;(function(L){L.MANIFEST="m",L.AUDIO="a",L.VIDEO="v",L.MUXED="av",L.INIT="i",L.CAPTION="c",L.TIMED_TEXT="tt",L.KEY="k",L.OTHER="o"})(E||(E={}));var R;(function(L){L.DASH="d",L.HLS="h",L.SMOOTH="s",L.OTHER="o"})(R||(R={}));var I;(function(L){L.VOD="v",L.LIVE="l"})(I||(I={}))},"./src/types/level.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"HlsSkip",function(){return R}),O.d(j,"getSkipValue",function(){return I}),O.d(j,"HlsUrlParameters",function(){return L}),O.d(j,"Level",function(){return T});function N(P,b){for(var S=0;S<b.length;S++){var w=b[S];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(P,w.key,w)}}function E(P,b,S){return b&&N(P.prototype,b),S&&N(P,S),P}var R;(function(P){P.No="",P.Yes="YES",P.v2="v2"})(R||(R={}));function I(P,b){var S=P.canSkipUntil,w=P.canSkipDateRanges,C=P.endSN,x=b!==void 0?b-C:0;return S&&x<S?w?R.v2:R.Yes:R.No}var L=function(){function P(S,w,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=w,this.skip=C}var b=P.prototype;return b.addDirectives=function(w){var C=new self.URL(w);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},P}(),T=function(){function P(b){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=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return E(P,[{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(S){var w=S%this.url.length;this._urlId!==w&&(this.details=void 0,this._urlId=w)}}]),P}()},"./src/types/loader.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"PlaylistContextType",function(){return N}),O.d(j,"PlaylistLevelType",function(){return E});var N;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(N||(N={}));var E;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(E||(E={}))},"./src/types/transmuxer.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"ChunkMetadata",function(){return N});var N=function(I,L,T,P,b,S){P===void 0&&(P=0),b===void 0&&(b=-1),S===void 0&&(S=!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=E(),this.buffering={audio:E(),video:E(),audiovideo:E()},this.level=I,this.sn=L,this.id=T,this.size=P,this.part=b,this.partial=S};function E(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"AttrList",function(){return R});var N=/^(\d+)x(\d+)$/,E=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function I(T){typeof T=="string"&&(T=I.parseAttrList(T));for(var P in T)T.hasOwnProperty(P)&&(this[P]=T[P])}var L=I.prototype;return L.decimalInteger=function(P){var b=parseInt(this[P],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},L.hexadecimalInteger=function(P){if(this[P]){var b=(this[P]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var S=new Uint8Array(b.length/2),w=0;w<b.length/2;w++)S[w]=parseInt(b.slice(w*2,w*2+2),16);return S}else return null},L.hexadecimalIntegerAsNumber=function(P){var b=parseInt(this[P],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},L.decimalFloatingPoint=function(P){return parseFloat(this[P])},L.optionalFloat=function(P,b){var S=this[P];return S?parseFloat(S):b},L.enumeratedString=function(P){return this[P]},L.bool=function(P){return this[P]==="YES"},L.decimalResolution=function(P){var b=N.exec(this[P]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},I.parseAttrList=function(P){var b,S={},w='"';for(E.lastIndex=0;(b=E.exec(P))!==null;){var C=b[2];C.indexOf(w)===0&&C.lastIndexOf(w)===C.length-1&&(C=C.slice(1,-1)),S[b[1]]=C}return S},I}()},"./src/utils/binary-search.ts":function(Ee,j,O){"use strict";O.r(j);var N={search:function(R,I){for(var L=0,T=R.length-1,P=null,b=null;L<=T;){P=(L+T)/2|0,b=R[P];var S=I(b);if(S>0)L=P+1;else if(S<0)T=P-1;else return b}return null}};j.default=N},"./src/utils/buffer-helper.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"BufferHelper",function(){return R});var N=O("./src/utils/logger.ts"),E={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function I(){}return I.isBuffered=function(T,P){try{if(T){for(var b=I.getBuffered(T),S=0;S<b.length;S++)if(P>=b.start(S)&&P<=b.end(S))return!0}}catch(w){}return!1},I.bufferInfo=function(T,P,b){try{if(T){var S=I.getBuffered(T),w=[],C;for(C=0;C<S.length;C++)w.push({start:S.start(C),end:S.end(C)});return this.bufferedInfo(w,P,b)}}catch(x){}return{len:0,start:P,end:P,nextStart:void 0}},I.bufferedInfo=function(T,P,b){P=Math.max(0,P),T.sort(function(o,m){var h=o.start-m.start;return h||m.end-o.end});var S=[];if(b)for(var w=0;w<T.length;w++){var C=S.length;if(C){var x=S[C-1].end;T[w].start-x<b?T[w].end>x&&(S[C-1].end=T[w].end):S.push(T[w])}else S.push(T[w])}else S=T;for(var _=0,p,n=P,u=P,l=0;l<S.length;l++){var v=S[l].start,d=S[l].end;if(P+b>=v&&P<d)n=v,u=d,_=u-P;else if(P+b<v){p=v;break}}return{len:_,start:n||0,end:u||0,nextStart:p}},I.getBuffered=function(T){try{return T.buffered}catch(P){return N.logger.log("failed to get media.buffered",P),E}},I}()},"./src/utils/cea-608-parser.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"Row",function(){return u}),O.d(j,"CaptionScreen",function(){return l});var N=O("./src/utils/logger.ts"),E={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},R=function(r){var e=r;return E.hasOwnProperty(r)&&(e=E[r]),String.fromCharCode(e)},I=15,L=100,T={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},P={17:2,18:4,21:6,22:8,23:10,19:13,20:15},b={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},S={25:2,26:4,29:6,30:8,31:10,27:13,28:15},w=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(a){a[a.ERROR=0]="ERROR",a[a.TEXT=1]="TEXT",a[a.WARNING=2]="WARNING",a[a.INFO=2]="INFO",a[a.DEBUG=3]="DEBUG",a[a.DATA=3]="DATA"})(C||(C={}));var x=function(){function a(){this.time=null,this.verboseLevel=C.ERROR}var r=a.prototype;return r.log=function(i,g){this.verboseLevel>=i&&N.logger.log(this.time+" ["+i+"] "+g)},a}(),_=function(r){for(var e=[],i=0;i<r.length;i++)e.push(r[i].toString(16));return e},p=function(){function a(e,i,g,f,y){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=i||!1,this.italics=g||!1,this.background=f||"black",this.flash=y||!1}var r=a.prototype;return r.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},r.setStyles=function(i){for(var g=["foreground","underline","italics","background","flash"],f=0;f<g.length;f++){var y=g[f];i.hasOwnProperty(y)&&(this[y]=i[y])}},r.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},r.equals=function(i){return this.foreground===i.foreground&&this.underline===i.underline&&this.italics===i.italics&&this.background===i.background&&this.flash===i.flash},r.copy=function(i){this.foreground=i.foreground,this.underline=i.underline,this.italics=i.italics,this.background=i.background,this.flash=i.flash},r.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},a}(),n=function(){function a(e,i,g,f,y,t){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new p(i,g,f,y,t)}var r=a.prototype;return r.reset=function(){this.uchar=" ",this.penState.reset()},r.setChar=function(i,g){this.uchar=i,this.penState.copy(g)},r.setPenState=function(i){this.penState.copy(i)},r.equals=function(i){return this.uchar===i.uchar&&this.penState.equals(i.penState)},r.copy=function(i){this.uchar=i.uchar,this.penState.copy(i.penState)},r.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},a}(),u=function(){function a(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 i=0;i<L;i++)this.chars.push(new n);this.logger=e,this.pos=0,this.currPenState=new p}var r=a.prototype;return r.equals=function(i){for(var g=!0,f=0;f<L;f++)if(!this.chars[f].equals(i.chars[f])){g=!1;break}return g},r.copy=function(i){for(var g=0;g<L;g++)this.chars[g].copy(i.chars[g])},r.isEmpty=function(){for(var i=!0,g=0;g<L;g++)if(!this.chars[g].isEmpty()){i=!1;break}return i},r.setCursor=function(i){this.pos!==i&&(this.pos=i),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>L&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=L)},r.moveCursor=function(i){var g=this.pos+i;if(i>1)for(var f=this.pos+1;f<g+1;f++)this.chars[f].setPenState(this.currPenState);this.setCursor(g)},r.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},r.insertChar=function(i){i>=144&&this.backSpace();var g=R(i);if(this.pos>=L){this.logger.log(C.ERROR,"Cannot insert "+i.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},r.clearFromPos=function(i){var g;for(g=i;g<L;g++)this.chars[g].reset()},r.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},r.clearToEndOfRow=function(){this.clearFromPos(this.pos)},r.getTextString=function(){for(var i=[],g=!0,f=0;f<L;f++){var y=this.chars[f].uchar;y!==" "&&(g=!1),i.push(y)}return g?"":i.join("")},r.setPenStyles=function(i){this.currPenState.setStyles(i);var g=this.chars[this.pos];g.setPenState(this.currPenState)},a}(),l=function(){function a(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 i=0;i<I;i++)this.rows.push(new u(e));this.logger=e,this.currRow=I-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var r=a.prototype;return r.reset=function(){for(var i=0;i<I;i++)this.rows[i].clear();this.currRow=I-1},r.equals=function(i){for(var g=!0,f=0;f<I;f++)if(!this.rows[f].equals(i.rows[f])){g=!1;break}return g},r.copy=function(i){for(var g=0;g<I;g++)this.rows[g].copy(i.rows[g])},r.isEmpty=function(){for(var i=!0,g=0;g<I;g++)if(!this.rows[g].isEmpty()){i=!1;break}return i},r.backSpace=function(){var i=this.rows[this.currRow];i.backSpace()},r.clearToEndOfRow=function(){var i=this.rows[this.currRow];i.clearToEndOfRow()},r.insertChar=function(i){var g=this.rows[this.currRow];g.insertChar(i)},r.setPen=function(i){var g=this.rows[this.currRow];g.setPenStyles(i)},r.moveCursor=function(i){var g=this.rows[this.currRow];g.moveCursor(i)},r.setCursor=function(i){this.logger.log(C.INFO,"setCursor: "+i);var g=this.rows[this.currRow];g.setCursor(i)},r.setPAC=function(i){this.logger.log(C.INFO,"pacData = "+JSON.stringify(i));var g=i.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var f=0;f<I;f++)this.rows[f].clear();var y=this.currRow+1-this.nrRollUpRows,t=this.lastOutputScreen;if(t){var A=t.rows[y].cueStartTime,U=this.logger.time;if(A&&U!==null&&A<U)for(var B=0;B<this.nrRollUpRows;B++)this.rows[g-this.nrRollUpRows+B+1].copy(t.rows[y+B])}}this.currRow=g;var G=this.rows[this.currRow];if(i.indent!==null){var J=i.indent,F=Math.max(J-1,0);G.setCursor(i.indent),i.color=G.chars[F].penState.foreground}var q={foreground:i.color,underline:i.underline,italics:i.italics,background:"black",flash:!1};this.setPen(q)},r.setBkgData=function(i){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(i)),this.backSpace(),this.setPen(i),this.insertChar(32)},r.setRollUpRows=function(i){this.nrRollUpRows=i},r.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var i=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(i,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(C.INFO,"Rolling up")},r.getDisplayText=function(i){i=i||!1;for(var g=[],f="",y=-1,t=0;t<I;t++){var A=this.rows[t].getTextString();A&&(y=t+1,i?g.push("Row "+y+": '"+A+"'"):g.push(A.trim()))}return g.length>0&&(i?f="["+g.join(" | ")+"]":f=g.join(`
|
|
`)),f},r.getTextAndFormat=function(){return this.rows},a}(),v=function(){function a(e,i,g){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=i,this.mode=null,this.verbose=0,this.displayedMemory=new l(g),this.nonDisplayedMemory=new l(g),this.lastOutputScreen=new l(g),this.currRollUpRow=this.displayedMemory.rows[I-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var r=a.prototype;return r.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[I-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},r.getHandler=function(){return this.outputFilter},r.setHandler=function(i){this.outputFilter=i},r.setPAC=function(i){this.writeScreen.setPAC(i)},r.setBkgData=function(i){this.writeScreen.setBkgData(i)},r.setMode=function(i){if(i===this.mode)return;this.mode=i,this.logger.log(C.INFO,"MODE="+i),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=i},r.insertChars=function(i){for(var g=0;g<i.length;g++)this.writeScreen.insertChar(i[g]);var f=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,f+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},r.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},r.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},r.ccAOF=function(){},r.ccAON=function(){},r.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},r.ccRU=function(i){this.logger.log(C.INFO,"RU("+i+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(i)},r.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},r.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},r.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},r.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},r.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},r.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},r.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},r.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var i=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=i,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},r.ccTO=function(i){this.logger.log(C.INFO,"TO("+i+") - Tab Offset"),this.writeScreen.moveCursor(i)},r.ccMIDROW=function(i){var g={flash:!1};if(g.underline=i%2===1,g.italics=i>=46,g.italics)g.foreground="white";else{var f=Math.floor(i/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=y[f]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},r.outputDataUpdate=function(i){i===void 0&&(i=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),i&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},r.cueSplitAtTime=function(i){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,i,this.displayedMemory),this.cueStartTime=i))},a}(),d=function(){function a(e,i,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var f=new x;this.channels=[null,new v(e,i,f),new v(e+1,g,f)],this.cmdHistory=h(),this.logger=f}var r=a.prototype;return r.getHandler=function(i){return this.channels[i].getHandler()},r.setHandler=function(i,g){this.channels[i].setHandler(g)},r.addData=function(i,g){var f,y,t,A=!1;this.logger.time=i;for(var U=0;U<g.length;U+=2){if(y=g[U]&127,t=g[U+1]&127,y===0&&t===0)continue;if(this.logger.log(C.DATA,"["+_([g[U],g[U+1]])+"] -> ("+_([y,t])+")"),f=this.parseCmd(y,t),f||(f=this.parseMidrow(y,t)),f||(f=this.parsePAC(y,t)),f||(f=this.parseBackgroundAttributes(y,t)),!f&&(A=this.parseChars(y,t),A)){var B=this.currentChannel;if(B&&B>0){var G=this.channels[B];G.insertChars(A)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!f&&!A&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+_([y,t])+" orig: "+_([g[U],g[U+1]]))}},r.parseCmd=function(i,g){var f=this.cmdHistory,y=(i===20||i===28||i===21||i===29)&&g>=32&&g<=47,t=(i===23||i===31)&&g>=33&&g<=35;if(!(y||t))return!1;if(m(i,g,f))return o(null,null,f),this.logger.log(C.DEBUG,"Repeated command ("+_([i,g])+") is dropped"),!0;var A=i===20||i===21||i===23?1:2,U=this.channels[A];return i===20||i===21||i===28||i===29?g===32?U.ccRCL():g===33?U.ccBS():g===34?U.ccAOF():g===35?U.ccAON():g===36?U.ccDER():g===37?U.ccRU(2):g===38?U.ccRU(3):g===39?U.ccRU(4):g===40?U.ccFON():g===41?U.ccRDC():g===42?U.ccTR():g===43?U.ccRTD():g===44?U.ccEDM():g===45?U.ccCR():g===46?U.ccENM():g===47&&U.ccEOC():U.ccTO(g-32),o(i,g,f),this.currentChannel=A,!0},r.parseMidrow=function(i,g){var f=0;if((i===17||i===25)&&g>=32&&g<=47){if(i===17?f=1:f=2,f!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[f];return y?(y.ccMIDROW(g),this.logger.log(C.DEBUG,"MIDROW ("+_([i,g])+")"),!0):!1}return!1},r.parsePAC=function(i,g){var f,y=this.cmdHistory,t=(i>=17&&i<=23||i>=25&&i<=31)&&g>=64&&g<=127,A=(i===16||i===24)&&g>=64&&g<=95;if(!(t||A))return!1;if(m(i,g,y))return o(null,null,y),!0;var U=i<=23?1:2;g>=64&&g<=95?f=U===1?T[i]:b[i]:f=U===1?P[i]:S[i];var B=this.channels[U];return B?(B.setPAC(this.interpretPAC(f,g)),o(i,g,y),this.currentChannel=U,!0):!1},r.interpretPAC=function(i,g){var f,y={color:null,italics:!1,indent:null,underline:!1,row:i};return g>95?f=g-96:f=g-64,y.underline=(f&1)===1,f<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(f/2)]:f<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((f-16)/2)*4,y},r.parseChars=function(i,g){var f,y=null,t=null;if(i>=25?(f=2,t=i-8):(f=1,t=i),t>=17&&t<=19){var A;t===17?A=g+80:t===18?A=g+112:A=g+144,this.logger.log(C.INFO,"Special char '"+R(A)+"' in channel "+f),y=[A]}else i>=32&&i<=127&&(y=g===0?[i]:[i,g]);if(y){var U=_(y);this.logger.log(C.DEBUG,"Char codes = "+U.join(",")),o(i,g,this.cmdHistory)}return y},r.parseBackgroundAttributes=function(i,g){var f=(i===16||i===24)&&g>=32&&g<=47,y=(i===23||i===31)&&g>=45&&g<=47;if(!(f||y))return!1;var t,A={};i===16||i===24?(t=Math.floor((g-32)/2),A.background=w[t],g%2===1&&(A.background=A.background+"_semi")):g===45?A.background="transparent":(A.foreground="black",g===47&&(A.underline=!0));var U=i<=23?1:2,B=this.channels[U];return B.setBkgData(A),o(i,g,this.cmdHistory),!0},r.reset=function(){for(var i=0;i<Object.keys(this.channels).length;i++){var g=this.channels[i];g&&g.reset()}this.cmdHistory=h()},r.cueSplitAtTime=function(i){for(var g=0;g<this.channels.length;g++){var f=this.channels[g];f&&f.cueSplitAtTime(i)}},a}();function o(a,r,e){e.a=a,e.b=r}function m(a,r,e){return e.a===a&&e.b===r}function h(){return{a:null,b:null}}j.default=d},"./src/utils/codecs.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"isCodecType",function(){return E}),O.d(j,"isCodecSupportedInMp4",function(){return R});var N={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function E(I,L){var T=N[L];return!!T&&T[I.slice(0,4)]===!0}function R(I,L){return MediaSource.isTypeSupported((L||"video")+'/mp4;codecs="'+I+'"')}},"./src/utils/cues.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/utils/vttparser.ts"),E=O("./src/utils/webvtt-parser.ts"),R=O("./src/utils/texttrack-utils.ts"),I=/\s/,L={newCue:function(P,b,S,w){for(var C=[],x,_,p,n,u,l=self.VTTCue||self.TextTrackCue,v=0;v<w.rows.length;v++)if(x=w.rows[v],p=!0,n=0,u="",!x.isEmpty()){for(var d=0;d<x.chars.length;d++)I.test(x.chars[d].uchar)&&p?n++:(u+=x.chars[d].uchar,p=!1);x.cueStartTime=b,b===S&&(S+=1e-4),n>=16?n--:n++;var o=Object(N.fixLineBreaks)(u.trim()),m=Object(E.generateCueId)(b,S,o);(!P||!P.cues||!P.cues.getCueById(m))&&(_=new l(b,S,o),_.id=m,_.line=v+1,_.align="left",_.position=10+Math.min(80,Math.floor(n*8/32)*10),C.push(_))}return P&&C.length&&(C.sort(function(h,a){return h.line==="auto"||a.line==="auto"?0:h.line>8&&a.line>8?a.line-h.line:h.line-a.line}),C.forEach(function(h){return Object(R.addCueToTrack)(P,h)})),C}};j.default=L},"./src/utils/discontinuities.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"findFirstFragWithCC",function(){return I}),O.d(j,"shouldAlignOnDiscontinuities",function(){return L}),O.d(j,"findDiscontinuousReferenceFrag",function(){return T}),O.d(j,"adjustSlidingStart",function(){return b}),O.d(j,"alignStream",function(){return S}),O.d(j,"alignPDT",function(){return C}),O.d(j,"alignFragmentByPDTDelta",function(){return x}),O.d(j,"alignMediaPlaylistByPDT",function(){return _});var N=O("./src/polyfills/number.ts"),E=O("./src/utils/logger.ts"),R=O("./src/controller/level-helper.ts");function I(p,n){for(var u=null,l=0,v=p.length;l<v;l++){var d=p[l];if(d&&d.cc===n){u=d;break}}return u}function L(p,n,u){return!!(n.details&&(u.endCC>u.startCC||p&&p.cc<u.startCC))}function T(p,n){var u=p.fragments,l=n.fragments;if(!l.length||!u.length){E.logger.log("No fragments to align");return}var v=I(u,l[0].cc);if(!v||v&&!v.startPTS){E.logger.log("No frag in previous level to align on");return}return v}function P(p,n){if(p){var u=p.start+n;p.start=p.startPTS=u,p.endPTS=u+p.duration}}function b(p,n){for(var u=n.fragments,l=0,v=u.length;l<v;l++)P(u[l],p);n.fragmentHint&&P(n.fragmentHint,p),n.alignedSliding=!0}function S(p,n,u){if(!n)return;w(p,u,n),!u.alignedSliding&&n.details&&C(u,n.details),!u.alignedSliding&&n.details&&!u.skippedSegments&&Object(R.adjustSliding)(n.details,u)}function w(p,n,u){if(L(p,u,n)){var l=T(u.details,n);l&&Object(N.isFiniteNumber)(l.start)&&(E.logger.log("Adjusting PTS using last level due to CC increase within current level "+n.url),b(l.start,n))}}function C(p,n){if(!n.fragments.length||!p.hasProgramDateTime||!n.hasProgramDateTime)return;var u=n.fragments[0].programDateTime,l=p.fragments[0].programDateTime,v=(l-u)/1e3+n.fragments[0].start;v&&Object(N.isFiniteNumber)(v)&&(E.logger.log("Adjusting PTS using programDateTime delta "+(l-u)+"ms, sliding:"+v.toFixed(3)+" "+p.url+" "),b(v,p))}function x(p,n){var u=p.programDateTime;if(!u)return;var l=(u-n)/1e3;p.start=p.startPTS=l,p.endPTS=l+p.duration}function _(p,n){if(!n.fragments.length||!p.hasProgramDateTime||!n.hasProgramDateTime)return;var u=n.fragments[0].programDateTime,l=n.fragments[0].start,v=u-l*1e3;p.fragments.forEach(function(d){x(d,v)}),p.fragmentHint&&x(p.fragmentHint,v),p.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/utils/ewma.ts"),E=function(){function R(L,T,P){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=P,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new N.default(L),this.fast_=new N.default(T)}var I=R.prototype;return I.update=function(T,P){var b=this.slow_,S=this.fast_;this.slow_.halfLife!==T&&(this.slow_=new N.default(T,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==P&&(this.fast_=new N.default(P,S.getEstimate(),S.getTotalWeight()))},I.sample=function(T,P){T=Math.max(T,this.minDelayMs_);var b=8*P,S=T/1e3,w=b/S;this.fast_.sample(S,w),this.slow_.sample(S,w)},I.canEstimate=function(){var T=this.fast_;return T&&T.getTotalWeight()>=this.minWeight_},I.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},I.destroy=function(){},R}();j.default=E},"./src/utils/ewma.ts":function(Ee,j,O){"use strict";O.r(j);var N=function(){function E(I,L,T){L===void 0&&(L=0),T===void 0&&(T=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=I,this.alpha_=I?Math.exp(Math.log(.5)/I):0,this.estimate_=L,this.totalWeight_=T}var R=E.prototype;return R.sample=function(L,T){var P=Math.pow(this.alpha_,L);this.estimate_=T*(1-P)+P*this.estimate_,this.totalWeight_+=L},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var L=1-Math.pow(this.alpha_,this.totalWeight_);if(L)return this.estimate_/L}return this.estimate_},E}();j.default=N},"./src/utils/fetch-loader.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"fetchSupported",function(){return x});var N=O("./src/polyfills/number.ts"),E=O("./src/loader/load-stats.ts"),R=O("./src/demux/chunk-cache.ts");function I(l,v){l.prototype=Object.create(v.prototype),l.prototype.constructor=l,S(l,v)}function L(l){var v=typeof Map=="function"?new Map:void 0;return L=function(o){if(o===null||!b(o))return o;if(typeof o!="function")throw new TypeError("Super expression must either be null or a function");if(typeof v!="undefined"){if(v.has(o))return v.get(o);v.set(o,m)}function m(){return T(o,arguments,w(this).constructor)}return m.prototype=Object.create(o.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),S(m,o)},L(l)}function T(l,v,d){return P()?T=Reflect.construct:T=function(m,h,a){var r=[null];r.push.apply(r,h);var e=Function.bind.apply(m,r),i=new e;return a&&S(i,a.prototype),i},T.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function b(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function S(l,v){return S=Object.setPrototypeOf||function(o,m){return o.__proto__=m,o},S(l,v)}function w(l){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},w(l)}function C(){return C=Object.assign||function(l){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(l[o]=d[o])}return l},C.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var _=function(){function l(d){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=d.fetchSetup||n,this.controller=new self.AbortController,this.stats=new E.LoadStats}var v=l.prototype;return v.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},v.abortInternal=function(){var o=this.response;(!o||!o.ok)&&(this.stats.aborted=!0,this.controller.abort())},v.abort=function(){var o;this.abortInternal(),(o=this.callbacks)!==null&&o!==void 0&&o.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},v.load=function(o,m,h){var a=this,r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();var e=p(o,this.controller.signal),i=h.onProgress,g=o.responseType==="arraybuffer",f=g?"byteLength":"length";this.context=o,this.config=m,this.callbacks=h,this.request=this.fetchSetup(o,e),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){a.abortInternal(),h.onTimeout(r,o,a.response)},m.timeout),self.fetch(this.request).then(function(y){if(a.response=a.loader=y,!y.ok){var t=y.status,A=y.statusText;throw new u(A||"fetch, bad network response",t,y)}return r.loading.first=Math.max(self.performance.now(),r.loading.start),r.total=parseInt(y.headers.get("Content-Length")||"0"),i&&Object(N.isFiniteNumber)(m.highWaterMark)?a.loadProgressively(y,r,o,m.highWaterMark,i):g?y.arrayBuffer():y.text()}).then(function(y){var t=a.response;self.clearTimeout(a.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first),r.loaded=r.total=y[f];var A={url:t.url,data:y};i&&!Object(N.isFiniteNumber)(m.highWaterMark)&&i(r,o,y,t),h.onSuccess(A,r,o,t)}).catch(function(y){if(self.clearTimeout(a.requestTimeout),r.aborted)return;var t=y.code||0;h.onError({code:t,text:y.message},o,y.details)})},v.getCacheAge=function(){var o=null;if(this.response){var m=this.response.headers.get("age");o=m?parseFloat(m):null}return o},v.loadProgressively=function(o,m,h,a,r){a===void 0&&(a=0);var e=new R.default,i=o.body.getReader(),g=function f(){return i.read().then(function(y){if(y.done)return e.dataLength&&r(m,h,e.flush(),o),Promise.resolve(new ArrayBuffer(0));var t=y.value,A=t.length;return m.loaded+=A,A<a||e.dataLength?(e.push(t),e.dataLength>=a&&r(m,h,e.flush(),o)):r(m,h,t,o),f()}).catch(function(){return Promise.reject()})};return g()},l}();function p(l,v){var d={method:"GET",mode:"cors",credentials:"same-origin",signal:v,headers:new self.Headers(C({},l.headers))};return l.rangeEnd&&d.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),d}function n(l,v){return new self.Request(l.url,v)}var u=function(l){I(v,l);function v(d,o,m){var h;return h=l.call(this,d)||this,h.code=void 0,h.details=void 0,h.code=o,h.details=m,h}return v}(L(Error));j.default=_},"./src/utils/imsc1-ttml-parser.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"IMSC1_CODEC",function(){return b}),O.d(j,"parseIMSC1",function(){return x});var N=O("./src/utils/mp4-tools.ts"),E=O("./src/utils/vttparser.ts"),R=O("./src/utils/vttcue.ts"),I=O("./src/demux/id3.ts"),L=O("./src/utils/timescale-conversion.ts"),T=O("./src/utils/webvtt-parser.ts");function P(){return P=Object.assign||function(a){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(a[i]=e[i])}return a},P.apply(this,arguments)}var b="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,w=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(a,r,e,i,g){var f=Object(N.findBox)(new Uint8Array(a),["mdat"]);if(f.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var y=f[0],t=Object(I.utf8ArrayToStr)(new Uint8Array(a,y.start,y.end-y.start)),A=Object(L.toTimescaleFromScale)(r,1,e);try{i(_(t,A))}catch(U){g(U)}}function _(a,r){var e=new DOMParser,i=e.parseFromString(a,"text/xml"),g=i.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var f={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(f).reduce(function(G,J){return G[J]=g.getAttribute("ttp:"+J)||f[J],G},{}),t=g.getAttribute("xml:space")!=="preserve",A=n(p(g,"styling","style")),U=n(p(g,"layout","region")),B=p(g,"body","[begin]");return[].map.call(B,function(G){var J=u(G,t);if(!J||!G.hasAttribute("begin"))return null;var F=o(G.getAttribute("begin"),y),q=o(G.getAttribute("dur"),y),re=o(G.getAttribute("end"),y);if(F===null)throw d(G);if(re===null){if(q===null)throw d(G);re=F+q}var ae=new R.default(F-r,re-r,J);ae.id=Object(T.generateCueId)(ae.startTime,ae.endTime,ae.text);var ve=U[G.getAttribute("region")],de=A[G.getAttribute("style")];ae.position=10,ae.size=80;var Z=l(ve,de),ee=Z.textAlign;if(ee){var pe=C[ee];pe&&(ae.lineAlign=pe),ae.align=ee}return P(ae,Z),ae}).filter(function(G){return G!==null})}function p(a,r,e){var i=a.getElementsByTagName(r)[0];return i?[].slice.call(i.querySelectorAll(e)):[]}function n(a){return a.reduce(function(r,e){var i=e.getAttribute("xml:id");return i&&(r[i]=e),r},{})}function u(a,r){return[].slice.call(a.childNodes).reduce(function(e,i,g){var f;return i.nodeName==="br"&&g?e+`
|
|
`:(f=i.childNodes)!==null&&f!==void 0&&f.length?u(i,r):r?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent},"")}function l(a,r){var e="http://www.w3.org/ns/ttml#styling",i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return i.reduce(function(g,f){var y=v(r,e,f)||v(a,e,f);return y&&(g[f]=y),g},{})}function v(a,r,e){return a.hasAttributeNS(r,e)?a.getAttributeNS(r,e):null}function d(a){return new Error("Could not parse ttml timestamp "+a)}function o(a,r){if(!a)return null;var e=Object(E.parseTimeStamp)(a);return e===null&&(S.test(a)?e=m(a,r):w.test(a)&&(e=h(a,r))),e}function m(a,r){var e=S.exec(a),i=(e[4]|0)+(e[5]|0)/r.subFrameRate;return(e[1]|0)*3600+(e[2]|0)*60+(e[3]|0)+i/r.frameRate}function h(a,r){var e=w.exec(a),i=Number(e[1]),g=e[2];switch(g){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/r.frameRate;case"t":return i/r.tickRate}return i}},"./src/utils/logger.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"enableLogs",function(){return T}),O.d(j,"logger",function(){return P});var N=function(){},E={trace:N,debug:N,log:N,warn:N,info:N,error:N},R=E;function I(b){var S=self.console[b];return S?S.bind(self.console,"["+b+"] >"):N}function L(b){for(var S=arguments.length,w=new Array(S>1?S-1:0),C=1;C<S;C++)w[C-1]=arguments[C];w.forEach(function(x){R[x]=b[x]?b[x].bind(b):I(x)})}function T(b){if(self.console&&b===!0||typeof b=="object"){L(b,"debug","log","info","warn","error");try{R.log()}catch(S){R=E}}else R=E}var P=R},"./src/utils/mediakeys-helper.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"KeySystems",function(){return N}),O.d(j,"requestMediaKeySystemAccess",function(){return E});var N;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(N||(N={}));var E=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"getMediaSource",function(){return N});function N(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"bin2str",function(){return L}),O.d(j,"readUint16",function(){return T}),O.d(j,"readUint32",function(){return P}),O.d(j,"writeUint32",function(){return b}),O.d(j,"findBox",function(){return S}),O.d(j,"parseSegmentIndex",function(){return w}),O.d(j,"parseInitSegment",function(){return C}),O.d(j,"getStartDTS",function(){return x}),O.d(j,"getDuration",function(){return _}),O.d(j,"computeRawDurationFromSamples",function(){return p}),O.d(j,"offsetStartDTS",function(){return n}),O.d(j,"segmentValidRange",function(){return u}),O.d(j,"appendUint8Array",function(){return l});var N=O("./src/utils/typed-array.ts"),E=O("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,I=[].push;function L(v){return String.fromCharCode.apply(null,v)}function T(v,d){"data"in v&&(d+=v.start,v=v.data);var o=v[d]<<8|v[d+1];return o<0?65536+o:o}function P(v,d){"data"in v&&(d+=v.start,v=v.data);var o=v[d]<<24|v[d+1]<<16|v[d+2]<<8|v[d+3];return o<0?4294967296+o:o}function b(v,d,o){"data"in v&&(d+=v.start,v=v.data),v[d]=o>>24,v[d+1]=o>>16&255,v[d+2]=o>>8&255,v[d+3]=o&255}function S(v,d){var o=[];if(!d.length)return o;var m,h,a;"data"in v?(m=v.data,h=v.start,a=v.end):(m=v,h=0,a=m.byteLength);for(var r=h;r<a;){var e=P(m,r),i=L(m.subarray(r+4,r+8)),g=e>1?r+e:a;if(i===d[0])if(d.length===1)o.push({data:m,start:r+8,end:g});else{var f=S({data:m,start:r+8,end:g},d.slice(1));f.length&&I.apply(o,f)}r=g}return o}function w(v){var d=S(v,["moov"]),o=d[0],m=o?o.end:null,h=S(v,["sidx"]);if(!h||!h[0])return null;var a=[],r=h[0],e=r.data[0],i=e===0?8:16,g=P(r,i);i+=4;var f=0,y=0;e===0?i+=8:i+=16,i+=2;var t=r.end+y,A=T(r,i);i+=2;for(var U=0;U<A;U++){var B=i,G=P(r,B);B+=4;var J=G&2147483647,F=(G&2147483648)>>>31;if(F===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=P(r,B);B+=4,a.push({referenceSize:J,subsegmentDuration:q,info:{duration:q/g,start:t,end:t+J-1}}),t+=J,B+=4,i=B}return{earliestPresentationTime:f,timescale:g,version:e,referencesCount:A,references:a,moovEndOffset:m}}function C(v){for(var d=[],o=S(v,["moov","trak"]),m=0;m<o.length;m++){var h=o[m],a=S(h,["tkhd"])[0];if(a){var r=a.data[a.start],e=r===0?12:20,i=P(a,e),g=S(h,["mdia","mdhd"])[0];if(g){r=g.data[g.start],e=r===0?12:20;var f=P(g,e),y=S(h,["mdia","hdlr"])[0];if(y){var t=L(y.data.subarray(y.start+8,y.start+12)),A={soun:E.ElementaryStreamTypes.AUDIO,vide:E.ElementaryStreamTypes.VIDEO}[t];if(A){var U=S(h,["mdia","minf","stbl","stsd"])[0],B=void 0;U&&(B=L(U.data.subarray(U.start+12,U.start+16))),d[i]={timescale:f,type:A},d[A]={timescale:f,id:i,codec:B}}}}}}var G=S(v,["moov","mvex","trex"]);return G.forEach(function(J){var F=P(J,4),q=d[F];q&&(q.default={duration:P(J,12),flags:P(J,20)})}),d}function x(v,d){return S(d,["moof","traf"]).reduce(function(o,m){var h=S(m,["tfdt"])[0],a=h.data[h.start],r=S(m,["tfhd"]).reduce(function(e,i){var g=P(i,4),f=v[g];if(f){var y=P(h,4);a===1&&(y*=Math.pow(2,32),y+=P(h,8));var t=f.timescale||9e4,A=y/t;if(isFinite(A)&&(e===null||A<e))return A}return e},null);return r!==null&&isFinite(r)&&(o===null||r<o)?r:o},null)||0}function _(v,d){for(var o=0,m=0,h=0,a=S(v,["moof","traf"]),r=0;r<a.length;r++){var e=a[r],i=S(e,["tfhd"])[0],g=P(i,4),f=d[g];if(!f)continue;var y=f.default,t=P(i,0)|(y==null?void 0:y.flags),A=y==null?void 0:y.duration;t&8&&(t&2?A=P(i,12):A=P(i,8));for(var U=f.timescale||9e4,B=S(e,["trun"]),G=0;G<B.length;G++){if(A){var J=P(B[G],4);o=A*J}else o=p(B[G]);f.type===E.ElementaryStreamTypes.VIDEO?m+=o/U:f.type===E.ElementaryStreamTypes.AUDIO&&(h+=o/U)}}if(m===0&&h===0){var F=w(v);if(F!=null&&F.references)return F.references.reduce(function(q,re){return q+re.info.duration||0},0)}return m||h}function p(v){var d=P(v,0),o=8;d&1&&(o+=4),d&4&&(o+=4);for(var m=0,h=P(v,4),a=0;a<h;a++){if(d&256){var r=P(v,o);m+=r,o+=4}d&512&&(o+=4),d&1024&&(o+=4),d&2048&&(o+=4)}return m}function n(v,d,o){S(d,["moof","traf"]).forEach(function(m){S(m,["tfhd"]).forEach(function(h){var a=P(h,4),r=v[a];if(!r)return;var e=r.timescale||9e4;S(m,["tfdt"]).forEach(function(i){var g=i.data[i.start],f=P(i,4);if(g===0)b(i,4,f-o*e);else{f*=Math.pow(2,32),f+=P(i,8),f-=o*e,f=Math.max(f,0);var y=Math.floor(f/(R+1)),t=Math.floor(f%(R+1));b(i,4,y),b(i,8,t)}})})})}function u(v){var d={valid:null,remainder:null},o=S(v,["moof"]);if(o){if(o.length<2)return d.remainder=v,d}else return d;var m=o[o.length-1];return d.valid=Object(N.sliceUint8)(v,0,m.start-8),d.remainder=Object(N.sliceUint8)(v,m.start-8),d}function l(v,d){var o=new Uint8Array(v.length+d.length);return o.set(v),o.set(d,v.length),o}},"./src/utils/output-filter.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"default",function(){return N});var N=function(){function E(I,L){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=I,this.trackName=L}var R=E.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(L,T,P){(this.startTime===null||this.startTime>L)&&(this.startTime=L),this.endTime=T,this.screen=P,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},E}()},"./src/utils/texttrack-utils.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"sendAddTrackEvent",function(){return E}),O.d(j,"addCueToTrack",function(){return R}),O.d(j,"clearCurrentCues",function(){return I}),O.d(j,"removeCuesInRange",function(){return L}),O.d(j,"getCuesInRange",function(){return P});var N=O("./src/utils/logger.ts");function E(b,S){var w;try{w=new Event("addtrack")}catch(C){w=document.createEvent("Event"),w.initEvent("addtrack",!1,!1)}w.track=b,S.dispatchEvent(w)}function R(b,S){var w=b.mode;if(w==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(S.id))try{if(b.addCue(S),!b.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(x){N.logger.debug("[texttrack-utils]: "+x);var C=new self.TextTrackCue(S.startTime,S.endTime,S.text);C.id=S.id,b.addCue(C)}w==="disabled"&&(b.mode=w)}function I(b){var S=b.mode;if(S==="disabled"&&(b.mode="hidden"),b.cues)for(var w=b.cues.length;w--;)b.removeCue(b.cues[w]);S==="disabled"&&(b.mode=S)}function L(b,S,w){var C=b.mode;if(C==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var x=P(b.cues,S,w),_=0;_<x.length;_++)b.removeCue(x[_]);C==="disabled"&&(b.mode=C)}function T(b,S){if(S<b[0].startTime)return 0;var w=b.length-1;if(S>b[w].endTime)return-1;for(var C=0,x=w;C<=x;){var _=Math.floor((x+C)/2);if(S<b[_].startTime)x=_-1;else if(S>b[_].startTime&&C<w)C=_+1;else return _}return b[C].startTime-S<S-b[x].startTime?C:x}function P(b,S,w){var C=[],x=T(b,S);if(x>-1)for(var _=x,p=b.length;_<p;_++){var n=b[_];if(n.startTime>=S&&n.endTime<=w)C.push(n);else if(n.startTime>w)return C}return C}},"./src/utils/time-ranges.ts":function(Ee,j,O){"use strict";O.r(j);var N={toString:function(R){for(var I="",L=R.length,T=0;T<L;T++)I+="["+R.start(T).toFixed(3)+","+R.end(T).toFixed(3)+"]";return I}};j.default=N},"./src/utils/timescale-conversion.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"toTimescaleFromBase",function(){return E}),O.d(j,"toTimescaleFromScale",function(){return R}),O.d(j,"toMsFromMpegTsClock",function(){return I}),O.d(j,"toMpegTsClockFromTimescale",function(){return L});var N=9e4;function E(T,P,b,S){b===void 0&&(b=1),S===void 0&&(S=!1);var w=T*P*b;return S?Math.round(w):w}function R(T,P,b,S){return b===void 0&&(b=1),S===void 0&&(S=!1),E(T,P,1/b,S)}function I(T,P){return P===void 0&&(P=!1),E(T,1e3,1/N,P)}function L(T,P){return P===void 0&&(P=1),E(T,N,1/P)}},"./src/utils/typed-array.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"sliceUint8",function(){return N});function N(E,R,I){return Uint8Array.prototype.slice?E.slice(R,I):new Uint8Array(Array.prototype.slice.call(E,R,I))}},"./src/utils/vttcue.ts":function(Ee,j,O){"use strict";O.r(j),j.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var N=["","lr","rl"],E=["start","middle","end","left","right"];function R(b,S){if(typeof S!="string")return!1;if(!Array.isArray(b))return!1;var w=S.toLowerCase();return~b.indexOf(w)?w:!1}function I(b){return R(N,b)}function L(b){return R(E,b)}function T(b){for(var S=arguments.length,w=new Array(S>1?S-1:0),C=1;C<S;C++)w[C-1]=arguments[C];for(var x=1;x<arguments.length;x++){var _=arguments[x];for(var p in _)b[p]=_[p]}return b}function P(b,S,w){var C=this,x={enumerable:!0};C.hasBeenReset=!1;var _="",p=!1,n=b,u=S,l=w,v=null,d="",o=!0,m="auto",h="start",a=50,r="middle",e=50,i="middle";Object.defineProperty(C,"id",T({},x,{get:function(){return _},set:function(f){_=""+f}})),Object.defineProperty(C,"pauseOnExit",T({},x,{get:function(){return p},set:function(f){p=!!f}})),Object.defineProperty(C,"startTime",T({},x,{get:function(){return n},set:function(f){if(typeof f!="number")throw new TypeError("Start time must be set to a number.");n=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",T({},x,{get:function(){return u},set:function(f){if(typeof f!="number")throw new TypeError("End time must be set to a number.");u=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",T({},x,{get:function(){return l},set:function(f){l=""+f,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",T({},x,{get:function(){return v},set:function(f){v=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",T({},x,{get:function(){return d},set:function(f){var y=I(f);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");d=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",T({},x,{get:function(){return o},set:function(f){o=!!f,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",T({},x,{get:function(){return m},set:function(f){if(typeof f!="number"&&f!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");m=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",T({},x,{get:function(){return h},set:function(f){var y=L(f);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");h=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",T({},x,{get:function(){return a},set:function(f){if(f<0||f>100)throw new Error("Position must be between 0 and 100.");a=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",T({},x,{get:function(){return r},set:function(f){var y=L(f);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");r=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",T({},x,{get:function(){return e},set:function(f){if(f<0||f>100)throw new Error("Size must be between 0 and 100.");e=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",T({},x,{get:function(){return i},set:function(f){var y=L(f);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");i=y,this.hasBeenReset=!0}})),C.displayState=void 0}return P.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},P}()},"./src/utils/vttparser.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"parseTimeStamp",function(){return R}),O.d(j,"fixLineBreaks",function(){return S}),O.d(j,"VTTParser",function(){return w});var N=O("./src/utils/vttcue.ts"),E=function(){function C(){}var x=C.prototype;return x.decode=function(p,n){if(!p)return"";if(typeof p!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(p))},C}();function R(C){function x(p,n,u,l){return(p|0)*3600+(n|0)*60+(u|0)+parseFloat(l||0)}var _=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return _?parseFloat(_[2])>59?x(_[2],_[3],0,_[4]):x(_[1],_[2],_[3],_[4]):null}var I=function(){function C(){this.values=Object.create(null)}var x=C.prototype;return x.set=function(p,n){!this.get(p)&&n!==""&&(this.values[p]=n)},x.get=function(p,n,u){return u?this.has(p)?this.values[p]:n[u]:this.has(p)?this.values[p]:n},x.has=function(p){return p in this.values},x.alt=function(p,n,u){for(var l=0;l<u.length;++l)if(n===u[l]){this.set(p,n);break}},x.integer=function(p,n){/^-?\d+$/.test(n)&&this.set(p,parseInt(n,10))},x.percent=function(p,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){var u=parseFloat(n);if(u>=0&&u<=100)return this.set(p,u),!0}return!1},C}();function L(C,x,_,p){var n=p?C.split(p):[C];for(var u in n){if(typeof n[u]!="string")continue;var l=n[u].split(_);if(l.length!==2)continue;var v=l[0],d=l[1];x(v,d)}}var T=new N.default(0,0,""),P=T.align==="middle"?"middle":"center";function b(C,x,_){var p=C;function n(){var v=R(C);if(v===null)throw new Error("Malformed timestamp: "+p);return C=C.replace(/^[^\sa-zA-Z-]+/,""),v}function u(v,d){var o=new I;L(v,function(a,r){var e;switch(a){case"region":for(var i=_.length-1;i>=0;i--)if(_[i].id===r){o.set(a,_[i].region);break}break;case"vertical":o.alt(a,r,["rl","lr"]);break;case"line":e=r.split(","),o.integer(a,e[0]),o.percent(a,e[0])&&o.set("snapToLines",!1),o.alt(a,e[0],["auto"]),e.length===2&&o.alt("lineAlign",e[1],["start",P,"end"]);break;case"position":e=r.split(","),o.percent(a,e[0]),e.length===2&&o.alt("positionAlign",e[1],["start",P,"end","line-left","line-right","auto"]);break;case"size":o.percent(a,r);break;case"align":o.alt(a,r,["start",P,"end","left","right"]);break}},/:/,/\s/),d.region=o.get("region",null),d.vertical=o.get("vertical","");var m=o.get("line","auto");m==="auto"&&T.line===-1&&(m=-1),d.line=m,d.lineAlign=o.get("lineAlign","start"),d.snapToLines=o.get("snapToLines",!0),d.size=o.get("size",100),d.align=o.get("align",P);var h=o.get("position","auto");h==="auto"&&T.position===50&&(h=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=h}function l(){C=C.replace(/^\s+/,"")}if(l(),x.startTime=n(),l(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+p);C=C.substr(3),l(),x.endTime=n(),l(),u(C,x)}function S(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var w=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new E,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var x=C.prototype;return x.parse=function(p){var n=this;p&&(n.buffer+=n.decoder.decode(p,{stream:!0}));function u(){var h=n.buffer,a=0;for(h=S(h);a<h.length&&h[a]!=="\r"&&h[a]!==`
|
|
`;)++a;var r=h.substr(0,a);return h[a]==="\r"&&++a,h[a]===`
|
|
`&&++a,n.buffer=h.substr(a),r}function l(h){L(h,function(a,r){},/:/)}try{var v="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;v=u();var d=v.match(/^()?WEBVTT([ \t].*)?$/);if(!d||!d[0])throw new Error("Malformed WebVTT signature.");n.state="HEADER"}for(var o=!1;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;o?o=!1:v=u();switch(n.state){case"HEADER":/:/.test(v)?l(v):v||(n.state="ID");continue;case"NOTE":v||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(v)){n.state="NOTE";break}if(!v)continue;if(n.cue=new N.default(0,0,""),n.state="CUE",v.indexOf("-->")===-1){n.cue.id=v;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{b(v,n.cue,n.regionList)}catch(h){n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{var m=v.indexOf("-->")!==-1;if(!v||m&&(o=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
|
|
`),n.cue.text+=v}continue;case"BADCUE":v||(n.state="ID")}}}catch(h){n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},x.flush=function(){var p=this;try{if((p.cue||p.state==="HEADER")&&(p.buffer+=`
|
|
|
|
`,p.parse()),p.state==="INITIAL"||p.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(n){p.onparsingerror&&p.onparsingerror(n)}return p.onflush&&p.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(Ee,j,O){"use strict";O.r(j),O.d(j,"generateCueId",function(){return w}),O.d(j,"parseWebVTT",function(){return x});var N=O("./src/polyfills/number.ts"),E=O("./src/utils/vttparser.ts"),R=O("./src/demux/id3.ts"),I=O("./src/utils/timescale-conversion.ts"),L=O("./src/remux/mp4-remuxer.ts"),T=/\r\n|\n\r|\n|\r/g,P=function(p,n,u){return u===void 0&&(u=0),p.substr(u,n.length)===n},b=function(p){var n=parseInt(p.substr(-3)),u=parseInt(p.substr(-6,2)),l=parseInt(p.substr(-9,2)),v=p.length>9?parseInt(p.substr(0,p.indexOf(":"))):0;if(!Object(N.isFiniteNumber)(n)||!Object(N.isFiniteNumber)(u)||!Object(N.isFiniteNumber)(l)||!Object(N.isFiniteNumber)(v))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+p);return n+=1e3*u,n+=60*1e3*l,n+=60*60*1e3*v,n},S=function(p){for(var n=5381,u=p.length;u;)n=n*33^p.charCodeAt(--u);return(n>>>0).toString()};function w(_,p,n){return S(_.toString())+S(p.toString())+S(n)}var C=function(p,n,u){var l=p[n],v=p[l.prevCC];if(!v||!v.new&&l.new){p.ccOffset=p.presentationOffset=l.start,l.new=!1;return}for(;(d=v)!==null&&d!==void 0&&d.new;){var d;p.ccOffset+=l.start-v.start,l.new=!1,l=v,v=p[l.prevCC]}p.presentationOffset=u};function x(_,p,n,u,l,v,d,o){var m=new E.VTTParser,h=Object(R.utf8ArrayToStr)(new Uint8Array(_)).trim().replace(T,`
|
|
`).split(`
|
|
`),a=[],r=Object(I.toMpegTsClockFromTimescale)(p,n),e="00:00.000",i=0,g=0,f,y=!0,t=!1;m.oncue=function(A){var U=u[l],B=u.ccOffset,G=(i-r)/9e4;if(U!=null&&U.new&&(g!==void 0?B=u.ccOffset=U.start:C(u,l,G)),G&&(B=G-u.presentationOffset),t){var J=A.endTime-A.startTime,F=Object(L.normalizePts)((A.startTime+B-g)*9e4,v*9e4)/9e4;A.startTime=F,A.endTime=F+J}var q=A.text.trim();A.text=decodeURIComponent(encodeURIComponent(q)),A.id||(A.id=w(A.startTime,A.endTime,q)),A.endTime>0&&a.push(A)},m.onparsingerror=function(A){f=A},m.onflush=function(){if(f){o(f);return}d(a)},h.forEach(function(A){if(y)if(P(A,"X-TIMESTAMP-MAP=")){y=!1,t=!0,A.substr(16).split(",").forEach(function(U){P(U,"LOCAL:")?e=U.substr(6):P(U,"MPEGTS:")&&(i=parseInt(U.substr(7)))});try{g=b(e)/1e3}catch(U){t=!1,f=U}return}else A===""&&(y=!1);m.parse(A+`
|
|
`)}),m.flush()}},"./src/utils/xhr-loader.ts":function(Ee,j,O){"use strict";O.r(j);var N=O("./src/utils/logger.ts"),E=O("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,I=function(){function L(P){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=P?P.xhrSetup:null,this.stats=new E.LoadStats,this.retryDelay=0}var T=L.prototype;return T.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},T.abortInternal=function(){var b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},T.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},T.load=function(b,S,w){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=b,this.config=S,this.callbacks=w,this.retryDelay=S.retryDelay,this.loadInternal()},T.loadInternal=function(){var b=this.config,S=this.context;if(!b)return;var w=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var x=this.xhrSetup;try{if(x)try{x(w,S.url)}catch(n){w.open("GET",S.url,!0),x(w,S.url)}w.readyState||w.open("GET",S.url,!0);var _=this.context.headers;if(_)for(var p in _)w.setRequestHeader(p,_[p])}catch(n){this.callbacks.onError({code:w.status,text:n.message},S,w);return}S.rangeEnd&&w.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),w.onreadystatechange=this.readystatechange.bind(this),w.onprogress=this.loadprogress.bind(this),w.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),w.send()},T.readystatechange=function(){var b=this.context,S=this.loader,w=this.stats;if(!b||!S)return;var C=S.readyState,x=this.config;if(w.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),w.loading.first===0&&(w.loading.first=Math.max(self.performance.now(),w.loading.start)),C===4){S.onreadystatechange=null,S.onprogress=null;var _=S.status;if(_>=200&&_<300){w.loading.end=Math.max(self.performance.now(),w.loading.first);var p,n;if(b.responseType==="arraybuffer"?(p=S.response,n=p.byteLength):(p=S.responseText,n=p.length),w.loaded=w.total=n,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(w,b,p,S),!this.callbacks)return;var l={url:S.responseURL,data:p};this.callbacks.onSuccess(l,w,b,S)}else w.retry>=x.maxRetry||_>=400&&_<499?(N.logger.error(_+" while loading "+b.url),this.callbacks.onError({code:_,text:S.statusText},b,S)):(N.logger.warn(_+" while loading "+b.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,x.maxRetryDelay),w.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},T.loadtimeout=function(){N.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},T.loadprogress=function(b){var S=this.stats;S.loaded=b.loaded,b.lengthComputable&&(S.total=b.total)},T.getCacheAge=function(){var b=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");b=S?parseFloat(S):null}return b},L}();j.default=I}}).default})},vHTk:function(Pt,Ye,K){Pt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},xlxt:function(Pt,Ye,K){Pt.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"}}}]);
|