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
813 KiB
330 lines
813 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[193,5,7,8,10],{"+92d":function(ft,Ge,W){ft.exports=W.p+"static/b1.8d46544a.svg"},"+RDj":function(ft,Ge,W){ft.exports=W.p+"static/dau.0c862b4c.svg"},"3SPk":function(ft,Ge,W){ft.exports=W.p+"static/c.893027ce.svg"},"5A5F":function(ft,Ge,W){ft.exports={flex_box_center:"flex_box_center___3fvo9",flex_space_between:"flex_space_between___2dIWe",flex_box_vertical_center:"flex_box_vertical_center___213Et",flex_box_center_end:"flex_box_center_end___1GXlY",flex_box_column:"flex_box_column___2XTWO",wrap:"wrap___1JbzU",bg:"bg___Dxa5l",btnWrap:"btnWrap___1CEeA",text:"text___ufYpy",btn:"btn___33IXa",content:"content___2Crhb",left:"left___12ObT",filterPoint:"filterPoint___1wSyY",btnWarp:"btnWarp___XLUgV",btnActive:"btnActive___2vIUq",action:"action___m_eZE",btnMask:"btnMask___epWeB",filterOrigin:"filterOrigin___OKol4",line:"line___psQHn",control:"control___1SAJX",table:"table___1Q9AI",tabWarp:"tabWarp___3884f",tabWarp2:"tabWarp2___1f1Zo",customTable:"customTable___6Ubut","btn-style-1":"btn-style-1___m4kGi","btn-style-2":"btn-style-2___2uJ8s","btn-style-3":"btn-style-3___3kuYl",right:"right___Ie2u1",title:"title___1uK2v",sort:"sort___1hyjY",titles:"titles___1i-V6",li:"li___3lR-W",titleWarp:"titleWarp___t0Zdh",hov:"hov___30B5q",hovBtn:"hovBtn___3ciGX",tag:"tag___hllWE",problemsclose:"problemsclose___1X9HB",imgsrc:"imgsrc___3koep"}},"6+eU":function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return l});var oe=W("wx14"),N=W("rePB"),S=W("VTBJ"),I=W("1OyB"),v=W("vuIU"),x=W("Ji7U"),U=W("LK+K"),M=W("q1tI"),R=W.n(M),w=W("TSYQ"),b=W.n(w),T=function(c){var i,n="".concat(c.rootPrefixCls,"-item"),t=b()(n,"".concat(n,"-").concat(c.page),(i={},Object(N.a)(i,"".concat(n,"-active"),c.active),Object(N.a)(i,c.className,!!c.className),Object(N.a)(i,"".concat(n,"-disabled"),!c.page),i)),e=function(){c.onClick(c.page)},p=function(_){c.onKeyPress(_,c.onClick,c.page)};return R.a.createElement("li",{title:c.showTitle?c.page:null,className:t,onClick:e,onKeyPress:p,tabIndex:"0"},c.itemRender(c.page,"page",R.a.createElement("a",{rel:"nofollow"},c.page)))},O=T,C={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},E=function(m){Object(x.a)(i,m);var c=Object(U.a)(i);function i(){var n;Object(I.a)(this,i);for(var t=arguments.length,e=new Array(t),p=0;p<t;p++)e[p]=arguments[p];return n=c.call.apply(c,[this].concat(e)),n.state={goInputText:""},n.buildOptionText=function(g){return"".concat(g," ").concat(n.props.locale.items_per_page)},n.changeSize=function(g){n.props.changeSize(Number(g))},n.handleChange=function(g){n.setState({goInputText:g.target.value})},n.handleBlur=function(g){var _=n.props,A=_.goButton,k=_.quickGo,F=_.rootPrefixCls,z=n.state.goInputText;if(A||z==="")return;if(g.relatedTarget&&(g.relatedTarget.className.indexOf("".concat(F,"-prev"))>=0||g.relatedTarget.className.indexOf("".concat(F,"-next"))>=0))return;n.setState({goInputText:""}),k(n.getValidValue())},n.go=function(g){var _=n.state.goInputText;if(_==="")return;(g.keyCode===C.ENTER||g.type==="click")&&(n.setState({goInputText:""}),n.props.quickGo(n.getValidValue()))},n}return Object(v.a)(i,[{key:"getValidValue",value:function(){var t=this.state,e=t.goInputText,p=t.current;return!e||isNaN(e)?p:Number(e)}},{key:"getPageSizeOptions",value:function(){var t=this.props,e=t.pageSize,p=t.pageSizeOptions;return p.some(function(g){return g.toString()===e.toString()})?p:p.concat([e.toString()]).sort(function(g,_){var A=isNaN(Number(g))?0:Number(g),k=isNaN(Number(_))?0:Number(_);return A-k})}},{key:"render",value:function(){var t=this,e=this.props,p=e.pageSize,g=e.locale,_=e.rootPrefixCls,A=e.changeSize,k=e.quickGo,F=e.goButton,z=e.selectComponentClass,J=e.buildOptionText,Y=e.selectPrefixCls,$=e.disabled,le=this.state.goInputText,be="".concat(_,"-options"),ve=z,ke=null,Te=null,xe=null;if(!A&&!k)return null;var _e=this.getPageSizeOptions();if(A&&ve){var Oe=_e.map(function(ce,Z){return R.a.createElement(ve.Option,{key:Z,value:ce.toString()},(J||t.buildOptionText)(ce))});ke=R.a.createElement(ve,{disabled:$,prefixCls:Y,showSearch:!1,className:"".concat(be,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(p||_e[0]).toString(),onChange:this.changeSize,getPopupContainer:function(Z){return Z.parentNode}},Oe)}return k&&(F&&(xe=typeof F=="boolean"?R.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:$,className:"".concat(be,"-quick-jumper-button")},g.jump_to_confirm):R.a.createElement("span",{onClick:this.go,onKeyUp:this.go},F)),Te=R.a.createElement("div",{className:"".concat(be,"-quick-jumper")},g.jump_to,R.a.createElement("input",{disabled:$,type:"text",value:le,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),g.page,xe)),R.a.createElement("li",{className:"".concat(be)},ke,Te)}}]),i}(R.a.Component);E.defaultProps={pageSizeOptions:["10","20","50","100"]};var y=E,h=W("N2Kk");function r(){}function o(m){return typeof m=="number"&&isFinite(m)&&Math.floor(m)===m}function s(m,c,i){return i}function f(m,c,i){var n=typeof m=="undefined"?c.pageSize:m;return Math.floor((i.total-1)/n)+1}var d=function(m){Object(x.a)(i,m);var c=Object(U.a)(i);function i(n){var t;Object(I.a)(this,i),t=c.call(this,n),t.getJumpPrevPage=function(){return Math.max(1,t.state.current-(t.props.showLessItems?3:5))},t.getJumpNextPage=function(){return Math.min(f(void 0,t.state,t.props),t.state.current+(t.props.showLessItems?3:5))},t.getItemIcon=function(A,k){var F=t.props.prefixCls,z=A||R.a.createElement("button",{type:"button","aria-label":k,className:"".concat(F,"-item-link")});return typeof A=="function"&&(z=R.a.createElement(A,Object(S.a)({},t.props))),z},t.savePaginationNode=function(A){t.paginationNode=A},t.isValid=function(A){return o(A)&&A!==t.state.current},t.shouldDisplayQuickJumper=function(){var A=t.props,k=A.showQuickJumper,F=A.pageSize,z=A.total;return z<=F?!1:k},t.handleKeyDown=function(A){(A.keyCode===C.ARROW_UP||A.keyCode===C.ARROW_DOWN)&&A.preventDefault()},t.handleKeyUp=function(A){var k=t.getValidValue(A),F=t.state.currentInputValue;k!==F&&t.setState({currentInputValue:k}),A.keyCode===C.ENTER?t.handleChange(k):A.keyCode===C.ARROW_UP?t.handleChange(k-1):A.keyCode===C.ARROW_DOWN&&t.handleChange(k+1)},t.changePageSize=function(A){var k=t.state.current,F=f(A,t.state,t.props);k=k>F?F:k,F===0&&(k=t.state.current),typeof A=="number"&&("pageSize"in t.props||t.setState({pageSize:A}),"current"in t.props||t.setState({current:k,currentInputValue:k})),t.props.onShowSizeChange(k,A),"onChange"in t.props&&t.props.onChange&&t.props.onChange(k,A)},t.handleChange=function(A){var k=t.props.disabled,F=A;if(t.isValid(F)&&!k){var z=f(void 0,t.state,t.props);F>z?F=z:F<1&&(F=1),"current"in t.props||t.setState({current:F,currentInputValue:F});var J=t.state.pageSize;return t.props.onChange(F,J),F}return t.state.current},t.prev=function(){t.hasPrev()&&t.handleChange(t.state.current-1)},t.next=function(){t.hasNext()&&t.handleChange(t.state.current+1)},t.jumpPrev=function(){t.handleChange(t.getJumpPrevPage())},t.jumpNext=function(){t.handleChange(t.getJumpNextPage())},t.hasPrev=function(){return t.state.current>1},t.hasNext=function(){return t.state.current<f(void 0,t.state,t.props)},t.runIfEnter=function(A,k){if(A.key==="Enter"||A.charCode===13){for(var F=arguments.length,z=new Array(F>2?F-2:0),J=2;J<F;J++)z[J-2]=arguments[J];k.apply(void 0,z)}},t.runIfEnterPrev=function(A){t.runIfEnter(A,t.prev)},t.runIfEnterNext=function(A){t.runIfEnter(A,t.next)},t.runIfEnterJumpPrev=function(A){t.runIfEnter(A,t.jumpPrev)},t.runIfEnterJumpNext=function(A){t.runIfEnter(A,t.jumpNext)},t.handleGoTO=function(A){(A.keyCode===C.ENTER||A.type==="click")&&t.handleChange(t.state.currentInputValue)};var e=n.onChange!==r,p="current"in n;p&&!e&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var g=n.defaultCurrent;"current"in n&&(g=n.current);var _=n.defaultPageSize;return"pageSize"in n&&(_=n.pageSize),g=Math.min(g,f(_,void 0,n)),t.state={current:g,currentInputValue:g,pageSize:_},t}return Object(v.a)(i,[{key:"componentDidUpdate",value:function(t,e){var p=this.props.prefixCls;if(e.current!==this.state.current&&this.paginationNode){var g=this.paginationNode.querySelector(".".concat(p,"-item-").concat(e.current));g&&document.activeElement===g&&g.blur()}}},{key:"getValidValue",value:function(t){var e=t.target.value,p=f(void 0,this.state,this.props),g=this.state.currentInputValue,_;return e===""?_=e:isNaN(Number(e))?_=g:e>=p?_=p:_=Number(e),_}},{key:"getShowSizeChanger",value:function(){var t=this.props,e=t.showSizeChanger,p=t.total,g=t.totalBoundaryShowSizeChanger;return typeof e!="undefined"?e:p>g}},{key:"renderPrev",value:function(t){var e=this.props,p=e.prevIcon,g=e.itemRender,_=g(t,"prev",this.getItemIcon(p,"prev page")),A=!this.hasPrev();return Object(M.isValidElement)(_)?Object(M.cloneElement)(_,{disabled:A}):_}},{key:"renderNext",value:function(t){var e=this.props,p=e.nextIcon,g=e.itemRender,_=g(t,"next",this.getItemIcon(p,"next page")),A=!this.hasNext();return Object(M.isValidElement)(_)?Object(M.cloneElement)(_,{disabled:A}):_}},{key:"render",value:function(){var t=this,e=this.props,p=e.prefixCls,g=e.className,_=e.style,A=e.disabled,k=e.hideOnSinglePage,F=e.total,z=e.locale,J=e.showQuickJumper,Y=e.showLessItems,$=e.showTitle,le=e.showTotal,be=e.simple,ve=e.itemRender,ke=e.showPrevNextJumpers,Te=e.jumpPrevIcon,xe=e.jumpNextIcon,_e=e.selectComponentClass,Oe=e.selectPrefixCls,ce=e.pageSizeOptions,Z=this.state,je=Z.current,at=Z.pageSize,rt=Z.currentInputValue;if(k===!0&&F<=at)return null;var Ke=f(void 0,this.state,this.props),He=[],we=null,Fe=null,$e=null,Qe=null,Ve=null,Ue=J&&J.goButton,Be=Y?1:2,ct=je-1>0?je-1:0,st=je+1<Ke?je+1:Ke,lt=Object.keys(this.props).reduce(function(H,G){return(G.substr(0,5)==="data-"||G.substr(0,5)==="aria-"||G==="role")&&(H[G]=t.props[G]),H},{});if(be)return Ue&&(typeof Ue=="boolean"?Ve=R.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},z.jump_to_confirm):Ve=R.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Ue),Ve=R.a.createElement("li",{title:$?"".concat(z.jump_to).concat(je,"/").concat(Ke):null,className:"".concat(p,"-simple-pager")},Ve)),R.a.createElement("ul",Object(oe.a)({className:b()(p,"".concat(p,"-simple"),Object(N.a)({},"".concat(p,"-disabled"),A),g),style:_,ref:this.savePaginationNode},lt),R.a.createElement("li",{title:$?z.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:b()("".concat(p,"-prev"),Object(N.a)({},"".concat(p,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(ct)),R.a.createElement("li",{title:$?"".concat(je,"/").concat(Ke):null,className:"".concat(p,"-simple-pager")},R.a.createElement("input",{type:"text",value:rt,disabled:A,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),R.a.createElement("span",{className:"".concat(p,"-slash")},"/"),Ke),R.a.createElement("li",{title:$?z.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:b()("".concat(p,"-next"),Object(N.a)({},"".concat(p,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(st)),Ve);if(Ke<=3+Be*2){var nt={locale:z,rootPrefixCls:p,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:$,itemRender:ve};Ke||He.push(R.a.createElement(O,Object(oe.a)({},nt,{key:"noPager",page:Ke,className:"".concat(p,"-disabled")})));for(var ht=1;ht<=Ke;ht+=1){var ut=je===ht;He.push(R.a.createElement(O,Object(oe.a)({},nt,{key:ht,page:ht,active:ut})))}}else{var fe=Y?z.prev_3:z.prev_5,ye=Y?z.next_3:z.next_5;ke&&(we=R.a.createElement("li",{title:$?fe:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:b()("".concat(p,"-jump-prev"),Object(N.a)({},"".concat(p,"-jump-prev-custom-icon"),!!Te))},ve(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(Te,"prev page"))),Fe=R.a.createElement("li",{title:$?ye:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:b()("".concat(p,"-jump-next"),Object(N.a)({},"".concat(p,"-jump-next-custom-icon"),!!xe))},ve(this.getJumpNextPage(),"jump-next",this.getItemIcon(xe,"next page")))),Qe=R.a.createElement(O,{locale:z,last:!0,rootPrefixCls:p,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Ke,page:Ke,active:!1,showTitle:$,itemRender:ve}),$e=R.a.createElement(O,{locale:z,rootPrefixCls:p,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:$,itemRender:ve});var Re=Math.max(1,je-Be),Ie=Math.min(je+Be,Ke);je-1<=Be&&(Ie=1+Be*2),Ke-je<=Be&&(Re=Ke-Be*2);for(var Ce=Re;Ce<=Ie;Ce+=1){var Ae=je===Ce;He.push(R.a.createElement(O,{locale:z,rootPrefixCls:p,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Ce,page:Ce,active:Ae,showTitle:$,itemRender:ve}))}je-1>=Be*2&&je!==1+2&&(He[0]=Object(M.cloneElement)(He[0],{className:"".concat(p,"-item-after-jump-prev")}),He.unshift(we)),Ke-je>=Be*2&&je!==Ke-2&&(He[He.length-1]=Object(M.cloneElement)(He[He.length-1],{className:"".concat(p,"-item-before-jump-next")}),He.push(Fe)),Re!==1&&He.unshift($e),Ie!==Ke&&He.push(Qe)}var ae=null;le&&(ae=R.a.createElement("li",{className:"".concat(p,"-total-text")},le(F,[F===0?0:(je-1)*at+1,je*at>F?F:je*at])));var ee=!this.hasPrev()||!Ke,te=!this.hasNext()||!Ke;return R.a.createElement("ul",Object(oe.a)({className:b()(p,g,Object(N.a)({},"".concat(p,"-disabled"),A)),style:_,unselectable:"unselectable",ref:this.savePaginationNode},lt),ae,R.a.createElement("li",{title:$?z.prev_page:null,onClick:this.prev,tabIndex:ee?null:0,onKeyPress:this.runIfEnterPrev,className:b()("".concat(p,"-prev"),Object(N.a)({},"".concat(p,"-disabled"),ee)),"aria-disabled":ee},this.renderPrev(ct)),He,R.a.createElement("li",{title:$?z.next_page:null,onClick:this.next,tabIndex:te?null:0,onKeyPress:this.runIfEnterNext,className:b()("".concat(p,"-next"),Object(N.a)({},"".concat(p,"-disabled"),te)),"aria-disabled":te},this.renderNext(st)),R.a.createElement(y,{disabled:A,locale:z,rootPrefixCls:p,selectComponentClass:_e,selectPrefixCls:Oe,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:je,pageSize:at,pageSizeOptions:ce,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ue}))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var p={};if("current"in t&&(p.current=t.current,t.current!==e.current&&(p.currentInputValue=p.current)),"pageSize"in t&&t.pageSize!==e.pageSize){var g=e.current,_=f(t.pageSize,e,t);g=g>_?_:g,"current"in t||(p.current=g,p.currentInputValue=g),p.pageSize=t.pageSize}return p}}]),i}(R.a.Component);d.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:r,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:r,locale:h.a,style:{},itemRender:s,totalBoundaryShowSizeChanger:50};var l=d},"6RRn":function(ft,Ge,W){"use strict";var oe=W("wCXF"),N=W("n6Qo");W.d(Ge,"b",function(){return N.a});var S=W("IBYe"),I=W("6eGT"),v=W("hW8S");W.d(Ge,"a",function(){return v.a}),Ge.c=oe.b},"6eGT":function(ft,Ge,W){"use strict";function oe(N){return null}Ge.a=oe},"815F":function(ft,Ge,W){"use strict";W.d(Ge,"e",function(){return U}),W.d(Ge,"c",function(){return R}),W.d(Ge,"d",function(){return w}),W.d(Ge,"a",function(){return T}),W.d(Ge,"f",function(){return O}),W.d(Ge,"b",function(){return C});var oe=W("KQm4"),N=W("VTBJ"),S=W("Ff2n"),I=W("Zm9Q"),v=W("Kwbf"),x=W("OZM5");function U(E,y){return E!=null?E:y}function M(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=new Map;function h(r){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(r||[]).forEach(function(s){var f=s.key,d=s.children;Object(v.a)(f!=null,"Tree node must have a certain key: [".concat(o).concat(f,"]"));var l=String(f);Object(v.a)(!y.has(l)||f===null||f===void 0,"Same 'key' exist in the Tree: ".concat(l)),y.set(l,!0),h(d,"".concat(o).concat(l," > "))})}h(E)}function R(E){function y(h){var r=Object(I.a)(h);return r.map(function(o){if(!Object(x.i)(o))return Object(v.a)(!o,"Tree/TreeNode can only accept TreeNode as children."),null;var s=o.key,f=o.props,d=f.children,l=Object(S.a)(f,["children"]),m=Object(N.a)({key:s},l),c=y(d);return c.length&&(m.children=c),m}).filter(function(o){return o})}return y(E)}function w(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],h=new Set(y===!0?[]:y),r=[];function o(s){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return s.map(function(d,l){var m=Object(x.h)(f?f.pos:"0",l),c=U(d.key,m),i=Object(N.a)(Object(N.a)({},d),{},{parent:f,pos:m,children:null,data:d,isStart:[].concat(Object(oe.a)(f?f.isStart:[]),[l===0]),isEnd:[].concat(Object(oe.a)(f?f.isEnd:[]),[l===s.length-1])});return r.push(i),y===!0||h.has(c)?i.children=o(d.children||[],i):i.children=[],i})}return o(E),r}function b(E,y,h){var r;h?typeof h=="string"?r=function(f){return f[h]}:typeof h=="function"&&(r=function(f){return h(f)}):r=function(f,d){return U(f.key,d)};function o(s,f,d){var l=s?s.children:E,m=s?Object(x.h)(d.pos,f):"0";if(s){var c=r(s,m),i={node:s,index:f,pos:m,key:c,parentPos:d.node?d.pos:null,level:d.level+1};y(i)}l&&l.forEach(function(n,t){o(n,t,{node:s,pos:m,level:d?d.level+1:-1})})}o(null)}function T(E){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=y.initWrapper,r=y.processEntity,o=y.onProcessFinished,s=arguments.length>2?arguments[2]:void 0,f={},d={},l={posEntities:f,keyEntities:d};return h&&(l=h(l)||l),b(E,function(m){var c=m.node,i=m.index,n=m.pos,t=m.key,e=m.parentPos,p=m.level,g={node:c,index:i,key:t,pos:n,level:p},_=U(t,n);f[n]=g,d[_]=g,g.parent=f[e],g.parent&&(g.parent.children=g.parent.children||[],g.parent.children.push(g)),r&&r(g,l)},s),o&&o(l),l}function O(E,y){var h=y.expandedKeys,r=y.selectedKeys,o=y.loadedKeys,s=y.loadingKeys,f=y.checkedKeys,d=y.halfCheckedKeys,l=y.dragOverNodeKey,m=y.dropPosition,c=y.keyEntities,i=c[E],n={eventKey:E,expanded:h.indexOf(E)!==-1,selected:r.indexOf(E)!==-1,loaded:o.indexOf(E)!==-1,loading:s.indexOf(E)!==-1,checked:f.indexOf(E)!==-1,halfChecked:d.indexOf(E)!==-1,pos:String(i?i.pos:""),dragOver:l===E&&m===0,dragOverGapTop:l===E&&m===-1,dragOverGapBottom:l===E&&m===1};return n}function C(E){var y=E.data,h=E.expanded,r=E.selected,o=E.checked,s=E.loaded,f=E.loading,d=E.halfChecked,l=E.dragOver,m=E.dragOverGapTop,c=E.dragOverGapBottom,i=E.pos,n=E.active,t=Object(N.a)(Object(N.a)({},y),{},{expanded:h,selected:r,checked:o,loaded:s,loading:f,halfChecked:d,dragOver:l,dragOverGapTop:m,dragOverGapBottom:c,pos:i,active:n});return"props"in t||Object.defineProperty(t,"props",{get:function(){return Object(v.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),E}}),t}},"8hTe":function(ft,Ge,W){ft.exports={button:"button___1wy9m"}},"9Bee":function(ft,Ge,W){"use strict";var oe=W("DYRE"),N=W("zeV3"),S=W("+L6B"),I=W("2/Rp"),v=W("k1fw"),x=W("9og8"),U=W("tJVT"),M=W("WmNS"),R=W.n(M),w=W("q1tI"),b=W.n(w),T=W("vg9a"),O=W("DlQD"),C=W.n(O),E=W("rUJ1");function y(P,a){var u=P.match(/^(\s+)(?:```)/);if(u===null)return a;var D=u[1];return a.split(`
|
|
`).map(function(B){var L=B.match(/^\s+/);if(L===null)return B;var se=Object(U.a)(L,1),Ne=se[0];return Ne.length>=D.length?B.slice(D.length):B}).join(`
|
|
`)}var h=[],r=["<ul>"],o=new C.a.Renderer,s=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function f(){h.length=0,r=["<ul>"]}var d={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(P,a,u,D){if(a>=P.length||P[a].level<=u)return a;var B=P[a];D.push("<li><a href='#"+B.anchor+"'>"+B.text+"</a>"),a++;var L=[];return a=l(P,a,B.level,L),L.length>0&&(D.push("<ul>"),L.forEach(function(se){D.push(se)}),D.push("</ul>")),D.push("</li>"),a=l(P,a,u,D),a}function m(){return l(h,0,0,r),r.push("</ul>"),r.join("")}var c={heading:function(a){var u=s.exec(a);if(u)return{type:"heading",raw:u[0],depth:u[1].length,text:u[2]}},fences:function(a){var u=this.rules.block.fences.exec(a);if(u){var D=u[0],B=y(D,u[3]||""),L=u[2]?u[2].trim():u[2];if(["latex","katex","math"].indexOf(L)>=0){var se=t(),Ne=B;B=se,e[se]={type:"block",expression:Ne}}return{type:"code",raw:D,lang:L,text:B}}}},i=/(?:\${2})([^\n`]+?)(?:\${2})/gi,n=0,t=function(){return"__special_katext_id_".concat(n++,"__")},e={};function p(){return e}function g(){n=0,e={}}function _(P){return P=P.replace(i,function(a,u){var D=t();return e[D]={type:"inline",expression:u},D}),P}var A=o.listitem;o.listitem=function(P){return A(_(P))};var k=o.paragraph;o.paragraph=function(P){return k(_(P))};var F=o.tablecell;o.tablecell=function(P,a){return F(_(P),a)},o.code=function(P,a,u){var D=(a||"").match(/\S*/)[0];return D?["latex","katex","math"].indexOf(D)>=0?"<p class='editormd-tex'>".concat(P,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(a,'">').concat(u?P:Object(E.escape)(P,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(u?P:Object(E.escape)(P,!0))+"</code></pre>"},o.heading=function(P,a,u){var D=this.options.headerPrefix+u.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:D,level:a,text:P}),"<h"+a+' id="'+D+'">'+P+"</h"+a+">"},C.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),C.a.use({tokenizer:c,renderer:o});var z=C.a,J=W("SJMd"),Y=W("ulZh"),$=W.n(Y),le=W("m3rI"),be=W("Oy/b"),ve=W("p5ED"),ke=W("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 Te=function(P,a){return(Te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,D){u.__proto__=D}||function(u,D){for(var B in D)Object.prototype.hasOwnProperty.call(D,B)&&(u[B]=D[B])})(P,a)};function xe(P,a){function u(){this.constructor=P}Te(P,a),P.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}function _e(P,a,u,D){return new(u||(u=Promise))(function(B,L){function se(pt){try{tt(D.next(pt))}catch(We){L(We)}}function Ne(pt){try{tt(D.throw(pt))}catch(We){L(We)}}function tt(pt){var We;pt.done?B(pt.value):(We=pt.value,We instanceof u?We:new u(function(bt){bt(We)})).then(se,Ne)}tt((D=D.apply(P,a||[])).next())})}function Oe(P,a){var u,D,B,L,se={label:0,sent:function(){if(1&B[0])throw B[1];return B[1]},trys:[],ops:[]};return L={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(L[Symbol.iterator]=function(){return this}),L;function Ne(tt){return function(pt){return function(We){if(u)throw new TypeError("Generator is already executing.");for(;se;)try{if(u=1,D&&(B=2&We[0]?D.return:We[0]?D.throw||((B=D.return)&&B.call(D),0):D.next)&&!(B=B.call(D,We[1])).done)return B;switch(D=0,B&&(We=[2&We[0],B.value]),We[0]){case 0:case 1:B=We;break;case 4:return se.label++,{value:We[1],done:!1};case 5:se.label++,D=We[1],We=[0];continue;case 7:We=se.ops.pop(),se.trys.pop();continue;default:if(!(B=se.trys,(B=B.length>0&&B[B.length-1])||We[0]!==6&&We[0]!==2)){se=0;continue}if(We[0]===3&&(!B||We[1]>B[0]&&We[1]<B[3])){se.label=We[1];break}if(We[0]===6&&se.label<B[1]){se.label=B[1],B=We;break}if(B&&se.label<B[2]){se.label=B[2],se.ops.push(We);break}B[2]&&se.ops.pop(),se.trys.pop();continue}We=a.call(P,se)}catch(bt){We=[6,bt],D=0}finally{u=B=0}if(5&We[0])throw We[1];return{value:We[0]?We[1]:void 0,done:!0}}([tt,pt])}}}function ce(){for(var P=0,a=0,u=arguments.length;a<u;a++)P+=arguments[a].length;var D=Array(P),B=0;for(a=0;a<u;a++)for(var L=arguments[a],se=0,Ne=L.length;se<Ne;se++,B++)D[B]=L[se];return D}var Z=function(){function P(){}return P.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},P.setAttributes=function(a,u){for(var D=0,B=u;D<B.length;D++){var L=B[D],se=L[0],Ne=L[1];a.setAttribute(se,Ne)}},P.createRect=function(a,u,D){var B=document.createElementNS("http://www.w3.org/2000/svg","rect");return B.setAttribute("width",a.toString()),B.setAttribute("height",u.toString()),D&&P.setAttributes(B,D),B},P.createLine=function(a,u,D,B,L){var se=document.createElementNS("http://www.w3.org/2000/svg","line");return se.setAttribute("x1",a.toString()),se.setAttribute("y1",u.toString()),se.setAttribute("x2",D.toString()),se.setAttribute("y2",B.toString()),L&&P.setAttributes(se,L),se},P.createPolygon=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",a),u&&P.setAttributes(D,u),D},P.createCircle=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(a/2).toString()),D.setAttribute("cy",(a/2).toString()),D.setAttribute("r",a.toString()),u&&P.setAttributes(D,u),D},P.createEllipse=function(a,u,D){var B=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return B.setAttribute("cx",(a/2).toString()),B.setAttribute("cy",(u/2).toString()),B.setAttribute("rx",(a/2).toString()),B.setAttribute("ry",(u/2).toString()),D&&P.setAttributes(B,D),B},P.createGroup=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","g");return a&&P.setAttributes(u,a),u},P.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},P.createMarker=function(a,u,D,B,L,se,Ne){var tt=document.createElementNS("http://www.w3.org/2000/svg","marker");return P.setAttributes(tt,[["id",a],["orient",u],["markerWidth",D.toString()],["markerHeight",B.toString()],["refX",L.toString()],["refY",se.toString()]]),tt.appendChild(Ne),tt},P.createText=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","text");return u.setAttribute("x","0"),u.setAttribute("y","0"),a&&P.setAttributes(u,a),u},P.createTSpan=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=a,u&&P.setAttributes(D,u),D},P.createImage=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","image");return a&&P.setAttributes(u,a),u},P.createPoint=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=a,D.y=u,D},P.createPath=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",a),u&&P.setAttributes(D,u),D},P}(),je=function(){function P(){}return P.addKey=function(a){P.key=a},Object.defineProperty(P,"isLicensed",{get:function(){return!!P.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(P.key)},enumerable:!1,configurable:!0}),P}(),at=function(){function P(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return P.prototype.rasterize=function(a,u,D){var B=this;return new Promise(function(L){var se=D!==void 0?D:document.createElement("canvas");a===null&&(B.markersOnly=!0,B.naturalSize=!1);var Ne=document.createElementNS("http://www.w3.org/2000/svg","svg");Ne.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ne.setAttribute("width",u.width.baseVal.valueAsString),Ne.setAttribute("height",u.height.baseVal.valueAsString),Ne.setAttribute("viewBox","0 0 "+u.viewBox.baseVal.width.toString()+" "+u.viewBox.baseVal.height.toString()),Ne.innerHTML=u.innerHTML,B.naturalSize===!0?(Ne.width.baseVal.value=a.naturalWidth,Ne.height.baseVal.value=a.naturalHeight):B.width!==void 0&&B.height!==void 0&&(Ne.width.baseVal.value=B.width,Ne.height.baseVal.value=B.height),se.width=Ne.width.baseVal.value,se.height=Ne.height.baseVal.value;var tt=Ne.outerHTML,pt=se.getContext("2d");B.markersOnly!==!0&&pt.drawImage(a,0,0,se.width,se.height);var We=window.URL,bt=new Image(se.width,se.height);bt.setAttribute("crossOrigin","anonymous");var Tt=new Blob([tt],{type:"image/svg+xml"}),Qt=We.createObjectURL(Tt);bt.onload=function(){pt.drawImage(bt,0,0),We.revokeObjectURL(Qt);var De=se.toDataURL(B.imageType,B.imageQuality);L(De)},bt.src=Qt})},P}(),rt=function(){},Ke=function(){function P(a){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+a+"_"}return Object.defineProperty(P.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(P.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(P.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),P.prototype.addClass=function(a){return this.styleSheet===void 0&&this.addStyleSheet(),a.name=""+this.classNamePrefix+a.localName,this.classes.push(a),this.styleSheet.sheet.insertRule("."+a.name+" {"+a.style+"}",this.styleSheet.sheet.cssRules.length),a},P.prototype.addRule=function(a){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(a),this.styleSheet.sheet.insertRule(a.selector+" {"+a.style+"}",this.styleSheet.sheet.cssRules.length)},P.prototype.addStyleSheet=function(){var a;this.styleSheet=document.createElement("style"),((a=this.styleSheetRoot)!==null&&a!==void 0?a:document.head).appendChild(this.styleSheet),this.addRule(new He("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new He("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new He("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new we("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new we("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},P.prototype.removeStyleSheet=function(){var a;this.styleSheet&&(((a=this.styleSheetRoot)!==null&&a!==void 0?a:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},P}(),He=function(P,a){this.selector=P,this.style=a},we=function(P,a){this.localName=P,this.style=a},Fe=function(){function P(a,u,D,B,L){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=a,this.displayMode=u,this.markerItems=D,this.uiStyleSettings=B,this.styles=L,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return P.prototype.show=function(a){var u=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=a,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(L){var se=document.createElement("div");se.className=""+u.toolbarButtonStyleClass.name,se.setAttribute("data-type-name",L.typeName),se.innerHTML=L.icon,se.addEventListener("click",function(){u.markerToolbarButtonClicked(se,L)}),u.buttons.push(se),u.markerButtons.push(se)}),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 B=document.createElement("div");B.className=this.toolbarBlockStyleClass.name,B.style.whiteSpace="nowrap",B.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(B),this.addActionButton(B,'<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(B,'<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()},P.prototype.addButtonClickListener=function(a){this.buttonClickListeners.push(a)},P.prototype.removeButtonClickListener=function(a){this.buttonClickListeners.indexOf(a)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(a),1)},P.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},P.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var a=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var u=0;u<this.markerButtons.length;u++)u<a||u===a&&this.markerButtons.length-1===a?this.markerButtonBlock.appendChild(this.markerButtons[u]):(u===a&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[u]))}},P.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")},P.prototype.resetButtonStyles=function(){var a=this;this.buttons.forEach(function(u){u.className=u.className.replace(a.uiStyleSettings.toolbarButtonStyleColorsClassName?a.uiStyleSettings.toolbarButtonStyleColorsClassName:a.toolbarButtonStyleColorsClass.name,"").trim(),u.className=u.className.replace(a.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?a.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:a.toolbarActiveButtonStyleColorsClass.name,"").trim(),u.className+=" "+(a.uiStyleSettings.toolbarButtonStyleColorsClassName?a.uiStyleSettings.toolbarButtonStyleColorsClassName:a.toolbarButtonStyleColorsClass.name)})},P.prototype.addActionButton=function(a,u,D){var B=this,L=document.createElement("div");switch(L.className=""+this.toolbarButtonStyleClass.name,L.innerHTML=u,L.setAttribute("data-action",D),L.addEventListener("click",function(){B.actionToolbarButtonClicked(L,D)}),D){case"select":L.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":L.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":L.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":L.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":L.style.fill=this.uiStyleSettings.closeButtonColor}a.appendChild(L),this.buttons.push(L)},P.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new we("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 we("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new we("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new we("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 we("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var a=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new we("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
|
|
padding: `+a+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new we("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new we("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new He("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new He("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},P.prototype.markerToolbarButtonClicked=function(a,u){this.setActiveButton(a),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("marker",u)}),this.markerButtonOverflowBlock.style.display="none"},P.prototype.actionToolbarButtonClicked=function(a,u){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("action",u)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},P.prototype.setActiveButton=function(a){this.resetButtonStyles(),a.className=a.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),a.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},P.prototype.setActiveMarkerButton=function(a){var u=this.markerButtons.find(function(D){return D.getAttribute("data-type-name")===a});u&&this.setActiveButton(u)},P.prototype.setCurrentMarker=function(a){var u=this;this.currentMarker=a,this.buttons.filter(function(D){return/delete|notes/.test(D.getAttribute("data-action"))}).forEach(function(D){u.currentMarker===void 0?(D.style.fillOpacity="0.4",D.style.pointerEvents="none"):(D.style.fillOpacity="1",D.style.pointerEvents="all")})},P}(),$e=function(){function P(a,u,D,B){this.panels=[],this.panelButtons=[],this.markerjsContainer=a,this.displayMode=u,this.uiStyleSettings=D,this.styles=B,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return P.prototype.addStyles=function(){var a;this.toolboxStyleClass=this.styles.addClass(new we("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 we("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var u=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new we("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new we("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new we("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 we("toolbox-panel-row_colors",`
|
|
background-color: `+((a=this.uiStyleSettings.toolboxBackgroundColor)!==null&&a!==void 0?a:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new we("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*u)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*u)+`px;
|
|
padding: `+u+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new we("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new we("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new He("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new He("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},P.prototype.show=function(a){var u;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=a,this.uiContainer.className=this.toolboxStyleClass.name+" "+((u=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&u!==void 0?u:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},P.prototype.setPanelButtons=function(a){var u,D,B=this;this.panels=a,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((u=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&u!==void 0?u: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(L){var se;L.uiStyleSettings=B.uiStyleSettings;var Ne=document.createElement("div");Ne.className=B.toolboxButtonStyleClass.name+" "+((se=B.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&se!==void 0?se:B.toolboxButtonStyleColorsClass.name),Ne.innerHTML=L.icon,Ne.title=L.title,Ne.addEventListener("click",function(){B.panelButtonClick(L)}),B.panelButtons.push(Ne),B.buttonRow.appendChild(Ne)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},P.prototype.panelButtonClick=function(a){var u=this,D=-1;if(a!==this.activePanel){D=this.panels.indexOf(a),this.panelRow.innerHTML="";var B=a.getUi();B.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(B),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=a}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){u.displayMode==="inline"?u.panelRow.style.display="none":u.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(L,se){var Ne,tt;L.className=u.toolboxButtonStyleClass.name+" "+(se===D?""+((Ne=u.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ne!==void 0?Ne:u.toolboxActiveButtonStyleColorsClass.name):""+((tt=u.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&tt!==void 0?tt:u.toolboxButtonStyleColorsClass.name))})},P}(),Qe=function(P,a){this.title=P,this.icon=a},Ve=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<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 se.colors=[],se.addTransparent=!1,se.colorBoxes=[],se.colors=D,se.currentColor=B,se.setCurrentColor=se.setCurrentColor.bind(se),se.getColorBox=se.getColorBox.bind(se),se}return xe(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.whiteSpace="nowrap",this.colors.forEach(function(B){var L=u.getColorBox(B);D.appendChild(L),u.colorBoxes.push(L)}),D},a.prototype.getColorBox=function(u){var D=this,B=this.uiStyleSettings.toolbarHeight/4,L=this.uiStyleSettings.toolbarHeight-B,se=document.createElement("div");se.style.display="inline-block",se.style.boxSizing="content-box",se.style.width=L-2+"px",se.style.height=L-2+"px",se.style.padding="1px",se.style.marginRight="2px",se.style.marginBottom="2px",se.style.borderWidth="2px",se.style.borderStyle="solid",se.style.borderRadius=(L+2)/2+"px",se.style.borderColor=u===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",se.addEventListener("click",function(){D.setCurrentColor(u,se)});var Ne=document.createElement("div");return Ne.style.display="inline-block",Ne.style.width=L-2+"px",Ne.style.height=L-2+"px",Ne.style.backgroundColor=u,Ne.style.borderRadius=L/2+"px",u==="transparent"&&(Ne.style.fill=this.uiStyleSettings.toolboxAccentColor,Ne.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>`),se.appendChild(Ne),se},a.prototype.setCurrentColor=function(u,D){var B=this;this.currentColor=u,this.colorBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(u)},a}(Qe),Ue=function(){function P(a,u,D){this._state="new",this._isSelected=!1,this._container=a,this._overlayContainer=u,this.globalSettings=D,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(P.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),P.prototype.ownsTarget=function(a){return!1},Object.defineProperty(P.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),P.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},P.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},P.prototype.pointerDown=function(a,u){},P.prototype.dblClick=function(a,u){},P.prototype.manipulate=function(a){},P.prototype.pointerUp=function(a){this.stateChanged()},P.prototype.dispose=function(){},P.prototype.addMarkerVisualToContainer=function(a){this.container.childNodes.length>0?this.container.insertBefore(a,this.container.childNodes[0]):this.container.appendChild(a)},P.prototype.getState=function(){return{typeName:P.typeName,state:this.state,notes:this.notes}},P.prototype.restoreState=function(a){this._state=a.state,this.notes=a.notes},P.prototype.scale=function(a,u){},P.prototype.colorChanged=function(a){this.onColorChanged&&this.onColorChanged(a),this.stateChanged()},P.prototype.fillColorChanged=function(a){this.onFillColorChanged&&this.onFillColorChanged(a),this.stateChanged()},P.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var a=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),a.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(a)&&this.onStateChanged(this)}},P.typeName="MarkerBase",P}(),Be=function(){function P(){this.findGripByVisual=this.findGripByVisual.bind(this)}return P.prototype.findGripByVisual=function(a){return this.topLeft.ownsTarget(a)?this.topLeft:this.topCenter.ownsTarget(a)?this.topCenter:this.topRight.ownsTarget(a)?this.topRight:this.centerLeft.ownsTarget(a)?this.centerLeft:this.centerRight.ownsTarget(a)?this.centerRight:this.bottomLeft.ownsTarget(a)?this.bottomLeft:this.bottomCenter.ownsTarget(a)?this.bottomCenter:this.bottomRight.ownsTarget(a)?this.bottomRight:void 0},P}(),ct=function(){function P(){this.GRIP_SIZE=10,this.visual=Z.createGroup(),this.visual.appendChild(Z.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Z.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return P.prototype.ownsTarget=function(a){return a===this.visual||a===this.visual.childNodes[0]||a===this.visual.childNodes[1]},P}(),st=function(){function P(){}return P.toITransformMatrix=function(a){return{a:a.a,b:a.b,c:a.c,d:a.d,e:a.e,f:a.f}},P.toSVGMatrix=function(a,u){return a.a=u.a,a.b=u.b,a.c=u.c,a.d=u.d,a.e=u.e,a.f=u.f,a},P}(),lt=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.left=0,L.top=0,L.width=0,L.height=0,L.defaultSize={x:50,y:20},L.offsetX=0,L.offsetY=0,L.rotationAngle=0,L.CB_DISTANCE=10,L._suppressMarkerCreateEvent=!1,L.container.transform.baseVal.appendItem(Z.createTransform()),L.setupControlBox(),L}return xe(a,P),Object.defineProperty(a.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"visual",{get:function(){return this._visual},set:function(u){this._visual=u;var D=Z.createTransform();this._visual.transform.baseVal.appendItem(D)},enumerable:!1,configurable:!0}),a.prototype.ownsTarget=function(u){return!!P.prototype.ownsTarget.call(this,u)||!!(this.controlGrips.findGripByVisual(u)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(u))},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="new"&&(this.left=u.x,this.top=u.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var B=this.unrotatePoint(u);if(this.manipulationStartX=B.x,this.manipulationStartY=B.y,this.offsetX=B.x-this.left,this.offsetY=B.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 L=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=L.x-this.width/2,this.top=L.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var se=this.container.transform.baseVal.getItem(0);se.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(se,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},a.prototype.pointerUp=function(u){var D=this.state;P.prototype.pointerUp.call(this,u),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(u),this._state="select",D==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},a.prototype.moveVisual=function(u){this.visual.style.transform="translate("+u.x+"px, "+u.y+"px)"},a.prototype.manipulate=function(u){var D=this.unrotatePoint(u);this.state==="creating"?this.resize(u):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(u)},a.prototype.resize=function(u){var D=this.manipulationStartLeft,B=this.manipulationStartWidth,L=this.manipulationStartTop,se=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:D=this.manipulationStartLeft+u.x-this.manipulationStartX,B=this.manipulationStartWidth+this.manipulationStartLeft-D;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:B=this.manipulationStartWidth+u.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:L=this.manipulationStartTop+u.y-this.manipulationStartY,se=this.manipulationStartHeight+this.manipulationStartTop-L;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:se=this.manipulationStartHeight+u.y-this.manipulationStartY}B>=0?(this.left=D,this.width=B):(this.left=D+B,this.width=-B),se>=0?(this.top=L,this.height=se):(this.top=L+se,this.height=-se),this.setSize()},a.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},a.prototype.rotate=function(u){if(Math.abs(u.x-this.centerX)>.1){var D=Math.sign(u.x-this.centerX);this.rotationAngle=180*Math.atan((u.y-this.centerY)/(u.x-this.centerX))/Math.PI+90*D,this.applyRotation()}},a.prototype.applyRotation=function(){var u=this.container.transform.baseVal.getItem(0);u.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(u,0)},a.prototype.rotatePoint=function(u){if(this.rotationAngle===0)return u;var D=this.container.getCTM(),B=Z.createPoint(u.x,u.y);return{x:(B=B.matrixTransform(D)).x,y:B.y}},a.prototype.unrotatePoint=function(u){if(this.rotationAngle===0)return u;var D=this.container.getCTM();D=D.inverse();var B=Z.createPoint(u.x,u.y);return{x:(B=B.matrixTransform(D)).x,y:B.y}},a.prototype.select=function(){P.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},a.prototype.deselect=function(){P.prototype.deselect.call(this),this.controlBox.style.display="none"},a.prototype.setupControlBox=function(){this.controlBox=Z.createGroup();var u=Z.createTransform();u.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(u),this.container.appendChild(this.controlBox),this.controlRect=Z.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=Z.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Be,this.addControlGrips(),this.controlBox.style.display="none"},a.prototype.adjustControlBox=function(){var u=this.controlBox.transform.baseVal.getItem(0);u.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(u,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()},a.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()},a.prototype.createGrip=function(){var u=new ct;return u.visual.transform.baseVal.appendItem(Z.createTransform()),this.controlBox.appendChild(u.visual),u},a.prototype.positionGrips=function(){var u=this.controlGrips.topLeft.GRIP_SIZE,D=-u/2,B=D,L=(this.width+this.CB_DISTANCE)/2-u/2,se=(this.height+this.CB_DISTANCE)/2-u/2,Ne=this.height+this.CB_DISTANCE-u/2,tt=this.width+this.CB_DISTANCE-u/2;this.positionGrip(this.controlGrips.topLeft.visual,D,B),this.positionGrip(this.controlGrips.topCenter.visual,L,B),this.positionGrip(this.controlGrips.topRight.visual,tt,B),this.positionGrip(this.controlGrips.centerLeft.visual,D,se),this.positionGrip(this.controlGrips.centerRight.visual,tt,se),this.positionGrip(this.controlGrips.bottomLeft.visual,D,Ne),this.positionGrip(this.controlGrips.bottomCenter.visual,L,Ne),this.positionGrip(this.controlGrips.bottomRight.visual,tt,Ne),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,L,B-3*this.CB_DISTANCE)},a.prototype.positionGrip=function(u,D,B){var L=u.transform.baseVal.getItem(0);L.setTranslate(D,B),u.transform.baseVal.replaceItem(L,0)},a.prototype.hideControlBox=function(){this.controlBox.style.display="none"},a.prototype.showControlBox=function(){this.controlBox.style.display=""},a.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:st.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:st.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},P.prototype.getState.call(this))},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;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(st.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,D.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(st.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,D.containerTransformMatrix))},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D);var B=this.rotatePoint({x:this.left,y:this.top}),L=this.unrotatePoint({x:B.x*u,y:B.y*D});this.left=L.x,this.top=L.y,this.width=this.width*u,this.height=this.height*D,this.adjustControlBox()},a}(Ue),nt=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.fillColor="transparent",L.strokeColor="transparent",L.strokeWidth=0,L.strokeDasharray="",L.opacity=1,L.setStrokeColor=L.setStrokeColor.bind(L),L.setFillColor=L.setFillColor.bind(L),L.setStrokeWidth=L.setStrokeWidth.bind(L),L.setStrokeDasharray=L.setStrokeDasharray.bind(L),L.createVisual=L.createVisual.bind(L),L}return xe(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual)},a.prototype.createVisual=function(){this.visual=Z.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="new"&&(this.createVisual(),this.moveVisual(u),this._state="creating")},a.prototype.manipulate=function(u){P.prototype.manipulate.call(this,u)},a.prototype.resize=function(u){P.prototype.resize.call(this,u),this.setSize()},a.prototype.setSize=function(){P.prototype.setSize.call(this),Z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},a.prototype.pointerUp=function(u){P.prototype.pointerUp.call(this,u),this.setSize()},a.prototype.setStrokeColor=function(u){this.strokeColor=u,this.visual&&Z.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(u),this.stateChanged()},a.prototype.setFillColor=function(u){this.fillColor=u,this.visual&&Z.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},a.prototype.setStrokeWidth=function(u){this.strokeWidth=u,this.visual&&Z.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},a.prototype.setStrokeDasharray=function(u){this.strokeDasharray=u,this.visual&&Z.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},a.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},P.prototype.getState.call(this))},a.prototype.restoreState=function(u){var D=u;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),P.prototype.restoreState.call(this,u),this.setSize()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.setSize()},a.title="Rectangle marker",a}(lt),ht=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return se.widths=[],se.widthBoxes=[],se.widths=D,se.currentWidth=B,se.setCurrentWidth=se.setCurrentWidth.bind(se),se}return xe(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.widths.forEach(function(B){var L=document.createElement("div");L.style.display="flex",L.style.flexGrow="2",L.style.alignItems="center",L.style.justifyContent="space-between",L.style.padding="5px",L.style.borderWidth="2px",L.style.borderStyle="solid",L.style.borderColor=B===u.currentWidth?u.uiStyleSettings.toolboxAccentColor:"transparent",L.addEventListener("click",function(){u.setCurrentWidth(B,L)}),D.appendChild(L);var se=document.createElement("div");se.innerText=B.toString(),se.style.marginRight="5px",L.appendChild(se);var Ne=document.createElement("div");Ne.style.minHeight="20px",Ne.style.flexGrow="2",Ne.style.display="flex",Ne.style.alignItems="center";var tt=document.createElement("hr");tt.style.minWidth="20px",tt.style.border="0px",tt.style.borderTop=B+"px solid "+u.uiStyleSettings.toolboxColor,tt.style.flexGrow="2",Ne.appendChild(tt),L.appendChild(Ne),u.widthBoxes.push(L)}),D},a.prototype.setCurrentWidth=function(u,D){var B=this;this.currentWidth=u,this.widthBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},a}(Qe),ut=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<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 se.styles=[],se.styleBoxes=[],se.styles=D,se.currentStyle=B,se.setCurrentStyle=se.setCurrentStyle.bind(se),se}return xe(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.styles.forEach(function(B){var L=document.createElement("div");L.style.display="flex",L.style.alignItems="center",L.style.justifyContent="space-between",L.style.padding="5px",L.style.borderWidth="2px",L.style.borderStyle="solid",L.style.overflow="hidden",L.style.maxWidth=100/u.styles.length-5+"%",L.style.borderColor=B===u.currentStyle?u.uiStyleSettings.toolboxAccentColor:"transparent",L.addEventListener("click",function(){u.setCurrentStyle(B,L)}),D.appendChild(L);var se=document.createElement("div");se.style.minHeight="20px",se.style.flexGrow="2",se.style.overflow="hidden";var Ne=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+u.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(B!==""?'stroke-dasharray="'+B+'"':"")+` />
|
|
</svg>`;se.innerHTML=Ne,L.appendChild(se),u.styleBoxes.push(L)}),D},a.prototype.setCurrentStyle=function(u,D){var B=this;this.currentStyle=u,this.styleBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},a}(Qe),fe=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.strokeColor=B.defaultColor,L.strokeWidth=B.defaultStrokeWidth,L.strokeDasharray=B.defaultStrokeDasharray,L.strokePanel=new Ve("Line color",B.defaultColorSet,B.defaultColor),L.strokePanel.onColorChanged=L.setStrokeColor,L.strokeWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.strokeWidthPanel.onWidthChanged=L.setStrokeWidth,L.strokeStylePanel=new ut("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),L.strokeStylePanel.onStyleChanged=L.setStrokeDasharray,L}return xe(a,P),Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.typeName="FrameMarker",a.title="Frame marker",a.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',a}(nt),ye=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},Re=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.x1=0,L.y1=0,L.x2=0,L.y2=0,L.defaultLength=50,L.manipulationStartX=0,L.manipulationStartY=0,L.manipulationStartX1=0,L.manipulationStartY1=0,L.manipulationStartX2=0,L.manipulationStartY2=0,L.setupControlBox(),L}return xe(a,P),a.prototype.ownsTarget=function(u){return!!P.prototype.ownsTarget.call(this,u)||!(!this.grip1.ownsTarget(u)&&!this.grip2.ownsTarget(u))},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.manipulationStartX=u.x,this.manipulationStartY=u.y,this.state==="new"&&(this.x1=u.x,this.y1=u.y,this.x2=u.x,this.y2=u.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")},a.prototype.pointerUp=function(u){var D=this.state;P.prototype.pointerUp.call(this,u),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(u),this._state="select",D==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},a.prototype.adjustVisual=function(){},a.prototype.manipulate=function(u){this.state==="creating"?this.resize(u):this.state==="move"?(this.x1=this.manipulationStartX1+u.x-this.manipulationStartX,this.y1=this.manipulationStartY1+u.y-this.manipulationStartY,this.x2=this.manipulationStartX2+u.x-this.manipulationStartX,this.y2=this.manipulationStartY2+u.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(u)},a.prototype.resize=function(u){switch(this.activeGrip){case this.grip1:this.x1=u.x,this.y1=u.y;break;case this.grip2:case void 0:this.x2=u.x,this.y2=u.y}this.adjustVisual(),this.adjustControlBox()},a.prototype.select=function(){P.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},a.prototype.deselect=function(){P.prototype.deselect.call(this),this.controlBox.style.display="none"},a.prototype.setupControlBox=function(){this.controlBox=Z.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},a.prototype.adjustControlBox=function(){this.positionGrips()},a.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},a.prototype.createGrip=function(){var u=new ct;return u.visual.transform.baseVal.appendItem(Z.createTransform()),this.controlBox.appendChild(u.visual),u},a.prototype.positionGrips=function(){var u=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-u/2,this.y1-u/2),this.positionGrip(this.grip2.visual,this.x2-u/2,this.y2-u/2)},a.prototype.positionGrip=function(u,D,B){var L=u.transform.baseVal.getItem(0);L.setTranslate(D,B),u.transform.baseVal.replaceItem(L,0)},a.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},P.prototype.getState.call(this))},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;this.x1=D.x1,this.y1=D.y1,this.x2=D.x2,this.y2=D.y2},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.x1=this.x1*u,this.y1=this.y1*D,this.x2=this.x2*u,this.y2=this.y2*D,this.adjustVisual(),this.adjustControlBox()},a}(Ue),Ie=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.strokeColor="transparent",L.strokeWidth=0,L.strokeDasharray="",L.setStrokeColor=L.setStrokeColor.bind(L),L.setStrokeWidth=L.setStrokeWidth.bind(L),L.setStrokeDasharray=L.setStrokeDasharray.bind(L),L.strokeColor=B.defaultColor,L.strokeWidth=B.defaultStrokeWidth,L.strokeDasharray=B.defaultStrokeDasharray,L.strokePanel=new Ve("Line color",B.defaultColorSet,B.defaultColor),L.strokePanel.onColorChanged=L.setStrokeColor,L.strokeWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.strokeWidthPanel.onWidthChanged=L.setStrokeWidth,L.strokeStylePanel=new ut("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),L.strokeStylePanel.onStyleChanged=L.setStrokeDasharray,L}return xe(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual&&u!==this.selectorLine&&u!==this.visibleLine)},a.prototype.createVisual=function(){this.visual=Z.createGroup(),this.selectorLine=Z.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=Z.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},a.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),Z.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),Z.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),Z.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},a.prototype.setStrokeColor=function(u){this.strokeColor=u,this.adjustVisual(),this.colorChanged(u)},a.prototype.setStrokeWidth=function(u){this.strokeWidth=u,this.adjustVisual()},a.prototype.setStrokeDasharray=function(u){this.strokeDasharray=u,this.adjustVisual(),this.stateChanged()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.createVisual(),this.adjustVisual()},a.typeName="LineMarker",a.title="Line marker",a.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',a}(Re),Ce=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<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 se.fonts=[],se.fontBoxes=[],se.fonts=D,se.currentFont=B,se.setCurrentFont=se.setCurrentFont.bind(se),se}return xe(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.flexGrow="2",this.fonts.forEach(function(B){var L=document.createElement("div");L.style.display="inline-block",L.style.alignItems="center",L.style.justifyContent="space-between",L.style.padding="5px",L.style.borderWidth="2px",L.style.borderStyle="solid",L.style.overflow="hidden",L.style.maxWidth=100/u.fonts.length-5+"%",L.style.borderColor=B===u.currentFont?u.uiStyleSettings.toolboxAccentColor:"transparent",L.addEventListener("click",function(){u.setCurrentFont(B,L)}),D.appendChild(L);var se=document.createElement("div");se.style.display="flex",se.style.minHeight="20px",se.style.flexGrow="2",se.style.fontFamily=B,se.style.overflow="hidden";var Ne=document.createElement("div");Ne.style.whiteSpace="nowrap",Ne.style.overflow="hidden",Ne.style.textOverflow="ellipsis",Ne.innerHTML="The quick brown fox jumps over the lazy dog",se.appendChild(Ne),L.appendChild(se),u.fontBoxes.push(L)}),D},a.prototype.setCurrentFont=function(u,D){var B=this;this.currentFont=u,this.fontBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},a}(Qe),Ae=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.color="transparent",L.padding=5,L.DEFAULT_TEXT="your text here",L.text=L.DEFAULT_TEXT,L.isMoved=!1,L.color=B.defaultColor,L.fontFamily=B.defaultFontFamily,L.defaultSize={x:100,y:30},L.setColor=L.setColor.bind(L),L.setFont=L.setFont.bind(L),L.renderText=L.renderText.bind(L),L.sizeText=L.sizeText.bind(L),L.textEditDivClicked=L.textEditDivClicked.bind(L),L.showTextEditor=L.showTextEditor.bind(L),L.setSize=L.setSize.bind(L),L.positionTextEditor=L.positionTextEditor.bind(L),L.colorPanel=new Ve("Color",B.defaultColorSet,B.defaultColor),L.colorPanel.onColorChanged=L.setColor,L.fontFamilyPanel=new Ce("Font",B.defaultFontFamilies,B.defaultFontFamily),L.fontFamilyPanel.onFontChanged=L.setFont,L}return xe(a,P),a.prototype.ownsTarget=function(u){if(P.prototype.ownsTarget.call(this,u)||u===this.visual||u===this.textElement||u===this.bgRectangle)return!0;var D=!1;return this.textElement.childNodes.forEach(function(B){B===u&&(D=!0)}),D},a.prototype.createVisual=function(){this.visual=Z.createGroup(),this.bgRectangle=Z.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=Z.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(Z.createTransform()),this.textElement.transform.baseVal.appendItem(Z.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.isMoved=!1,this.pointerDownPoint=u,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(u),this._state="creating")},a.prototype.renderText=function(){var u=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){u.textElement.appendChild(Z.createTSpan(D.trim()===""?" ":D.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},a.prototype.getTextScale=function(){var u=this.textElement.getBBox(),D=1;if(u.width>0&&u.height>0){var B=(1*this.width-this.width*this.padding*2/100)/u.width,L=(1*this.height-this.height*this.padding*2/100)/u.height;D=Math.min(B,L)}return D},a.prototype.getTextPosition=function(u){var D=this.textElement.getBBox(),B=0,L=0;return D.width>0&&D.height>0&&(B=(this.width-D.width*u)/2,L=this.height/2-D.height*u/2),{x:B,y:L}},a.prototype.sizeText=function(){var u=this.textElement.getBBox(),D=this.getTextScale(),B=this.getTextPosition(D);B.y-=u.y*D,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+B.x+"px, "+B.y+"px) scale("+D+", "+D+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(B.x,B.y),this.textElement.transform.baseVal.getItem(1).setScale(D,D))},a.prototype.manipulate=function(u){P.prototype.manipulate.call(this,u),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(u.x-this.pointerDownPoint.x)>5||Math.abs(u.y-this.pointerDownPoint.y)>5)},a.prototype.resize=function(u){P.prototype.resize.call(this,u),this.isMoved=!0,this.setSize(),this.sizeText()},a.prototype.setSize=function(){P.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(Z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),Z.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},a.prototype.pointerUp=function(u){var D=this.state;D==="creating"&&(this._suppressMarkerCreateEvent=!0),P.prototype.pointerUp.call(this,u),this.setSize(),(D==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},a.prototype.showTextEditor=function(){var u=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(u.textEditor.style.fontSize);u.textEditor.clientWidth>=Number.parseInt(u.textEditor.style.maxWidth)&&D>.9;)D-=.1,u.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 B=D.clipboardData.getData("text"),L=window.getSelection();if(!L.rangeCount)return!1;L.deleteFromDocument(),L.getRangeAt(0).insertNode(document.createTextNode(B)),D.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){u.textEditDivClicked(u.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},a.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var u=this.getTextScale(),D=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),B=this.textElement.getBBox(),L={x:B.width*u,y:B.height*u};D.x-=L.x/2,D.y-=L.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*u,12)+"px",this.textElement.style.display="none"}},a.prototype.textEditDivClicked=function(u){this.text=u.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},a.prototype.select=function(){P.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},a.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),P.prototype.deselect.call(this)},a.prototype.dblClick=function(u,D){P.prototype.dblClick.call(this,u,D),this.showTextEditor()},a.prototype.setColor=function(u){this.textElement&&Z.setAttributes(this.textElement,[["fill",u]]),this.color=u,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(u)},a.prototype.setFont=function(u){this.textElement&&Z.setAttributes(this.textElement,[["font-family",u]]),this.fontFamily=u,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},a.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},a.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){var D=u;this.color=D.color,this.fontFamily=D.fontFamily,this.padding=D.padding,this.text=D.text,this.createVisual(),P.prototype.restoreState.call(this,u),this.setSize()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.setSize(),this.sizeText(),this.positionTextEditor()},a.typeName="TextMarker",a.title="Text marker",a.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>',a}(lt),ae=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.color="transparent",L.lineWidth=3,L.drawing=!1,L.pixelRatio=1,L.color=B.defaultColor,L.lineWidth=B.defaultStrokeWidth,L.pixelRatio=B.freehandPixelRatio,L.setColor=L.setColor.bind(L),L.addCanvas=L.addCanvas.bind(L),L.finishCreation=L.finishCreation.bind(L),L.setLineWidth=L.setLineWidth.bind(L),L.colorPanel=new Ve("Color",B.defaultColorSet,B.defaultColor),L.colorPanel.onColorChanged=L.setColor,L.lineWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.lineWidthPanel.onWidthChanged=L.setLineWidth,L}return xe(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual&&u!==this.drawingImage)},a.prototype.createVisual=function(){this.visual=Z.createGroup(),this.drawingImage=Z.createImage(),this.visual.appendChild(this.drawingImage);var u=Z.createTransform();this.visual.transform.baseVal.appendItem(u),this.addMarkerVisualToContainer(this.visual)},a.prototype.pointerDown=function(u,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(u.x,u.y),this.drawing=!0):P.prototype.pointerDown.call(this,u,D)},a.prototype.manipulate=function(u){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(u.x,u.y),this.canvasContext.stroke()):P.prototype.manipulate.call(this,u)},a.prototype.resize=function(u){P.prototype.resize.call(this,u),Z.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),Z.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},a.prototype.pointerUp=function(u){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):P.prototype.pointerUp.call(this,u)},a.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)},a.prototype.select=function(){this.state==="creating"&&this.finishCreation(),P.prototype.select.call(this)},a.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),P.prototype.deselect.call(this)},a.prototype.finishCreation=function(){for(var u=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),D=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],B=D[0],L=D[1],se=D[2],Ne=D[3],tt=!1,pt=0;pt<this.canvasElement.height;pt++)for(var We=0;We<this.canvasElement.width;We++)u.data[pt*this.canvasElement.width*4+4*We+3]>0&&(tt=!0,pt<L&&(L=pt),We<B&&(B=We),pt>Ne&&(Ne=pt),We>se&&(se=We));if(tt){this.left=B/this.pixelRatio,this.top=L/this.pixelRatio,this.width=(se-B)/this.pixelRatio,this.height=(Ne-L)/this.pixelRatio;var bt=document.createElement("canvas");bt.width=se-B,bt.height=Ne-L,bt.getContext("2d").putImageData(this.canvasContext.getImageData(B,L,se-B,Ne-L),0,0),this.drawingImgUrl=bt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},a.prototype.setDrawingImage=function(){Z.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),Z.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},a.prototype.setColor=function(u){this.color=u,this.colorChanged(u)},a.prototype.setLineWidth=function(u){this.lineWidth=u},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({drawingImgUrl:this.drawingImgUrl},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){this.createVisual(),P.prototype.restoreState.call(this,u),this.drawingImgUrl=u.drawingImgUrl,this.setDrawingImage()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.setDrawingImage()},a.typeName="FreehandMarker",a.title="Freehand marker",a.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>',a}(lt),ee=function(P){function a(u,D,B){var L=P.call(this,u,B||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return L.typeBoxes=[],L.currentType=D,L.setCurrentType=L.setCurrentType.bind(L),L}return xe(a,P),a.prototype.getUi=function(){var u=this,D=document.createElement("div");D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2";for(var B=function(Ne){var tt="both";switch(Ne){case 0:tt="both";break;case 1:tt="start";break;case 2:tt="end";break;case 3:tt="none"}var pt=document.createElement("div");if(pt.style.display="flex",pt.style.flexGrow="2",pt.style.alignItems="center",pt.style.justifyContent="space-between",pt.style.padding="5px",pt.style.borderWidth="2px",pt.style.borderStyle="solid",pt.style.borderColor=tt===L.currentType?L.uiStyleSettings.toolboxAccentColor:"transparent",pt.addEventListener("click",function(){u.setCurrentType(tt,pt)}),D.appendChild(pt),tt==="both"||tt==="start"){var We=document.createElement("div");We.style.display="flex",We.style.alignItems="center",We.style.minHeight="20px",We.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="`+(L.uiStyleSettings!==void 0?L.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,We.style.marginLeft="5px",pt.appendChild(We)}var bt=document.createElement("div");bt.style.display="flex",bt.style.alignItems="center",bt.style.minHeight="20px",bt.style.flexGrow="2";var Tt=document.createElement("hr");if(Tt.style.minWidth="20px",Tt.style.border="0px",Tt.style.borderTop="3px solid "+(L.uiStyleSettings!==void 0?L.uiStyleSettings.toolboxColor:"#eeeeee"),Tt.style.flexGrow="2",bt.appendChild(Tt),pt.appendChild(bt),tt==="both"||tt==="end"){var Qt=document.createElement("div");Qt.style.display="flex",Qt.style.alignItems="center",Qt.style.minHeight="20px",Qt.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="`+(L.uiStyleSettings!==void 0?L.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Qt.style.marginRight="5px",pt.appendChild(Qt)}L.typeBoxes.push(pt)},L=this,se=0;se<4;se++)B(se);return D},a.prototype.setCurrentType=function(u,D){var B=this;this.currentType=u,this.typeBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},a}(Qe),te=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.arrowType="end",L.arrowBaseHeight=10,L.arrowBaseWidth=10,L.getArrowPoints=L.getArrowPoints.bind(L),L.setArrowType=L.setArrowType.bind(L),L.arrowTypePanel=new ee("Arrow type","end"),L.arrowTypePanel.onArrowTypeChanged=L.setArrowType,L}return xe(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.arrow1&&u!==this.arrow2)},a.prototype.getArrowPoints=function(u,D){var B=this.arrowBaseWidth+2*this.strokeWidth,L=this.arrowBaseHeight+2*this.strokeWidth;return u-B/2+","+(D+L/2)+" "+u+","+(D-L/2)+" "+(u+B/2)+","+(D+L/2)},a.prototype.createTips=function(){this.arrow1=Z.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(Z.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=Z.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(Z.createTransform()),this.visual.appendChild(this.arrow2)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="creating"&&this.createTips()},a.prototype.adjustVisual=function(){if(P.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",Z.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),Z.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var u=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(u,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(D,0);var B=this.arrow2.transform.baseVal.getItem(0);B.setRotate(u+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(B,0)}},a.prototype.setArrowType=function(u){this.arrowType=u,this.adjustVisual(),this.stateChanged()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({arrowType:this.arrowType},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;this.arrowType=D.arrowType,this.createTips(),this.adjustVisual()},a.typeName="ArrowMarker",a.title="Arrow marker",a.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',a}(Ie),H=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.fillColor=B.defaultFillColor,L.strokeWidth=0,L.fillPanel=new Ve("Color",B.defaultColorSet,B.defaultFillColor),L.fillPanel.onColorChanged=L.setFillColor,L}return xe(a,P),Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.typeName="CoverMarker",a.title="Cover marker",a.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',a}(nt),G=function(P){function a(u,D,B,L){var se=P.call(this,u,L||'<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 se.opacities=[],se.opacityBoxes=[],se.opacities=D,se.currentOpacity=B,se.setCurrentOpacity=se.setCurrentOpacity.bind(se),se}return xe(a,P),a.prototype.getUi=function(){var u=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(B){var L=document.createElement("div");L.style.display="flex",L.style.alignItems="center",L.style.justifyContent="center",L.style.padding="5px",L.style.borderWidth="2px",L.style.borderStyle="solid",L.style.borderColor=B===u.currentOpacity?u.uiStyleSettings.toolboxAccentColor:"transparent",L.addEventListener("click",function(){u.setCurrentOpacity(B,L)}),D.appendChild(L);var se=document.createElement("div");se.innerText=100*B+"%",L.appendChild(se),u.opacityBoxes.push(L)}),D},a.prototype.setCurrentOpacity=function(u,D){var B=this;this.currentOpacity=u,this.opacityBoxes.forEach(function(L){L.style.borderColor=L===D?B.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},a}(Qe),V=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.setOpacity=L.setOpacity.bind(L),L.fillColor=B.defaultHighlightColor,L.strokeWidth=0,L.opacity=B.defaultHighlightOpacity,L.fillPanel=new Ve("Color",B.defaultColorSet,L.fillColor),L.fillPanel.onColorChanged=L.setFillColor,L.opacityPanel=new G("Opacity",B.defaultOpacitySteps,L.opacity),L.opacityPanel.onOpacityChanged=L.setOpacity,L}return xe(a,P),a.prototype.setOpacity=function(u){this.opacity=u,this.visual&&Z.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.typeName="HighlightMarker",a.title="Highlight marker",a.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>',a}(H),Q='<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>',de=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.bgColor="transparent",L.tipPosition={x:0,y:0},L.tipBase1Position={x:0,y:0},L.tipBase2Position={x:0,y:0},L.tipMoving=!1,L.color=B.defaultStrokeColor,L.bgColor=B.defaultFillColor,L.fontFamily=B.defaultFontFamily,L.defaultSize={x:100,y:30},L.setBgColor=L.setBgColor.bind(L),L.getTipPoints=L.getTipPoints.bind(L),L.positionTip=L.positionTip.bind(L),L.setTipPoints=L.setTipPoints.bind(L),L.colorPanel=new Ve("Text color",B.defaultColorSet,L.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>'),L.colorPanel.onColorChanged=L.setColor,L.bgColorPanel=new Ve("Fill color",B.defaultColorSet,L.bgColor,Q),L.bgColorPanel.onColorChanged=L.setBgColor,L.fontFamilyPanel=new Ce("Font",B.defaultFontFamilies,B.defaultFontFamily),L.fontFamilyPanel.onFontChanged=L.setFont,L.tipGrip=new ct,L.tipGrip.visual.transform.baseVal.appendItem(Z.createTransform()),L.controlBox.appendChild(L.tipGrip.visual),L}return xe(a,P),a.prototype.ownsTarget=function(u){return P.prototype.ownsTarget.call(this,u)||this.tipGrip.ownsTarget(u)||this.tip===u},a.prototype.createTip=function(){Z.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=Z.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},a.prototype.pointerDown=function(u,D){this.state==="new"&&P.prototype.pointerDown.call(this,u,D),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(D)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):P.prototype.pointerDown.call(this,u,D)},a.prototype.pointerUp=function(u){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,P.prototype.pointerUp.call(this,u);else{var D=this.state==="creating";P.prototype.pointerUp.call(this,u),this.setTipPoints(D),this.positionTip()}},a.prototype.manipulate=function(u){if(this.tipMoving){var D=this.unrotatePoint(u);this.tipPosition={x:D.x-this.manipulationStartLeft,y:D.y-this.manipulationStartTop},this.positionTip()}else P.prototype.manipulate.call(this,u)},a.prototype.setBgColor=function(u){this.bgRectangle&&this.tip&&(Z.setAttributes(this.bgRectangle,[["fill",u]]),Z.setAttributes(this.tip,[["fill",u]])),this.bgColor=u,this.fillColorChanged(u)},a.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},a.prototype.setTipPoints=function(u){u===void 0&&(u=!1);var D=Math.min(this.height/2,15),B=this.height/5;u&&(this.tipPosition={x:D+B/2,y:this.height+20});var L=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?L<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(B=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:0},this.tipBase2Position={x:D+B,y:0}):(this.tipBase1Position={x:0,y:D},this.tipBase2Position={x:0,y:D+B}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?L<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(B=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-B,y:0},this.tipBase2Position={x:this.width-D,y:0}):(this.tipBase1Position={x:this.width,y:D},this.tipBase2Position={x:this.width,y:D+B}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?L<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(B=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-B,y:this.height},this.tipBase2Position={x:this.width-D,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-D-B},this.tipBase2Position={x:this.width,y:this.height-D}):L<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(B=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:this.height},this.tipBase2Position={x:D+B,y:this.height}):(this.tipBase1Position={x:0,y:this.height-D},this.tipBase2Position={x:0,y:this.height-D-B})},a.prototype.resize=function(u){P.prototype.resize.call(this,u),this.positionTip()},a.prototype.positionTip=function(){Z.setAttributes(this.tip,[["points",this.getTipPoints()]]);var u=this.tipGrip.visual.transform.baseVal.getItem(0);u.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(u,0)},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),a.prototype.select=function(){this.positionTip(),P.prototype.select.call(this)},a.prototype.getState=function(){var u=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){var D=u;this.bgColor=D.bgColor,this.tipPosition=D.tipPosition,P.prototype.restoreState.call(this,u),this.createTip(),this.setTipPoints()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.tipPosition={x:this.tipPosition.x*u,y:this.tipPosition.y*D},this.positionTip()},a.typeName="CalloutMarker",a.title="Callout marker",a.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>',a}(Ae),ge=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.fillColor="transparent",L.strokeColor="transparent",L.strokeWidth=0,L.strokeDasharray="",L.opacity=1,L.strokeColor=B.defaultColor,L.strokeWidth=B.defaultStrokeWidth,L.strokeDasharray=B.defaultStrokeDasharray,L.fillColor=B.defaultFillColor,L.setStrokeColor=L.setStrokeColor.bind(L),L.setFillColor=L.setFillColor.bind(L),L.setStrokeWidth=L.setStrokeWidth.bind(L),L.setStrokeDasharray=L.setStrokeDasharray.bind(L),L.setOpacity=L.setOpacity.bind(L),L.createVisual=L.createVisual.bind(L),L.strokePanel=new Ve("Line color",ce(B.defaultColorSet,["transparent"]),B.defaultColor),L.strokePanel.onColorChanged=L.setStrokeColor,L.fillPanel=new Ve("Fill color",ce(B.defaultColorSet,["transparent"]),L.fillColor,Q),L.fillPanel.onColorChanged=L.setFillColor,L.strokeWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.strokeWidthPanel.onWidthChanged=L.setStrokeWidth,L.strokeStylePanel=new ut("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),L.strokeStylePanel.onStyleChanged=L.setStrokeDasharray,L.opacityPanel=new G("Opacity",B.defaultOpacitySteps,L.opacity),L.opacityPanel.onOpacityChanged=L.setOpacity,L}return xe(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual)},a.prototype.createVisual=function(){this.visual=Z.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="new"&&(this.createVisual(),this.moveVisual(u),this._state="creating")},a.prototype.manipulate=function(u){P.prototype.manipulate.call(this,u)},a.prototype.resize=function(u){P.prototype.resize.call(this,u),this.setSize()},a.prototype.setSize=function(){P.prototype.setSize.call(this),Z.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},a.prototype.pointerUp=function(u){P.prototype.pointerUp.call(this,u),this.setSize()},a.prototype.setStrokeColor=function(u){this.strokeColor=u,this.visual&&Z.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(u),this.stateChanged()},a.prototype.setFillColor=function(u){this.fillColor=u,this.visual&&Z.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(u),this.stateChanged()},a.prototype.setStrokeWidth=function(u){this.strokeWidth=u,this.visual&&Z.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},a.prototype.setStrokeDasharray=function(u){this.strokeDasharray=u,this.visual&&Z.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},a.prototype.setOpacity=function(u){this.opacity=u,this.visual&&Z.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){var D=u;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),P.prototype.restoreState.call(this,u),this.setSize()},a.prototype.scale=function(u,D){P.prototype.scale.call(this,u,D),this.setSize()},a.typeName="EllipseMarker",a.title="Ellipse marker",a.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>',a}(lt),Me=function(P){function a(u,D,B){return P.call(this,u,D,B)||this}return xe(a,P),Object.defineProperty(a.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.tip1&&u!==this.tip2)},a.prototype.createTips=function(){this.tip1=Z.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(Z.createTransform()),this.visual.appendChild(this.tip1),this.tip2=Z.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(Z.createTransform()),this.visual.appendChild(this.tip2)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.state==="creating"&&this.createTips()},a.prototype.adjustVisual=function(){if(P.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(Z.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Z.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var u=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(u,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(D,0);var B=this.tip2.transform.baseVal.getItem(0);B.setRotate(u+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(B,0)}},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u),this.createTips(),this.adjustVisual()},a.typeName="MeasurementMarker",a.title="Measurement marker",a.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>',a}(Ie),et=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.strokePanel.colors=B.defaultColorSet,L.fillColor="transparent",L}return xe(a,P),Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=P.prototype.getState.call(this);return u.typeName=a.typeName,u},a.typeName="EllipseFrameMarker",a.title="Ellipse frame marker",a.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>',a}(ge),dt=function(){function P(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(P.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),P.prototype.addUndoStep=function(a){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(a)||(this.undoStack.push(a),JSON.stringify(this.lastRedoStep)!==JSON.stringify(a)&&this.redoStack.splice(0,this.redoStack.length))},P.prototype.replaceLastUndoStep=function(a){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=a)},P.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},P.prototype.undo=function(){if(this.undoStack.length>1){var a=this.undoStack.pop();return a!==void 0&&this.redoStack.push(a),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},P.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},P}(),qe=function(P){function a(u,D,B){var L=P.call(this,u,D,B)||this;return L.strokeColor="transparent",L.strokeWidth=0,L.strokeDasharray="",L.curveX=0,L.curveY=0,L.manipulationStartCurveX=0,L.manipulationStartCurveY=0,L.setStrokeColor=L.setStrokeColor.bind(L),L.setStrokeWidth=L.setStrokeWidth.bind(L),L.setStrokeDasharray=L.setStrokeDasharray.bind(L),L.positionGrips=L.positionGrips.bind(L),L.addControlGrips=L.addControlGrips.bind(L),L.adjustVisual=L.adjustVisual.bind(L),L.setupControlBox=L.setupControlBox.bind(L),L.resize=L.resize.bind(L),L.strokeColor=B.defaultColor,L.strokeWidth=B.defaultStrokeWidth,L.strokeDasharray=B.defaultStrokeDasharray,L.strokePanel=new Ve("Line color",B.defaultColorSet,B.defaultColor),L.strokePanel.onColorChanged=L.setStrokeColor,L.strokeWidthPanel=new ht("Line width",B.defaultStrokeWidths,B.defaultStrokeWidth),L.strokeWidthPanel.onWidthChanged=L.setStrokeWidth,L.strokeStylePanel=new ut("Line style",B.defaultStrokeDasharrays,B.defaultStrokeDasharray),L.strokeStylePanel.onStyleChanged=L.setStrokeDasharray,L}return xe(a,P),a.prototype.ownsTarget=function(u){return!(!P.prototype.ownsTarget.call(this,u)&&u!==this.visual&&u!==this.selectorCurve&&u!==this.visibleCurve&&!this.curveGrip.ownsTarget(u))},a.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},a.prototype.createVisual=function(){this.visual=Z.createGroup(),this.selectorCurve=Z.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=Z.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},a.prototype.pointerDown=function(u,D){P.prototype.pointerDown.call(this,u,D),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=u.x,this.curveY=u.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(D)&&(this.activeGrip=this.curveGrip,this._state="resize")},a.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),Z.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),Z.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),Z.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},a.prototype.setupControlBox=function(){P.prototype.setupControlBox.call(this),this.curveControlLine1=Z.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=Z.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},a.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,P.prototype.addControlGrips.call(this)},a.prototype.positionGrips=function(){P.prototype.positionGrips.call(this);var u=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-u/2,this.curveY-u/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()))},a.prototype.manipulate=function(u){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+u.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+u.y-this.manipulationStartY),P.prototype.manipulate.call(this,u)},a.prototype.resize=function(u){this.activeGrip===this.curveGrip&&(this.curveX=u.x,this.curveY=u.y),P.prototype.resize.call(this,u),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},a.prototype.setStrokeColor=function(u){this.strokeColor=u,this.adjustVisual(),this.colorChanged(u)},a.prototype.setStrokeWidth=function(u){this.strokeWidth=u,this.adjustVisual()},a.prototype.setStrokeDasharray=function(u){this.strokeDasharray=u,this.adjustVisual()},a.prototype.scale=function(u,D){this.curveX=this.curveX*u,this.curveY=this.curveY*D,P.prototype.scale.call(this,u,D)},Object.defineProperty(a.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),a.prototype.getState=function(){var u=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},P.prototype.getState.call(this));return u.typeName=a.typeName,u},a.prototype.restoreState=function(u){P.prototype.restoreState.call(this,u);var D=u;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.curveX=D.curveX,this.curveY=D.curveY,this.createVisual(),this.adjustVisual()},a.typeName="CurveMarker",a.title="Curve marker",a.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>',a}(Re),Ct=function(){function P(a,u){u===void 0&&(u=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=a,this.cancelable=u}return Object.defineProperty(P.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),P.prototype.preventDefault=function(){this._defaultPrevented=!0},P}(),_t=function(P){function a(u,D,B){var L=P.call(this,u,!1)||this;return L.dataUrl=D,L.state=B,L}return xe(a,P),a}(Ct),ot=function(P){function a(u,D,B){B===void 0&&(B=!1);var L=P.call(this,u,B)||this;return L.marker=D,L}return xe(a,P),a}(Ct),It=function(){function P(){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 P.prototype.addEventListener=function(a,u){this[a].push(u)},P.prototype.removeEventListener=function(a,u){var D=this[a].indexOf(u);D>-1&&this[a].splice(D,1)},P}(),At=function(){function P(a){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ye,this._isOpen=!1,this.undoRedoManager=new dt,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 It,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=P.instanceCounter++,this.styles=new Ke(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=a,this.targetRoot=document.body,this.width=a.clientWidth,this.height=a.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(P.prototype,"ALL_MARKER_TYPES",{get:function(){return[fe,ae,te,Ae,et,ge,V,de,Me,H,Ie,qe]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[fe,ae,te,Ae,ge,V,de]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"BASIC_MARKER_TYPES",{get:function(){return[fe,ae,te,Ae,V]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(a){var u=this;this._availableMarkerTypes.splice(0),a.forEach(function(D){if(typeof D=="string"){var B=u.ALL_MARKER_TYPES.find(function(L){return L.typeName===D});B!==void 0&&u._availableMarkerTypes.push(B)}else u._availableMarkerTypes.push(D)})},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(a){this._zoomLevel=a,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(P.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),P.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),je.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},P.prototype.show=function(){var a=this;this.styles.styleSheetRoot===void 0&&rt.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=rt.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(u){return u(new Ct(a))})},P.prototype.render=function(){return _e(this,void 0,void 0,function(){var a;return Oe(this,function(u){switch(u.label){case 0:return this.setCurrentMarker(),(a=new at).naturalSize=this.renderAtNaturalSize,a.imageType=this.renderImageType,a.imageQuality=this.renderImageQuality,a.markersOnly=this.renderMarkersOnly,a.width=this.renderWidth,a.height=this.renderHeight,[4,a.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return u.sent(),[4,a.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,u.sent()]}})})},P.prototype.close=function(a){var u=this;if(a===void 0&&(a=!1),this.isOpen){var D=!1;a||this.eventListeners.beforeclose.forEach(function(B){var L=new Ct(u,!0);B(L),L.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(B){return B(new Ct(u))}),this.detachEvents(),this._isOpen=!1)}},P.prototype.addMarkersToToolbar=function(){for(var a,u=[],D=0;D<arguments.length;D++)u[D]=arguments[D];(a=this._availableMarkerTypes).push.apply(a,u)},P.prototype.addRenderEventListener=function(a){this.addEventListener("render",function(u){a(u.dataUrl,u.state)})},P.prototype.removeRenderEventListener=function(a){},P.prototype.addCloseEventListener=function(a){this.addEventListener("close",function(){a()})},P.prototype.removeCloseEventListener=function(a){},P.prototype.setupResizeObserver=function(){var a=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){a.resize(a.target.clientWidth,a.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return a.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},P.prototype.onPopupTargetResize=function(){var a=1*this.target.clientWidth/this.target.clientHeight,u=this.editorCanvas.clientWidth/a>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*a:this.editorCanvas.clientWidth,D=u<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/a;this.resize(u,D)},P.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},P.prototype.resize=function(a,u){this._isResizing=!0;var D=a/this.imageWidth,B=u/this.imageHeight;this.imageWidth=Math.round(a),this.imageHeight=Math.round(u),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,B),this._isResizing=!1},P.prototype.scaleMarkers=function(a,u){var D,B=this;this._currentMarker&&this._currentMarker instanceof Ae?this._currentMarker.scale(a,u):(D=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(L){L!==B._currentMarker&&L.scale(a,u)}),D!==void 0&&this.setCurrentMarker(D)},P.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"},P.prototype.setTopLeft=function(){var a=this.editingTarget.getBoundingClientRect(),u=this.editorCanvas.getBoundingClientRect();this.left=a.left-u.left,this.top=a.top-u.top},P.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)},P.prototype.addDefs=function(){for(var a,u=[],D=0;D<arguments.length;D++)u[D]=arguments[D];this.defs=Z.createDefs(),this.addDefsToImage(),(a=this.defs).append.apply(a,u)},P.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},P.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)},P.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},P.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},P.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)},P.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},P.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)},P.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 a=document.createElement("a");a.href="https://markerjs.com/",a.target="_blank",a.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>',a.title="Powered by marker.js",a.style.display="grid",a.style.alignItems="center",a.style.justifyItems="center",a.style.padding="3px",a.style.width="20px",a.style.height="20px",this.logoUI.appendChild(a),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},P.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")},P.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"},P.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},P.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 a=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=a+"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 Fe(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 $e(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},P.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},P.prototype.removeMarker=function(a){this.markerImage.removeChild(a.container),this.markers.indexOf(a)>-1&&this.markers.splice(this.markers.indexOf(a),1),a.dispose()},P.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())},P.prototype.toolbarButtonClicked=function(a,u){if(a==="marker"&&u!==void 0)this.createNewMarker(u);else if(a==="action")switch(u){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()}},P.prototype.deleteSelectedMarker=function(){var a=this;if(this._currentMarker!==void 0){var u=!1;if(this.eventListeners.markerbeforedelete.forEach(function(B){var L=new ot(a,a._currentMarker,!0);B(L),L.defaultPrevented&&(u=!0)}),!u){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(B){return B(new ot(a,D))})}}},P.prototype.clear=function(){var a=this,u=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(se){var Ne=new ot(a,void 0,!0);se(Ne),Ne.defaultPrevented&&(u=!0)}),!u)){this.setCurrentMarker();for(var D=function(se){var Ne=B.markers[se];B.setCurrentMarker(B.markers[se]),B._currentMarker.dispose(),B.markerImage.removeChild(B._currentMarker.container),B.markers.splice(B.markers.indexOf(B._currentMarker),1),B.eventListeners.markerdelete.forEach(function(tt){return tt(new ot(a,Ne))})},B=this,L=this.markers.length-1;L>=0;L--)D(L);this.addUndoStep()}},Object.defineProperty(P.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),P.prototype.showNotesEditor=function(){var a;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=(a=this._currentMarker.notes)!==null&&a!==void 0?a:"",this.overlayContainer.appendChild(this.notesArea))},P.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)},P.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},P.prototype.addUndoStep=function(){var a=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var u=this.getState(),D=this.undoRedoManager.getLastUndoStep();if(!D||D.width===u.width&&D.height===u.height){var B=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(u),B<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(L){return L(new Ct(a))})}else this.undoRedoManager.replaceLastUndoStep(u),this.eventListeners.statechange.forEach(function(L){return L(new Ct(a))})}},P.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},P.prototype.undoStep=function(){var a=this,u=this.undoRedoManager.undo();u!==void 0&&(this.restoreState(u),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new Ct(a))}))},P.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},P.prototype.redoStep=function(){var a=this,u=this.undoRedoManager.redo();u!==void 0&&(this.restoreState(u),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new Ct(a))}))},P.prototype.stepZoom=function(){var a=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=a<this.zoomSteps.length-1?this.zoomSteps[a+1]:this.zoomSteps[0]},P.prototype.panTo=function(a){this.contentDiv.scrollBy({left:this.prevPanPoint.x-a.x,top:this.prevPanPoint.y-a.y}),this.prevPanPoint=a},P.prototype.startRenderAndClose=function(){return _e(this,void 0,void 0,function(){var a,u,D=this;return Oe(this,function(B){switch(B.label){case 0:return[4,this.render()];case 1:return a=B.sent(),u=this.getState(),this.eventListeners.render.forEach(function(L){return L(new _t(D,a,u))}),this.close(!0),[2]}})})},P.prototype.getState=function(a){a===!0&&this.setCurrentMarker();var u={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(D){return u.markers.push(D.getState())}),u},P.prototype.restoreState=function(a){var u=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);a.markers.forEach(function(D){var B=u._availableMarkerTypes.find(function(se){return se.typeName===D.typeName});if(B!==void 0){var L=u.addNewMarker(B);L.restoreState(D),u.markers.push(L)}}),a.width&&a.height&&(a.width!==this.imageWidth||a.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/a.width,this.imageHeight/a.height),this.eventListeners.restorestate.forEach(function(D){return D(new Ct(u))})},P.prototype.addNewMarker=function(a){var u=Z.createGroup();return this.markerImage.appendChild(u),new a(u,this.overlayContainer,this.settings)},P.prototype.createNewMarker=function(a){var u,D=this;(u=typeof a=="string"?this._availableMarkerTypes.find(function(B){return B.typeName===a}):a)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(u),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(u.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(B){return B(new ot(D,D._currentMarker))}))},P.prototype.markerCreated=function(a){var u=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(a),this.setCurrentMarker(a),a instanceof ae&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ae):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(D){return D(new ot(u,u._currentMarker))})},P.prototype.colorChanged=function(a){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=a,this.settings.defaultStrokeColor=a)},P.prototype.fillColorChanged=function(a){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=a)},P.prototype.markerStateChanged=function(a){var u=this;this.eventListeners.markerchange.forEach(function(D){return D(new ot(u,a))})},P.prototype.setCurrentMarker=function(a){var u=this;this._currentMarker!==a&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(D){return D(new ot(u,u._currentMarker))})),this._currentMarker=a,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 ot(u,u._currentMarker))}))},P.prototype.onPointerDown=function(a){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||a.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var u=this.markers.find(function(D){return D.ownsTarget(a.target)});u!==void 0?(this.setCurrentMarker(u),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(a.clientX,a.clientY),a.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:a.clientX,y:a.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(a.clientX,a.clientY))},P.prototype.onDblClick=function(a){if(this._isFocused||this.focus(),this.mode==="select"){var u=this.markers.find(function(D){return D.ownsTarget(a.target)});u!==void 0&&u!==this._currentMarker&&this.setCurrentMarker(u),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(a.clientX,a.clientY),a.target):this.setCurrentMarker()}},P.prototype.onPointerMove=function(a){this.touchPoints!==1&&a.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||a.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(a.clientX,a.clientY)):this.zoomLevel>1&&this.panTo({x:a.clientX,y:a.clientY}))},P.prototype.onPointerUp=function(a){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(a.clientX,a.clientY)),this.isDragging=!1,this.addUndoStep()},P.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},P.prototype.onKeyUp=function(a){this._currentMarker===void 0||this.notesArea!==void 0||a.key!=="Delete"&&a.key!=="Backspace"||this.deleteSelectedMarker()},P.prototype.clientToLocalCoordinates=function(a,u){var D=this.markerImage.getBoundingClientRect();return{x:(a-D.left)/this.zoomLevel,y:(u-D.top)/this.zoomLevel}},P.prototype.onWindowResize=function(){this.positionUI()},P.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var a=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=a+"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()},P.prototype.addLicenseKey=function(a){je.addKey(a)},P.prototype.addEventListener=function(a,u){this.eventListeners.addEventListener(a,u)},P.prototype.removeEventListener=function(a,u){this.eventListeners.removeEventListener(a,u)},P.prototype.renderState=function(a){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(a),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(P.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),P.prototype.focus=function(){var a=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(u){return u(new Ct(a))}))},P.prototype.blur=function(){var a=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(u){return u(new Ct(a))}))},P.instanceCounter=0,P}();/* **********************************
|
|
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 Ot=function(P,a){return(Ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,D){u.__proto__=D}||function(u,D){for(var B in D)Object.prototype.hasOwnProperty.call(D,B)&&(u[B]=D[B])})(P,a)};function Wt(P,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function u(){this.constructor=P}Ot(P,a),P.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}function gt(P,a,u,D){return new(u||(u=Promise))(function(B,L){function se(pt){try{tt(D.next(pt))}catch(We){L(We)}}function Ne(pt){try{tt(D.throw(pt))}catch(We){L(We)}}function tt(pt){var We;pt.done?B(pt.value):(We=pt.value,We instanceof u?We:new u(function(bt){bt(We)})).then(se,Ne)}tt((D=D.apply(P,a||[])).next())})}function Bt(P,a){var u,D,B,L,se={label:0,sent:function(){if(1&B[0])throw B[1];return B[1]},trys:[],ops:[]};return L={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(L[Symbol.iterator]=function(){return this}),L;function Ne(tt){return function(pt){return function(We){if(u)throw new TypeError("Generator is already executing.");for(;se;)try{if(u=1,D&&(B=2&We[0]?D.return:We[0]?D.throw||((B=D.return)&&B.call(D),0):D.next)&&!(B=B.call(D,We[1])).done)return B;switch(D=0,B&&(We=[2&We[0],B.value]),We[0]){case 0:case 1:B=We;break;case 4:return se.label++,{value:We[1],done:!1};case 5:se.label++,D=We[1],We=[0];continue;case 7:We=se.ops.pop(),se.trys.pop();continue;default:if(!(B=se.trys,(B=B.length>0&&B[B.length-1])||We[0]!==6&&We[0]!==2)){se=0;continue}if(We[0]===3&&(!B||We[1]>B[0]&&We[1]<B[3])){se.label=We[1];break}if(We[0]===6&&se.label<B[1]){se.label=B[1],B=We;break}if(B&&se.label<B[2]){se.label=B[2],se.ops.push(We);break}B[2]&&se.ops.pop(),se.trys.pop();continue}We=a.call(P,se)}catch(bt){We=[6,bt],D=0}finally{u=B=0}if(5&We[0])throw We[1];return{value:We[0]?We[1]:void 0,done:!0}}([tt,pt])}}}var Nt=function(){function P(){}return P.addKey=function(a){P.key=a},Object.defineProperty(P,"isLicensed",{get:function(){return!!P.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(P.key)},enumerable:!1,configurable:!0}),P}(),Ze=function(){function P(){}return P.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},P.setAttributes=function(a,u){for(var D=0,B=u;D<B.length;D++){var L=B[D],se=L[0],Ne=L[1];a.setAttribute(se,Ne)}},P.createRect=function(a,u,D){var B=document.createElementNS("http://www.w3.org/2000/svg","rect");return B.setAttribute("width",a.toString()),B.setAttribute("height",u.toString()),D&&P.setAttributes(B,D),B},P.createLine=function(a,u,D,B,L){var se=document.createElementNS("http://www.w3.org/2000/svg","line");return se.setAttribute("x1",a.toString()),se.setAttribute("y1",u.toString()),se.setAttribute("x2",D.toString()),se.setAttribute("y2",B.toString()),L&&P.setAttributes(se,L),se},P.createPolygon=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",a),u&&P.setAttributes(D,u),D},P.createCircle=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(a/2).toString()),D.setAttribute("cy",(a/2).toString()),D.setAttribute("r",a.toString()),u&&P.setAttributes(D,u),D},P.createEllipse=function(a,u,D){var B=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return B.setAttribute("cx",(a/2).toString()),B.setAttribute("cy",(u/2).toString()),B.setAttribute("rx",(a/2).toString()),B.setAttribute("ry",(u/2).toString()),D&&P.setAttributes(B,D),B},P.createGroup=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","g");return a&&P.setAttributes(u,a),u},P.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},P.createMarker=function(a,u,D,B,L,se,Ne){var tt=document.createElementNS("http://www.w3.org/2000/svg","marker");return P.setAttributes(tt,[["id",a],["orient",u],["markerWidth",D.toString()],["markerHeight",B.toString()],["refX",L.toString()],["refY",se.toString()]]),tt.appendChild(Ne),tt},P.createText=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","text");return u.setAttribute("x","0"),u.setAttribute("y","0"),a&&P.setAttributes(u,a),u},P.createTSpan=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=a,u&&P.setAttributes(D,u),D},P.createImage=function(a){var u=document.createElementNS("http://www.w3.org/2000/svg","image");return a&&P.setAttributes(u,a),u},P.createPoint=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=a,D.y=u,D},P.createPath=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",a),u&&P.setAttributes(D,u),D},P.createElement=function(a,u){var D=document.createElementNS("http://www.w3.org/2000/svg",a);return u&&P.setAttributes(D,u),D},P.getHollowRectanglePath=function(a,u,D,B,L,se,Ne,tt){return"M"+a+","+u+"V"+(u+B)+"H"+(a+D)+"V"+u+"H"+L+"V"+se+"H"+(L+Ne)+"V"+(se+tt)+"H"+L+"V"+u+"Z"},P}(),Yt=function(){function P(a){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+a+"_"}return Object.defineProperty(P.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(P.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(P.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),P.prototype.addClass=function(a){return this.styleSheet===void 0&&this.addStyleSheet(),a.name=""+this.classNamePrefix+a.localName,this.classes.push(a),this.styleSheet.sheet.insertRule("."+a.name+" {"+a.style+"}",this.styleSheet.sheet.cssRules.length),a},P.prototype.addRule=function(a){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(a),this.styleSheet.sheet.insertRule(a.selector+" {"+a.style+"}",this.styleSheet.sheet.cssRules.length)},P.prototype.addStyleSheet=function(){var a;this.styleSheet=document.createElement("style"),((a=this.styleSheetRoot)!==null&&a!==void 0?a:document.head).appendChild(this.styleSheet),this.addRule(new or("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new or("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new or("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Gt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Gt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},P.prototype.removeStyleSheet=function(){var a;this.styleSheet&&(((a=this.styleSheetRoot)!==null&&a!==void 0?a:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},P}(),or=function(P,a){this.selector=P,this.style=a},Gt=function(P,a){this.localName=P,this.style=a},rr=function(){function P(){this.blocks=[],this.display=""}return P.prototype.addButtonBlock=function(a){a.className=this.blockClassName,a.buttonClassName=this.buttonClassName,a.buttonColorsClassName=this.buttonColorsClassName,a.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(a)},P.prototype.addElementBlock=function(a){a.className===void 0&&(a.className=this.blockClassName),this.blocks.push(a)},P.prototype.getUI=function(){var a=document.createElement("div");return a.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,a.style.display=this.display,this.blocks.forEach(function(u){return a.appendChild(u.getUI())}),a},P}(),$r=function(){function P(){}return P.prototype.getUI=function(){var a=document.createElement("div");if(a.className=this.className,this.minWidth!==void 0&&(a.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":a.style.justifyContent="flex-start";break;case"center":a.style.justifyContent="center";break;case"end":a.style.justifyContent="flex-end"}return a.style.whiteSpace="nowrap",a},P}(),Ir=function(P){function a(){var u=P!==null&&P.apply(this,arguments)||this;return u.buttons=[],u}return Wt(a,P),a.prototype.addButton=function(u){u.className=this.buttonClassName,u.colorsClassName=this.buttonColorsClassName,u.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(u)},a.prototype.getUI=function(){var u=P.prototype.getUI.call(this);return this.buttons.forEach(function(D){return u.appendChild(D.getUI())}),u},a}($r),yr=function(){function P(a,u){this._isActive=!1,this._isHidden=!1,this._icon=a,this.title=u,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(P.prototype,"icon",{get:function(){return this._icon},set:function(a){this._icon=a,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isActive",{get:function(){return this._isActive},set:function(a){this._isActive=a,this.adjustClassName()},enumerable:!1,configurable:!0}),P.prototype.getUI=function(){var a=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 a.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},P.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,"")))},P.prototype.hide=function(){this._isHidden=!0},P}(),pr=function(P){function a(){var u=P!==null&&P.apply(this,arguments)||this;return u.elements=[],u}return Wt(a,P),a.prototype.addElement=function(u){this.elements.push(u)},a.prototype.getUI=function(){var u=P.prototype.getUI.call(this);return this.elements.forEach(function(D){return u.appendChild(D)}),u},a}($r),Mr=function(){function P(a,u){this.horizontal=a,this.vertical=u}return Object.defineProperty(P.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),P.prototype.getVerticalLength=function(a){return a/this.ratio},P.prototype.getHorizontalLength=function(a){return a*this.ratio},P}(),Nr=function(){function P(){}return P.getIcon=function(a,u){if(a>0&&u>0){var D=new Mr(a,u),B=D.ratio>=1?20:D.getHorizontalLength(20),L=D.ratio<1?20:D.getVerticalLength(20),se=document.createElementNS("http://www.w3.org/2000/svg","svg");se.setAttribute("xmlns","http://www.w3.org/2000/svg"),se.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(se);var Ne=Ze.createDefs();se.appendChild(Ne);var tt=Ze.createElement("clipPath",[["id","text-bg-clip"]]);Ne.appendChild(tt);var pt=Ze.createPath(Ze.getHollowRectanglePath((24-B)/2,(24-L)/2,B,L,(24-B)/2+2,(24-L)/2+2,B-4,L-4));se.appendChild(pt);var We=Ze.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);We.appendChild(Ze.createTSpan(a+":"+u)),se.appendChild(We);var bt=We.getBBox();Ze.setAttributes(We,[["x",((24-bt.width)/2).toString()],["y",((24-bt.height)/2-bt.y).toString()]]);var Tt=Ze.createPath(Ze.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(bt.width))/2,(24-Math.ceil(bt.height))/2,Math.ceil(bt.width),Math.ceil(bt.height)));return tt.appendChild(Tt),Ze.setAttributes(pt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(se),se.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>'},P}(),Kr=function(P){function a(u,D,B){var L=P.call(this,u,D)||this;return L.isDropdownOpen=!1,L.onClick=L.dropdownButtonClicked,L.dropdownButtons=B,L}return Wt(a,P),a.prototype.setupDropdown=function(){var u=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=u.className,D.colorsClassName=u.colorsClassName,u.dropdownBlock.appendChild(D.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},a.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},a.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},a.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},a.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},a.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},a}(yr),Sr=function(){function P(a,u){this.GRIP_SIZE=10,this.color=a,this.fillColor=u,this.visual=Ze.createGroup(),this.visual.appendChild(Ze.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ze.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return P.prototype.ownsTarget=function(a){return a===this.visual||a===this.visual.childNodes[0]||a===this.visual.childNodes[1]},P.prototype.setCenter=function(a,u){this.visual.childNodes.forEach(function(D){return Ze.setAttributes(D,[["cx",a.toString()],["cy",u.toString()]])})},P}(),_r=function(){function P(a,u,D,B){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=a,this.canvasHeight=u,this.margin=D,this.container=B,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(P.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(a){this._aspectRatio=a,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(a){this._isGridVisible=a,this.gridContainer&&Ze.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(a){this._zoomFactor=a,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),P.prototype.open=function(){var a=this;this.cropShadeElement=Ze.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ze.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var u=0;u<this.numberOfGridLines;u++)this.horizontalGridLines.push(Ze.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Ze.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(D){return a.gridContainer.appendChild(D)}),this.verticalGridLines.forEach(function(D){return a.gridContainer.appendChild(D)}),this.cropRectElement=Ze.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Sr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Sr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Sr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Sr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},P.prototype.setCropRectangle=function(a){this.cropRect=a;var u=Object.assign({},this.cropRect);this.zoomFactor!==1&&(u.width=this.cropRect.width*this.zoomFactor,u.height=this.cropRect.height*this.zoomFactor,u.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-u.width/2,u.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-u.height/2),Ze.setAttributes(this.cropRectElement,[["x",u.x.toString()],["y",u.y.toString()],["width",u.width.toString()],["height",u.height.toString()]]);var D=u.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(L,se){var Ne=u.y+D*(se+1);Ze.setAttributes(L,[["x1",""+u.x],["y1",""+Ne],["x2",""+(u.x+u.width)],["y2",""+Ne]])});var B=u.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(L,se){var Ne=u.x+B*(se+1);Ze.setAttributes(L,[["x1",""+Ne],["y1",""+u.y],["x2",""+Ne],["y2",""+(u.y+u.height)]])}),Ze.setAttributes(this.cropShadeElement,[["d",Ze.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,u.x,u.y,u.width,u.height)]]),this.topLeftGrip.setCenter(u.x,u.y),this.topRightGrip.setCenter(u.x+u.width,u.y),this.bottomLeftGrip.setCenter(u.x,u.y+u.height),this.bottomRightGrip.setCenter(u.x+u.width,u.y+u.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},P.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)},P.prototype.clientToLocalCoordinates=function(a,u){var D=this.container.getBoundingClientRect();return{x:a-D.left+this.margin,y:u-D.top+this.margin}},P.prototype.onPointerDown=function(a){this.container.setPointerCapture(a.pointerId),this.previousPoint=this.clientToLocalCoordinates(a.clientX,a.clientY),this.cropRectElement===a.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(a.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(a.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(a.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(a.target)&&(this.activeGrip=this.bottomRightGrip)},P.prototype.onPointerMove=function(a){if(this.isMoving)this.move(this.clientToLocalCoordinates(a.clientX,a.clientY));else if(this.activeGrip){var u=this.clientToLocalCoordinates(a.clientX,a.clientY);this.resize(u)}a.preventDefault()},P.prototype.onPointerUp=function(a){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(a.pointerId)},P.prototype.move=function(a){var u=a.x-this.previousPoint.x,D=a.y-this.previousPoint.y;this.zoomFactor!==1&&(u=-u/this.zoomFactor,D=-D/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+u),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=a},P.prototype.resize=function(a){var u=Object.assign({},this.cropRect),D=a.x-this.previousPoint.x,B=a.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:u.x+D<this.margin&&(D=this.margin-u.x),u.x+=D,u.width=this.cropRect.x+this.cropRect.width-u.x;break;case this.bottomRightGrip:case this.topRightGrip:u.width+D>this.canvasWidth*this.zoomFactor&&(D=this.canvasWidth*this.zoomFactor-u.width),u.width+=D}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(u.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(D),u.height=this.aspectRatio.getVerticalLength(u.width)):(u.y+=B,u.height=this.cropRect.y+this.cropRect.height-u.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?u.height=this.aspectRatio.getVerticalLength(u.width):u.height+=B}u.width<10&&(u.x=this.cropRect.x,u.width=10),u.height<10&&(u.y=this.cropRect.y,u.height=10),this.previousPoint=a,u.x>=this.margin&&u.y>=this.margin&&u.x-this.margin+u.width<=this.canvasWidth&&u.y-this.margin+u.height<=this.canvasHeight&&(this.cropRect=u,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},P.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var a=this.cropRect.x+this.cropRect.width/2,u=this.cropRect.y+this.cropRect.height/2,D=this.aspectRatio.getHorizontalLength(this.cropRect.height),B=this.aspectRatio.getVerticalLength(this.cropRect.width);D/this.canvasWidth<B/this.canvasHeight?this.cropRect.width=D:this.cropRect.height=B,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=a-this.cropRect.width/2,this.cropRect.y=u-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)}},P.prototype.getRescaledRect=function(a,u,D,B,L,se){var Ne=D/a,tt=B/u;return{x:(L.x-se)*Ne+se,y:(L.y-se)*tt+se,width:L.width*Ne,height:L.height*tt}},P.prototype.scaleCanvas=function(a,u){var D=this.getRescaledRect(this.canvasWidth,this.canvasHeight,a,u,this.cropRect,this.margin);this.canvasWidth=a,this.canvasHeight=u,this.onCropChange&&this.onCropChange(D),this.setCropRectangle(D)},P}(),tn=function(){function P(a){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=a,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(P.prototype,"angle",{get:function(){return this._angle},set:function(a){this._angle=a,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),P.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},P.prototype.onPointerDown=function(a){this.controlContainer.setPointerCapture(a.pointerId),this.isDragging=!0,this.previousPoint={x:a.clientX,y:a.clientY}},P.prototype.onPointerMove=function(a){this.isDragging&&(this.onAngleChange&&this.onAngleChange((a.clientX-this.previousPoint.x)/5),this.previousPoint.x=a.clientX)},P.prototype.onPointerUp=function(a){this.isDragging&&this.onAngleChange&&this.onAngleChange((a.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(a.pointerId)},P.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var a=this.angleLabelText.getBBox();Ze.setAttributes(this.angleLabelElement,[["x",((this.width-a.width)/2).toString()],["y",(this.height/2).toString()]])}},P.prototype.positionScaleShape=function(){if(this.scaleShape){var a=this.scaleShape.transform.baseVal.getItem(0);a.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(a,0)}},P.prototype.getVisual=function(){var a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("width",this.width+"px"),a.setAttribute("height",this.height+"px"),a.setAttribute("viewBox","0 0 "+this.width+" "+this.height),a.style.flexShrink="0",document.body.appendChild(a);for(var u="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,D=1;D<=this.width/5+10;D++){var B=D%5==0?this.height/3:this.height/6;u+="h4v"+-B+"h1v"+B}u+="v1H0Z",this.scaleShape=Ze.createPath(u);var L=Ze.createTransform();this.scaleShape.transform.baseVal.appendItem(L),a.appendChild(this.scaleShape),this.angleLabelElement=Ze.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ze.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var se=Ze.createTSpan("");return se.innerHTML="°",this.angleLabelElement.appendChild(se),a.appendChild(this.angleLabelElement),document.body.removeChild(a),a},P}(),Ur=function(){function P(){this.naturalSize=!1,this.imageType="image/png"}return P.prototype.rasterize=function(a,u,D,B,L,se,Ne){var tt=this;return new Promise(function(pt){var We=document.createElement("canvas");We.width=a.width.baseVal.value-2*B,We.height=a.height.baseVal.value-2*B;var bt=1,Tt=1;tt.naturalSize===!0?(bt=u.naturalWidth/(a.width.baseVal.value-2*B)/se,Tt=u.naturalHeight/(a.height.baseVal.value-2*B)/Ne,We.width=u.naturalWidth/se,We.height=u.naturalHeight/Ne):tt.width!==void 0&&tt.height!==void 0&&(bt=tt.width/D.width,Tt=tt.height/D.height,We.width*=bt,We.height*=Tt);var Qt=We.getContext("2d");Qt.translate(We.width/2,We.height/2),Qt.rotate(L*Math.PI/180),Qt.scale(se,Ne),Qt.translate(-We.width/2,-We.height/2),Qt.drawImage(u,0,0,We.width,We.height);var De=document.createElement("canvas");De.width=D.width*bt,De.height=D.height*Tt,De.getContext("2d").putImageData(Qt.getImageData((D.x-B)*bt,(D.y-B)*Tt,D.width*bt,D.height*Tt),0,0),pt(De.toDataURL(tt.imageType,tt.imageQuality))})},P}(),wt=function(){function P(a){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=P.instanceCounter++,this.styles=new Yt(this.instanceNo),this.target=a,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(P.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(a){this._zoomToCropEnabled=a,a?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(a){this._isGridVisible=a,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"gridLines",{get:function(){return this._gridLines},set:function(a){this._gridLines=a,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(a){this._rotationAngle=a,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"aspectRatio",{get:function(){var a;return(a=this._aspectRatio)!==null&&a!==void 0?a:this.aspectRatios[0]},set:function(a){this._aspectRatio=a},enumerable:!1,configurable:!0}),P.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},P.prototype.show=function(){this.showUI(),this.open()},P.prototype.close=function(a){a===void 0&&(a=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),a||this.closeEventListeners.forEach(function(u){return u()}),this._isOpen=!1)},P.prototype.addRenderEventListener=function(a){this.renderEventListeners.push(a)},P.prototype.removeRenderEventListener=function(a){this.renderEventListeners.indexOf(a)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(a),1)},P.prototype.addCloseEventListener=function(a){this.closeEventListeners.push(a)},P.prototype.removeCloseEventListener=function(a){this.closeEventListeners.indexOf(a)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(a),1)},P.prototype.setupResizeObserver=function(){var a=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){a.resize(a.target.clientWidth,a.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))},P.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var a=1*this.target.clientWidth/this.target.clientHeight,u=this.contentDiv.clientWidth/a>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*a:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,D=u+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/a;this.resize(u,D)}},P.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},P.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",Ze.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},P.prototype.resize=function(a,u){this.imageWidth=Math.round(a),this.imageHeight=Math.round(u),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()},P.prototype.setEditingTarget=function(){var a=document.createElement("canvas");a.width=this.target.naturalWidth,a.height=this.target.naturalHeight,a.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var u=a.toDataURL();Ze.setAttributes(this.editingTarget,[["href",u]]),this.setEditingTargetSize()},P.prototype.setTopLeft=function(){var a=this.target.getBoundingClientRect(),u=this.editorCanvas.getBoundingClientRect();this.left=a.left-u.left-this.CANVAS_MARGIN,this.top=a.top-u.top-this.CANVAS_MARGIN},P.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=Ze.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Ze.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Ze.createGroup(),this.editingTargetRotationScaleContainer=Ze.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var a=Ze.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(a);var u=Ze.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(u),this.editingTargetContainer=Ze.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)},P.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},P.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Ze.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new _r(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()},P.prototype.zoomToCrop=function(){if(this.cropRect){var a=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,u=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=a+"px "+u+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-a+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-u+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},P.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)},P.prototype.cropRectChanged=function(a){this.cropRect=a,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},P.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},P.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"},P.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},P.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 a=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,u=this.target.offsetTop>a+this.CANVAS_MARGIN?this.target.offsetTop-(a+this.CANVAS_MARGIN):0;this.coverDiv.style.top=u+"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},P.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},P.prototype.addTopToolbar=function(){var a=this;this.topToolbar=new rr,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 u=new Ir;u.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(u);var D=[];this.aspectRatios.forEach(function(Tt){var Qt=new yr(Nr.getIcon(Tt.horizontal,Tt.vertical),Tt.horizontal===0&&Tt.vertical===0?"FREE":Tt.horizontal+":"+Tt.vertical);Qt.onClick=function(){return a.ratioButtonClicked(Tt)},D.push(Qt)}),this.aspectRatioButton=new Kr(Nr.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,u.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var B=new yr('<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");B.isActive=this.isGridVisible,B.onClick=function(){a.isGridVisible=!a.isGridVisible,B.isActive=a.isGridVisible},u.addButton(B);var L=new yr('<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(L.isActive=this.zoomToCropEnabled,L.onClick=function(){a.zoomToCropEnabled=!a.zoomToCropEnabled,L.isActive=a.zoomToCropEnabled},u.addButton(L),!Nt.isLicensed){var se=new pr;this.topToolbar.addElementBlock(se);var Ne=document.createElement("div");Ne.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var tt=document.createElement("a");tt.style.color="currentColor",tt.href="https://markerjs.com/products/cropro",tt.target="_blank",tt.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>',Ne.appendChild(tt),se.addElement(Ne)}var pt=new Ir;pt.minWidth=3*this.toolbarHeight+"px",pt.contentAlign="end",this.topToolbar.addButtonBlock(pt);var We=new yr('<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");We.onClick=this.startRenderAndClose,pt.addButton(We),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(We.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var bt=new yr('<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");bt.onClick=this.close,pt.addButton(bt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(bt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},P.prototype.addBottomToolbar=function(){var a=this;this.bottomToolbar=new rr,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 u=new Ir;u.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(u);var D=new yr('<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,u.addButton(D);var B=new yr('<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");B.onClick=this.rotateRightButtonClicked,u.addButton(B);var L=new pr;L.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(L),this.straightener=new tn("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(pt){a.rotateBy(pt),a.straightener.angle=a.rotationAngle},L.addElement(this.straightener.getUI());var se=new Ir;se.minWidth=2*this.toolbarHeight+"px",se.contentAlign="end",this.bottomToolbar.addButtonBlock(se);var Ne=new yr('<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");Ne.onClick=this.flipHorizontallyButtonClicked,se.addButton(Ne);var tt=new yr('<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");tt.onClick=this.flipVerticallyButtonClicked,se.addButton(tt)},P.prototype.ratioButtonClicked=function(a){this.aspectRatio=a,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},P.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Nr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},P.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Mr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},P.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},P.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},P.prototype.restoreState=function(a){if(a){var u=this.cropLayer.getRescaledRect(a.width,a.height,this.imageWidth,this.imageHeight,a.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(u),this.cropRectChanged(u),this.flippedHorizontally=a.flippedHorizontally,this.flippedVertically=a.flippedVertically,this.applyFlip(),this.rotationAngle=a.rotationAngle,this.applyRotation()}},P.prototype.clientToLocalCoordinates=function(a,u){var D=this.cropImage.getBoundingClientRect();return{x:a-D.left,y:u-D.top}},P.prototype.onWindowResize=function(){this.positionUI()},P.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var a=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=a+"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()},P.prototype.rotateLeftButtonClicked=function(){var a=this.rotationAngle-90;this.rotationAngle%90!=0&&(a+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(a)},P.prototype.rotateRightButtonClicked=function(){var a=this.rotationAngle+90;this.rotationAngle%90!=0&&(a-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(a)},P.prototype.rotateTo=function(a){a=(a=a>180?a-360:a)<=-180?a+360:a,this.rotationAngle=a,this.applyRotation()},P.prototype.rotateBy=function(a){this.rotateTo((this.rotationAngle+a)%360)},P.prototype.applyRotation=function(){var a=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var u=this.editingTargetRotationContainer.transform.baseVal.getItem(0);u.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(u,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=a},P.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},P.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},P.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},P.prototype.startRenderAndClose=function(){return gt(this,void 0,void 0,function(){var a,u;return Bt(this,function(D){switch(D.label){case 0:return[4,this.render()];case 1:return a=D.sent(),u=this.getState(),this.renderEventListeners.forEach(function(B){return B(a,u)}),this.close(!0),[2]}})})},P.prototype.render=function(){return gt(this,void 0,void 0,function(){var a;return Bt(this,function(u){switch(u.label){case 0:return(a=new Ur).naturalSize=this.renderAtNaturalSize,a.imageType=this.renderImageType,a.imageQuality=this.renderImageQuality,a.width=this.renderWidth,a.height=this.renderHeight,this.unzoomFromCrop(),Ze.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,a.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 u.sent(),[4,a.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,u.sent()]}})})},P.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Gt("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 Gt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Gt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var a=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Gt("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*a)+`px;
|
|
height: `+(this.toolbarHeight-2*a)+`px;
|
|
padding: `+a+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new or("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new or("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Gt("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 Gt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Gt("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 Gt("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*a)+`px;
|
|
padding: `+a+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Gt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},P.instanceCounter=0,P}(),Yr=W("8hTe"),kr=W.n(Yr),Hr=/<pre[^>]*>/g;function Br(P){var a=document.createElement("div");return a.innerHTML=P,a.childNodes.length===0?"":a.childNodes[0].nodeValue}var rn=Ge.a=function(P){var a=P.value,u=a===void 0?"":a,D=P.edit,B=D===void 0?!1:D,L=P.className,se=P.showTextOnly,Ne=P.showLines,tt=P.replaces,pt=P.zoomImg,We=P.hasMask,bt=P.style,Tt=bt===void 0?{}:bt,Qt=P.stylesPrev,De=Qt===void 0?{}:Qt,br=String(u),sr=Object(w.useRef)(),Rr=Object(w.useRef)(),Cn=Object(w.useState)(""),nn=Object(U.a)(Cn,2),jr=nn[0],Qr=nn[1],zr=Object(w.useState)("office"),an=Object(U.a)(zr,2),Tn=an[0],hn=an[1],bn=function(){var Lt=new wt(Rr.current);Lt.displayMode="popup",Lt.addRenderEventListener(function(){var lr=Object(x.a)(R.a.mark(function jt(mr){var Zt;return R.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:return sr.current.style.display="none",vr.next=3,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr}});case 3:Zt=vr.sent,Zt!=null&&Zt.id&&tt(Rr.current.getAttribute("src").replace(le.a.API_SERVER,""),"/api/attachments/".concat(Zt==null?void 0:Zt.id,"?type=").concat(Zt.content_type));case 5:case"end":return vr.stop()}},jt)}));return function(jt){return lr.apply(this,arguments)}}()),Lt.show()},Mn=function(){var Lt=new At(Rr.current);Lt.settings.displayMode="popup",Lt.addEventListener("render",function(){var lr=Object(x.a)(R.a.mark(function jt(mr){var Zt;return R.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:if(sr.current.style.display="none",!Rr.current){vr.next=6;break}return vr.next=4,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mr.dataUrl}});case 4:Zt=vr.sent,Zt!=null&&Zt.id&&tt(Rr.current.getAttribute("src").replace(le.a.API_SERVER,""),"/api/attachments/".concat(Zt==null?void 0:Zt.id,"?type=").concat(Zt.content_type));case 6:case"end":return vr.stop()}},jt)}));return function(jt){return lr.apply(this,arguments)}}()),Lt.show(),window.markerArea=Lt},on=Object(w.useMemo)(function(){try{var qt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Lt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,lr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;br=br.replace(qt,"("+le.a.API_SERVER+"/api/attachments/").replace(Lt,'"'+le.a.API_SERVER+"/api/attachments/").replace(lr,'"'+le.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,`
|
|
`),br=br.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(pn){}var jt=z(br),mr=p();if(br.match(/\[TOC\]/)&&(jt=jt.replace("<p>[TOC]</p>",m()),f()),jt=jt.replace(/(__special_katext_id_\d+__)/g,function(pn,vr){var En=mr[vr],sn=En.type,mn=En.expression;return Object(be.renderToString)(Br(mn)||"",{displayMode:sn==="block",throwOnError:!1,output:"html"})}),jt=jt.replace(/▁/g,"\u2581\u2581\u2581"),g(),se){var Zt=document.createElement("div");return Zt.innerHTML=jt,Zt.innerText}return setTimeout(function(){return Sn()},500),jt},[br]),Er=Object(w.useRef)();d.WebkitLineClamp=Ne,Ne&&(Tt=Object(v.a)(Object(v.a)({},Tt),d));function Jr(qt){var Lt=qt.target;if(Lt.tagName.toUpperCase()==="IMG"){if(pt){var lr=Lt.getAttribute("src");Qr(lr),hn("image")}}else if(Lt.tagName.toUpperCase()==="A"){var jt=Lt.getAttribute("href");if(jt.indexOf("office")>-1)qt.preventDefault(),Qr(jt),hn("office");else if(jt.indexOf("application/pdf")>-1)qt.preventDefault(),Qr(jt),hn("pdf");else if(jt.indexOf("type=text")>-1)qt.preventDefault(),Qr(jt),hn("html");else if(jt.startsWith("#")){qt.preventDefault();var mr=document.getElementById(jt.replace("#",""));mr&&mr.scrollIntoView(!0)}}}var Sn=function(){var Lt,lr=(Lt=Er.current)===null||Lt===void 0?void 0:Lt.querySelectorAll("video");lr==null||lr.forEach(function(jt){if(jt.oncontextmenu=function(){return!1},jt.src.indexOf(".m3u8")>-1&&!jt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var mr=new $.a;mr.loadSource(jt.src),mr.attachMedia(jt)}}})};Object(w.useEffect)(function(){if(Er.current&&on&&(on.match(Hr)&&window.PR.prettyPrint()),Er.current)return Er.current.addEventListener("click",Jr),function(){Er.current.removeEventListener("click",Jr),g(),f()}},[on,Er.current,Jr]);var fn=function(Lt){if(!B)return;Lt.target.nodeName==="IMG"?(sr.current.style.display="flex",sr.current.style.width=Lt.target.clientWidth+"px",sr.current.style.height=Lt.target.clientHeight+"px",sr.current.style.top=Lt.target.offsetTop+"px",sr.current.style.left=Lt.target.offsetLeft+"px",Rr.current.src=Lt.target.getAttribute("src")):sr.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:Er,style:Object(v.a)({},Tt),className:"".concat(L||""," markdown-body ").concat(kr.a.mdBody),onMouseOver:fn,dangerouslySetInnerHTML:{__html:on}}),b.a.createElement("div",{ref:sr,className:kr.a.button},b.a.createElement(N.a,null,b.a.createElement(I.a,{onClick:function(){return bn()}},"\u88C1\u526A"),b.a.createElement(I.a,{onClick:function(){return Mn()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:Rr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(ve.a,{close:!0,data:jr,hasMask:We,type:jr!=null&&jr.length?Tn:"",style:Object(v.a)({},De),onClose:function(){return Qr("")}}))}},BJfS:function(ft,Ge){var W=function(oe){return oe.replace(/[A-Z]/g,function(N){return"-"+N.toLowerCase()}).toLowerCase()};ft.exports=W},BU3w:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return x});var oe=W("MNnm"),N="rc-util-key";function S(U){if(U.attachTo)return U.attachTo;var M=document.querySelector("head");return M||document.body}function I(U){var M,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(oe.a)())return null;var w=document.createElement("style");if((M=R.csp)===null||M===void 0?void 0:M.nonce){var b;w.nonce=(b=R.csp)===null||b===void 0?void 0:b.nonce}w.innerHTML=U;var T=S(R),O=T.firstChild;return R.prepend&&T.prepend?T.prepend(w):R.prepend&&O?T.insertBefore(w,O):T.appendChild(w),w}var v=new Map;function x(U,M){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=S(R);if(!v.has(w)){var b=I("",R),T=b.parentNode;v.set(w,T),T.removeChild(b)}var O=Array.from(v.get(w).children).find(function(r){return r.tagName==="STYLE"&&r[N]===M});if(O){var C,E;if(((C=R.csp)===null||C===void 0?void 0:C.nonce)&&O.nonce!==((E=R.csp)===null||E===void 0?void 0:E.nonce)){var y;O.nonce=(y=R.csp)===null||y===void 0?void 0:y.nonce}return O.innerHTML!==U&&(O.innerHTML=U),O}var h=I(U,R);return h[N]=M,h}},DlQD:function(ft,Ge,W){(function(oe,N){ft.exports=N()})(this,function(){"use strict";function oe(ae,ee){for(var te=0;te<ee.length;te++){var H=ee[te];H.enumerable=H.enumerable||!1,H.configurable=!0,"value"in H&&(H.writable=!0),Object.defineProperty(ae,H.key,H)}}function N(ae,ee,te){return ee&&oe(ae.prototype,ee),te&&oe(ae,te),ae}function S(ae,ee){if(!ae)return;if(typeof ae=="string")return I(ae,ee);var te=Object.prototype.toString.call(ae).slice(8,-1);if(te==="Object"&&ae.constructor&&(te=ae.constructor.name),te==="Map"||te==="Set")return Array.from(ae);if(te==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(te))return I(ae,ee)}function I(ae,ee){(ee==null||ee>ae.length)&&(ee=ae.length);for(var te=0,H=new Array(ee);te<ee;te++)H[te]=ae[te];return H}function v(ae,ee){var te;if(typeof Symbol=="undefined"||ae[Symbol.iterator]==null){if(Array.isArray(ae)||(te=S(ae))||ee&&ae&&typeof ae.length=="number"){te&&(ae=te);var H=0;return function(){return H>=ae.length?{done:!0}:{done:!1,value:ae[H++]}}}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 te=ae[Symbol.iterator](),te.next.bind(te)}function x(ae,ee){return ee={exports:{}},ae(ee,ee.exports),ee.exports}var U=x(function(ae){function ee(){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 te(H){ae.exports.defaults=H}ae.exports={defaults:ee(),getDefaults:ee,changeDefaults:te}}),M=U.defaults,R=U.getDefaults,w=U.changeDefaults,b=/[&<>"']/,T=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,E={"&":"&","<":"<",">":">",'"':""","'":"'"},y=function(ee){return E[ee]};function h(ae,ee){if(ee){if(b.test(ae))return ae.replace(T,y)}else if(O.test(ae))return ae.replace(C,y);return ae}var r=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function o(ae){return ae.replace(r,function(ee,te){return te=te.toLowerCase(),te==="colon"?":":te.charAt(0)==="#"?te.charAt(1)==="x"?String.fromCharCode(parseInt(te.substring(2),16)):String.fromCharCode(+te.substring(1)):""})}var s=/(^|[^\[])\^/g;function f(ae,ee){ae=ae.source||ae,ee=ee||"";var te={replace:function(G,V){return V=V.source||V,V=V.replace(s,"$1"),ae=ae.replace(G,V),te},getRegex:function(){return new RegExp(ae,ee)}};return te}var d=/[^\w:]/g,l=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function m(ae,ee,te){if(ae){var H;try{H=decodeURIComponent(o(te)).replace(d,"").toLowerCase()}catch(G){return null}if(H.indexOf("javascript:")===0||H.indexOf("vbscript:")===0||H.indexOf("data:")===0)return null}ee&&!l.test(te)&&(te=e(ee,te));try{te=encodeURI(te).replace(/%25/g,"%")}catch(G){return null}return te}var c={},i=/^[^:]+:\/*[^/]*$/,n=/^([^:]+:)[\s\S]*$/,t=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(ae,ee){c[" "+ae]||(i.test(ae)?c[" "+ae]=ae+"/":c[" "+ae]=A(ae,"/",!0)),ae=c[" "+ae];var te=ae.indexOf(":")===-1;return ee.substring(0,2)==="//"?te?ee:ae.replace(n,"$1")+ee:ee.charAt(0)==="/"?te?ee:ae.replace(t,"$1")+ee:ae+ee}var p={exec:function(){}};function g(ae){for(var ee=1,te,H;ee<arguments.length;ee++){te=arguments[ee];for(H in te)Object.prototype.hasOwnProperty.call(te,H)&&(ae[H]=te[H])}return ae}function _(ae,ee){var te=ae.replace(/\|/g,function(V,Q,de){for(var ge=!1,Me=Q;--Me>=0&&de[Me]==="\\";)ge=!ge;return ge?"|":" |"}),H=te.split(/ \|/),G=0;if(H.length>ee)H.splice(ee);else for(;H.length<ee;)H.push("");for(;G<H.length;G++)H[G]=H[G].trim().replace(/\\\|/g,"|");return H}function A(ae,ee,te){var H=ae.length;if(H===0)return"";for(var G=0;G<H;){var V=ae.charAt(H-G-1);if(V===ee&&!te)G++;else if(V!==ee&&te)G++;else break}return ae.substr(0,H-G)}function k(ae,ee){if(ae.indexOf(ee[1])===-1)return-1;for(var te=ae.length,H=0,G=0;G<te;G++)if(ae[G]==="\\")G++;else if(ae[G]===ee[0])H++;else if(ae[G]===ee[1]&&(H--,H<0))return G;return-1}function F(ae){ae&&ae.sanitize&&!ae.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 z={escape:h,unescape:o,edit:f,cleanUrl:m,resolveUrl:e,noopTest:p,merge:g,splitCells:_,rtrim:A,findClosingBracket:k,checkSanitizeDeprecation:F},J=U.defaults,Y=z.rtrim,$=z.splitCells,le=z.escape,be=z.findClosingBracket;function ve(ae,ee,te){var H=ee.href,G=ee.title?le(ee.title):null,V=ae[1].replace(/\\([\[\]])/g,"$1");return ae[0].charAt(0)!=="!"?{type:"link",raw:te,href:H,title:G,text:V}:{type:"image",raw:te,href:H,title:G,text:le(V)}}function ke(ae,ee){var te=ae.match(/^(\s+)(?:```)/);if(te===null)return ee;var H=te[1];return ee.split(`
|
|
`).map(function(G){var V=G.match(/^\s+/);if(V===null)return G;var Q=V[0];return Q.length>=H.length?G.slice(H.length):G}).join(`
|
|
`)}var Te=function(){function ae(te){this.options=te||J}var ee=ae.prototype;return ee.space=function(H){var G=this.rules.block.newline.exec(H);if(G)return G[0].length>1?{type:"space",raw:G[0]}:{raw:`
|
|
`}},ee.code=function(H,G){var V=this.rules.block.code.exec(H);if(V){var Q=G[G.length-1];if(Q&&Q.type==="paragraph")return{raw:V[0],text:V[0].trimRight()};var de=V[0].replace(/^ {4}/gm,"");return{type:"code",raw:V[0],codeBlockStyle:"indented",text:this.options.pedantic?de:Y(de,`
|
|
`)}}},ee.fences=function(H){var G=this.rules.block.fences.exec(H);if(G){var V=G[0],Q=ke(V,G[3]||"");return{type:"code",raw:V,lang:G[2]?G[2].trim():G[2],text:Q}}},ee.heading=function(H){var G=this.rules.block.heading.exec(H);if(G)return{type:"heading",raw:G[0],depth:G[1].length,text:G[2]}},ee.nptable=function(H){var G=this.rules.block.nptable.exec(H);if(G){var V={type:"table",header:$(G[1].replace(/^ *| *\| *$/g,"")),align:G[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:G[3]?G[3].replace(/\n$/,"").split(`
|
|
`):[],raw:G[0]};if(V.header.length===V.align.length){var Q=V.align.length,de;for(de=0;de<Q;de++)/^ *-+: *$/.test(V.align[de])?V.align[de]="right":/^ *:-+: *$/.test(V.align[de])?V.align[de]="center":/^ *:-+ *$/.test(V.align[de])?V.align[de]="left":V.align[de]=null;for(Q=V.cells.length,de=0;de<Q;de++)V.cells[de]=$(V.cells[de],V.header.length);return V}}},ee.hr=function(H){var G=this.rules.block.hr.exec(H);if(G)return{type:"hr",raw:G[0]}},ee.blockquote=function(H){var G=this.rules.block.blockquote.exec(H);if(G){var V=G[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:G[0],text:V}}},ee.list=function(H){var G=this.rules.block.list.exec(H);if(G){for(var V=G[0],Q=G[2],de=Q.length>1,ge=Q[Q.length-1]===")",Me={type:"list",raw:V,ordered:de,start:de?+Q.slice(0,-1):"",loose:!1,items:[]},et=G[0].match(this.rules.block.item),dt=!1,qe,Ct,_t,ot,It,At,Ot,Wt=et.length,gt=0;gt<Wt;gt++)qe=et[gt],V=qe,Ct=qe.length,qe=qe.replace(/^ *([*+-]|\d+[.)]) */,""),~qe.indexOf(`
|
|
`)&&(Ct-=qe.length,qe=this.options.pedantic?qe.replace(/^ {1,4}/gm,""):qe.replace(new RegExp("^ {1,"+Ct+"}","gm"),"")),gt!==Wt-1&&(_t=this.rules.block.bullet.exec(et[gt+1])[0],(de?_t.length===1||!ge&&_t[_t.length-1]===")":_t.length>1||this.options.smartLists&&_t!==Q)&&(ot=et.slice(gt+1).join(`
|
|
`),Me.raw=Me.raw.substring(0,Me.raw.length-ot.length),gt=Wt-1)),It=dt||/\n\n(?!\s*$)/.test(qe),gt!==Wt-1&&(dt=qe.charAt(qe.length-1)===`
|
|
`,It||(It=dt)),It&&(Me.loose=!0),At=/^\[[ xX]\] /.test(qe),Ot=void 0,At&&(Ot=qe[1]!==" ",qe=qe.replace(/^\[[ xX]\] +/,"")),Me.items.push({type:"list_item",raw:V,task:At,checked:Ot,loose:It,text:qe});return Me}},ee.html=function(H){var G=this.rules.block.html.exec(H);if(G)return{type:this.options.sanitize?"paragraph":"html",raw:G[0],pre:!this.options.sanitizer&&(G[1]==="pre"||G[1]==="script"||G[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(G[0]):le(G[0]):G[0]}},ee.def=function(H){var G=this.rules.block.def.exec(H);if(G){G[3]&&(G[3]=G[3].substring(1,G[3].length-1));var V=G[1].toLowerCase().replace(/\s+/g," ");return{tag:V,raw:G[0],href:G[2],title:G[3]}}},ee.table=function(H){var G=this.rules.block.table.exec(H);if(G){var V={type:"table",header:$(G[1].replace(/^ *| *\| *$/g,"")),align:G[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:G[3]?G[3].replace(/\n$/,"").split(`
|
|
`):[]};if(V.header.length===V.align.length){V.raw=G[0];var Q=V.align.length,de;for(de=0;de<Q;de++)/^ *-+: *$/.test(V.align[de])?V.align[de]="right":/^ *:-+: *$/.test(V.align[de])?V.align[de]="center":/^ *:-+ *$/.test(V.align[de])?V.align[de]="left":V.align[de]=null;for(Q=V.cells.length,de=0;de<Q;de++)V.cells[de]=$(V.cells[de].replace(/^ *\| *| *\| *$/g,""),V.header.length);return V}}},ee.lheading=function(H){var G=this.rules.block.lheading.exec(H);if(G)return{type:"heading",raw:G[0],depth:G[2].charAt(0)==="="?1:2,text:G[1]}},ee.paragraph=function(H){var G=this.rules.block.paragraph.exec(H);if(G)return{type:"paragraph",raw:G[0],text:G[1].charAt(G[1].length-1)===`
|
|
`?G[1].slice(0,-1):G[1]}},ee.text=function(H,G){var V=this.rules.block.text.exec(H);if(V){var Q=G[G.length-1];return Q&&Q.type==="text"?{raw:V[0],text:V[0]}:{type:"text",raw:V[0],text:V[0]}}},ee.escape=function(H){var G=this.rules.inline.escape.exec(H);if(G)return{type:"escape",raw:G[0],text:le(G[1])}},ee.tag=function(H,G,V){var Q=this.rules.inline.tag.exec(H);if(Q)return!G&&/^<a /i.test(Q[0])?G=!0:G&&/^<\/a>/i.test(Q[0])&&(G=!1),!V&&/^<(pre|code|kbd|script)(\s|>)/i.test(Q[0])?V=!0:V&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(Q[0])&&(V=!1),{type:this.options.sanitize?"text":"html",raw:Q[0],inLink:G,inRawBlock:V,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):le(Q[0]):Q[0]}},ee.link=function(H){var G=this.rules.inline.link.exec(H);if(G){var V=be(G[2],"()");if(V>-1){var Q=G[0].indexOf("!")===0?5:4,de=Q+G[1].length+V;G[2]=G[2].substring(0,V),G[0]=G[0].substring(0,de).trim(),G[3]=""}var ge=G[2],Me="";if(this.options.pedantic){var et=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ge);et?(ge=et[1],Me=et[3]):Me=""}else Me=G[3]?G[3].slice(1,-1):"";ge=ge.trim().replace(/^<([\s\S]*)>$/,"$1");var dt=ve(G,{href:ge&&ge.replace(this.rules.inline._escapes,"$1"),title:Me&&Me.replace(this.rules.inline._escapes,"$1")},G[0]);return dt}},ee.reflink=function(H,G){var V;if((V=this.rules.inline.reflink.exec(H))||(V=this.rules.inline.nolink.exec(H))){var Q=(V[2]||V[1]).replace(/\s+/g," ");if(Q=G[Q.toLowerCase()],!Q||!Q.href){var de=V[0].charAt(0);return{type:"text",raw:de,text:de}}var ge=ve(V,Q,V[0]);return ge}},ee.strong=function(H,G,V){V===void 0&&(V="");var Q=this.rules.inline.strong.start.exec(H);if(Q&&(!Q[1]||Q[1]&&(V===""||this.rules.inline.punctuation.exec(V)))){G=G.slice(-1*H.length);var de=Q[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;de.lastIndex=0;for(var ge;(Q=de.exec(G))!=null;)if(ge=this.rules.inline.strong.middle.exec(G.slice(0,Q.index+3)),ge)return{type:"strong",raw:H.slice(0,ge[0].length),text:H.slice(2,ge[0].length-2)}}},ee.em=function(H,G,V){V===void 0&&(V="");var Q=this.rules.inline.em.start.exec(H);if(Q&&(!Q[1]||Q[1]&&(V===""||this.rules.inline.punctuation.exec(V)))){G=G.slice(-1*H.length);var de=Q[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;de.lastIndex=0;for(var ge;(Q=de.exec(G))!=null;)if(ge=this.rules.inline.em.middle.exec(G.slice(0,Q.index+2)),ge)return{type:"em",raw:H.slice(0,ge[0].length),text:H.slice(1,ge[0].length-1)}}},ee.codespan=function(H){var G=this.rules.inline.code.exec(H);if(G){var V=G[2].replace(/\n/g," "),Q=/[^ ]/.test(V),de=V.startsWith(" ")&&V.endsWith(" ");return Q&&de&&(V=V.substring(1,V.length-1)),V=le(V,!0),{type:"codespan",raw:G[0],text:V}}},ee.br=function(H){var G=this.rules.inline.br.exec(H);if(G)return{type:"br",raw:G[0]}},ee.del=function(H){var G=this.rules.inline.del.exec(H);if(G)return{type:"del",raw:G[0],text:G[1]}},ee.autolink=function(H,G){var V=this.rules.inline.autolink.exec(H);if(V){var Q,de;return V[2]==="@"?(Q=le(this.options.mangle?G(V[1]):V[1]),de="mailto:"+Q):(Q=le(V[1]),de=Q),{type:"link",raw:V[0],text:Q,href:de,tokens:[{type:"text",raw:Q,text:Q}]}}},ee.url=function(H,G){var V;if(V=this.rules.inline.url.exec(H)){var Q,de;if(V[2]==="@")Q=le(this.options.mangle?G(V[0]):V[0]),de="mailto:"+Q;else{var ge;do ge=V[0],V[0]=this.rules.inline._backpedal.exec(V[0])[0];while(ge!==V[0]);Q=le(V[0]),V[1]==="www."?de="http://"+Q:de=Q}return{type:"link",raw:V[0],text:Q,href:de,tokens:[{type:"text",raw:Q,text:Q}]}}},ee.inlineText=function(H,G,V){var Q=this.rules.inline.text.exec(H);if(Q){var de;return G?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):le(Q[0]):Q[0]:de=le(this.options.smartypants?V(Q[0]):Q[0]),{type:"text",raw:Q[0],text:de}}},ae}(),xe=z.noopTest,_e=z.edit,Oe=z.merge,ce={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:xe,table:xe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ce.def=_e(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex(),ce.bullet=/(?:[*+-]|\d{1,9}[.)])/,ce.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ce.item=_e(ce.item,"gm").replace(/bull/g,ce.bullet).getRegex(),ce.list=_e(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex(),ce._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",ce._comment=/<!--(?!-?>)[\s\S]*?-->/,ce.html=_e(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ce.paragraph=_e(ce._paragraph).replace("hr",ce.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",ce._tag).getRegex(),ce.blockquote=_e(ce.blockquote).replace("paragraph",ce.paragraph).getRegex(),ce.normal=Oe({},ce),ce.gfm=Oe({},ce.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*|$)"}),ce.gfm.nptable=_e(ce.gfm.nptable).replace("hr",ce.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",ce._tag).getRegex(),ce.gfm.table=_e(ce.gfm.table).replace("hr",ce.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",ce._tag).getRegex(),ce.pedantic=Oe({},ce.normal,{html:_e(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._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:xe,paragraph:_e(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:xe,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:xe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};Z._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Z.punctuation=_e(Z.punctuation).replace(/punctuation/g,Z._punctuation).getRegex(),Z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",Z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",Z.em.start=_e(Z.em.start).replace(/punctuation/g,Z._punctuation).getRegex(),Z.em.middle=_e(Z.em.middle).replace(/punctuation/g,Z._punctuation).replace(/overlapSkip/g,Z._overlapSkip).getRegex(),Z.em.endAst=_e(Z.em.endAst,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.em.endUnd=_e(Z.em.endUnd,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.start=_e(Z.strong.start).replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.middle=_e(Z.strong.middle).replace(/punctuation/g,Z._punctuation).replace(/blockSkip/g,Z._blockSkip).getRegex(),Z.strong.endAst=_e(Z.strong.endAst,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.strong.endUnd=_e(Z.strong.endUnd,"g").replace(/punctuation/g,Z._punctuation).getRegex(),Z.blockSkip=_e(Z._blockSkip,"g").getRegex(),Z.overlapSkip=_e(Z._overlapSkip,"g").getRegex(),Z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Z._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])?)+(?![-_])/,Z.autolink=_e(Z.autolink).replace("scheme",Z._scheme).replace("email",Z._email).getRegex(),Z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Z.tag=_e(Z.tag).replace("comment",ce._comment).replace("attribute",Z._attribute).getRegex(),Z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,Z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Z.link=_e(Z.link).replace("label",Z._label).replace("href",Z._href).replace("title",Z._title).getRegex(),Z.reflink=_e(Z.reflink).replace("label",Z._label).getRegex(),Z.reflinkSearch=_e(Z.reflinkSearch,"g").replace("reflink",Z.reflink).replace("nolink",Z.nolink).getRegex(),Z.normal=Oe({},Z),Z.pedantic=Oe({},Z.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:_e(/^!?\[(label)\]\((.*?)\)/).replace("label",Z._label).getRegex(),reflink:_e(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z._label).getRegex()}),Z.gfm=Oe({},Z.normal,{escape:_e(Z.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),Z.gfm.url=_e(Z.gfm.url,"i").replace("email",Z.gfm._extended_email).getRegex(),Z.breaks=Oe({},Z.gfm,{br:_e(Z.br).replace("{2,}","*").getRegex(),text:_e(Z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var je={block:ce,inline:Z},at=U.defaults,rt=je.block,Ke=je.inline;function He(ae){return ae.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 we(ae){var ee="",te,H,G=ae.length;for(te=0;te<G;te++)H=ae.charCodeAt(te),Math.random()>.5&&(H="x"+H.toString(16)),ee+="&#"+H+";";return ee}var Fe=function(){function ae(te){this.tokens=[],this.tokens.links=Object.create(null),this.options=te||at,this.options.tokenizer=this.options.tokenizer||new Te,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var H={block:rt.normal,inline:Ke.normal};this.options.pedantic?(H.block=rt.pedantic,H.inline=Ke.pedantic):this.options.gfm&&(H.block=rt.gfm,this.options.breaks?H.inline=Ke.breaks:H.inline=Ke.gfm),this.tokenizer.rules=H}ae.lex=function(H,G){var V=new ae(G);return V.lex(H)};var ee=ae.prototype;return ee.lex=function(H){return H=H.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(H,this.tokens,!0),this.inline(this.tokens),this.tokens},ee.blockTokens=function(H,G,V){G===void 0&&(G=[]),V===void 0&&(V=!0),H=H.replace(/^ +$/gm,"");for(var Q,de,ge,Me;H;){if(Q=this.tokenizer.space(H)){H=H.substring(Q.raw.length),Q.type&&G.push(Q);continue}if(Q=this.tokenizer.code(H,G)){H=H.substring(Q.raw.length),Q.type?G.push(Q):(Me=G[G.length-1],Me.raw+=`
|
|
`+Q.raw,Me.text+=`
|
|
`+Q.text);continue}if(Q=this.tokenizer.fences(H)){H=H.substring(Q.raw.length),G.push(Q);continue}if(Q=this.tokenizer.heading(H)){H=H.substring(Q.raw.length),G.push(Q);continue}if(Q=this.tokenizer.nptable(H)){H=H.substring(Q.raw.length),G.push(Q);continue}if(Q=this.tokenizer.hr(H)){H=H.substring(Q.raw.length),G.push(Q);continue}if(Q=this.tokenizer.blockquote(H)){H=H.substring(Q.raw.length),Q.tokens=this.blockTokens(Q.text,[],V),G.push(Q);continue}if(Q=this.tokenizer.list(H)){for(H=H.substring(Q.raw.length),ge=Q.items.length,de=0;de<ge;de++)Q.items[de].tokens=this.blockTokens(Q.items[de].text,[],!1);G.push(Q);continue}if(Q=this.tokenizer.html(H)){H=H.substring(Q.raw.length),G.push(Q);continue}if(V&&(Q=this.tokenizer.def(H))){H=H.substring(Q.raw.length),this.tokens.links[Q.tag]||(this.tokens.links[Q.tag]={href:Q.href,title:Q.title});continue}if(Q=this.tokenizer.table(H)){H=H.substring(Q.raw.length),G.push(Q);continue}if(Q=this.tokenizer.lheading(H)){H=H.substring(Q.raw.length),G.push(Q);continue}if(V&&(Q=this.tokenizer.paragraph(H))){H=H.substring(Q.raw.length),G.push(Q);continue}if(Q=this.tokenizer.text(H,G)){H=H.substring(Q.raw.length),Q.type?G.push(Q):(Me=G[G.length-1],Me.raw+=`
|
|
`+Q.raw,Me.text+=`
|
|
`+Q.text);continue}if(H){var et="Infinite loop on byte: "+H.charCodeAt(0);if(this.options.silent){console.error(et);break}else throw new Error(et)}}return G},ee.inline=function(H){var G,V,Q,de,ge,Me,et=H.length;for(G=0;G<et;G++){Me=H[G];switch(Me.type){case"paragraph":case"text":case"heading":{Me.tokens=[],this.inlineTokens(Me.text,Me.tokens);break}case"table":{for(Me.tokens={header:[],cells:[]},de=Me.header.length,V=0;V<de;V++)Me.tokens.header[V]=[],this.inlineTokens(Me.header[V],Me.tokens.header[V]);for(de=Me.cells.length,V=0;V<de;V++)for(ge=Me.cells[V],Me.tokens.cells[V]=[],Q=0;Q<ge.length;Q++)Me.tokens.cells[V][Q]=[],this.inlineTokens(ge[Q],Me.tokens.cells[V][Q]);break}case"blockquote":{this.inline(Me.tokens);break}case"list":{for(de=Me.items.length,V=0;V<de;V++)this.inline(Me.items[V].tokens);break}}}return H},ee.inlineTokens=function(H,G,V,Q,de){G===void 0&&(G=[]),V===void 0&&(V=!1),Q===void 0&&(Q=!1),de===void 0&&(de="");var ge,Me=H,et;if(this.tokens.links){var dt=Object.keys(this.tokens.links);if(dt.length>0)for(;(et=this.tokenizer.rules.inline.reflinkSearch.exec(Me))!=null;)dt.includes(et[0].slice(et[0].lastIndexOf("[")+1,-1))&&(Me=Me.slice(0,et.index)+"["+"a".repeat(et[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(et=this.tokenizer.rules.inline.blockSkip.exec(Me))!=null;)Me=Me.slice(0,et.index)+"["+"a".repeat(et[0].length-2)+"]"+Me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;H;){if(ge=this.tokenizer.escape(H)){H=H.substring(ge.raw.length),G.push(ge);continue}if(ge=this.tokenizer.tag(H,V,Q)){H=H.substring(ge.raw.length),V=ge.inLink,Q=ge.inRawBlock,G.push(ge);continue}if(ge=this.tokenizer.link(H)){H=H.substring(ge.raw.length),ge.type==="link"&&(ge.tokens=this.inlineTokens(ge.text,[],!0,Q)),G.push(ge);continue}if(ge=this.tokenizer.reflink(H,this.tokens.links)){H=H.substring(ge.raw.length),ge.type==="link"&&(ge.tokens=this.inlineTokens(ge.text,[],!0,Q)),G.push(ge);continue}if(ge=this.tokenizer.strong(H,Me,de)){H=H.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],V,Q),G.push(ge);continue}if(ge=this.tokenizer.em(H,Me,de)){H=H.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],V,Q),G.push(ge);continue}if(ge=this.tokenizer.codespan(H)){H=H.substring(ge.raw.length),G.push(ge);continue}if(ge=this.tokenizer.br(H)){H=H.substring(ge.raw.length),G.push(ge);continue}if(ge=this.tokenizer.del(H)){H=H.substring(ge.raw.length),ge.tokens=this.inlineTokens(ge.text,[],V,Q),G.push(ge);continue}if(ge=this.tokenizer.autolink(H,we)){H=H.substring(ge.raw.length),G.push(ge);continue}if(!V&&(ge=this.tokenizer.url(H,we))){H=H.substring(ge.raw.length),G.push(ge);continue}if(ge=this.tokenizer.inlineText(H,Q,He)){H=H.substring(ge.raw.length),de=ge.raw.slice(-1),G.push(ge);continue}if(H){var qe="Infinite loop on byte: "+H.charCodeAt(0);if(this.options.silent){console.error(qe);break}else throw new Error(qe)}}return G},N(ae,null,[{key:"rules",get:function(){return{block:rt,inline:Ke}}}]),ae}(),$e=U.defaults,Qe=z.cleanUrl,Ve=z.escape,Ue=function(){function ae(te){this.options=te||$e}var ee=ae.prototype;return ee.code=function(H,G,V){var Q=(G||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(H,Q);de!=null&&de!==H&&(V=!0,H=de)}return Q?'<pre><code class="'+this.options.langPrefix+Ve(Q,!0)+'">'+(V?H:Ve(H,!0))+`</code></pre>
|
|
`:"<pre><code>"+(V?H:Ve(H,!0))+`</code></pre>
|
|
`},ee.blockquote=function(H){return`<blockquote>
|
|
`+H+`</blockquote>
|
|
`},ee.html=function(H){return H},ee.heading=function(H,G,V,Q){return this.options.headerIds?"<h"+G+' id="'+this.options.headerPrefix+Q.slug(V)+'">'+H+"</h"+G+`>
|
|
`:"<h"+G+">"+H+"</h"+G+`>
|
|
`},ee.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ee.list=function(H,G,V){var Q=G?"ol":"ul",de=G&&V!==1?' start="'+V+'"':"";return"<"+Q+de+`>
|
|
`+H+"</"+Q+`>
|
|
`},ee.listitem=function(H){return"<li>"+H+`</li>
|
|
`},ee.checkbox=function(H){return"<input "+(H?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ee.paragraph=function(H){return"<p>"+H+`</p>
|
|
`},ee.table=function(H,G){return G&&(G="<tbody>"+G+"</tbody>"),`<table>
|
|
<thead>
|
|
`+H+`</thead>
|
|
`+G+`</table>
|
|
`},ee.tablerow=function(H){return`<tr>
|
|
`+H+`</tr>
|
|
`},ee.tablecell=function(H,G){var V=G.header?"th":"td",Q=G.align?"<"+V+' align="'+G.align+'">':"<"+V+">";return Q+H+"</"+V+`>
|
|
`},ee.strong=function(H){return"<strong>"+H+"</strong>"},ee.em=function(H){return"<em>"+H+"</em>"},ee.codespan=function(H){return"<code>"+H+"</code>"},ee.br=function(){return this.options.xhtml?"<br/>":"<br>"},ee.del=function(H){return"<del>"+H+"</del>"},ee.link=function(H,G,V){if(H=Qe(this.options.sanitize,this.options.baseUrl,H),H===null)return V;var Q='<a href="'+Ve(H)+'"';return G&&(Q+=' title="'+G+'"'),Q+=">"+V+"</a>",Q},ee.image=function(H,G,V){if(H=Qe(this.options.sanitize,this.options.baseUrl,H),H===null)return V;var Q='<img src="'+H+'" alt="'+V+'"';return G&&(Q+=' title="'+G+'"'),Q+=this.options.xhtml?"/>":">",Q},ee.text=function(H){return H},ae}(),Be=function(){function ae(){}var ee=ae.prototype;return ee.strong=function(H){return H},ee.em=function(H){return H},ee.codespan=function(H){return H},ee.del=function(H){return H},ee.html=function(H){return H},ee.text=function(H){return H},ee.link=function(H,G,V){return""+V},ee.image=function(H,G,V){return""+V},ee.br=function(){return""},ae}(),ct=function(){function ae(){this.seen={}}var ee=ae.prototype;return ee.slug=function(H){var G=H.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(G)){var V=G;do this.seen[V]++,G=V+"-"+this.seen[V];while(this.seen.hasOwnProperty(G))}return this.seen[G]=0,G},ae}(),st=U.defaults,lt=z.unescape,nt=function(){function ae(te){this.options=te||st,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Be,this.slugger=new ct}ae.parse=function(H,G){var V=new ae(G);return V.parse(H)};var ee=ae.prototype;return ee.parse=function(H,G){G===void 0&&(G=!0);var V="",Q,de,ge,Me,et,dt,qe,Ct,_t,ot,It,At,Ot,Wt,gt,Bt,Nt,Ze,Yt=H.length;for(Q=0;Q<Yt;Q++){ot=H[Q];switch(ot.type){case"space":continue;case"hr":{V+=this.renderer.hr();continue}case"heading":{V+=this.renderer.heading(this.parseInline(ot.tokens),ot.depth,lt(this.parseInline(ot.tokens,this.textRenderer)),this.slugger);continue}case"code":{V+=this.renderer.code(ot.text,ot.lang,ot.escaped);continue}case"table":{for(Ct="",qe="",Me=ot.header.length,de=0;de<Me;de++)qe+=this.renderer.tablecell(this.parseInline(ot.tokens.header[de]),{header:!0,align:ot.align[de]});for(Ct+=this.renderer.tablerow(qe),_t="",Me=ot.cells.length,de=0;de<Me;de++){for(dt=ot.tokens.cells[de],qe="",et=dt.length,ge=0;ge<et;ge++)qe+=this.renderer.tablecell(this.parseInline(dt[ge]),{header:!1,align:ot.align[ge]});_t+=this.renderer.tablerow(qe)}V+=this.renderer.table(Ct,_t);continue}case"blockquote":{_t=this.parse(ot.tokens),V+=this.renderer.blockquote(_t);continue}case"list":{for(It=ot.ordered,At=ot.start,Ot=ot.loose,Me=ot.items.length,_t="",de=0;de<Me;de++)gt=ot.items[de],Bt=gt.checked,Nt=gt.task,Wt="",gt.task&&(Ze=this.renderer.checkbox(Bt),Ot?gt.tokens.length>0&>.tokens[0].type==="text"?(gt.tokens[0].text=Ze+" "+gt.tokens[0].text,gt.tokens[0].tokens&>.tokens[0].tokens.length>0&>.tokens[0].tokens[0].type==="text"&&(gt.tokens[0].tokens[0].text=Ze+" "+gt.tokens[0].tokens[0].text)):gt.tokens.unshift({type:"text",text:Ze}):Wt+=Ze),Wt+=this.parse(gt.tokens,Ot),_t+=this.renderer.listitem(Wt,Nt,Bt);V+=this.renderer.list(_t,It,At);continue}case"html":{V+=this.renderer.html(ot.text);continue}case"paragraph":{V+=this.renderer.paragraph(this.parseInline(ot.tokens));continue}case"text":{for(_t=ot.tokens?this.parseInline(ot.tokens):ot.text;Q+1<Yt&&H[Q+1].type==="text";)ot=H[++Q],_t+=`
|
|
`+(ot.tokens?this.parseInline(ot.tokens):ot.text);V+=G?this.renderer.paragraph(_t):_t;continue}default:{var or='Token with "'+ot.type+'" type was not found.';if(this.options.silent){console.error(or);return}else throw new Error(or)}}}return V},ee.parseInline=function(H,G){G=G||this.renderer;var V="",Q,de,ge=H.length;for(Q=0;Q<ge;Q++){de=H[Q];switch(de.type){case"escape":{V+=G.text(de.text);break}case"html":{V+=G.html(de.text);break}case"link":{V+=G.link(de.href,de.title,this.parseInline(de.tokens,G));break}case"image":{V+=G.image(de.href,de.title,de.text);break}case"strong":{V+=G.strong(this.parseInline(de.tokens,G));break}case"em":{V+=G.em(this.parseInline(de.tokens,G));break}case"codespan":{V+=G.codespan(de.text);break}case"br":{V+=G.br();break}case"del":{V+=G.del(this.parseInline(de.tokens,G));break}case"text":{V+=G.text(de.text);break}default:{var Me='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}}return V},ae}(),ht=z.merge,ut=z.checkSanitizeDeprecation,fe=z.escape,ye=U.getDefaults,Re=U.changeDefaults,Ie=U.defaults;function Ce(ae,ee,te){if(typeof ae=="undefined"||ae===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ae!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ae)+", string expected");if(typeof ee=="function"&&(te=ee,ee=null),ee=ht({},Ce.defaults,ee||{}),ut(ee),te){var H=ee.highlight,G;try{G=Fe.lex(ae,ee)}catch(ge){return te(ge)}var V=function(Me){var et;if(!Me)try{et=nt.parse(G,ee)}catch(dt){Me=dt}return ee.highlight=H,Me?te(Me):te(null,et)};if(!H||H.length<3)return V();if(delete ee.highlight,!G.length)return V();var Q=0;Ce.walkTokens(G,function(ge){ge.type==="code"&&(Q++,setTimeout(function(){H(ge.text,ge.lang,function(Me,et){if(Me)return V(Me);et!=null&&et!==ge.text&&(ge.text=et,ge.escaped=!0),Q--,Q===0&&V()})},0))}),Q===0&&V();return}try{var de=Fe.lex(ae,ee);return ee.walkTokens&&Ce.walkTokens(de,ee.walkTokens),nt.parse(de,ee)}catch(ge){if(ge.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ee.silent)return"<p>An error occurred:</p><pre>"+fe(ge.message+"",!0)+"</pre>";throw ge}}Ce.options=Ce.setOptions=function(ae){return ht(Ce.defaults,ae),Re(Ce.defaults),Ce},Ce.getDefaults=ye,Ce.defaults=Ie,Ce.use=function(ae){var ee=ht({},ae);if(ae.renderer&&function(){var H=Ce.defaults.renderer||new Ue,G=function(de){var ge=H[de];H[de]=function(){for(var Me=arguments.length,et=new Array(Me),dt=0;dt<Me;dt++)et[dt]=arguments[dt];var qe=ae.renderer[de].apply(H,et);return qe===!1&&(qe=ge.apply(H,et)),qe}};for(var V in ae.renderer)G(V);ee.renderer=H}(),ae.tokenizer&&function(){var H=Ce.defaults.tokenizer||new Te,G=function(de){var ge=H[de];H[de]=function(){for(var Me=arguments.length,et=new Array(Me),dt=0;dt<Me;dt++)et[dt]=arguments[dt];var qe=ae.tokenizer[de].apply(H,et);return qe===!1&&(qe=ge.apply(H,et)),qe}};for(var V in ae.tokenizer)G(V);ee.tokenizer=H}(),ae.walkTokens){var te=Ce.defaults.walkTokens;ee.walkTokens=function(H){ae.walkTokens(H),te&&te(H)}}Ce.setOptions(ee)},Ce.walkTokens=function(ae,ee){for(var te=v(ae),H;!(H=te()).done;){var G=H.value;ee(G);switch(G.type){case"table":{for(var V=v(G.tokens.header),Q;!(Q=V()).done;){var de=Q.value;Ce.walkTokens(de,ee)}for(var ge=v(G.tokens.cells),Me;!(Me=ge()).done;)for(var et=Me.value,dt=v(et),qe;!(qe=dt()).done;){var Ct=qe.value;Ce.walkTokens(Ct,ee)}break}case"list":{Ce.walkTokens(G.items,ee);break}default:G.tokens&&Ce.walkTokens(G.tokens,ee)}}},Ce.Parser=nt,Ce.parser=nt.parse,Ce.Renderer=Ue,Ce.TextRenderer=Be,Ce.Lexer=Fe,Ce.lexer=Fe.lex,Ce.Tokenizer=Te,Ce.Slugger=ct,Ce.parse=Ce;var Ae=Ce;return Ae})},IBYe:function(ft,Ge,W){"use strict";function oe(N){return null}Ge.a=oe},LdHM:function(ft,Ge,W){"use strict";W.d(Ge,"b",function(){return s}),W.d(Ge,"a",function(){return d});var oe=W("1OyB"),N=W("vuIU"),S=W("Ji7U"),I=W("LK+K"),v=W("q1tI"),x=W("rePB"),U=W("Ff2n"),M=W("ODXe"),R=W("4IlW"),w=W("bX4T"),b=W("YrtM"),T=W("TSYQ"),O=W.n(T),C=W("+nKL"),E=W("8OUc"),y=function($,le){var be=$.prefixCls,ve=$.id,ke=$.flattenOptions,Te=$.childrenAsData,xe=$.values,_e=$.searchValue,Oe=$.multiple,ce=$.defaultActiveFirstOption,Z=$.height,je=$.itemHeight,at=$.notFoundContent,rt=$.open,Ke=$.menuItemSelectedIcon,He=$.virtual,we=$.onSelect,Fe=$.onToggleOpen,$e=$.onActiveValue,Qe=$.onScroll,Ve=$.onMouseEnter,Ue="".concat(be,"-item"),Be=Object(b.a)(function(){return ke},[rt,ke],function(Ae,ae){return ae[0]&&Ae[1]!==ae[1]}),ct=v.useRef(null),st=function(ae){ae.preventDefault()},lt=function(ae){ct.current&&ct.current.scrollTo({index:ae})},nt=function(ae){for(var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,te=Be.length,H=0;H<te;H+=1){var G=(ae+H*ee+te)%te,V=Be[G],Q=V.group,de=V.data;if(!Q&&!de.disabled)return G}return-1},ht=v.useState(function(){return nt(0)}),ut=Object(M.a)(ht,2),fe=ut[0],ye=ut[1],Re=function(ae){ye(ae);var ee=Be[ae];if(!ee){$e(null,-1);return}$e(ee.data.value,ae)};v.useEffect(function(){Re(ce!==!1?nt(0):-1)},[Be.length,_e]),v.useEffect(function(){var Ae=setTimeout(function(){if(!Oe&&rt&&xe.size===1){var ae=Array.from(xe)[0],ee=Be.findIndex(function(te){var H=te.data;return H.value===ae});Re(ee),lt(ee)}});return function(){return clearTimeout(Ae)}},[rt]);var Ie=function(ae){ae!==void 0&&we(ae,{selected:!xe.has(ae)}),Oe||Fe(!1)};if(v.useImperativeHandle(le,function(){return{onKeyDown:function(ae){var ee=ae.which;switch(ee){case R.a.UP:case R.a.DOWN:{var te=0;if(ee===R.a.UP?te=-1:ee===R.a.DOWN&&(te=1),te!==0){var H=nt(fe+te,te);lt(H),Re(H)}break}case R.a.ENTER:{var G=Be[fe];G&&!G.data.disabled?Ie(G.data.value):Ie(void 0),rt&&ae.preventDefault();break}case R.a.ESC:Fe(!1)}},onKeyUp:function(){},scrollTo:function(ae){lt(ae)}}}),Be.length===0)return v.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),className:"".concat(Ue,"-empty"),onMouseDown:st},at);function Ce(Ae){var ae=Be[Ae];if(!ae)return null;var ee=ae.data||{},te=ee.value,H=ee.label,G=ee.children,V=Object(w.a)(ee,!0),Q=Te?G:H;return ae?v.createElement("div",Object.assign({"aria-label":typeof Q=="string"?Q:null},V,{key:Ae,role:"option",id:"".concat(ve,"_list_").concat(Ae),"aria-selected":xe.has(te)}),te):null}return v.createElement(v.Fragment,null,v.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ce(fe-1),Ce(fe),Ce(fe+1)),v.createElement(C.a,{itemKey:"key",ref:ct,data:Be,height:Z,itemHeight:je,fullHeight:!1,onMouseDown:st,onScroll:Qe,virtual:He,onMouseEnter:Ve},function(Ae,ae){var ee,te=Ae.group,H=Ae.groupOption,G=Ae.data,V=G.label,Q=G.key;if(te)return v.createElement("div",{className:O()(Ue,"".concat(Ue,"-group"))},V!==void 0?V:Q);var de=G.disabled,ge=G.value,Me=G.title,et=G.children,dt=G.style,qe=G.className,Ct=Object(U.a)(G,["disabled","value","title","children","style","className"]),_t=xe.has(ge),ot="".concat(Ue,"-option"),It=O()(Ue,ot,qe,(ee={},Object(x.a)(ee,"".concat(ot,"-grouped"),H),Object(x.a)(ee,"".concat(ot,"-active"),fe===ae&&!de),Object(x.a)(ee,"".concat(ot,"-disabled"),de),Object(x.a)(ee,"".concat(ot,"-selected"),_t),ee)),At=Te?et:V,Ot=!Ke||typeof Ke=="function"||_t;return v.createElement("div",Object.assign({},Ct,{"aria-selected":_t,className:It,title:Me,onMouseMove:function(){if(fe===ae||de)return;Re(ae)},onClick:function(){de||Ie(ge)},style:dt}),v.createElement("div",{className:"".concat(ot,"-content")},At||ge),v.isValidElement(Ke)||_t,Ot&&v.createElement(E.a,{className:"".concat(Ue,"-option-state"),customizeIcon:Ke,customizeIconProps:{isSelected:_t}},_t?"\u2713":null))}))},h=v.forwardRef(y);h.displayName="OptionList";var r=h,o=function(){return null};o.isSelectOption=!0;var s=o,f=function(){return null};f.isSelectOptGroup=!0;var d=f,l=W("VTBJ"),m=W("Zm9Q");function c(Y){var $=Y.key,le=Y.props,be=le.children,ve=le.value,ke=Object(U.a)(le,["children","value"]);return Object(l.a)({key:$,value:ve!==void 0?ve:$,children:be},ke)}function i(Y){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(m.a)(Y).map(function(le,be){if(!v.isValidElement(le)||!le.type)return null;var ve=le.type.isSelectOptGroup,ke=le.key,Te=le.props,xe=Te.children,_e=Object(U.a)(Te,["children"]);return $||!ve?c(le):Object(l.a)(Object(l.a)({key:"__RC_SELECT_GRP__".concat(ke===null?be:ke,"__"),label:ke},_e),{},{options:i(xe)})}).filter(function(le){return le})}var n=W("2Qr1"),t=W("qNPg"),e=W("U8pU"),p=W("Kwbf"),g=W("WKfj");function _(Y){var $=Y.mode,le=Y.options,be=Y.children,ve=Y.backfill,ke=Y.allowClear,Te=Y.placeholder,xe=Y.getInputElement,_e=Y.showSearch,Oe=Y.onSearch,ce=Y.defaultOpen,Z=Y.autoFocus,je=Y.labelInValue,at=Y.value,rt=Y.inputValue,Ke=Y.optionLabelProp,He=$==="multiple"||$==="tags",we=_e!==void 0?_e:He||$==="combobox",Fe=le||i(be);if(Object(p.a)($!=="tags"||Fe.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var $e=Fe.some(function(Ue){return Ue.options?Ue.options.some(function(Be){return typeof("value"in Be?Be.value:Be.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(p.a)(!$e,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(p.a)($!=="combobox"||!Ke,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(p.a)($==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(p.a)($==="combobox"||!xe,"`getInputElement` only work with `combobox` mode."),Object(p.b)($!=="combobox"||!xe||!ke||!Te,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Oe&&!we&&$!=="combobox"&&$!=="tags"&&Object(p.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(p.b)(!ce||Z,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),at!=null){var Qe=Object(g.d)(at);Object(p.a)(!je||Qe.every(function(Ue){return Object(e.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(p.a)(!He||Array.isArray(at),"`value` should be array when `mode` is `multiple` or `tags`")}if(be){var Ve=null;Object(m.a)(be).some(function(Ue){if(!v.isValidElement(Ue)||!Ue.type)return!1;var Be=Ue.type;if(Be.isSelectOption)return!1;if(Be.isSelectOptGroup){var ct=Object(m.a)(Ue.props.children).every(function(st){return!v.isValidElement(st)||!Ue.type||st.type.isSelectOption?!0:(Ve=st.type,!1)});return!ct}return Ve=Be,!0}),Ve&&Object(p.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ve.displayName||Ve.name||Ve,"`.")),Object(p.a)(rt===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var A=_,k=Object(t.a)({prefixCls:"rc-select",components:{optionList:r},convertChildrenToData:i,flattenOptions:n.d,getLabeledValue:n.e,filterOptions:n.b,isValueDisabled:n.g,findValueOption:n.c,warningProps:A,fillOptionsWithMissingValue:n.a}),F=function(Y){Object(S.a)(le,Y);var $=Object(I.a)(le);function le(){var be;return Object(oe.a)(this,le),be=$.apply(this,arguments),be.selectRef=v.createRef(),be.focus=function(){be.selectRef.current.focus()},be.blur=function(){be.selectRef.current.blur()},be}return Object(N.a)(le,[{key:"render",value:function(){return v.createElement(k,Object.assign({ref:this.selectRef},this.props))}}]),le}(v.Component);F.Option=s,F.OptGroup=d;var z=F,J=Ge.c=z},NvD2:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return x});var oe=W("Kwbf");function N(U,M){var R=new Set;return U.forEach(function(w){M.has(w)||R.add(w)}),R}function S(U){var M=U||{},R=M.disabled,w=M.disableCheckbox,b=M.checkable;return!!(R||w)||b===!1}function I(U,M,R,w){for(var b=new Set(U),T=new Set,O=0;O<=R;O+=1){var C=M.get(O)||new Set;C.forEach(function(r){var o=r.key,s=r.node,f=r.children,d=f===void 0?[]:f;b.has(o)&&!w(s)&&d.filter(function(l){return!w(l.node)}).forEach(function(l){b.add(l.key)})})}for(var E=new Set,y=R;y>=0;y-=1){var h=M.get(y)||new Set;h.forEach(function(r){var o=r.parent,s=r.node;if(w(s)||!r.parent||E.has(r.parent.key))return;if(w(r.parent.node)){E.add(o.key);return}var f=!0,d=!1;(o.children||[]).filter(function(l){return!w(l.node)}).forEach(function(l){var m=l.key,c=b.has(m);f&&!c&&(f=!1),!d&&(c||T.has(m))&&(d=!0)}),f&&b.add(o.key),d&&T.add(o.key),E.add(o.key)})}return{checkedKeys:Array.from(b),halfCheckedKeys:Array.from(N(T,b))}}function v(U,M,R,w,b){for(var T=new Set(U),O=new Set(M),C=0;C<=w;C+=1){var E=R.get(C)||new Set;E.forEach(function(o){var s=o.key,f=o.node,d=o.children,l=d===void 0?[]:d;!T.has(s)&&!O.has(s)&&!b(f)&&l.filter(function(m){return!b(m.node)}).forEach(function(m){T.delete(m.key)})})}O=new Set;for(var y=new Set,h=w;h>=0;h-=1){var r=R.get(h)||new Set;r.forEach(function(o){var s=o.parent,f=o.node;if(b(f)||!o.parent||y.has(o.parent.key))return;if(b(o.parent.node)){y.add(s.key);return}var d=!0,l=!1;(s.children||[]).filter(function(m){return!b(m.node)}).forEach(function(m){var c=m.key,i=T.has(c);d&&!i&&(d=!1),!l&&(i||O.has(c))&&(l=!0)}),d||T.delete(s.key),l&&O.add(s.key),y.add(s.key)})}return{checkedKeys:Array.from(T),halfCheckedKeys:Array.from(N(O,T))}}function x(U,M,R,w){var b=[],T;w?T=w:T=S;var O=new Set(U.filter(function(h){var r=!!R[h];return r||b.push(h),r})),C=new Map,E=0;Object.keys(R).forEach(function(h){var r=R[h],o=r.level,s=C.get(o);s||(s=new Set,C.set(o,s)),s.add(r),E=Math.max(E,o)}),Object(oe.a)(!b.length,"Tree missing follow keys: ".concat(b.slice(0,100).map(function(h){return"'".concat(h,"'")}).join(", ")));var y;return M===!0?y=I(O,C,E,T):y=v(O,M.halfCheckedKeys,C,E,T),y}},OZM5:function(ft,Ge,W){"use strict";W.d(Ge,"b",function(){return w}),W.d(Ge,"a",function(){return b}),W.d(Ge,"k",function(){return T}),W.d(Ge,"h",function(){return O}),W.d(Ge,"i",function(){return C}),W.d(Ge,"g",function(){return E}),W.d(Ge,"c",function(){return y}),W.d(Ge,"d",function(){return h}),W.d(Ge,"j",function(){return s}),W.d(Ge,"e",function(){return f}),W.d(Ge,"f",function(){return d});var oe=W("KQm4"),N=W("U8pU"),S=W("Ff2n"),I=W("q1tI"),v=W.n(I),x=W("Kwbf"),U=W("WaYH"),M=.25,R=2;function w(l,m){var c=l.slice(),i=c.indexOf(m);return i>=0&&c.splice(i,1),c}function b(l,m){var c=l.slice();return c.indexOf(m)===-1&&c.push(m),c}function T(l){return l.split("-")}function O(l,m){return"".concat(l,"-").concat(m)}function C(l){return l&&l.type&&l.type.isTreeNode}function E(l,m){var c=[l],i=m[l];function n(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];t.forEach(function(e){var p=e.key,g=e.children;c.push(p),n(g)})}return n(i.children),c}function y(l,m){var c=l.clientY,i=m.selectHandle.getBoundingClientRect(),n=i.top,t=i.bottom,e=i.height,p=Math.max(e*M,R);return c<=n+p?-1:c>=t-p?1:0}function h(l,m){if(!l)return;var c=m.multiple;return c?l.slice():l.length?[l[0]]:l}var r=function(m){return m};function o(l,m){if(!l)return[];var c=m||{},i=c.processProps,n=i===void 0?r:i,t=Array.isArray(l)?l:[l];return t.map(function(e){var p=e.children,g=Object(S.a)(e,["children"]),_=o(p,m);return v.a.createElement(U.a,Object.assign({},n(g)),_)})}function s(l){if(!l)return null;var m;if(Array.isArray(l))m={checkedKeys:l,halfCheckedKeys:void 0};else if(Object(N.a)(l)==="object")m={checkedKeys:l.checked||void 0,halfCheckedKeys:l.halfChecked||void 0};else return Object(x.a)(!1,"`checkedKeys` is not an array or an object"),null;return m}function f(l,m){var c=new Set;function i(n){if(c.has(n))return;var t=m[n];if(!t)return;c.add(n);var e=t.parent,p=t.node;if(p.disabled)return;e&&i(e.key)}return(l||[]).forEach(function(n){i(n)}),Object(oe.a)(c)}function d(l){var m={};return Object.keys(l).forEach(function(c){(c.startsWith("data-")||c.startsWith("aria-"))&&(m[c]=l[c])}),m}},"SA+Z":function(ft,Ge,W){var oe=W("wTVA"),N=W("EbDI"),S=W("ZhPi"),I=W("wkBT");function v(x){return oe(x)||N(x)||S(x)||I()}ft.exports=v,ft.exports.__esModule=!0,ft.exports.default=ft.exports},SJMd:function(ft,Ge){/**
|
|
* @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 W,oe,N,S=!1,I,v;window.PR_SHOULD_USE_CONTINUATION=!0;var x,U;(function(){var M=window,R=["break,continue,do,else,for,if,return,while"],w=[R,"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=[w,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[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"],O=[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"],E="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",y=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="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",r=[R,"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"],o=[R,"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"],s=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],f=[T,C,O,y,h,r,o,s],d=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,l="str",m="kwd",c="com",i="typ",n="lit",t="pun",e="pln",p="tag",g="dec",_="src",A="atn",k="atv",F="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function J(we){for(var Fe=0,$e=!1,Qe=!1,Ve=0,Ue=we.length;Ve<Ue;++Ve){var Be=we[Ve];if(Be.ignoreCase)Qe=!0;else if(/[a-z]/i.test(Be.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){$e=!0,Qe=!1;break}}var ct={b:8,t:9,n:10,v:11,f:12,r:13};function st(fe){var ye=fe.charCodeAt(0);if(ye!==92)return ye;var Re=fe.charAt(1);return ye=ct[Re],ye||("0"<=Re&&Re<="7"?parseInt(fe.substring(1),8):Re==="u"||Re==="x"?parseInt(fe.substring(2),16):fe.charCodeAt(1))}function lt(fe){if(fe<32)return(fe<16?"\\x0":"\\x")+fe.toString(16);var ye=String.fromCharCode(fe);return ye==="\\"||ye==="-"||ye==="]"||ye==="^"?"\\"+ye:ye}function nt(fe){var ye=fe.substring(1,fe.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")),Re=[],Ie=ye[0]==="^",Ce=["["];Ie&&Ce.push("^");for(var Ae=Ie?1:0,ae=ye.length;Ae<ae;++Ae){var ee=ye[Ae];if(/\\[bdsw]/i.test(ee))Ce.push(ee);else{var te=st(ee),H;Ae+2<ae&&ye[Ae+1]==="-"?(H=st(ye[Ae+2]),Ae+=2):H=te,Re.push([te,H]),H<65||te>122||(H<65||te>90||Re.push([Math.max(65,te)|32,Math.min(H,90)|32]),H<97||te>122||Re.push([Math.max(97,te)&~32,Math.min(H,122)&~32]))}}Re.sort(function(de,ge){return de[0]-ge[0]||ge[1]-de[1]});for(var G=[],V=[],Ae=0;Ae<Re.length;++Ae){var Q=Re[Ae];Q[0]<=V[1]+1?V[1]=Math.max(V[1],Q[1]):G.push(V=Q)}for(var Ae=0;Ae<G.length;++Ae){var Q=G[Ae];Ce.push(lt(Q[0])),Q[1]>Q[0]&&(Q[1]+1>Q[0]&&Ce.push("-"),Ce.push(lt(Q[1])))}return Ce.push("]"),Ce.join("")}function ht(fe){for(var ye=fe.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")),Re=ye.length,Ie=[],Ce=0,Ae=0;Ce<Re;++Ce){var ae=ye[Ce];if(ae==="(")++Ae;else if(ae.charAt(0)==="\\"){var ee=+ae.substring(1);ee&&(ee<=Ae?Ie[ee]=-1:ye[Ce]=lt(ee))}}for(var Ce=1;Ce<Ie.length;++Ce)Ie[Ce]===-1&&(Ie[Ce]=++Fe);for(var Ce=0,Ae=0;Ce<Re;++Ce){var ae=ye[Ce];if(ae==="(")++Ae,Ie[Ae]||(ye[Ce]="(?:");else if(ae.charAt(0)==="\\"){var ee=+ae.substring(1);ee&&ee<=Ae&&(ye[Ce]="\\"+Ie[ee])}}for(var Ce=0;Ce<Re;++Ce)ye[Ce]==="^"&&ye[Ce+1]!=="^"&&(ye[Ce]="");if(fe.ignoreCase&&$e)for(var Ce=0;Ce<Re;++Ce){var ae=ye[Ce],te=ae.charAt(0);ae.length>=2&&te==="["?ye[Ce]=nt(ae):te!=="\\"&&(ye[Ce]=ae.replace(/[a-zA-Z]/g,function(V){var Q=V.charCodeAt(0);return"["+String.fromCharCode(Q&~32,Q|32)+"]"}))}return ye.join("")}for(var ut=[],Ve=0,Ue=we.length;Ve<Ue;++Ve){var Be=we[Ve];if(Be.global||Be.multiline)throw new Error(""+Be);ut.push("(?:"+ht(Be)+")")}return new RegExp(ut.join("|"),Qe?"gi":"g")}function Y(we,Fe){var $e=/(?:^|\s)nocode(?:\s|$)/,Qe=[],Ve=0,Ue=[],Be=0;function ct(st){var lt=st.nodeType;if(lt==1){if($e.test(st.className))return;for(var nt=st.firstChild;nt;nt=nt.nextSibling)ct(nt);var ht=st.nodeName.toLowerCase();(ht==="br"||ht==="li")&&(Qe[Be]=`
|
|
`,Ue[Be<<1]=Ve++,Ue[Be++<<1|1]=st)}else if(lt==3||lt==4){var ut=st.nodeValue;ut.length&&(Fe?ut=ut.replace(/\r\n?/g,`
|
|
`):ut=ut.replace(/[ \t\r\n]+/g," "),Qe[Be]=ut,Ue[Be<<1]=Ve,Ve+=ut.length,Ue[Be++<<1|1]=st)}}return ct(we),{sourceCode:Qe.join("").replace(/\n$/,""),spans:Ue}}function $(we,Fe,$e,Qe,Ve){if(!$e)return;var Ue={sourceNode:we,pre:1,langExtension:null,numberLines:null,sourceCode:$e,spans:null,basePos:Fe,decorations:null};Qe(Ue),Ve.push.apply(Ve,Ue.decorations)}var le=/\S/;function be(we){for(var Fe=void 0,$e=we.firstChild;$e;$e=$e.nextSibling){var Qe=$e.nodeType;Fe=Qe===1?Fe?we:$e:Qe===3&&le.test($e.nodeValue)?we:Fe}return Fe===we?void 0:Fe}function ve(we,Fe){var $e={},Qe;(function(){for(var Be=we.concat(Fe),ct=[],st={},lt=0,nt=Be.length;lt<nt;++lt){var ht=Be[lt],ut=ht[3];if(ut)for(var fe=ut.length;--fe>=0;)$e[ut.charAt(fe)]=ht;var ye=ht[1],Re=""+ye;st.hasOwnProperty(Re)||(ct.push(ye),st[Re]=null)}ct.push(/[\0-\uffff]/),Qe=J(ct)})();var Ve=Fe.length,Ue=function(Be){for(var ct=Be.sourceCode,st=Be.basePos,lt=Be.sourceNode,nt=[st,e],ht=0,ut=ct.match(Qe)||[],fe={},ye=0,Re=ut.length;ye<Re;++ye){var Ie=ut[ye],Ce=fe[Ie],Ae=void 0,ae;if(typeof Ce=="string")ae=!1;else{var ee=$e[Ie.charAt(0)];if(ee)Ae=Ie.match(ee[1]),Ce=ee[0];else{for(var te=0;te<Ve;++te)if(ee=Fe[te],Ae=Ie.match(ee[1]),Ae){Ce=ee[0];break}Ae||(Ce=e)}ae=Ce.length>=5&&Ce.substring(0,5)==="lang-",ae&&!(Ae&&typeof Ae[1]=="string")&&(ae=!1,Ce=_),ae||(fe[Ie]=Ce)}var H=ht;if(ht+=Ie.length,!ae)nt.push(st+H,Ce);else{var G=Ae[1],V=Ie.indexOf(G),Q=V+G.length;Ae[2]&&(Q=Ie.length-Ae[2].length,V=Q-G.length);var de=Ce.substring(5);$(lt,st+H,Ie.substring(0,V),Ue,nt),$(lt,st+H+V,G,Z(de,G),nt),$(lt,st+H+Q,Ie.substring(Q),Ue,nt)}}Be.decorations=nt};return Ue}function ke(we){var Fe=[],$e=[];we.tripleQuotedStrings?Fe.push([l,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):we.multiLineStrings?Fe.push([l,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Fe.push([l,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),we.verbatimStrings&&$e.push([l,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Qe=we.hashComments;Qe&&(we.cStyleComments?(Qe>1?Fe.push([c,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Fe.push([c,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),$e.push([l,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Fe.push([c,/^#[^\r\n]*/,null,"#"])),we.cStyleComments&&($e.push([c,/^\/\/[^\r\n]*/,null]),$e.push([c,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ve=we.regexLiterals;if(Ve){var Ue=Ve>1?"":`
|
|
\r`,Be=Ue?".":"[\\S\\s]",ct="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+Be+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+Be+")*(?:\\x5D|$))+/";$e.push(["lang-regex",RegExp("^"+z+"("+ct+")")])}var st=we.types;st&&$e.push([i,st]);var lt=(""+we.keywords).replace(/^ | $/g,"");lt.length&&$e.push([m,new RegExp("^(?:"+lt.replace(/[\s,]+/g,"|")+")\\b"),null]),Fe.push([e,/^\s+/,null,` \r
|
|
\xA0`]);var nt="^.[^\\s\\w.$@'\"`/\\\\]*";return we.regexLiterals&&(nt+="(?!s*/)"),$e.push([n,/^@[a-z_$][a-z_$@0-9]*/i,null],[i,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[e,/^[a-z_$][a-z_$@0-9]*/i,null],[n,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[e,/^\\[\s\S]?/,null],[t,new RegExp(nt),null]),ve(Fe,$e)}var Te=ke({keywords:f,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function xe(we,Fe,$e){for(var Qe=/(?:^|\s)nocode(?:\s|$)/,Ve=/\r\n?|\n/,Ue=we.ownerDocument,Be=Ue.createElement("li");we.firstChild;)Be.appendChild(we.firstChild);var ct=[Be];function st(ye){var Re=ye.nodeType;if(Re==1&&!Qe.test(ye.className))if(ye.nodeName==="br")lt(ye),ye.parentNode&&ye.parentNode.removeChild(ye);else for(var Ie=ye.firstChild;Ie;Ie=Ie.nextSibling)st(Ie);else if((Re==3||Re==4)&&$e){var Ce=ye.nodeValue,Ae=Ce.match(Ve);if(Ae){var ae=Ce.substring(0,Ae.index);ye.nodeValue=ae;var ee=Ce.substring(Ae.index+Ae[0].length);if(ee){var te=ye.parentNode;te.insertBefore(Ue.createTextNode(ee),ye.nextSibling)}lt(ye),ae||ye.parentNode.removeChild(ye)}}}function lt(ye){for(;!ye.nextSibling;)if(ye=ye.parentNode,!ye)return;function Re(Ae,ae){var ee=ae?Ae.cloneNode(!1):Ae,te=Ae.parentNode;if(te){var H=Re(te,1),G=Ae.nextSibling;H.appendChild(ee);for(var V=G;V;V=G)G=V.nextSibling,H.appendChild(V)}return ee}for(var Ie=Re(ye.nextSibling,0),Ce;(Ce=Ie.parentNode)&&Ce.nodeType===1;)Ie=Ce;ct.push(Ie)}for(var nt=0;nt<ct.length;++nt)st(ct[nt]);Fe===(Fe|0)&&ct[0].setAttribute("value",Fe);var ht=Ue.createElement("ol");ht.className="linenums";for(var ut=Math.max(0,Fe-1|0)||0,nt=0,fe=ct.length;nt<fe;++nt)Be=ct[nt],Be.className="L"+(nt+ut)%10,Be.firstChild||Be.appendChild(Ue.createTextNode("\xA0")),ht.appendChild(Be);we.appendChild(ht)}function _e(we){var Fe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Fe=Fe&&+Fe[1]<=8;var $e=/\n/g,Qe=we.sourceCode,Ve=Qe.length,Ue=0,Be=we.spans,ct=Be.length,st=0,lt=we.decorations,nt=lt.length,ht=0;lt[nt]=Ve;var ut,fe;for(fe=ut=0;fe<nt;)lt[fe]!==lt[fe+2]?(lt[ut++]=lt[fe++],lt[ut++]=lt[fe++]):fe+=2;for(nt=ut,fe=ut=0;fe<nt;){for(var ye=lt[fe],Re=lt[fe+1],Ie=fe+2;Ie+2<=nt&<[Ie+1]===Re;)Ie+=2;lt[ut++]=ye,lt[ut++]=Re,fe=Ie}nt=lt.length=ut;var Ce=we.sourceNode,Ae="";Ce&&(Ae=Ce.style.display,Ce.style.display="none");try{for(var ae=null;st<ct;){var ee=Be[st],te=Be[st+2]||Ve,H=lt[ht+2]||Ve,Ie=Math.min(te,H),G=Be[st+1],V;if(G.nodeType!==1&&(V=Qe.substring(Ue,Ie))){Fe&&(V=V.replace($e,"\r")),G.nodeValue=V;var Q=G.ownerDocument,de=Q.createElement("span");de.className=lt[ht+1];var ge=G.parentNode;ge.replaceChild(de,G),de.appendChild(G),Ue<te&&(Be[st+1]=G=Q.createTextNode(Qe.substring(Ie,te)),ge.insertBefore(G,de.nextSibling))}Ue=Ie,Ue>=te&&(st+=2),Ue>=H&&(ht+=2)}}finally{Ce&&(Ce.style.display=Ae)}}var Oe={};function ce(we,Fe){for(var $e=Fe.length;--$e>=0;){var Qe=Fe[$e];Oe.hasOwnProperty(Qe)?M.console&&console.warn("cannot override language handler %s",Qe):Oe[Qe]=we}}function Z(we,Fe){return we&&Oe.hasOwnProperty(we)||(we=/^\s*</.test(Fe)?"default-markup":"default-code"),Oe[we]}ce(Te,["default-code"]),ce(ve([],[[e,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[c,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[t,/^(?:<[%?]|[%?]>)/],["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"]),ce(ve([[e,/^[\s]+/,null,` \r
|
|
`],[k,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[p,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[A,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[t,/^[=<>\/]+/],["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"]),ce(ve([],[[k,/^[\s\S]+/]]),["uq.val"]),ce(ke({keywords:T,hashComments:!0,cStyleComments:!0,types:d}),["c","cc","cpp","cxx","cyc","m"]),ce(ke({keywords:"null,true,false"}),["json"]),ce(ke({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:d}),["cs"]),ce(ke({keywords:O,cStyleComments:!0}),["java"]),ce(ke({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ce(ke({keywords:r,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ce(ke({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ce(ke({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ce(ke({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ce(ke({keywords:E,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ce(ve([],[[l,/^[\s\S]+/]]),["regex"]);function je(we){var Fe=we.langExtension;try{var $e=Y(we.sourceNode,we.pre),Qe=$e.sourceCode;we.sourceCode=Qe,we.spans=$e.spans,we.basePos=0,Z(Fe,Qe)(we),_e(we)}catch(Ve){M.console&&console.log(Ve&&Ve.stack||Ve)}}function at(we,Fe,$e){var Qe=$e||!1,Ve=Fe||null,Ue=document.createElement("div");Ue.innerHTML="<pre>"+we+"</pre>",Ue=Ue.firstChild,Qe&&xe(Ue,Qe,!0);var Be={langExtension:Ve,numberLines:Qe,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return je(Be),Ue.innerHTML}function rt(we,Fe){var $e=Fe||document.body,Qe=$e.ownerDocument||document;function Ve(ee){return $e.getElementsByTagName(ee)}for(var Ue=[Ve("pre"),Ve("code"),Ve("xmp")],Be=[],ct=0;ct<Ue.length;++ct)for(var st=0,lt=Ue[ct].length;st<lt;++st)Be.push(Ue[ct][st]);Ue=null;var nt=Date;nt.now||(nt={now:function(){return+new Date}});var ht=0,ut=/\blang(?:uage)?-([\w.]+)(?!\S)/,fe=/\bprettyprint\b/,ye=/\bprettyprinted\b/,Re=/pre|xmp/i,Ie=/^code$/i,Ce=/^(?:pre|code|xmp)$/i,Ae={};function ae(){for(var ee=M.PR_SHOULD_USE_CONTINUATION?nt.now()+250:Infinity;ht<Be.length&&nt.now()<ee;ht++){for(var te=Be[ht],H=Ae,G=te;G=G.previousSibling;){var V=G.nodeType,Q=(V===7||V===8)&&G.nodeValue;if(Q?!/^\??prettify\b/.test(Q):V!==3||/\S/.test(G.nodeValue))break;if(Q){H={},Q.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,gt,Bt){H[gt]=Bt});break}}var de=te.className;if((H!==Ae||fe.test(de))&&!ye.test(de)){for(var ge=!1,Me=te.parentNode;Me;Me=Me.parentNode){var et=Me.tagName;if(Ce.test(et)&&Me.className&&fe.test(Me.className)){ge=!0;break}}if(!ge){te.className+=" prettyprinted";var dt=H.lang;if(!dt){dt=de.match(ut);var qe;!dt&&(qe=be(te))&&Ie.test(qe.tagName)&&(dt=qe.className.match(ut)),dt&&(dt=dt[1])}var Ct;if(Re.test(te.tagName))Ct=1;else{var _t=te.currentStyle,ot=Qe.defaultView,It=_t?_t.whiteSpace:ot&&ot.getComputedStyle?ot.getComputedStyle(te,null).getPropertyValue("white-space"):0;Ct=It&&It.substring(0,3)==="pre"}var At=H.linenums;(At=At==="true"||+At)||(At=de.match(/\blinenums\b(?::(\d+))?/),At=At?At[1]&&At[1].length?+At[1]:!0:!1),At&&xe(te,At,Ct);var Ot={langExtension:dt,sourceNode:te,numberLines:At,pre:Ct,sourceCode:null,basePos:null,spans:null,decorations:null};je(Ot)}}}ht<Be.length?M.setTimeout(ae,250):typeof we=="function"&&we()}ae()}var Ke=M.PR={createSimpleLexer:ve,registerLangHandler:ce,sourceDecorator:ke,PR_ATTRIB_NAME:A,PR_ATTRIB_VALUE:k,PR_COMMENT:c,PR_DECLARATION:g,PR_KEYWORD:m,PR_LITERAL:n,PR_NOCODE:F,PR_PLAIN:e,PR_PUNCTUATION:t,PR_SOURCE:_,PR_STRING:l,PR_TAG:p,PR_TYPE:i,prettyPrintOne:S?M.prettyPrintOne=at:x=at,prettyPrint:U=S?M.prettyPrint=rt:U=rt},He=M.define;typeof He=="function"&&He.amd&&He("google-code-prettify",[],function(){return Ke})})()},WaYH:function(ft,Ge,W){"use strict";var oe=W("rePB"),N=W("Ff2n"),S=W("VTBJ"),I=W("1OyB"),v=W("vuIU"),x=W("JX7q"),U=W("Ji7U"),M=W("LK+K"),R=W("q1tI"),w=W("TSYQ"),b=W.n(w),T=W("sboe"),O=W("OZM5"),C=function(m){var c=m.prefixCls,i=m.level,n=m.isStart,t=m.isEnd;if(!i)return null;for(var e="".concat(c,"-indent-unit"),p=[],g=0;g<i;g+=1){var _;p.push(R.createElement("span",{key:g,className:b()(e,(_={},Object(oe.a)(_,"".concat(e,"-start"),n[g+1]),Object(oe.a)(_,"".concat(e,"-end"),t[g+1]),Object(oe.a)(_,"".concat(e,"-end-first-level"),!g&&t[0]),_))}))}return R.createElement("span",{"aria-hidden":"true",className:"".concat(c,"-indent")},p)},E=C,y=W("815F"),h="open",r="close",o="---",s=function(l){Object(U.a)(c,l);var m=Object(M.a)(c);function c(){var i;return Object(I.a)(this,c),i=m.apply(this,arguments),i.state={dragNodeHighlight:!1},i.onSelectorClick=function(n){var t=i.props.context.onNodeClick;t(n,Object(y.b)(i.props)),i.isSelectable()?i.onSelect(n):i.onCheck(n)},i.onSelectorDoubleClick=function(n){var t=i.props.context.onNodeDoubleClick;t(n,Object(y.b)(i.props))},i.onSelect=function(n){if(i.isDisabled())return;var t=i.props.context.onNodeSelect;n.preventDefault(),t(n,Object(y.b)(i.props))},i.onCheck=function(n){if(i.isDisabled())return;var t=i.props,e=t.disableCheckbox,p=t.checked,g=i.props.context.onNodeCheck;if(!i.isCheckable()||e)return;n.preventDefault();var _=!p;g(n,Object(y.b)(i.props),_)},i.onMouseEnter=function(n){var t=i.props.context.onNodeMouseEnter;t(n,Object(y.b)(i.props))},i.onMouseLeave=function(n){var t=i.props.context.onNodeMouseLeave;t(n,Object(y.b)(i.props))},i.onContextMenu=function(n){var t=i.props.context.onNodeContextMenu;t(n,Object(y.b)(i.props))},i.onDragStart=function(n){var t=i.props.context.onNodeDragStart;n.stopPropagation(),i.setState({dragNodeHighlight:!0}),t(n,Object(x.a)(i));try{n.dataTransfer.setData("text/plain","")}catch(e){}},i.onDragEnter=function(n){var t=i.props.context.onNodeDragEnter;n.preventDefault(),n.stopPropagation(),t(n,Object(x.a)(i))},i.onDragOver=function(n){var t=i.props.context.onNodeDragOver;n.preventDefault(),n.stopPropagation(),t(n,Object(x.a)(i))},i.onDragLeave=function(n){var t=i.props.context.onNodeDragLeave;n.stopPropagation(),t(n,Object(x.a)(i))},i.onDragEnd=function(n){var t=i.props.context.onNodeDragEnd;n.stopPropagation(),i.setState({dragNodeHighlight:!1}),t(n,Object(x.a)(i))},i.onDrop=function(n){var t=i.props.context.onNodeDrop;n.preventDefault(),n.stopPropagation(),i.setState({dragNodeHighlight:!1}),t(n,Object(x.a)(i))},i.onExpand=function(n){var t=i.props.context.onNodeExpand;t(n,Object(y.b)(i.props))},i.setSelectHandle=function(n){i.selectHandle=n},i.getNodeState=function(){var n=i.props.expanded;return i.isLeaf()?null:n?h:r},i.hasChildren=function(){var n=i.props.eventKey,t=i.props.context.keyEntities,e=t[n]||{},p=e.children;return!!(p||[]).length},i.isLeaf=function(){var n=i.props,t=n.isLeaf,e=n.loaded,p=i.props.context.loadData,g=i.hasChildren();return t===!1?!1:t||!p&&!g||p&&e&&!g},i.isDisabled=function(){var n=i.props.disabled,t=i.props.context.disabled;return!!(t||n)},i.isCheckable=function(){var n=i.props.checkable,t=i.props.context.checkable;return!t||n===!1?!1:t},i.syncLoadData=function(n){var t=n.expanded,e=n.loading,p=n.loaded,g=i.props.context,_=g.loadData,A=g.onNodeLoad;if(e)return;_&&t&&!i.isLeaf()&&(!i.hasChildren()&&!p&&A(Object(y.b)(i.props)))},i.renderSwitcher=function(){var n=i.props,t=n.expanded,e=n.switcherIcon,p=i.props.context,g=p.prefixCls,_=p.switcherIcon,A=e||_;if(i.isLeaf())return R.createElement("span",{className:b()("".concat(g,"-switcher"),"".concat(g,"-switcher-noop"))},typeof A=="function"?A(Object(S.a)(Object(S.a)({},i.props),{},{isLeaf:!0})):A);var k=b()("".concat(g,"-switcher"),"".concat(g,"-switcher_").concat(t?h:r));return R.createElement("span",{onClick:i.onExpand,className:k},typeof A=="function"?A(Object(S.a)(Object(S.a)({},i.props),{},{isLeaf:!1})):A)},i.renderCheckbox=function(){var n=i.props,t=n.checked,e=n.halfChecked,p=n.disableCheckbox,g=i.props.context.prefixCls,_=i.isDisabled(),A=i.isCheckable();if(!A)return null;var k=typeof A!="boolean"?A:null;return R.createElement("span",{className:b()("".concat(g,"-checkbox"),t&&"".concat(g,"-checkbox-checked"),!t&&e&&"".concat(g,"-checkbox-indeterminate"),(_||p)&&"".concat(g,"-checkbox-disabled")),onClick:i.onCheck},k)},i.renderIcon=function(){var n=i.props.loading,t=i.props.context.prefixCls;return R.createElement("span",{className:b()("".concat(t,"-iconEle"),"".concat(t,"-icon__").concat(i.getNodeState()||"docu"),n&&"".concat(t,"-icon_loading"))})},i.renderSelector=function(){var n=i.state.dragNodeHighlight,t=i.props,e=t.title,p=t.selected,g=t.icon,_=t.loading,A=t.data,k=i.props.context,F=k.prefixCls,z=k.showIcon,J=k.icon,Y=k.draggable,$=k.loadData,le=k.titleRender,be=i.isDisabled(),ve="".concat(F,"-node-content-wrapper"),ke;if(z){var Te=g||J;ke=Te?R.createElement("span",{className:b()("".concat(F,"-iconEle"),"".concat(F,"-icon__customize"))},typeof Te=="function"?Te(i.props):Te):i.renderIcon()}else $&&_&&(ke=i.renderIcon());var xe;typeof e=="function"?xe=e(A):le?xe=le(A):xe=e;var _e=R.createElement("span",{className:"".concat(F,"-title")},xe);return R.createElement("span",{ref:i.setSelectHandle,title:typeof e=="string"?e:"",className:b()("".concat(ve),"".concat(ve,"-").concat(i.getNodeState()||"normal"),!be&&(p||n)&&"".concat(F,"-node-selected"),!be&&Y&&"draggable"),draggable:!be&&Y||void 0,"aria-grabbed":!be&&Y||void 0,onMouseEnter:i.onMouseEnter,onMouseLeave:i.onMouseLeave,onContextMenu:i.onContextMenu,onClick:i.onSelectorClick,onDoubleClick:i.onSelectorDoubleClick,onDragStart:Y?i.onDragStart:void 0},ke,_e)},i}return Object(v.a)(c,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var n=this.props.selectable,t=this.props.context.selectable;return typeof n=="boolean"?n:t}},{key:"render",value:function(){var n,t=this.props,e=t.eventKey,p=t.className,g=t.style,_=t.dragOver,A=t.dragOverGapTop,k=t.dragOverGapBottom,F=t.isLeaf,z=t.isStart,J=t.isEnd,Y=t.expanded,$=t.selected,le=t.checked,be=t.halfChecked,ve=t.loading,ke=t.domRef,Te=t.active,xe=t.onMouseMove,_e=Object(N.a)(t,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),Oe=this.props.context,ce=Oe.prefixCls,Z=Oe.filterTreeNode,je=Oe.draggable,at=Oe.keyEntities,rt=this.isDisabled(),Ke=Object(O.f)(_e),He=at[e]||{},we=He.level,Fe=J[J.length-1];return R.createElement("div",Object.assign({ref:ke,className:b()(p,"".concat(ce,"-treenode"),(n={},Object(oe.a)(n,"".concat(ce,"-treenode-disabled"),rt),Object(oe.a)(n,"".concat(ce,"-treenode-switcher-").concat(Y?"open":"close"),!F),Object(oe.a)(n,"".concat(ce,"-treenode-checkbox-checked"),le),Object(oe.a)(n,"".concat(ce,"-treenode-checkbox-indeterminate"),be),Object(oe.a)(n,"".concat(ce,"-treenode-selected"),$),Object(oe.a)(n,"".concat(ce,"-treenode-loading"),ve),Object(oe.a)(n,"".concat(ce,"-treenode-active"),Te),Object(oe.a)(n,"".concat(ce,"-treenode-leaf-last"),Fe),Object(oe.a)(n,"drag-over",!rt&&_),Object(oe.a)(n,"drag-over-gap-top",!rt&&A),Object(oe.a)(n,"drag-over-gap-bottom",!rt&&k),Object(oe.a)(n,"filter-node",Z&&Z(Object(y.b)(this.props))),n)),style:g,onDragEnter:je?this.onDragEnter:void 0,onDragOver:je?this.onDragOver:void 0,onDragLeave:je?this.onDragLeave:void 0,onDrop:je?this.onDrop:void 0,onDragEnd:je?this.onDragEnd:void 0,onMouseMove:xe},Ke),R.createElement(E,{prefixCls:ce,level:we,isStart:z,isEnd:J}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),c}(R.Component),f=function(m){return R.createElement(T.a.Consumer,null,function(c){return R.createElement(s,Object.assign({},m,{context:c}))})};f.displayName="TreeNode",f.defaultProps={title:o},f.isTreeNode=1;var d=Ge.a=f},Y1PL:function(ft,Ge,W){"use strict";W.r(Ge),W.d(Ge,"ResizableTextArea",function(){return be});var oe=W("wx14"),N=W("1OyB"),S=W("vuIU"),I=W("Ji7U"),v=W("LK+K"),x=W("q1tI"),U=W("VTBJ"),M=W("rePB"),R=W("Zm9Q"),w=W("Kwbf"),b=W("c+Xe"),T=W("m+aA"),O=W("bdgK"),C=new Map;function E(Te){Te.forEach(function(xe){var _e,Oe=xe.target;(_e=C.get(Oe))===null||_e===void 0||_e.forEach(function(ce){return ce(Oe)})})}var y=new O.default(E),h=null,r=null;function o(Te,xe){C.has(Te)||(C.set(Te,new Set),y.observe(Te)),C.get(Te).add(xe)}function s(Te,xe){C.has(Te)&&(C.get(Te).delete(xe),C.get(Te).size||(y.unobserve(Te),C.delete(Te)))}var f=function(Te){Object(I.a)(_e,Te);var xe=Object(v.a)(_e);function _e(){return Object(N.a)(this,_e),xe.apply(this,arguments)}return Object(S.a)(_e,[{key:"render",value:function(){return this.props.children}}]),_e}(x.Component),d=x.createContext(null);function l(Te){var xe=Te.children,_e=Te.onBatchResize,Oe=x.useRef(0),ce=x.useRef([]),Z=x.useContext(d),je=x.useCallback(function(at,rt,Ke){Oe.current+=1;var He=Oe.current;ce.current.push({size:at,element:rt,data:Ke}),Promise.resolve().then(function(){He===Oe.current&&(_e==null||_e(ce.current),ce.current=[])}),Z==null||Z(at,rt,Ke)},[_e,Z]);return x.createElement(d.Provider,{value:je},xe)}function m(Te){var xe=Te.children,_e=Te.disabled,Oe=x.useRef(null),ce=x.useRef(null),Z=x.useContext(d),je=x.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),at=x.isValidElement(xe)&&Object(b.c)(xe),rt=at?xe.ref:null,Ke=x.useMemo(function(){return Object(b.a)(rt,Oe)},[rt,Oe]),He=x.useRef(Te);He.current=Te;var we=x.useCallback(function(Fe){var $e=He.current,Qe=$e.onResize,Ve=$e.data,Ue=Fe.getBoundingClientRect(),Be=Ue.width,ct=Ue.height,st=Fe.offsetWidth,lt=Fe.offsetHeight,nt=Math.floor(Be),ht=Math.floor(ct);if(je.current.width!==nt||je.current.height!==ht||je.current.offsetWidth!==st||je.current.offsetHeight!==lt){var ut={width:nt,height:ht,offsetWidth:st,offsetHeight:lt};je.current=ut;var fe=st===Math.round(Be)?Be:st,ye=lt===Math.round(ct)?ct:lt,Re=Object(U.a)(Object(U.a)({},ut),{},{offsetWidth:fe,offsetHeight:ye});Z==null||Z(Re,Fe,Ve),Qe&&Promise.resolve().then(function(){Qe(Re,Fe)})}},[]);return x.useEffect(function(){var Fe=Object(T.a)(Oe.current)||Object(T.a)(ce.current);return Fe&&!_e&&o(Fe,we),function(){return s(Fe,we)}},[Oe.current,_e]),x.createElement(f,{ref:ce},at?x.cloneElement(xe,{ref:Ke}):xe)}var c="rc-observer-key";function i(Te){var xe=Te.children,_e=Object(R.a)(xe);return _e.map(function(Oe,ce){var Z=(Oe==null?void 0:Oe.key)||"".concat(c,"-").concat(ce);return x.createElement(m,Object(oe.a)({},Te,{key:Z}),Oe)})}i.Collection=l;var n=i,t=W("bT9E"),e=W("TSYQ"),p=W.n(e),g=`
|
|
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
|
|
`,_=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],A={},k;function F(Te){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_e=Te.getAttribute("id")||Te.getAttribute("data-reactid")||Te.getAttribute("name");if(xe&&A[_e])return A[_e];var Oe=window.getComputedStyle(Te),ce=Oe.getPropertyValue("box-sizing")||Oe.getPropertyValue("-moz-box-sizing")||Oe.getPropertyValue("-webkit-box-sizing"),Z=parseFloat(Oe.getPropertyValue("padding-bottom"))+parseFloat(Oe.getPropertyValue("padding-top")),je=parseFloat(Oe.getPropertyValue("border-bottom-width"))+parseFloat(Oe.getPropertyValue("border-top-width")),at=_.map(function(Ke){return"".concat(Ke,":").concat(Oe.getPropertyValue(Ke))}).join(";"),rt={sizingStyle:at,paddingSize:Z,borderSize:je,boxSizing:ce};return xe&&_e&&(A[_e]=rt),rt}function z(Te){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Oe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;k||(k=document.createElement("textarea"),k.setAttribute("tab-index","-1"),k.setAttribute("aria-hidden","true"),document.body.appendChild(k)),Te.getAttribute("wrap")?k.setAttribute("wrap",Te.getAttribute("wrap")):k.removeAttribute("wrap");var ce=F(Te,xe),Z=ce.paddingSize,je=ce.borderSize,at=ce.boxSizing,rt=ce.sizingStyle;k.setAttribute("style","".concat(rt,";").concat(g)),k.value=Te.value||Te.placeholder||"";var Ke=Number.MIN_SAFE_INTEGER,He=Number.MAX_SAFE_INTEGER,we=k.scrollHeight,Fe;if(at==="border-box"?we+=je:at==="content-box"&&(we-=Z),_e!==null||Oe!==null){k.value=" ";var $e=k.scrollHeight-Z;_e!==null&&(Ke=$e*_e,at==="border-box"&&(Ke=Ke+Z+je),we=Math.max(Ke,we)),Oe!==null&&(He=$e*Oe,at==="border-box"&&(He=He+Z+je),Fe=we>He?"":"hidden",we=Math.min(He,we))}return{height:we,minHeight:Ke,maxHeight:He,overflowY:Fe,resize:"none"}}var J=W("Gytx"),Y=W.n(J),$;(function(Te){Te[Te.NONE=0]="NONE",Te[Te.RESIZING=1]="RESIZING",Te[Te.RESIZED=2]="RESIZED"})($||($={}));var le=function(Te){Object(I.a)(_e,Te);var xe=Object(v.a)(_e);function _e(Oe){var ce;return Object(N.a)(this,_e),ce=xe.call(this,Oe),ce.nextFrameActionId=void 0,ce.resizeFrameId=void 0,ce.textArea=void 0,ce.saveTextArea=function(Z){ce.textArea=Z},ce.handleResize=function(Z){var je=ce.state.resizeStatus,at=ce.props,rt=at.autoSize,Ke=at.onResize;if(je!==$.NONE)return;typeof Ke=="function"&&Ke(Z),rt&&ce.resizeOnNextFrame()},ce.resizeOnNextFrame=function(){cancelAnimationFrame(ce.nextFrameActionId),ce.nextFrameActionId=requestAnimationFrame(ce.resizeTextarea)},ce.resizeTextarea=function(){var Z=ce.props.autoSize;if(!Z||!ce.textArea)return;var je=Z.minRows,at=Z.maxRows,rt=z(ce.textArea,!1,je,at);ce.setState({textareaStyles:rt,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(ce.resizeFrameId),ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:$.RESIZED},function(){ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:$.NONE}),ce.fixFirefoxAutoScroll()})})})})},ce.renderTextArea=function(){var Z=ce.props,je=Z.prefixCls,at=je===void 0?"rc-textarea":je,rt=Z.autoSize,Ke=Z.onResize,He=Z.className,we=Z.disabled,Fe=ce.state,$e=Fe.textareaStyles,Qe=Fe.resizeStatus,Ve=Object(t.a)(ce.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=p()(at,He,Object(M.a)({},"".concat(at,"-disabled"),we));"value"in Ve&&(Ve.value=Ve.value||"");var Be=Object(U.a)(Object(U.a)(Object(U.a)({},ce.props.style),$e),Qe===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return x.createElement(n,{onResize:ce.handleResize,disabled:!(rt||Ke)},x.createElement("textarea",Object(oe.a)({},Ve,{className:Ue,style:Be,ref:ce.saveTextArea})))},ce.state={textareaStyles:{},resizeStatus:$.NONE},ce}return Object(S.a)(_e,[{key:"componentDidUpdate",value:function(ce){(ce.value!==this.props.value||!Y()(ce.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 ce=this.textArea.selectionStart,Z=this.textArea.selectionEnd;this.textArea.setSelectionRange(ce,Z)}}catch(je){}}},{key:"render",value:function(){return this.renderTextArea()}}]),_e}(x.Component),be=le,ve=function(Te){Object(I.a)(_e,Te);var xe=Object(v.a)(_e);function _e(Oe){var ce;Object(N.a)(this,_e),ce=xe.call(this,Oe),ce.resizableTextArea=void 0,ce.focus=function(){ce.resizableTextArea.textArea.focus()},ce.saveTextArea=function(je){ce.resizableTextArea=je},ce.handleChange=function(je){var at=ce.props.onChange;ce.setValue(je.target.value,function(){ce.resizableTextArea.resizeTextarea()}),at&&at(je)},ce.handleKeyDown=function(je){var at=ce.props,rt=at.onPressEnter,Ke=at.onKeyDown;je.keyCode===13&&rt&&rt(je),Ke&&Ke(je)};var Z=typeof Oe.value=="undefined"||Oe.value===null?Oe.defaultValue:Oe.value;return ce.state={value:Z},ce}return Object(S.a)(_e,[{key:"setValue",value:function(ce,Z){"value"in this.props||this.setState({value:ce},Z)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return x.createElement(be,Object(oe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ce){return"value"in ce?{value:ce.value}:null}}]),_e}(x.Component),ke=Ge.default=ve},ZW9T:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return f});var oe=W("k1fw"),N=W("miYZ"),S=W("tsqr"),I=W("rAM+"),v=W("tJVT"),x=W("PpiC"),U=W("q1tI"),M=W.n(U),R=W("bdgK");function w(d,l,m,c,i){var n=l.getWordUntilPosition(m),t={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:n.startColumn,endColumn:n.endColumn},e=c.map(function(p){return{label:p,kind:d.languages.CompletionItemKind.Keyword,insertText:p,insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:t}});return i.map(function(p){e.push(Object(oe.a)(Object(oe.a)({},p),{},{range:t}))}),e}var b=function(d){var l={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(t,e){var p=w(d,t,e,m,[l]);return{suggestions:p}}});var c=["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(t,e){var p=[{label:"print",kind:d.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet}],g=w(d,t,e,c,p);return{suggestions:g}}});var i=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];d.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(t,e){var p=[l,{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}],g=w(d,t,e,i,p);return{suggestions:g}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=W("LvDl");function C(d){return/^\d+$/.test(d)?"".concat(d,"px"):d}function E(){}var y=!1,h={"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 r(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],l=d;if(Array.isArray(d)){for(var m=0;m<d.length;m++){var c=h[d[m]];if(c)return c}return l[0]}return h[l]||l}var o=null,s=Ge.b=function(d){var l=d.width,m=l===void 0?"100%":l,c=d.height,i=c===void 0?"100%":c,n=d.value,t=d.language,e=t===void 0?"javascript":t,p=d.style,g=p===void 0?{}:p,_=d.options,A=_===void 0?{}:_,k=d.overrideServices,F=k===void 0?{}:k,z=d.theme,J=z===void 0?"vs-dark":z,Y=d.onEditBlur,$=d.onSave,le=d.autoHeight,be=le===void 0?!1:le,ve=d.forbidCopy,ke=ve===void 0?!1:ve,Te=d.onChange,xe=Te===void 0?E:Te,_e=d.editorDidMount,Oe=_e===void 0?E:_e,ce=d.onFocus,Z=ce===void 0?E:ce,je=d.filename,at=je===void 0?"educoder.txt":je,rt=Object(x.a)(d,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Ke=Object(U.useRef)(),He=Object(U.useRef)({}),we=Object(U.useRef)(),Fe=Object(U.useRef)(!1),$e=Object(U.useRef)(),Qe=Object(U.useState)(!1),Ve=Object(v.a)(Qe,2),Ue=Ve[0],Be=Ve[1];function ct(){var V;return Ke.current&&(V=new R.default(function(Q){var de=Object(I.a)(Q),ge;try{for(de.s();!(ge=de.n()).done;){var Me=ge.value;(Me.target.offsetHeight>0||Me.target.offsetWidth>0)&&He.current.instance.layout()}}catch(et){de.e(et)}finally{de.f()}}),V.observe(Ke.current)),V}function st(){S.b.warn(decodeURIComponent(T))}var lt=function(){var Q=He.current.instance;if(n!=null&&Q&&Ue){var de=Q.getModel();de&&n!==de.getValue()&&(y=!0,de.setValue(n),Q.layout(),y=!1)}};Object(U.useEffect)(function(){we.current&&clearTimeout(we.current),we.current=setTimeout(function(){lt()},500)},[n,Ue,He.current]);function nt(){var V=He.current.instance;if(V){var Q=V.getSelection(),de=He.current.pastePos||{},ge=new o.Range(de.startLineNumber||Q.endLineNumber,de.startColumn||Q.endColumn,de.endLineNumber||Q.endLineNumber,de.endColumn||Q.endColumn);setTimeout(function(){V.executeEdits("",[{range:ge,text:""}])},300)}}function ht(V){(window.navigator.platform.match("Mac")?V.metaKey:V.ctrlKey)&&V.keyCode==83&&(V.preventDefault(),$())}var ut=function(){if(be&&He.current.instance){var Q=He.current.instance.getContentHeight();H(Q<i?i:Q)}else H(i)};function fe(V){var Q=document.createEvent("MouseEvents");Q.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),V.dispatchEvent(Q)}function ye(V,Q){var de=window.URL||window.webkitURL||window,ge=new Blob([Q]),Me=document.createElementNS("http://www.w3.org/1999/xhtml","a");Me.href=de.createObjectURL(ge),Me.download=V,fe(Me)}Object(U.useEffect)(function(){ut()},[ut]),Object(U.useEffect)(function(){Ke.current&&!Ue&&W.e(27).then(W.t.bind(null,"M/lh",7)).then(function(V){try{o=V,He.current.instance=o.editor.create(Ke.current,{value:n,language:r(e),theme:J,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},F);var Q=He.current.instance;if(Oe(Q,o),setTimeout(function(){ut(),He.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ye(at||"educoder.txt",Q.getValue())}})},500),He.current.subscription=Q.onDidChangeModelContent(function(ge){Fe.current?clearTimeout($e.current):(ut(),xe(Q.getValue(),ge)),$e.current=setTimeout(function(){Fe.current=!1},500)}),window.Monaco||b(o),ke&&(Q.addCommand(o.KeyMod.CtrlCmd|o.KeyMod.Shift|o.KeyCode.KEY_V,function(){return st(),null}),Q.addCommand(o.KeyMod.CtrlCmd|o.KeyCode.KEY_C,function(){return st(),null})),window.Monaco=o,Y&&Q.onDidBlurEditorWidget(function(){Y(Q.getValue())}),Z&&Q.onDidFocusEditorText(function(){Z(Q.getValue())}),ke){Q.addCommand(o.KeyMod.CtrlCmd|o.KeyCode.KEY_V,function(){return st(),null}),Q.onDidPaste(function(ge){He.current.pastePos=ge});try{window.addEventListener("paste",nt)}catch(ge){}}var de=ct();return Be(!0),function(){var ge=He.current.instance;ge.dispose();var Me=ge.getModel();Me&&Me.dispose(),He.current.subscription&&He.current.subscription.dispose(),ke&&window.removeEventListener("paste",nt),de.unobserve(Ke.current)}}catch(ge){}})},[]),Object(U.useEffect)(function(){var V=He.current.instance;if(V&&Ue)return document.addEventListener("keydown",ht,!1),function(){document.removeEventListener("keydown",ht)}},[$,Ue]),Object(U.useEffect)(function(){var V=He.current.instance;if(V&&Ue){var Q=r(e);o.editor.setModelLanguage(V.getModel(),Q),console.log("language:",e,V.getModel(),Q)}},[e,Ue]),Object(U.useEffect)(function(){var V=He.current.instance;V&&Ue&&o.editor.setTheme(J)},[J,Ue]),Object(U.useEffect)(function(){var V=He.current.instance;V&&Ue&&(V.updateOptions(Object(oe.a)({},A)),setTimeout(function(){V.getModel().updateOptions(Object(oe.a)({},A))},200))},[JSON.stringify(A),Ue]),Object(U.useEffect)(function(){var V=He.current.instance;V&&Ue&&V.layout()},[m,i,Ue]);var Re=Object(U.useState)(C(m)),Ie=Object(v.a)(Re,2),Ce=Ie[0],Ae=Ie[1],ae=Object(U.useState)(C(i)),ee=Object(v.a)(ae,2),te=ee[0],H=ee[1],G=Object(oe.a)(Object(oe.a)({},g),{},{width:Ce,height:te});return M.a.createElement("div",{className:"my-monaco-editor",ref:Ke,style:G})};function f(d){var l=d.width,m=l===void 0?"100%":l,c=d.height,i=c===void 0?"100%":c,n=d.original,t=d.modified,e=d.language,p=d.options,g=p===void 0?{}:p,_=Object(U.useRef)(),A=Object(U.useState)(null),k=Object(v.a)(A,2),F=k[0],z=k[1];function J(be){var ve;return _.current&&(ve=new R.default(function(ke){var Te=Object(I.a)(ke),xe;try{for(Te.s();!(xe=Te.n()).done;){var _e=xe.value;(_e.target.offsetHeight>0||_e.target.offsetWidth>0)&&be.layout()}}catch(Oe){Te.e(Oe)}finally{Te.f()}}),ve.observe(_.current)),ve}Object(U.useEffect)(function(){_.current&&W.e(27).then(W.t.bind(null,"M/lh",7)).then(function(be){o=be;var ve=o.editor.createDiffEditor(_.current,Object(oe.a)(Object(oe.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},g),{},{wordWrap:!0}));z(ve);var ke=J(ve);return function(){ve.dispose();var Te=ve.getModel();Te&&Te.dispose(),ke.unobserve(_.current)}})},[]),Object(U.useEffect)(function(){F&&F.setModel({original:o.editor.createModel(n,e),modified:o.editor.createModel(t,e)})},[n,t,e,F]);var Y=C(m),$=C(i),le={width:Y,height:$};return M.a.createElement("div",{className:"my-diff-editor",ref:_,style:le})}},bT9E:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return N});var oe=W("VTBJ");function N(S,I){var v=Object(oe.a)({},S);return Array.isArray(I)&&I.forEach(function(x){delete v[x]}),v}},biw7:function(ft,Ge,W){"use strict";var oe=W("q1tI"),N=W.n(oe),S=oe.createContext(null);Ge.a=S},eZjB:function(ft,Ge,W){ft.exports=W.p+"static/a1.80c95864.svg"},fyJ8:function(ft,Ge,W){"use strict";var oe=W("rePB"),N=W("VTBJ"),S=W("Ff2n"),I=W("U8pU"),v=W("q1tI"),x=W.n(v),U=W("TSYQ"),M=W.n(U),R=W("c+Xe"),w=W("sR1s");function b(y){return y&&Object(I.a)(y)==="object"&&!Array.isArray(y)&&!v.isValidElement(y)}function T(y){return typeof y=="string"?!0:Object(R.c)(y)}function O(y,h){var r,o=y.prefixCls,s=y.className,f=y.record,d=y.index,l=y.dataIndex,m=y.render,c=y.children,i=y.component,n=i===void 0?"td":i,t=y.colSpan,e=y.rowSpan,p=y.fixLeft,g=y.fixRight,_=y.firstFixLeft,A=y.lastFixLeft,k=y.firstFixRight,F=y.lastFixRight,z=y.appendNode,J=y.additionalProps,Y=J===void 0?{}:J,$=y.ellipsis,le=y.align,be=y.rowType,ve=y.isSticky,ke="".concat(o,"-cell"),Te,xe;if(c)xe=c;else{var _e=Object(w.b)(f,l);if(xe=_e,m){var Oe=m(_e,f,d);b(Oe)?(xe=Oe.children,Te=Oe.props):xe=Oe}}Object(I.a)(xe)==="object"&&!Array.isArray(xe)&&!v.isValidElement(xe)&&(xe=null),$&&(A||k)&&(xe=v.createElement("span",{className:"".concat(ke,"-content")},xe));var ce=Te||{},Z=ce.colSpan,je=ce.rowSpan,at=ce.style,rt=ce.className,Ke=Object(S.a)(ce,["colSpan","rowSpan","style","className"]),He=Z!==void 0?Z:t,we=je!==void 0?je:e;if(He===0||we===0)return null;var Fe={},$e=typeof p=="number",Qe=typeof g=="number";$e&&(Fe.position="sticky",Fe.left=p),Qe&&(Fe.position="sticky",Fe.right=g);var Ve={};le&&(Ve.textAlign=le);var Ue,Be=$===!0?{showTitle:!0}:$;Be&&(Be.showTitle||be==="header")&&(typeof xe=="string"||typeof xe=="number"?Ue=xe.toString():v.isValidElement(xe)&&typeof xe.props.children=="string"&&(Ue=xe.props.children));var ct=Object(N.a)(Object(N.a)(Object(N.a)({title:Ue},Ke),Y),{},{colSpan:He&&He!==1?He:null,rowSpan:we&&we!==1?we:null,className:M()(ke,s,(r={},Object(oe.a)(r,"".concat(ke,"-fix-left"),$e),Object(oe.a)(r,"".concat(ke,"-fix-left-first"),_),Object(oe.a)(r,"".concat(ke,"-fix-left-last"),A),Object(oe.a)(r,"".concat(ke,"-fix-right"),Qe),Object(oe.a)(r,"".concat(ke,"-fix-right-first"),k),Object(oe.a)(r,"".concat(ke,"-fix-right-last"),F),Object(oe.a)(r,"".concat(ke,"-ellipsis"),$),Object(oe.a)(r,"".concat(ke,"-with-append"),z),Object(oe.a)(r,"".concat(ke,"-fix-sticky"),($e||Qe)&&ve),r),Y.className,rt),style:Object(N.a)(Object(N.a)(Object(N.a)(Object(N.a)({},Y.style),Ve),Fe),at),ref:T(n)?h:null});return v.createElement(n,Object.assign({},ct),z,xe)}var C=v.forwardRef(O);C.displayName="Cell";var E=v.memo(C,function(y,h){return h.shouldCellUpdate?!h.shouldCellUpdate(h.record,y.record):!1});Ge.a=E},hW8S:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return I}),W.d(Ge,"c",function(){return v}),W.d(Ge,"b",function(){return x});var oe=W("VTBJ"),N=W("Ff2n"),S=W("Kwbf"),I="RC_TABLE_INTERNAL_COL_DEFINE";function v(U){var M=U.expandable,R=Object(N.a)(U,["expandable"]);return"expandable"in U?Object(oe.a)(Object(oe.a)({},R),M):R}function x(U){return Object.keys(U).reduce(function(M,R){return(R.substr(0,5)==="data-"||R.substr(0,5)==="aria-")&&(M[R]=U[R]),M},{})}},k3GJ:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return pi});var oe=W("rePB"),N=W("ODXe"),S=W("Ff2n"),I=W("VTBJ"),v=W("q1tI"),x=W("TSYQ"),U=W.n(x),M=W("Zm9Q"),R=W("6cGi"),w=W("KQm4"),b=W("xEkU"),T=W.n(b),O=W("t23M");function C(q){var ue=Object(v.useRef)(),pe=Object(v.useRef)(!1);function ne(){for(var j=arguments.length,X=new Array(j),K=0;K<j;K++)X[K]=arguments[K];pe.current||(T.a.cancel(ue.current),ue.current=T()(function(){q.apply(void 0,X)}))}return Object(v.useEffect)(function(){return function(){pe.current=!0,T.a.cancel(ue.current)}},[]),ne}function E(q){var ue=Object(v.useRef)([]),pe=Object(v.useState)({}),ne=Object(N.a)(pe,2),j=ne[1],X=Object(v.useRef)(typeof q=="function"?q():q),K=C(function(){var ie=X.current;ue.current.forEach(function(me){ie=me(ie)}),ue.current=[],X.current=ie,j({})});function re(ie){ue.current.push(ie),K()}return[X.current,re]}var y=W("4IlW");function h(q,ue){var pe,ne=q.prefixCls,j=q.id,X=q.active,K=q.rtl,re=q.tab,ie=re.key,me=re.tab,he=re.disabled,Ee=re.closeIcon,Pe=q.tabBarGutter,Ye=q.tabPosition,Xe=q.closable,it=q.renderWrapper,St=q.removeAriaLabel,Mt=q.editable,Rt=q.onClick,Ut=q.onRemove,kt=q.onFocus,Dt="".concat(ne,"-tab");v.useEffect(function(){return Ut},[]);var Pt={};Ye==="top"||Ye==="bottom"?Pt[K?"marginLeft":"marginRight"]=Pe:Pt.marginBottom=Pe;var Vt=Mt&&Xe!==!1&&!he;function Ft(xt){if(he)return;Rt(xt)}function fr(xt){xt.preventDefault(),xt.stopPropagation(),Mt.onEdit("remove",{key:ie,event:xt})}var nr=v.createElement("div",{key:ie,ref:ue,className:U()(Dt,(pe={},Object(oe.a)(pe,"".concat(Dt,"-with-remove"),Vt),Object(oe.a)(pe,"".concat(Dt,"-active"),X),Object(oe.a)(pe,"".concat(Dt,"-disabled"),he),pe)),style:Pt,onClick:Ft},v.createElement("div",{role:"tab","aria-selected":X,id:j&&"".concat(j,"-tab-").concat(ie),className:"".concat(Dt,"-btn"),"aria-controls":j&&"".concat(j,"-panel-").concat(ie),"aria-disabled":he,tabIndex:he?null:0,onClick:function(Et){Et.stopPropagation(),Ft(Et)},onKeyDown:function(Et){[y.a.SPACE,y.a.ENTER].includes(Et.which)&&(Et.preventDefault(),Ft(Et))},onFocus:kt},me),Vt&&v.createElement("button",{type:"button","aria-label":St||"remove",tabIndex:0,className:"".concat(Dt,"-remove"),onClick:function(Et){Et.stopPropagation(),fr(Et)}},Ee||Mt.removeIcon||"\xD7"));return it&&(nr=it(nr)),nr}var r=v.forwardRef(h),o={width:0,height:0,left:0,top:0};function s(q,ue,pe){return Object(v.useMemo)(function(){for(var ne,j=new Map,X=ue.get((ne=q[0])===null||ne===void 0?void 0:ne.key)||o,K=X.left+X.width,re=0;re<q.length;re+=1){var ie=q[re].key,me=ue.get(ie);if(!me){var he;me=ue.get((he=q[re-1])===null||he===void 0?void 0:he.key)||o}var Ee=j.get(ie)||Object(I.a)({},me);Ee.right=K-Ee.left-Ee.width,j.set(ie,Ee)}return j},[q.map(function(ne){return ne.key}).join("_"),ue,pe])}var f={width:0,height:0,left:0,top:0,right:0};function d(q,ue,pe,ne,j){var X=j.tabs,K=j.tabPosition,re=j.rtl,ie,me,he;["top","bottom"].includes(K)?(ie="width",me=re?"right":"left",he=Math.abs(ue.left)):(ie="height",me="top",he=-ue.top);var Ee=ue[ie],Pe=pe[ie],Ye=ne[ie],Xe=Ee;return Pe+Ye>Ee&&(Xe=Ee-Ye),Object(v.useMemo)(function(){if(!X.length)return[0,0];for(var it=X.length,St=it,Mt=0;Mt<it;Mt+=1){var Rt=q.get(X[Mt].key)||f;if(Rt[me]+Rt[ie]>he+Xe){St=Mt-1;break}}for(var Ut=0,kt=it-1;kt>=0;kt-=1){var Dt=q.get(X[kt].key)||f;if(Dt[me]<he){Ut=kt+1;break}}return[Ut,St]},[q,he,Xe,K,X.map(function(it){return it.key}).join("_"),re])}var l=W("wx14"),m=W("1OyB"),c=W("vuIU"),i=W("JX7q"),n=W("Ji7U"),t=W("LK+K"),e=W("I8Z2"),p=W("bT9E"),g=W("2GS6"),_=W("Gytx"),A=W.n(_),k=W("U8pU"),F=/iPhone/i,z=/iPod/i,J=/iPad/i,Y=/\bAndroid(?:.+)Mobile\b/i,$=/Android/i,le=/\bAndroid(?:.+)SD4930UR\b/i,be=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,ve=/Windows Phone/i,ke=/\bWindows(?:.+)ARM\b/i,Te=/BlackBerry/i,xe=/BB10/i,_e=/Opera Mini/i,Oe=/\b(CriOS|Chrome)(?:.+)Mobile/i,ce=/Mobile(?:.+)Firefox\b/i;function Z(q,ue){return q.test(ue)}function je(q){var ue=q||(typeof navigator!="undefined"?navigator.userAgent:""),pe=(ue||"").split("[FBAN");if(typeof pe[1]!="undefined"){var ne=pe,j=Object(N.a)(ne,1);ue=j[0]}if(pe=ue.split("Twitter"),typeof pe[1]!="undefined"){var X=pe,K=Object(N.a)(X,1);ue=K[0]}var re={apple:{phone:Z(F,ue)&&!Z(ve,ue),ipod:Z(z,ue),tablet:!Z(F,ue)&&Z(J,ue)&&!Z(ve,ue),device:(Z(F,ue)||Z(z,ue)||Z(J,ue))&&!Z(ve,ue)},amazon:{phone:Z(le,ue),tablet:!Z(le,ue)&&Z(be,ue),device:Z(le,ue)||Z(be,ue)},android:{phone:!Z(ve,ue)&&Z(le,ue)||!Z(ve,ue)&&Z(Y,ue),tablet:!Z(ve,ue)&&!Z(le,ue)&&!Z(Y,ue)&&(Z(be,ue)||Z($,ue)),device:!Z(ve,ue)&&(Z(le,ue)||Z(be,ue)||Z(Y,ue)||Z($,ue))||Z(/\bokhttp\b/i,ue)},windows:{phone:Z(ve,ue),tablet:Z(ke,ue),device:Z(ve,ue)||Z(ke,ue)},other:{blackberry:Z(Te,ue),blackberry10:Z(xe,ue),opera:Z(_e,ue),firefox:Z(ce,ue),chrome:Z(Oe,ue),device:Z(Te,ue)||Z(xe,ue)||Z(_e,ue)||Z(ce,ue)||Z(Oe,ue)},any:null,phone:null,tablet:null};return re.any=re.apple.device||re.android.device||re.windows.device||re.other.device,re.phone=re.apple.phone||re.android.phone||re.windows.phone,re.tablet=re.apple.tablet||re.android.tablet||re.windows.tablet,re}var at=Object(I.a)(Object(I.a)({},je()),{},{isMobile:je}),rt=at;function Ke(){}function He(q,ue,pe){var ne=ue||"";return q.key||"".concat(ne,"item_").concat(pe)}function we(q){return"".concat(q,"-menu-")}function Fe(q,ue){var pe=-1;v.Children.forEach(q,function(ne){pe+=1,ne&&ne.type&&ne.type.isMenuItemGroup?v.Children.forEach(ne.props.children,function(j){pe+=1,ue(j,pe)}):ue(ne,pe)})}function $e(q,ue,pe){if(!q||pe.find)return;v.Children.forEach(q,function(ne){if(ne){var j=ne.type;if(!j||!(j.isSubMenu||j.isMenuItem||j.isMenuItemGroup))return;ue.indexOf(ne.key)!==-1?pe.find=!0:ne.props.children&&$e(ne.props.children,ue,pe)}})}var Qe=["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"],Ve=function(ue){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ne=ue&&typeof ue.getBoundingClientRect=="function"&&ue.getBoundingClientRect().width;if(ne){if(pe){var j=getComputedStyle(ue),X=j.marginLeft,K=j.marginRight;ne+=+X.replace("px","")+ +K.replace("px","")}ne=+ne.toFixed(6)}return ne||0},Ue=function(ue,pe,ne){ue&&Object(k.a)(ue.style)==="object"&&(ue.style[pe]=ne)},Be=function(){return rt.any},ct=W("bdgK"),st=W("i8i4"),lt=W.n(st),nt=W("wgJM"),ht=W("l4aY"),ut=W("m+aA"),fe=W("c+Xe"),ye=W("zT1h"),Re=W("QC+M");function Ie(q,ue,pe){return pe?q[0]===ue[0]:q[0]===ue[0]&&q[1]===ue[1]}function Ce(q,ue,pe){var ne=q[ue]||{};return Object(I.a)(Object(I.a)({},ne),pe)}function Ae(q,ue,pe,ne){for(var j=pe.points,X=Object.keys(q),K=0;K<X.length;K+=1){var re=X[K];if(Ie(q[re].points,j,ne))return"".concat(ue,"-placement-").concat(re)}return""}var ae=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var q=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(q)||/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(q==null?void 0:q.substr(0,4)))},ee=W("MNnm");function te(q,ue){var pe={};return pe[q.toLowerCase()]=ue.toLowerCase(),pe["Webkit".concat(q)]="webkit".concat(ue),pe["Moz".concat(q)]="moz".concat(ue),pe["ms".concat(q)]="MS".concat(ue),pe["O".concat(q)]="o".concat(ue.toLowerCase()),pe}function H(q,ue){var pe={animationend:te("Animation","AnimationEnd"),transitionend:te("Transition","TransitionEnd")};return q&&("AnimationEvent"in ue||delete pe.animationend.animation,"TransitionEvent"in ue||delete pe.transitionend.transition),pe}var G=H(Object(ee.a)(),typeof window!="undefined"?window:{}),V={};if(Object(ee.a)()){var Q=document.createElement("div");V=Q.style}var de={};function ge(q){if(de[q])return de[q];var ue=G[q];if(ue)for(var pe=Object.keys(ue),ne=pe.length,j=0;j<ne;j+=1){var X=pe[j];if(Object.prototype.hasOwnProperty.call(ue,X)&&X in V)return de[q]=ue[X],de[q]}return""}var Me=ge("animationend"),et=ge("transitionend"),dt=!!(Me&&et),qe=Me||"animationend",Ct=et||"transitionend";function _t(q,ue){if(!q)return null;if(Object(k.a)(q)==="object"){var pe=ue.replace(/-\w/g,function(ne){return ne[1].toUpperCase()});return q[pe]}return"".concat(q,"-").concat(ue)}var ot="none",It="appear",At="enter",Ot="leave",Wt="none",gt="prepare",Bt="start",Nt="active",Ze="end";function Yt(q){var ue=Object(v.useRef)(!1),pe=Object(v.useState)(q),ne=Object(N.a)(pe,2),j=ne[0],X=ne[1];function K(re){ue.current||X(re)}return Object(v.useEffect)(function(){return function(){ue.current=!0}},[]),[j,K]}var or=Object(ee.a)()?v.useLayoutEffect:v.useEffect,Gt=or,rr=function(){var q=v.useRef(null);function ue(){nt.a.cancel(q.current)}function pe(ne){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;ue();var X=Object(nt.a)(function(){j<=1?ne({isCanceled:function(){return X!==q.current}}):pe(ne,j-1)});q.current=X}return v.useEffect(function(){return function(){ue()}},[]),[pe,ue]},$r=[gt,Bt,Nt,Ze],Ir=!1,yr=!0;function pr(q){return q===Nt||q===Ze}var Mr=function(q,ue){var pe=v.useState(Wt),ne=Object(N.a)(pe,2),j=ne[0],X=ne[1],K=rr(),re=Object(N.a)(K,2),ie=re[0],me=re[1];function he(){X(gt)}return Gt(function(){if(j!==Wt&&j!==Ze){var Ee=$r.indexOf(j),Pe=$r[Ee+1],Ye=ue(j);Ye===Ir?X(Pe):ie(function(Xe){function it(){if(Xe.isCanceled())return;X(Pe)}Ye===!0?it():Promise.resolve(Ye).then(it)})}},[q,j]),v.useEffect(function(){return function(){me()}},[]),[he,j]},Nr=function(q){var ue=Object(v.useRef)(),pe=Object(v.useRef)(q);pe.current=q;var ne=v.useCallback(function(K){pe.current(K)},[]);function j(K){K&&(K.removeEventListener(Ct,ne),K.removeEventListener(qe,ne))}function X(K){ue.current&&ue.current!==K&&j(ue.current),K&&K!==ue.current&&(K.addEventListener(Ct,ne),K.addEventListener(qe,ne),ue.current=K)}return v.useEffect(function(){return function(){j(ue.current)}},[]),[X,j]};function Kr(q,ue,pe,ne){var j=ne.motionEnter,X=j===void 0?!0:j,K=ne.motionAppear,re=K===void 0?!0:K,ie=ne.motionLeave,me=ie===void 0?!0:ie,he=ne.motionDeadline,Ee=ne.motionLeaveImmediately,Pe=ne.onAppearPrepare,Ye=ne.onEnterPrepare,Xe=ne.onLeavePrepare,it=ne.onAppearStart,St=ne.onEnterStart,Mt=ne.onLeaveStart,Rt=ne.onAppearActive,Ut=ne.onEnterActive,kt=ne.onLeaveActive,Dt=ne.onAppearEnd,Pt=ne.onEnterEnd,Vt=ne.onLeaveEnd,Ft=ne.onVisibleChanged,fr=Yt(),nr=Object(N.a)(fr,2),xt=nr[0],Et=nr[1],Kt=Yt(ot),zt=Object(N.a)(Kt,2),vt=zt[0],Xt=zt[1],dr=Yt(null),$t=Object(N.a)(dr,2),ar=$t[0],hr=$t[1],Dr=Object(v.useRef)(!1),Vr=Object(v.useRef)(null),gr=Object(v.useRef)(!1),Xr=Object(v.useRef)(null);function yn(){var cr=pe();return cr||Xr.current}var Zr=Object(v.useRef)(!1);function qr(cr){var tr=yn();if(cr&&!cr.deadline&&cr.target!==tr)return;var Lr;vt===It&&Zr.current?Lr=Dt==null?void 0:Dt(tr,cr):vt===At&&Zr.current?Lr=Pt==null?void 0:Pt(tr,cr):vt===Ot&&Zr.current&&(Lr=Vt==null?void 0:Vt(tr,cr)),Lr!==!1&&!gr.current&&(Xt(ot),hr(null))}var Cr=Nr(qr),Wr=Object(N.a)(Cr,1),Pr=Wr[0],wr=v.useMemo(function(){var cr,tr,Lr;switch(vt){case"appear":return cr={},Object(oe.a)(cr,gt,Pe),Object(oe.a)(cr,Bt,it),Object(oe.a)(cr,Nt,Rt),cr;case"enter":return tr={},Object(oe.a)(tr,gt,Ye),Object(oe.a)(tr,Bt,St),Object(oe.a)(tr,Nt,Ut),tr;case"leave":return Lr={},Object(oe.a)(Lr,gt,Xe),Object(oe.a)(Lr,Bt,Mt),Object(oe.a)(Lr,Nt,kt),Lr;default:return{}}},[vt]),Dn=Mr(vt,function(cr){if(cr===gt){var tr=wr[gt];return tr?tr(yn()):Ir}if(ur in wr){var Lr;hr(((Lr=wr[ur])===null||Lr===void 0?void 0:Lr.call(wr,yn(),null))||null)}return ur===Nt&&(Pr(yn()),he>0&&(clearTimeout(Vr.current),Vr.current=setTimeout(function(){qr({deadline:!0})},he))),yr}),Pn=Object(N.a)(Dn,2),Fn=Pn[0],ur=Pn[1],xn=pr(ur);Zr.current=xn,Gt(function(){Et(ue);var cr=Dr.current;if(Dr.current=!0,!q)return;var tr;!cr&&ue&&re&&(tr=It),cr&&ue&&X&&(tr=At),(cr&&!ue&&me||!cr&&Ee&&!ue&&me)&&(tr=Ot),tr&&(Xt(tr),Fn())},[ue]),Object(v.useEffect)(function(){(vt===It&&!re||vt===At&&!X||vt===Ot&&!me)&&Xt(ot)},[re,X,me]),Object(v.useEffect)(function(){return function(){clearTimeout(Vr.current),gr.current=!0}},[]),Object(v.useEffect)(function(){xt!==void 0&&vt===ot&&(Ft==null||Ft(xt))},[xt,vt]);var Wn=ar;return wr[gt]&&ur===Bt&&(Wn=Object(I.a)({transition:"none"},Wn)),[vt,ur,Wn,xt!=null?xt:ue]}var Sr=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(){return Object(m.a)(this,pe),ue.apply(this,arguments)}return Object(c.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(v.Component),_r=Sr;function tn(q){var ue=q;Object(k.a)(q)==="object"&&(ue=q.transitionSupport);function pe(j){return!!(j.motionName&&ue)}var ne=v.forwardRef(function(j,X){var K=j.visible,re=K===void 0?!0:K,ie=j.removeOnLeave,me=ie===void 0?!0:ie,he=j.forceRender,Ee=j.children,Pe=j.motionName,Ye=j.leavedClassName,Xe=j.eventProps,it=pe(j),St=Object(v.useRef)(),Mt=Object(v.useRef)();function Rt(){try{return Object(ut.a)(St.current||Mt.current)}catch(Xt){return null}}var Ut=Kr(it,re,Rt,j),kt=Object(N.a)(Ut,4),Dt=kt[0],Pt=kt[1],Vt=kt[2],Ft=kt[3],fr=v.useRef(Ft);Ft&&(fr.current=!0);var nr=Object(v.useRef)(X);nr.current=X;var xt=v.useCallback(function(Xt){St.current=Xt,Object(fe.b)(nr.current,Xt)},[]),Et,Kt=Object(I.a)(Object(I.a)({},Xe),{},{visible:re});if(!Ee)Et=null;else if(Dt===ot||!pe(j))Ft?Et=Ee(Object(I.a)({},Kt),xt):!me&&fr.current?Et=Ee(Object(I.a)(Object(I.a)({},Kt),{},{className:Ye}),xt):he?Et=Ee(Object(I.a)(Object(I.a)({},Kt),{},{style:{display:"none"}}),xt):Et=null;else{var zt,vt;Pt===gt?vt="prepare":pr(Pt)?vt="active":Pt===Bt&&(vt="start"),Et=Ee(Object(I.a)(Object(I.a)({},Kt),{},{className:U()(_t(Pe,Dt),(zt={},Object(oe.a)(zt,_t(Pe,"".concat(Dt,"-").concat(vt)),vt),Object(oe.a)(zt,Pe,typeof Pe=="string"),zt)),style:Vt}),xt)}return v.createElement(_r,{ref:Mt},Et)});return ne.displayName="CSSMotion",ne}var Ur=tn(dt),wt="add",Yr="keep",kr="remove",Hr="removed";function Br(q){var ue;return q&&Object(k.a)(q)==="object"&&"key"in q?ue=q:ue={key:q},Object(I.a)(Object(I.a)({},ue),{},{key:String(ue.key)})}function rn(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return q.map(Br)}function P(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],pe=[],ne=0,j=ue.length,X=rn(q),K=rn(ue);X.forEach(function(me){for(var he=!1,Ee=ne;Ee<j;Ee+=1){var Pe=K[Ee];if(Pe.key===me.key){ne<Ee&&(pe=pe.concat(K.slice(ne,Ee).map(function(Ye){return Object(I.a)(Object(I.a)({},Ye),{},{status:wt})})),ne=Ee),pe.push(Object(I.a)(Object(I.a)({},Pe),{},{status:Yr})),ne+=1,he=!0;break}}he||pe.push(Object(I.a)(Object(I.a)({},me),{},{status:kr}))}),ne<j&&(pe=pe.concat(K.slice(ne).map(function(me){return Object(I.a)(Object(I.a)({},me),{},{status:wt})})));var re={};pe.forEach(function(me){var he=me.key;re[he]=(re[he]||0)+1});var ie=Object.keys(re).filter(function(me){return re[me]>1});return ie.forEach(function(me){pe=pe.filter(function(he){var Ee=he.key,Pe=he.status;return Ee!==me||Pe!==kr}),pe.forEach(function(he){he.key===me&&(he.status=Yr)})}),pe}var a=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function u(q){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ur,pe=function(ne){Object(n.a)(X,ne);var j=Object(t.a)(X);function X(){var K;return Object(m.a)(this,X),K=j.apply(this,arguments),K.state={keyEntities:[]},K.removeKey=function(re){K.setState(function(ie){var me=ie.keyEntities;return{keyEntities:me.map(function(he){return he.key!==re?he:Object(I.a)(Object(I.a)({},he),{},{status:Hr})})}})},K}return Object(c.a)(X,[{key:"render",value:function(){var re=this,ie=this.state.keyEntities,me=this.props,he=me.component,Ee=me.children,Pe=me.onVisibleChanged,Ye=Object(S.a)(me,["component","children","onVisibleChanged"]),Xe=he||v.Fragment,it={};return a.forEach(function(St){it[St]=Ye[St],delete Ye[St]}),delete Ye.keys,v.createElement(Xe,Ye,ie.map(function(St){var Mt=St.status,Rt=Object(S.a)(St,["status"]),Ut=Mt===wt||Mt===Yr;return v.createElement(ue,Object(l.a)({},it,{key:Rt.key,visible:Ut,eventProps:Rt,onVisibleChanged:function(Dt){Pe==null||Pe(Dt,{key:Rt.key}),Dt||re.removeKey(Rt.key)}}),Ee)}))}}],[{key:"getDerivedStateFromProps",value:function(re,ie){var me=re.keys,he=ie.keyEntities,Ee=rn(me),Pe=P(he,Ee);return{keyEntities:Pe.filter(function(Ye){var Xe=he.find(function(it){var St=it.key;return Ye.key===St});return!(Xe&&Xe.status===Hr&&Ye.status===kr)})}}}]),X}(v.Component);return pe.defaultProps={component:"div"},pe}var D=u(dt),B=Ur;function L(q){var ue=q.prefixCls,pe=q.motion,ne=q.animation,j=q.transitionName;return pe||(ne?{motionName:"".concat(ue,"-").concat(ne)}:j?{motionName:j}:null)}function se(q){var ue=q.prefixCls,pe=q.visible,ne=q.zIndex,j=q.mask,X=q.maskMotion,K=q.maskAnimation,re=q.maskTransitionName;if(!j)return null;var ie={};return(X||re||K)&&(ie=Object(I.a)({motionAppear:!0},L({motion:X,prefixCls:ue,transitionName:re,animation:K}))),v.createElement(B,Object(l.a)({},ie,{visible:pe,removeOnLeave:!0}),function(me){var he=me.className;return v.createElement("div",{style:{zIndex:ne},className:U()("".concat(ue,"-mask"),he)})})}var Ne=W("9mu1"),tt=W("o0o1"),pt=W.n(tt),We=W("HaE+"),bt=["measure","align",null,"motion"],Tt=function(q,ue){var pe=Object(v.useState)(null),ne=Object(N.a)(pe,2),j=ne[0],X=ne[1],K=Object(v.useRef)(),re=Object(v.useRef)(!1);function ie(Ee){re.current||X(Ee)}function me(){nt.a.cancel(K.current)}function he(Ee){me(),K.current=Object(nt.a)(function(){ie(function(Pe){switch(j){case"align":return"motion";case"motion":return"stable";default:}return Pe}),Ee==null||Ee()})}return Object(v.useEffect)(function(){ie("measure")},[q]),Object(v.useEffect)(function(){switch(j){case"measure":ue();break;default:}j&&(K.current=Object(nt.a)(Object(We.a)(pt.a.mark(function Ee(){var Pe,Ye;return pt.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:Pe=bt.indexOf(j),Ye=bt[Pe+1],Ye&&Pe!==-1&&ie(Ye);case 3:case"end":return it.stop()}},Ee)}))))},[j]),Object(v.useEffect)(function(){return function(){re.current=!0,me()}},[]),[j,he]},Qt=function(q){var ue=v.useState({width:0,height:0}),pe=Object(N.a)(ue,2),ne=pe[0],j=pe[1];function X(re){j({width:re.offsetWidth,height:re.offsetHeight})}var K=v.useMemo(function(){var re={};if(q){var ie=ne.width,me=ne.height;q.indexOf("height")!==-1&&me?re.height=me:q.indexOf("minHeight")!==-1&&me&&(re.minHeight=me),q.indexOf("width")!==-1&&ie?re.width=ie:q.indexOf("minWidth")!==-1&&ie&&(re.minWidth=ie)}return re},[q,ne]);return[K,X]},De=v.forwardRef(function(q,ue){var pe=q.visible,ne=q.prefixCls,j=q.className,X=q.style,K=q.children,re=q.zIndex,ie=q.stretch,me=q.destroyPopupOnHide,he=q.forceRender,Ee=q.align,Pe=q.point,Ye=q.getRootDomNode,Xe=q.getClassNameFromAlign,it=q.onAlign,St=q.onMouseEnter,Mt=q.onMouseLeave,Rt=q.onMouseDown,Ut=q.onTouchStart,kt=Object(v.useRef)(),Dt=Object(v.useRef)(),Pt=Object(v.useState)(),Vt=Object(N.a)(Pt,2),Ft=Vt[0],fr=Vt[1],nr=Qt(ie),xt=Object(N.a)(nr,2),Et=xt[0],Kt=xt[1];function zt(){ie&&Kt(Ye())}var vt=Tt(pe,zt),Xt=Object(N.a)(vt,2),dr=Xt[0],$t=Xt[1],ar=Object(v.useRef)();function hr(){return Pe||Ye}function Dr(){var Cr;(Cr=kt.current)===null||Cr===void 0||Cr.forceAlign()}function Vr(Cr,Wr){var Pr=Xe(Wr);Ft!==Pr&&fr(Pr),dr==="align"&&(Ft!==Pr?Promise.resolve().then(function(){Dr()}):$t(function(){var wr;(wr=ar.current)===null||wr===void 0||wr.call(ar)}),it==null||it(Cr,Wr))}var gr=Object(I.a)({},L(q));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(Cr){var Wr=gr[Cr];gr[Cr]=function(Pr,wr){return $t(),Wr==null?void 0:Wr(Pr,wr)}});function Xr(){return new Promise(function(Cr){ar.current=Cr})}v.useEffect(function(){!gr.motionName&&dr==="motion"&&$t()},[gr.motionName,dr]),v.useImperativeHandle(ue,function(){return{forceAlign:Dr,getElement:function(){return Dt.current}}});var yn=Object(I.a)(Object(I.a)({},Et),{},{zIndex:re,opacity:dr==="motion"||dr==="stable"||!pe?void 0:0,pointerEvents:dr==="stable"?void 0:"none"},X),Zr=!0;(Ee==null?void 0:Ee.points)&&(dr==="align"||dr==="stable")&&(Zr=!1);var qr=K;return v.Children.count(K)>1&&(qr=v.createElement("div",{className:"".concat(ne,"-content")},K)),v.createElement(B,Object(l.a)({visible:pe,ref:Dt,leavedClassName:"".concat(ne,"-hidden")},gr,{onAppearPrepare:Xr,onEnterPrepare:Xr,removeOnLeave:me,forceRender:he}),function(Cr,Wr){var Pr=Cr.className,wr=Cr.style,Dn=U()(ne,j,Ft,Pr);return v.createElement(Ne.a,{target:hr(),key:"popup",ref:kt,monitorWindowResize:!0,disabled:Zr,align:Ee,onAlign:Vr},v.createElement("div",{ref:Wr,className:Dn,onMouseEnter:St,onMouseLeave:Mt,onMouseDownCapture:Rt,onTouchStartCapture:Ut,style:Object(I.a)(Object(I.a)({},wr),yn)},qr))})});De.displayName="PopupInner";var br=De,sr=v.forwardRef(function(q,ue){var pe=q.prefixCls,ne=q.visible,j=q.zIndex,X=q.children,K=q.mobile;K=K===void 0?{}:K;var re=K.popupClassName,ie=K.popupStyle,me=K.popupMotion,he=me===void 0?{}:me,Ee=K.popupRender,Pe=v.useRef();v.useImperativeHandle(ue,function(){return{forceAlign:function(){},getElement:function(){return Pe.current}}});var Ye=Object(I.a)({zIndex:j},ie),Xe=X;return v.Children.count(X)>1&&(Xe=v.createElement("div",{className:"".concat(pe,"-content")},X)),Ee&&(Xe=Ee(Xe)),v.createElement(B,Object(l.a)({visible:ne,ref:Pe,removeOnLeave:!0},he),function(it,St){var Mt=it.className,Rt=it.style,Ut=U()(pe,re,Mt);return v.createElement("div",{ref:St,className:Ut,style:Object(I.a)(Object(I.a)({},Rt),Ye)},Xe)})});sr.displayName="MobilePopupInner";var Rr=sr,Cn=["visible","mobile"],nn=v.forwardRef(function(q,ue){var pe=q.visible,ne=q.mobile,j=Object(S.a)(q,Cn),X=Object(v.useState)(pe),K=Object(N.a)(X,2),re=K[0],ie=K[1],me=Object(v.useState)(!1),he=Object(N.a)(me,2),Ee=he[0],Pe=he[1],Ye=Object(I.a)(Object(I.a)({},j),{},{visible:re});Object(v.useEffect)(function(){ie(pe),pe&&ne&&Pe(ae())},[pe,ne]);var Xe=Ee?v.createElement(Rr,Object(l.a)({},Ye,{mobile:ne,ref:ue})):v.createElement(br,Object(l.a)({},Ye,{ref:ue}));return v.createElement("div",null,v.createElement(se,Ye),Xe)});nn.displayName="Popup";var jr=nn,Qr=v.createContext(null),zr=Qr;function an(){}function Tn(){return""}function hn(q){return q?q.ownerDocument:window.document}var bn=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Mn(q){var ue=function(pe){Object(n.a)(j,pe);var ne=Object(t.a)(j);function j(X){var K;Object(m.a)(this,j),K=ne.call(this,X),K.popupRef=v.createRef(),K.triggerRef=v.createRef(),K.attachId=void 0,K.clickOutsideHandler=void 0,K.touchOutsideHandler=void 0,K.contextMenuOutsideHandler1=void 0,K.contextMenuOutsideHandler2=void 0,K.mouseDownTimeout=void 0,K.focusTime=void 0,K.preClickTime=void 0,K.preTouchTime=void 0,K.delayTimer=void 0,K.hasPopupMouseDown=void 0,K.onMouseEnter=function(ie){var me=K.props.mouseEnterDelay;K.fireEvents("onMouseEnter",ie),K.delaySetPopupVisible(!0,me,me?null:ie)},K.onMouseMove=function(ie){K.fireEvents("onMouseMove",ie),K.setPoint(ie)},K.onMouseLeave=function(ie){K.fireEvents("onMouseLeave",ie),K.delaySetPopupVisible(!1,K.props.mouseLeaveDelay)},K.onPopupMouseEnter=function(){K.clearDelayTimer()},K.onPopupMouseLeave=function(ie){var me;if(ie.relatedTarget&&!ie.relatedTarget.setTimeout&&Object(ht.a)((me=K.popupRef.current)===null||me===void 0?void 0:me.getElement(),ie.relatedTarget))return;K.delaySetPopupVisible(!1,K.props.mouseLeaveDelay)},K.onFocus=function(ie){K.fireEvents("onFocus",ie),K.clearDelayTimer(),K.isFocusToShow()&&(K.focusTime=Date.now(),K.delaySetPopupVisible(!0,K.props.focusDelay))},K.onMouseDown=function(ie){K.fireEvents("onMouseDown",ie),K.preClickTime=Date.now()},K.onTouchStart=function(ie){K.fireEvents("onTouchStart",ie),K.preTouchTime=Date.now()},K.onBlur=function(ie){K.fireEvents("onBlur",ie),K.clearDelayTimer(),K.isBlurToHide()&&K.delaySetPopupVisible(!1,K.props.blurDelay)},K.onContextMenu=function(ie){ie.preventDefault(),K.fireEvents("onContextMenu",ie),K.setPopupVisible(!0,ie)},K.onContextMenuClose=function(){K.isContextMenuToShow()&&K.close()},K.onClick=function(ie){if(K.fireEvents("onClick",ie),K.focusTime){var me;if(K.preClickTime&&K.preTouchTime?me=Math.min(K.preClickTime,K.preTouchTime):K.preClickTime?me=K.preClickTime:K.preTouchTime&&(me=K.preTouchTime),Math.abs(me-K.focusTime)<20)return;K.focusTime=0}K.preClickTime=0,K.preTouchTime=0,K.isClickToShow()&&(K.isClickToHide()||K.isBlurToHide())&&ie&&ie.preventDefault&&ie.preventDefault();var he=!K.state.popupVisible;(K.isClickToHide()&&!he||he&&K.isClickToShow())&&K.setPopupVisible(!K.state.popupVisible,ie)},K.onPopupMouseDown=function(){if(K.hasPopupMouseDown=!0,clearTimeout(K.mouseDownTimeout),K.mouseDownTimeout=window.setTimeout(function(){K.hasPopupMouseDown=!1},0),K.context){var ie;(ie=K.context).onPopupMouseDown.apply(ie,arguments)}},K.onDocumentClick=function(ie){if(K.props.mask&&!K.props.maskClosable)return;var me=ie.target,he=K.getRootDomNode(),Ee=K.getPopupDomNode();(!Object(ht.a)(he,me)||K.isContextMenuOnly())&&!Object(ht.a)(Ee,me)&&!K.hasPopupMouseDown&&K.close()},K.getRootDomNode=function(){var ie=K.props.getTriggerDOMNode;if(ie)return ie(K.triggerRef.current);try{var me=Object(ut.a)(K.triggerRef.current);if(me)return me}catch(he){}return lt.a.findDOMNode(Object(i.a)(K))},K.getPopupClassNameFromAlign=function(ie){var me=[],he=K.props,Ee=he.popupPlacement,Pe=he.builtinPlacements,Ye=he.prefixCls,Xe=he.alignPoint,it=he.getPopupClassNameFromAlign;return Ee&&Pe&&me.push(Ae(Pe,Ye,ie,Xe)),it&&me.push(it(ie)),me.join(" ")},K.getComponent=function(){var ie=K.props,me=ie.prefixCls,he=ie.destroyPopupOnHide,Ee=ie.popupClassName,Pe=ie.onPopupAlign,Ye=ie.popupMotion,Xe=ie.popupAnimation,it=ie.popupTransitionName,St=ie.popupStyle,Mt=ie.mask,Rt=ie.maskAnimation,Ut=ie.maskTransitionName,kt=ie.maskMotion,Dt=ie.zIndex,Pt=ie.popup,Vt=ie.stretch,Ft=ie.alignPoint,fr=ie.mobile,nr=ie.forceRender,xt=K.state,Et=xt.popupVisible,Kt=xt.point,zt=K.getPopupAlign(),vt={};return K.isMouseEnterToShow()&&(vt.onMouseEnter=K.onPopupMouseEnter),K.isMouseLeaveToHide()&&(vt.onMouseLeave=K.onPopupMouseLeave),vt.onMouseDown=K.onPopupMouseDown,vt.onTouchStart=K.onPopupMouseDown,v.createElement(jr,Object(l.a)({prefixCls:me,destroyPopupOnHide:he,visible:Et,point:Ft&&Kt,className:Ee,align:zt,onAlign:Pe,animation:Xe,getClassNameFromAlign:K.getPopupClassNameFromAlign},vt,{stretch:Vt,getRootDomNode:K.getRootDomNode,style:St,mask:Mt,zIndex:Dt,transitionName:it,maskAnimation:Rt,maskTransitionName:Ut,maskMotion:kt,ref:K.popupRef,motion:Ye,mobile:fr,forceRender:nr}),typeof Pt=="function"?Pt():Pt)},K.attachParent=function(ie){nt.a.cancel(K.attachId);var me=K.props,he=me.getPopupContainer,Ee=me.getDocument,Pe=K.getRootDomNode(),Ye;he?(Pe||he.length===0)&&(Ye=he(Pe)):Ye=Ee(K.getRootDomNode()).body,Ye?Ye.appendChild(ie):K.attachId=Object(nt.a)(function(){K.attachParent(ie)})},K.getContainer=function(){var ie=K.props.getDocument,me=ie(K.getRootDomNode()).createElement("div");return me.style.position="absolute",me.style.top="0",me.style.left="0",me.style.width="100%",K.attachParent(me),me},K.setPoint=function(ie){var me=K.props.alignPoint;if(!me||!ie)return;K.setState({point:{pageX:ie.pageX,pageY:ie.pageY}})},K.handlePortalUpdate=function(){K.state.prevPopupVisible!==K.state.popupVisible&&K.props.afterPopupVisibleChange(K.state.popupVisible)},K.triggerContextValue={onPopupMouseDown:K.onPopupMouseDown};var re;return"popupVisible"in X?re=!!X.popupVisible:re=!!X.defaultPopupVisible,K.state={prevPopupVisible:re,popupVisible:re},bn.forEach(function(ie){K["fire".concat(ie)]=function(me){K.fireEvents(ie,me)}}),K}return Object(c.a)(j,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var K=this.props,re=this.state;if(re.popupVisible){var ie;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(ie=K.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(ye.a)(ie,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(ie=ie||K.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(ye.a)(ie,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(ie=ie||K.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(ye.a)(ie,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(ye.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),nt.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var K;return((K=this.popupRef.current)===null||K===void 0?void 0:K.getElement())||null}},{key:"getPopupAlign",value:function(){var K=this.props,re=K.popupPlacement,ie=K.popupAlign,me=K.builtinPlacements;return re&&me?Ce(me,re,ie):ie}},{key:"setPopupVisible",value:function(K,re){var ie=this.props.alignPoint,me=this.state.popupVisible;this.clearDelayTimer(),me!==K&&("popupVisible"in this.props||this.setState({popupVisible:K,prevPopupVisible:me}),this.props.onPopupVisibleChange(K)),ie&&re&&K&&this.setPoint(re)}},{key:"delaySetPopupVisible",value:function(K,re,ie){var me=this,he=re*1e3;if(this.clearDelayTimer(),he){var Ee=ie?{pageX:ie.pageX,pageY:ie.pageY}:null;this.delayTimer=window.setTimeout(function(){me.setPopupVisible(K,Ee),me.clearDelayTimer()},he)}else this.setPopupVisible(K,ie)}},{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(K){var re=this.props.children.props,ie=this.props;return re[K]&&ie[K]?this["fire".concat(K)]:re[K]||ie[K]}},{key:"isClickToShow",value:function(){var K=this.props,re=K.action,ie=K.showAction;return re.indexOf("click")!==-1||ie.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var K=this.props.action;return K==="contextMenu"||K.length===1&&K[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var K=this.props,re=K.action,ie=K.showAction;return re.indexOf("contextMenu")!==-1||ie.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var K=this.props,re=K.action,ie=K.hideAction;return re.indexOf("click")!==-1||ie.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var K=this.props,re=K.action,ie=K.showAction;return re.indexOf("hover")!==-1||ie.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var K=this.props,re=K.action,ie=K.hideAction;return re.indexOf("hover")!==-1||ie.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var K=this.props,re=K.action,ie=K.showAction;return re.indexOf("focus")!==-1||ie.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var K=this.props,re=K.action,ie=K.hideAction;return re.indexOf("focus")!==-1||ie.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var K;(K=this.popupRef.current)===null||K===void 0||K.forceAlign()}}},{key:"fireEvents",value:function(K,re){var ie=this.props.children.props[K];ie&&ie(re);var me=this.props[K];me&&me(re)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var K=this.state.popupVisible,re=this.props,ie=re.children,me=re.forceRender,he=re.alignPoint,Ee=re.className,Pe=re.autoDestroy,Ye=v.Children.only(ie),Xe={key:"trigger"};this.isContextMenuToShow()?Xe.onContextMenu=this.onContextMenu:Xe.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(Xe.onClick=this.onClick,Xe.onMouseDown=this.onMouseDown,Xe.onTouchStart=this.onTouchStart):(Xe.onClick=this.createTwoChains("onClick"),Xe.onMouseDown=this.createTwoChains("onMouseDown"),Xe.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(Xe.onMouseEnter=this.onMouseEnter,he&&(Xe.onMouseMove=this.onMouseMove)):Xe.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?Xe.onMouseLeave=this.onMouseLeave:Xe.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(Xe.onFocus=this.onFocus,Xe.onBlur=this.onBlur):(Xe.onFocus=this.createTwoChains("onFocus"),Xe.onBlur=this.createTwoChains("onBlur"));var it=U()(Ye&&Ye.props&&Ye.props.className,Ee);it&&(Xe.className=it);var St=Object(I.a)({},Xe);Object(fe.c)(Ye)&&(St.ref=Object(fe.a)(this.triggerRef,Ye.ref));var Mt=v.cloneElement(Ye,St),Rt;return(K||this.popupRef.current||me)&&(Rt=v.createElement(q,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!K&&Pe&&(Rt=null),v.createElement(zr.Provider,{value:this.triggerContextValue},Mt,Rt)}}],[{key:"getDerivedStateFromProps",value:function(K,re){var ie=K.popupVisible,me={};return ie!==void 0&&re.popupVisible!==ie&&(me.popupVisible=ie,me.prevPopupVisible=re.popupVisible),me}}]),j}(v.Component);return ue.contextType=zr,ue.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Tn,getDocument:hn,onPopupVisibleChange:an,afterPopupVisibleChange:an,onPopupAlign:an,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},ue}var on=Mn(Re.a),Er={adjustX:1,adjustY:1},Jr={topLeft:{points:["bl","tl"],overflow:Er,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:Er,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:Er,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:Er,offset:[4,0]}},Sn={topLeft:{points:["bl","tl"],overflow:Er,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:Er,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:Er,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:Er,offset:[4,0]}},fn=Jr,qt=0,Lt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},lr=function(ue,pe,ne){var j=we(pe),X=ue.getState();ue.setState({defaultActiveFirst:Object(I.a)(Object(I.a)({},X.defaultActiveFirst),{},Object(oe.a)({},j,ne))})},jt=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(ne){var j;Object(m.a)(this,pe),j=ue.call(this,ne),j.onDestroy=function(he){j.props.onDestroy(he)},j.onKeyDown=function(he){var Ee=he.keyCode,Pe=j.menuInstance,Ye=j.props.store,Xe=j.getVisible();if(Ee===y.a.ENTER)return j.onTitleClick(he),lr(Ye,j.props.eventKey,!0),!0;if(Ee===y.a.RIGHT)return Xe?Pe.onKeyDown(he):(j.triggerOpenChange(!0),lr(Ye,j.props.eventKey,!0)),!0;if(Ee===y.a.LEFT){var it;if(Xe)it=Pe.onKeyDown(he);else return;return it||(j.triggerOpenChange(!1),it=!0),it}return Xe&&(Ee===y.a.UP||Ee===y.a.DOWN)?Pe.onKeyDown(he):void 0},j.onOpenChange=function(he){j.props.onOpenChange(he)},j.onPopupVisibleChange=function(he){j.triggerOpenChange(he,he?"mouseenter":"mouseleave")},j.onMouseEnter=function(he){var Ee=j.props,Pe=Ee.eventKey,Ye=Ee.onMouseEnter,Xe=Ee.store;lr(Xe,j.props.eventKey,!1),Ye({key:Pe,domEvent:he})},j.onMouseLeave=function(he){var Ee=j.props,Pe=Ee.parentMenu,Ye=Ee.eventKey,Xe=Ee.onMouseLeave;Pe.subMenuInstance=Object(i.a)(j),Xe({key:Ye,domEvent:he})},j.onTitleMouseEnter=function(he){var Ee=j.props,Pe=Ee.eventKey,Ye=Ee.onItemHover,Xe=Ee.onTitleMouseEnter;Ye({key:Pe,hover:!0}),Xe({key:Pe,domEvent:he})},j.onTitleMouseLeave=function(he){var Ee=j.props,Pe=Ee.parentMenu,Ye=Ee.eventKey,Xe=Ee.onItemHover,it=Ee.onTitleMouseLeave;Pe.subMenuInstance=Object(i.a)(j),Xe({key:Ye,hover:!1}),it({key:Ye,domEvent:he})},j.onTitleClick=function(he){var Ee=Object(i.a)(j),Pe=Ee.props;if(Pe.onTitleClick({key:Pe.eventKey,domEvent:he}),Pe.triggerSubMenuAction==="hover")return;j.triggerOpenChange(!j.getVisible(),"click"),lr(Pe.store,j.props.eventKey,!1)},j.onSubMenuClick=function(he){typeof j.props.onClick=="function"&&j.props.onClick(j.addKeyPath(he))},j.onSelect=function(he){j.props.onSelect(he)},j.onDeselect=function(he){j.props.onDeselect(he)},j.getPrefixCls=function(){return"".concat(j.props.rootPrefixCls,"-submenu")},j.getActiveClassName=function(){return"".concat(j.getPrefixCls(),"-active")},j.getDisabledClassName=function(){return"".concat(j.getPrefixCls(),"-disabled")},j.getSelectedClassName=function(){return"".concat(j.getPrefixCls(),"-selected")},j.getOpenClassName=function(){return"".concat(j.props.rootPrefixCls,"-submenu-open")},j.getVisible=function(){return j.state.isOpen},j.getMode=function(){return j.state.mode},j.saveMenuInstance=function(he){j.menuInstance=he},j.addKeyPath=function(he){return Object(I.a)(Object(I.a)({},he),{},{keyPath:(he.keyPath||[]).concat(j.props.eventKey)})},j.triggerOpenChange=function(he,Ee){var Pe=j.props.eventKey,Ye=function(){j.onOpenChange({key:Pe,item:Object(i.a)(j),trigger:Ee,open:he})};Ee==="mouseenter"?j.mouseenterTimeout=setTimeout(function(){Ye()},0):Ye()},j.isChildrenSelected=function(){var he={find:!1};return $e(j.props.children,j.props.selectedKeys,he),he.find},j.isInlineMode=function(){return j.getMode()==="inline"},j.adjustWidth=function(){if(!j.subMenuTitle||!j.menuInstance)return;var he=st.findDOMNode(j.menuInstance);if(he.offsetWidth>=j.subMenuTitle.offsetWidth)return;he.style.minWidth="".concat(j.subMenuTitle.offsetWidth,"px")},j.saveSubMenuTitle=function(he){j.subMenuTitle=he},j.getBaseProps=function(){var he=Object(i.a)(j),Ee=he.props,Pe=j.getMode();return{mode:Pe==="horizontal"?"vertical":Pe,visible:j.getVisible(),level:Ee.level+1,inlineIndent:Ee.inlineIndent,focusable:!1,onClick:j.onSubMenuClick,onSelect:j.onSelect,onDeselect:j.onDeselect,onDestroy:j.onDestroy,selectedKeys:Ee.selectedKeys,eventKey:"".concat(Ee.eventKey,"-menu-"),openKeys:Ee.openKeys,motion:Ee.motion,onOpenChange:j.onOpenChange,subMenuOpenDelay:Ee.subMenuOpenDelay,parentMenu:Object(i.a)(j),subMenuCloseDelay:Ee.subMenuCloseDelay,forceSubMenuRender:Ee.forceSubMenuRender,triggerSubMenuAction:Ee.triggerSubMenuAction,builtinPlacements:Ee.builtinPlacements,defaultActiveFirst:Ee.store.getState().defaultActiveFirst[we(Ee.eventKey)],multiple:Ee.multiple,prefixCls:Ee.rootPrefixCls,id:j.internalMenuId,manualRef:j.saveMenuInstance,itemIcon:Ee.itemIcon,expandIcon:Ee.expandIcon,direction:Ee.direction}},j.getMotion=function(he,Ee){var Pe=Object(i.a)(j),Ye=Pe.haveRendered,Xe=j.props,it=Xe.motion,St=Xe.rootPrefixCls,Mt=Object(I.a)(Object(I.a)({},it),{},{leavedClassName:"".concat(St,"-hidden"),removeOnLeave:!1,motionAppear:Ye||!Ee||he!=="inline"});return Mt};var X=ne.store,K=ne.eventKey,re=X.getState(),ie=re.defaultActiveFirst;j.isRootMenu=!1;var me=!1;return ie&&(me=ie[K]),lr(X,K,me),j.state={mode:ne.mode,isOpen:ne.isOpen},j}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var j=this,X=this.props,K=X.mode,re=X.parentMenu,ie=X.manualRef,me=X.isOpen,he=function(){j.setState({mode:K,isOpen:me})},Ee=me!==this.state.isOpen,Pe=K!==this.state.mode;if((Pe||Ee)&&(nt.a.cancel(this.updateStateRaf),Pe?this.updateStateRaf=Object(nt.a)(he):he()),ie&&ie(this),K!=="horizontal"||!(re==null?void 0:re.isRootMenu)||!me)return;this.minWidthTimeout=setTimeout(function(){return j.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var j=this.props,X=j.onDestroy,K=j.eventKey;X&&X(K),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),nt.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(j,X){var K=this.getBaseProps();return v.createElement(wn,Object(l.a)({},K,{id:this.internalMenuId,className:j,style:X}),this.props.children)}},{key:"renderChildren",value:function(){var j=this,X=this.getBaseProps(),K=X.mode,re=X.visible,ie=X.forceSubMenuRender,me=X.direction,he=this.getMotion(K,re);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||re||ie,!this.haveOpened)return v.createElement("div",null);var Ee=U()("".concat(X.prefixCls,"-sub"),Object(oe.a)({},"".concat(X.prefixCls,"-rtl"),me==="rtl"));return this.isInlineMode()?v.createElement(B,Object(l.a)({visible:X.visible,forceRender:ie},he),function(Pe){var Ye=Pe.className,Xe=Pe.style,it=U()(Ee,Ye);return j.renderPopupMenu(it,Xe)}):this.renderPopupMenu(Ee)}},{key:"render",value:function(){var j,X,K,re=Object(I.a)({},this.props),ie=this.getVisible(),me=this.getPrefixCls(),he=this.isInlineMode(),Ee=this.getMode(),Pe=U()(me,"".concat(me,"-").concat(Ee),(j={},Object(oe.a)(j,re.className,!!re.className),Object(oe.a)(j,this.getOpenClassName(),ie),Object(oe.a)(j,this.getActiveClassName(),re.active||ie&&!he),Object(oe.a)(j,this.getDisabledClassName(),re.disabled),Object(oe.a)(j,this.getSelectedClassName(),this.isChildrenSelected()),j));this.internalMenuId||(re.eventKey?this.internalMenuId="".concat(re.eventKey,"$Menu"):(qt+=1,this.internalMenuId="$__$".concat(qt,"$Menu")));var Ye={},Xe={},it={};re.disabled||(Ye={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},Xe={onClick:this.onTitleClick},it={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var St={},Mt=re.direction,Rt=Mt==="rtl";he&&(Rt?St.paddingRight=re.inlineIndent*re.level:St.paddingLeft=re.inlineIndent*re.level);var Ut={};this.getVisible()&&(Ut={"aria-owns":this.internalMenuId});var kt=null;Ee!=="horizontal"&&(kt=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(kt=v.createElement(this.props.expandIcon,Object(I.a)({},this.props))));var Dt=v.createElement("div",Object(l.a)({ref:this.saveSubMenuTitle,style:St,className:"".concat(me,"-title"),role:"button"},it,Xe,{"aria-expanded":ie},Ut,{"aria-haspopup":"true",title:typeof re.title=="string"?re.title:void 0}),re.title,kt||v.createElement("i",{className:"".concat(me,"-arrow")})),Pt=this.renderChildren(),Vt=((X=re.parentMenu)===null||X===void 0?void 0:X.isRootMenu)?re.parentMenu.props.getPopupContainer:function(hr){return hr.parentNode},Ft=Lt[Ee],fr=re.popupOffset?{offset:re.popupOffset}:{},nr=U()((K={},Object(oe.a)(K,re.popupClassName,re.popupClassName&&!he),Object(oe.a)(K,"".concat(me,"-rtl"),Rt),K)),xt=re.disabled,Et=re.triggerSubMenuAction,Kt=re.subMenuOpenDelay,zt=re.forceSubMenuRender,vt=re.subMenuCloseDelay,Xt=re.builtinPlacements;Qe.forEach(function(hr){return delete re[hr]}),delete re.onClick;var dr=Rt?Object(I.a)(Object(I.a)({},Sn),Xt):Object(I.a)(Object(I.a)({},Jr),Xt);delete re.direction;var $t=this.getBaseProps(),ar=he?null:this.getMotion($t.mode,$t.visible);return v.createElement("li",Object(l.a)({},re,Ye,{className:Pe,role:"menuitem"}),v.createElement(on,{prefixCls:me,popupClassName:U()("".concat(me,"-popup"),nr),getPopupContainer:Vt,builtinPlacements:dr,popupPlacement:Ft,popupVisible:he?!1:ie,popupAlign:fr,popup:he?null:Pt,action:xt||he?[]:[Et],mouseEnterDelay:Kt,mouseLeaveDelay:vt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:zt,popupMotion:ar},Dt),he?Pt:null)}}]),pe}(v.Component);jt.defaultProps={onMouseEnter:Ke,onMouseLeave:Ke,onTitleMouseEnter:Ke,onTitleMouseLeave:Ke,onTitleClick:Ke,manualRef:Ke,mode:"vertical",title:""};var mr=Object(e.b)(function(q,ue){var pe=q.openKeys,ne=q.activeKey,j=q.selectedKeys,X=ue.eventKey,K=ue.subMenuKey;return{isOpen:pe.indexOf(X)>-1,active:ne[K]===X,selectedKeys:j}})(jt);mr.isSubMenu=!0;var Zt=mr,pn="menuitem-overflowed",vr=.5,En=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(){var ne;return Object(m.a)(this,pe),ne=ue.apply(this,arguments),ne.resizeObserver=null,ne.mutationObserver=null,ne.originalTotalWidth=0,ne.overflowedItems=[],ne.menuItemSizes=[],ne.cancelFrameId=null,ne.state={lastVisibleIndex:void 0},ne.childRef=v.createRef(),ne.getMenuItemNodes=function(){var j=ne.props.prefixCls,X=ne.childRef.current;return X?[].slice.call(X.children).filter(function(K){return K.className.split(" ").indexOf("".concat(j,"-overflowed-submenu"))<0}):[]},ne.getOverflowedSubMenuItem=function(j,X,K){var re=ne.props,ie=re.overflowedIndicator,me=re.level,he=re.mode,Ee=re.prefixCls,Pe=re.theme;if(me!==1||he!=="horizontal")return null;var Ye=ne.props.children[0],Xe=Ye.props,it=Xe.children,St=Xe.title,Mt=Xe.style,Rt=Object(S.a)(Xe,["children","title","style"]),Ut=Object(I.a)({},Mt),kt="".concat(j,"-overflowed-indicator"),Dt="".concat(j,"-overflowed-indicator");X.length===0&&K!==!0?Ut=Object(I.a)(Object(I.a)({},Ut),{},{display:"none"}):K&&(Ut=Object(I.a)(Object(I.a)({},Ut),{},{visibility:"hidden",position:"absolute"}),kt="".concat(kt,"-placeholder"),Dt="".concat(Dt,"-placeholder"));var Pt=Pe?"".concat(Ee,"-").concat(Pe):"",Vt={};return Qe.forEach(function(Ft){Rt[Ft]!==void 0&&(Vt[Ft]=Rt[Ft])}),v.createElement(Zt,Object(l.a)({title:ie,className:"".concat(Ee,"-overflowed-submenu"),popupClassName:Pt},Vt,{key:kt,eventKey:Dt,disabled:!1,style:Ut}),X)},ne.setChildrenWidthAndResize=function(){if(ne.props.mode!=="horizontal")return;var j=ne.childRef.current;if(!j)return;var X=j.children;if(!X||X.length===0)return;var K=j.children[X.length-1];Ue(K,"display","inline-block");var re=ne.getMenuItemNodes(),ie=re.filter(function(me){return me.className.split(" ").indexOf(pn)>=0});ie.forEach(function(me){Ue(me,"display","inline-block")}),ne.menuItemSizes=re.map(function(me){return Ve(me,!0)}),ie.forEach(function(me){Ue(me,"display","none")}),ne.overflowedIndicatorWidth=Ve(j.children[j.children.length-1],!0),ne.originalTotalWidth=ne.menuItemSizes.reduce(function(me,he){return me+he},0),ne.handleResize(),Ue(K,"display","none")},ne.handleResize=function(){if(ne.props.mode!=="horizontal")return;var j=ne.childRef.current;if(!j)return;var X=Ve(j);ne.overflowedItems=[];var K=0,re;ne.originalTotalWidth>X+vr&&(re=-1,ne.menuItemSizes.forEach(function(ie){K+=ie,K+ne.overflowedIndicatorWidth<=X&&(re+=1)})),ne.setState({lastVisibleIndex:re})},ne}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){var j=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var X=this.childRef.current;if(!X)return;this.resizeObserver=new ct.default(function(K){K.forEach(function(){var re=j.cancelFrameId;cancelAnimationFrame(re),j.cancelFrameId=requestAnimationFrame(j.setChildrenWidthAndResize)})}),[].slice.call(X.children).concat(X).forEach(function(K){j.resizeObserver.observe(K)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){j.resizeObserver.disconnect(),[].slice.call(X.children).concat(X).forEach(function(K){j.resizeObserver.observe(K)}),j.setChildrenWidthAndResize()}),this.mutationObserver.observe(X,{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(j){var X=this,K=this.state.lastVisibleIndex;return(j||[]).reduce(function(re,ie,me){var he=ie;if(X.props.mode==="horizontal"){var Ee=X.getOverflowedSubMenuItem(ie.props.eventKey,[]);K!==void 0&&X.props.className.indexOf("".concat(X.props.prefixCls,"-root"))!==-1&&(me>K&&(he=v.cloneElement(ie,{style:{display:"none"},eventKey:"".concat(ie.props.eventKey,"-hidden"),className:"".concat(pn)})),me===K+1&&(X.overflowedItems=j.slice(K+1).map(function(Ye){return v.cloneElement(Ye,{key:Ye.props.eventKey,mode:"vertical-left"})}),Ee=X.getOverflowedSubMenuItem(ie.props.eventKey,X.overflowedItems)));var Pe=[].concat(Object(w.a)(re),[Ee,he]);return me===j.length-1&&Pe.push(X.getOverflowedSubMenuItem(ie.props.eventKey,[],!0)),Pe}return[].concat(Object(w.a)(re),[he])},[])}},{key:"render",value:function(){var j=this.props,X=j.visible,K=j.prefixCls,re=j.overflowedIndicator,ie=j.mode,me=j.level,he=j.tag,Ee=j.children,Pe=j.theme,Ye=Object(S.a)(j,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),Xe=he;return v.createElement(Xe,Object(l.a)({ref:this.childRef},Ye),this.renderChildren(Ee))}}]),pe}(v.Component);En.defaultProps={tag:"div",className:""};var sn=En;function mn(q){return q.length?q.every(function(ue){return!!ue.props.disabled}):!0}function ln(q,ue,pe){var ne=q.getState();q.setState({activeKey:Object(I.a)(Object(I.a)({},ne.activeKey),{},Object(oe.a)({},ue,pe))})}function Ar(q){return q.eventKey||"0-menu-"}function _n(q,ue){var pe=ue,ne=q.children,j=q.eventKey;if(pe){var X;if(Fe(ne,function(K,re){K&&K.props&&!K.props.disabled&&pe===He(K,j,re)&&(X=!0)}),X)return pe}return pe=null,q.defaultActiveFirst&&Fe(ne,function(K,re){!pe&&K&&!K.props.disabled&&(pe=He(K,j,re))}),pe}function un(q){if(!q)return;var ue=this.instanceArray.indexOf(q);ue!==-1?this.instanceArray[ue]=q:this.instanceArray.push(q)}var Kn=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(ne){var j;return Object(m.a)(this,pe),j=ue.call(this,ne),j.onKeyDown=function(X,K){var re=X.keyCode,ie;if(j.getFlatInstanceArray().forEach(function(he){he&&he.props.active&&he.onKeyDown&&(ie=he.onKeyDown(X))}),ie)return 1;var me=null;return(re===y.a.UP||re===y.a.DOWN)&&(me=j.step(re===y.a.UP?-1:1)),me?(X.preventDefault(),ln(j.props.store,Ar(j.props),me.props.eventKey),typeof K=="function"&&K(me),1):void 0},j.onItemHover=function(X){var K=X.key,re=X.hover;ln(j.props.store,Ar(j.props),re?K:null)},j.onDeselect=function(X){j.props.onDeselect(X)},j.onSelect=function(X){j.props.onSelect(X)},j.onClick=function(X){j.props.onClick(X)},j.onOpenChange=function(X){j.props.onOpenChange(X)},j.onDestroy=function(X){j.props.onDestroy(X)},j.getFlatInstanceArray=function(){return j.instanceArray},j.step=function(X){var K=j.getFlatInstanceArray(),re=j.props.store.getState().activeKey[Ar(j.props)],ie=K.length;if(!ie)return null;X<0&&(K=K.concat().reverse());var me=-1;if(K.every(function(Ye,Xe){return Ye&&Ye.props.eventKey===re?(me=Xe,!1):!0}),!j.props.defaultActiveFirst&&me!==-1&&mn(K.slice(me,ie-1)))return;var he=(me+1)%ie,Ee=he;do{var Pe=K[Ee];if(!Pe||Pe.props.disabled)Ee=(Ee+1)%ie;else return Pe}while(Ee!==he);return null},j.renderCommonMenuItem=function(X,K,re){var ie=j.props.store.getState(),me=Object(i.a)(j),he=me.props,Ee=He(X,he.eventKey,K),Pe=X.props;if(!Pe||typeof X.type=="string")return X;var Ye=Ee===ie.activeKey,Xe=Object(I.a)(Object(I.a)({mode:Pe.mode||he.mode,level:he.level,inlineIndent:he.inlineIndent,renderMenuItem:j.renderMenuItem,rootPrefixCls:he.prefixCls,index:K,parentMenu:he.parentMenu,manualRef:Pe.disabled?void 0:Object(g.a)(X.ref,un.bind(Object(i.a)(j))),eventKey:Ee,active:!Pe.disabled&&Ye,multiple:he.multiple,onClick:function(St){(Pe.onClick||Ke)(St),j.onClick(St)},onItemHover:j.onItemHover,motion:he.motion,subMenuOpenDelay:he.subMenuOpenDelay,subMenuCloseDelay:he.subMenuCloseDelay,forceSubMenuRender:he.forceSubMenuRender,onOpenChange:j.onOpenChange,onDeselect:j.onDeselect,onSelect:j.onSelect,builtinPlacements:he.builtinPlacements,itemIcon:Pe.itemIcon||j.props.itemIcon,expandIcon:Pe.expandIcon||j.props.expandIcon},re),{},{direction:he.direction});return(he.mode==="inline"||Be())&&(Xe.triggerSubMenuAction="click"),v.cloneElement(X,Object(I.a)(Object(I.a)({},Xe),{},{key:Ee||K}))},j.renderMenuItem=function(X,K,re){if(!X)return null;var ie=j.props.store.getState(),me={openKeys:ie.openKeys,selectedKeys:ie.selectedKeys,triggerSubMenuAction:j.props.triggerSubMenuAction,subMenuKey:re};return j.renderCommonMenuItem(X,K,me)},ne.store.setState({activeKey:Object(I.a)(Object(I.a)({},ne.store.getState().activeKey),{},Object(oe.a)({},ne.eventKey,_n(ne,ne.activeKey)))}),j.instanceArray=[],j}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(j){return this.props.visible||j.visible||this.props.className!==j.className||!A()(this.props.style,j.style)}},{key:"componentDidUpdate",value:function(j){var X=this.props,K="activeKey"in X?X.activeKey:X.store.getState().activeKey[Ar(X)],re=_n(X,K);if(re!==K)ln(X.store,Ar(X),re);else if("activeKey"in j){var ie=_n(j,j.activeKey);re!==ie&&ln(X.store,Ar(X),re)}}},{key:"render",value:function(){var j=this,X=Object(l.a)({},this.props);this.instanceArray=[];var K=U()(X.prefixCls,X.className,"".concat(X.prefixCls,"-").concat(X.mode)),re={className:K,role:X.role||"menu"};X.id&&(re.id=X.id),X.focusable&&(re.tabIndex=0,re.onKeyDown=this.onKeyDown);var ie=X.prefixCls,me=X.eventKey,he=X.visible,Ee=X.level,Pe=X.mode,Ye=X.overflowedIndicator,Xe=X.theme;return Qe.forEach(function(it){return delete X[it]}),delete X.onClick,v.createElement(sn,Object(l.a)({},X,{prefixCls:ie,mode:Pe,tag:"ul",level:Ee,theme:Xe,visible:he,overflowedIndicator:Ye},re),Object(M.a)(X.children).map(function(it,St){return j.renderMenuItem(it,St,me||"0-menu-")}))}}]),pe}(v.Component);Kn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:Ke};var Hn=Object(e.b)()(Kn),wn=Hn,vn=W("Kwbf");function kn(q,ue,pe){var ne=q.prefixCls,j=q.motion,X=q.defaultMotions,K=X===void 0?{}:X,re=q.openAnimation,ie=q.openTransitionName,me=ue.switchingModeFromInline;if(j)return j;if(Object(k.a)(re)==="object"&&re)Object(vn.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof re=="string")return{motionName:"".concat(ne,"-open-").concat(re)};if(ie)return{motionName:ie};var he=K[pe];return he||(me?null:K.other)}var Fr=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(ne){var j;Object(m.a)(this,pe),j=ue.call(this,ne),j.onSelect=function(re){var ie=Object(i.a)(j),me=ie.props;if(me.selectable){var he=j.store.getState(),Ee=he.selectedKeys,Pe=re.key;me.multiple?Ee=Ee.concat([Pe]):Ee=[Pe],"selectedKeys"in me||j.store.setState({selectedKeys:Ee}),me.onSelect(Object(I.a)(Object(I.a)({},re),{},{selectedKeys:Ee}))}},j.onClick=function(re){var ie=j.getRealMenuMode(),me=Object(i.a)(j),he=me.store,Ee=me.props.onOpenChange;ie!=="inline"&&!("openKeys"in j.props)&&(he.setState({openKeys:[]}),Ee([])),j.props.onClick(re)},j.onKeyDown=function(re,ie){j.innerMenu.getWrappedInstance().onKeyDown(re,ie)},j.onOpenChange=function(re){var ie=Object(i.a)(j),me=ie.props,he=j.store.getState().openKeys.concat(),Ee=!1,Pe=function(Xe){var it=!1;if(Xe.open)it=he.indexOf(Xe.key)===-1,it&&he.push(Xe.key);else{var St=he.indexOf(Xe.key);it=St!==-1,it&&he.splice(St,1)}Ee=Ee||it};Array.isArray(re)?re.forEach(Pe):Pe(re),Ee&&("openKeys"in j.props||j.store.setState({openKeys:he}),me.onOpenChange(he))},j.onDeselect=function(re){var ie=Object(i.a)(j),me=ie.props;if(me.selectable){var he=j.store.getState().selectedKeys.concat(),Ee=re.key,Pe=he.indexOf(Ee);Pe!==-1&&he.splice(Pe,1),"selectedKeys"in me||j.store.setState({selectedKeys:he}),me.onDeselect(Object(I.a)(Object(I.a)({},re),{},{selectedKeys:he}))}},j.onMouseEnter=function(re){j.restoreModeVerticalFromInline();var ie=j.props.onMouseEnter;ie&&ie(re)},j.onTransitionEnd=function(re){var ie=re.propertyName==="width"&&re.target===re.currentTarget,me=re.target.className,he=Object.prototype.toString.call(me)==="[object SVGAnimatedString]"?me.animVal:me,Ee=re.propertyName==="font-size"&&he.indexOf("anticon")>=0;(ie||Ee)&&j.restoreModeVerticalFromInline()},j.setInnerMenu=function(re){j.innerMenu=re},j.isRootMenu=!0;var X=ne.defaultSelectedKeys,K=ne.defaultOpenKeys;return"selectedKeys"in ne&&(X=ne.selectedKeys||[]),"openKeys"in ne&&(K=ne.openKeys||[]),j.store=Object(e.c)({selectedKeys:X,openKeys:K,activeKey:{"0-menu-":_n(ne,ne.activeKey)}}),j.state={switchingModeFromInline:!1,prevProps:ne,inlineOpenKeys:[],store:j.store},j}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(j){var X=this.props,K=X.siderCollapsed,re=X.inlineCollapsed,ie=X.onOpenChange;(!j.inlineCollapsed&&re||!j.siderCollapsed&&K)&&ie([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var j=this.props.collapsedWidth,X=this.store,K=this.prevOpenKeys,re=this.getInlineCollapsed()&&(j===0||j==="0"||j==="0px");re?(this.prevOpenKeys=X.getState().openKeys.concat(),this.store.setState({openKeys:[]})):K&&(this.store.setState({openKeys:K}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var j=this.props.mode,X=this.state.switchingModeFromInline,K=this.getInlineCollapsed();return X&&K?"inline":K?"vertical":j}},{key:"getInlineCollapsed",value:function(){var j=this.props,X=j.inlineCollapsed,K=j.siderCollapsed;return K!==void 0?K:X}},{key:"restoreModeVerticalFromInline",value:function(){var j=this.state.switchingModeFromInline;j&&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 j=Object(I.a)({},Object(p.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),X=this.getRealMenuMode();return j.className+=" ".concat(j.prefixCls,"-root"),j.direction==="rtl"&&(j.className+=" ".concat(j.prefixCls,"-rtl")),j=Object(I.a)(Object(I.a)({},j),{},{mode:X,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:kn(this.props,this.state,X)}),delete j.openAnimation,delete j.openTransitionName,v.createElement(e.a,{store:this.store},v.createElement(wn,Object(l.a)({},j,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(j,X){var K=X.prevProps,re=X.store,ie=re.getState(),me={},he={prevProps:j};return K.mode==="inline"&&j.mode!=="inline"&&(he.switchingModeFromInline=!0),"openKeys"in j?me.openKeys=j.openKeys||[]:((j.inlineCollapsed&&!K.inlineCollapsed||j.siderCollapsed&&!K.siderCollapsed)&&(he.switchingModeFromInline=!0,he.inlineOpenKeys=ie.openKeys,me.openKeys=[]),(!j.inlineCollapsed&&K.inlineCollapsed||!j.siderCollapsed&&K.siderCollapsed)&&(me.openKeys=X.inlineOpenKeys,he.inlineOpenKeys=[])),Object.keys(me).length&&re.setState(me),he}}]),pe}(v.Component);Fr.defaultProps={selectable:!0,onClick:Ke,onSelect:Ke,onOpenChange:Ke,onDeselect:Ke,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:v.createElement("span",null,"\xB7\xB7\xB7")};var In=Fr,dn=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(){var ne;return Object(m.a)(this,pe),ne=ue.apply(this,arguments),ne.onKeyDown=function(j){var X=j.keyCode;return X===y.a.ENTER?(ne.onClick(j),!0):void 0},ne.onMouseLeave=function(j){var X=ne.props,K=X.eventKey,re=X.onItemHover,ie=X.onMouseLeave;re({key:K,hover:!1}),ie({key:K,domEvent:j})},ne.onMouseEnter=function(j){var X=ne.props,K=X.eventKey,re=X.onItemHover,ie=X.onMouseEnter;re({key:K,hover:!0}),ie({key:K,domEvent:j})},ne.onClick=function(j){var X=ne.props,K=X.eventKey,re=X.multiple,ie=X.onClick,me=X.onSelect,he=X.onDeselect,Ee=X.isSelected,Pe={key:K,keyPath:[K],item:Object(i.a)(ne),domEvent:j};ie(Pe),re?Ee?he(Pe):me(Pe):Ee||me(Pe)},ne.saveNode=function(j){ne.node=j},ne}return Object(c.a)(pe,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var j=this.props;j.onDestroy&&j.onDestroy(j.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 j,X=Object(I.a)({},this.props),K=U()(this.getPrefixCls(),X.className,(j={},Object(oe.a)(j,this.getActiveClassName(),!X.disabled&&X.active),Object(oe.a)(j,this.getSelectedClassName(),X.isSelected),Object(oe.a)(j,this.getDisabledClassName(),X.disabled),j)),re=Object(I.a)(Object(I.a)({},X.attribute),{},{title:typeof X.title=="string"?X.title:void 0,className:K,role:X.role||"menuitem","aria-disabled":X.disabled});X.role==="option"?re=Object(I.a)(Object(I.a)({},re),{},{role:"option","aria-selected":X.isSelected}):(X.role===null||X.role==="none")&&(re.role="none");var ie={onClick:X.disabled?null:this.onClick,onMouseLeave:X.disabled?null:this.onMouseLeave,onMouseEnter:X.disabled?null:this.onMouseEnter},me=Object(I.a)({},X.style);X.mode==="inline"&&(X.direction==="rtl"?me.paddingRight=X.inlineIndent*X.level:me.paddingLeft=X.inlineIndent*X.level),Qe.forEach(function(Ee){return delete X[Ee]}),delete X.direction;var he=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(he=v.createElement(this.props.itemIcon,this.props)),v.createElement("li",Object(l.a)({},Object(p.a)(X,["onClick","onMouseEnter","onMouseLeave","onSelect"]),re,ie,{style:me,ref:this.saveNode}),X.children,he)}}]),pe}(v.Component);dn.isMenuItem=!0,dn.defaultProps={onSelect:Ke,onMouseEnter:Ke,onMouseLeave:Ke,manualRef:Ke};var Nn=Object(e.b)(function(q,ue){var pe=q.activeKey,ne=q.selectedKeys,j=ue.eventKey,X=ue.subMenuKey;return{active:pe[X]===j,isSelected:Array.isArray(ne)?ne.indexOf(j)!==-1:ne===j}})(dn),On=Nn,gn=function(q){Object(n.a)(pe,q);var ue=Object(t.a)(pe);function pe(){var ne;return Object(m.a)(this,pe),ne=ue.apply(this,arguments),ne.renderInnerMenuItem=function(j){var X=ne.props,K=X.renderMenuItem,re=X.index;return K(j,re,ne.props.subMenuKey)},ne}return Object(c.a)(pe,[{key:"render",value:function(){var j=Object(l.a)({},this.props),X=j.className,K=X===void 0?"":X,re=j.rootPrefixCls,ie="".concat(re,"-item-group-title"),me="".concat(re,"-item-group-list"),he=j.title,Ee=j.children;return Qe.forEach(function(Pe){return delete j[Pe]}),delete j.direction,v.createElement("li",Object(l.a)({},j,{onClick:function(Ye){return Ye.stopPropagation()},className:"".concat(K," ").concat(re,"-item-group")}),v.createElement("div",{className:ie,title:typeof he=="string"?he:void 0},he),v.createElement("ul",{className:me},v.Children.map(Ee,this.renderInnerMenuItem)))}}]),pe}(v.Component);gn.isMenuItemGroup=!0,gn.defaultProps={disabled:!0};var Vn=gn,Un=function(ue){var pe=ue.className,ne=ue.rootPrefixCls,j=ue.style;return v.createElement("li",{className:"".concat(pe," ").concat(ne,"-item-divider"),style:j})};Un.defaultProps={disabled:!0,className:"",style:{}};var Bn=Un,Gr=In,jn=W("eDIo");function Xn(q,ue){var pe=q.prefixCls,ne=q.editable,j=q.locale,X=q.style;return!ne||ne.showAdd===!1?null:v.createElement("button",{ref:ue,type:"button",className:"".concat(pe,"-nav-add"),style:X,"aria-label":(j==null?void 0:j.addAriaLabel)||"Add tab",onClick:function(re){ne.onEdit("add",{event:re})}},ne.addIcon||"+")}var Rn=v.forwardRef(Xn);function $n(q,ue){var pe=q.prefixCls,ne=q.id,j=q.tabs,X=q.locale,K=q.mobile,re=q.moreIcon,ie=re===void 0?"More":re,me=q.moreTransitionName,he=q.style,Ee=q.className,Pe=q.editable,Ye=q.tabBarGutter,Xe=q.rtl,it=q.onTabClick,St=Object(v.useState)(!1),Mt=Object(N.a)(St,2),Rt=Mt[0],Ut=Mt[1],kt=Object(v.useState)(null),Dt=Object(N.a)(kt,2),Pt=Dt[0],Vt=Dt[1],Ft="".concat(ne,"-more-popup"),fr="".concat(pe,"-dropdown"),nr=Pt!==null?"".concat(Ft,"-").concat(Pt):null,xt=X==null?void 0:X.dropdownAriaLabel,Et=v.createElement(Gr,{onClick:function(ar){var hr=ar.key,Dr=ar.domEvent;it(hr,Dr),Ut(!1)},id:Ft,tabIndex:-1,role:"listbox","aria-activedescendant":nr,selectedKeys:[Pt],"aria-label":xt!==void 0?xt:"expanded dropdown"},j.map(function($t){return v.createElement(On,{key:$t.key,id:"".concat(Ft,"-").concat($t.key),role:"option","aria-controls":ne&&"".concat(ne,"-panel-").concat($t.key),disabled:$t.disabled},$t.tab)}));function Kt($t){for(var ar=j.filter(function(Xr){return!Xr.disabled}),hr=ar.findIndex(function(Xr){return Xr.key===Pt})||0,Dr=ar.length,Vr=0;Vr<Dr;Vr+=1){hr=(hr+$t+Dr)%Dr;var gr=ar[hr];if(!gr.disabled){Vt(gr.key);return}}}function zt($t){var ar=$t.which;if(!Rt){[y.a.DOWN,y.a.SPACE,y.a.ENTER].includes(ar)&&(Ut(!0),$t.preventDefault());return}switch(ar){case y.a.UP:Kt(-1),$t.preventDefault();break;case y.a.DOWN:Kt(1),$t.preventDefault();break;case y.a.ESC:Ut(!1);break;case y.a.SPACE:case y.a.ENTER:Pt!==null&&it(Pt,$t);break}}Object(v.useEffect)(function(){var $t=document.getElementById(nr);$t&&$t.scrollIntoView&&$t.scrollIntoView(!1)},[Pt]),Object(v.useEffect)(function(){Rt||Vt(null)},[Rt]);var vt=Object(oe.a)({},Xe?"marginLeft":"marginRight",Ye);j.length||(vt.visibility="hidden",vt.order=1);var Xt=U()(Object(oe.a)({},"".concat(fr,"-rtl"),Xe)),dr=K?null:v.createElement(jn.a,{prefixCls:fr,overlay:Et,trigger:["hover"],visible:Rt,transitionName:me,onVisibleChange:Ut,overlayClassName:Xt,mouseEnterDelay:.1,mouseLeaveDelay:.1},v.createElement("button",{type:"button",className:"".concat(pe,"-nav-more"),style:vt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":Ft,id:"".concat(ne,"-more"),"aria-expanded":Rt,onKeyDown:zt},ie));return v.createElement("div",{className:U()("".concat(pe,"-nav-operations"),Ee),style:he,ref:ue},dr,v.createElement(Rn,{prefixCls:pe,locale:X,editable:Pe}))}var Yn=v.forwardRef($n),ze=Object(v.createContext)(null),Se=.1,Le=.01,Je=20,mt=Math.pow(.995,Je);function yt(){var q=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(q)||/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(q.substr(0,4)))}function er(q,ue){var pe=Object(v.useState)(),ne=Object(N.a)(pe,2),j=ne[0],X=ne[1],K=Object(v.useState)(0),re=Object(N.a)(K,2),ie=re[0],me=re[1],he=Object(v.useState)(0),Ee=Object(N.a)(he,2),Pe=Ee[0],Ye=Ee[1],Xe=Object(v.useState)(),it=Object(N.a)(Xe,2),St=it[0],Mt=it[1],Rt=Object(v.useRef)();function Ut(xt){var Et=xt.touches[0],Kt=Et.screenX,zt=Et.screenY;X({x:Kt,y:zt}),window.clearInterval(Rt.current)}function kt(xt){if(!j)return;xt.preventDefault();var Et=xt.touches[0],Kt=Et.screenX,zt=Et.screenY;X({x:Kt,y:zt});var vt=Kt-j.x,Xt=zt-j.y;ue(vt,Xt);var dr=Date.now();me(dr),Ye(dr-ie),Mt({x:vt,y:Xt})}function Dt(){if(!j)return;if(X(null),Mt(null),St){var xt=St.x/Pe,Et=St.y/Pe,Kt=Math.abs(xt),zt=Math.abs(Et);if(Math.max(Kt,zt)<Se)return;var vt=xt,Xt=Et;Rt.current=window.setInterval(function(){if(Math.abs(vt)<Le&&Math.abs(Xt)<Le){window.clearInterval(Rt.current);return}vt*=mt,Xt*=mt,ue(vt*Je,Xt*Je)},Je)}}var Pt=Object(v.useRef)(0),Vt=Object(v.useRef)(!1),Ft=Object(v.useRef)();function fr(xt){var Et=xt.deltaX,Kt=xt.deltaY,zt=0,vt=Math.abs(Et),Xt=Math.abs(Kt);vt===Xt?zt=Ft.current==="x"?Et:Kt:vt>Xt?(zt=Et,Ft.current="x"):(zt=Kt,Ft.current="y");var dr=Date.now();dr-Pt.current>100&&(Vt.current=!1),(ue(-zt,-zt)||Vt.current)&&(xt.preventDefault(),Vt.current=!0),Pt.current=dr}var nr=Object(v.useRef)(null);nr.current={onTouchStart:Ut,onTouchMove:kt,onTouchEnd:Dt,onWheel:fr},v.useEffect(function(){function xt(vt){nr.current.onTouchStart(vt)}function Et(vt){nr.current.onTouchMove(vt)}function Kt(vt){nr.current.onTouchEnd(vt)}function zt(vt){nr.current.onWheel(vt)}return document.addEventListener("touchmove",Et,{passive:!1}),document.addEventListener("touchend",Kt,{passive:!1}),q.current.addEventListener("touchstart",xt,{passive:!1}),q.current.addEventListener("wheel",zt),function(){document.removeEventListener("touchmove",Et),document.removeEventListener("touchend",Kt)}},[])}function Tr(){var q=Object(v.useRef)(new Map);function ue(ne){return q.current.has(ne)||q.current.set(ne,v.createRef()),q.current.get(ne)}function pe(ne){q.current.delete(ne)}return[ue,pe]}function xr(q,ue){var pe=v.useRef(q),ne=v.useState({}),j=Object(N.a)(ne,2),X=j[1];function K(re){var ie=typeof re=="function"?re(pe.current):re;ie!==pe.current&&ue(ie,pe.current),pe.current=ie,X({})}return[pe.current,K]}var Jt=function(ue){var pe=ue.position,ne=ue.prefixCls,j=ue.extra;if(!j)return null;var X,K=j;return pe==="right"&&(X=K.right||!K.left&&K||null),pe==="left"&&(X=K.left||null),X?v.createElement("div",{className:"".concat(ne,"-extra-content")},X):null};function An(q,ue){var pe,ne=v.useContext(ze),j=ne.prefixCls,X=ne.tabs,K=q.className,re=q.style,ie=q.id,me=q.animated,he=q.activeKey,Ee=q.rtl,Pe=q.extra,Ye=q.editable,Xe=q.locale,it=q.tabPosition,St=q.tabBarGutter,Mt=q.children,Rt=q.onTabClick,Ut=q.onTabScroll,kt=Object(v.useRef)(),Dt=Object(v.useRef)(),Pt=Object(v.useRef)(),Vt=Object(v.useRef)(),Ft=Tr(),fr=Object(N.a)(Ft,2),nr=fr[0],xt=fr[1],Et=it==="top"||it==="bottom",Kt=xr(0,function(ir,Ht){Et&&Ut&&Ut({direction:ir>Ht?"left":"right"})}),zt=Object(N.a)(Kt,2),vt=zt[0],Xt=zt[1],dr=xr(0,function(ir,Ht){!Et&&Ut&&Ut({direction:ir>Ht?"top":"bottom"})}),$t=Object(N.a)(dr,2),ar=$t[0],hr=$t[1],Dr=Object(v.useState)(0),Vr=Object(N.a)(Dr,2),gr=Vr[0],Xr=Vr[1],yn=Object(v.useState)(0),Zr=Object(N.a)(yn,2),qr=Zr[0],Cr=Zr[1],Wr=Object(v.useState)(0),Pr=Object(N.a)(Wr,2),wr=Pr[0],Dn=Pr[1],Pn=Object(v.useState)(0),Fn=Object(N.a)(Pn,2),ur=Fn[0],xn=Fn[1],Wn=Object(v.useState)(null),cr=Object(N.a)(Wn,2),tr=cr[0],Lr=cr[1],Gi=Object(v.useState)(null),gi=Object(N.a)(Gi,2),zn=gi[0],Vi=gi[1],Xi=Object(v.useState)(0),yi=Object(N.a)(Xi,2),$i=yi[0],Yi=yi[1],Qi=Object(v.useState)(0),bi=Object(N.a)(Qi,2),Ji=bi[0],Zi=bi[1],qi=E(new Map),Ei=Object(N.a)(qi,2),ea=Ei[0],ta=Ei[1],ii=s(X,ea,gr),xi="".concat(j,"-nav-operations-hidden"),Qn=0,Jn=0;Et?Ee?(Qn=0,Jn=Math.max(0,gr-tr)):(Qn=Math.min(0,tr-gr),Jn=0):(Qn=Math.min(0,zn-qr),Jn=0);function ai(ir){return ir<Qn?[Qn,!1]:ir>Jn?[Jn,!1]:[ir,!0]}var Ci=Object(v.useRef)(),ra=Object(v.useState)(),Ti=Object(N.a)(ra,2),oi=Ti[0],Si=Ti[1];function si(){Si(Date.now())}function li(){window.clearTimeout(Ci.current)}er(kt,function(ir,Ht){var Or=!1;function en(qn,ei){qn(function(ti){var ri=ai(ti+ei),Gn=Object(N.a)(ri,2),hi=Gn[0],fi=Gn[1];return Or=fi,hi})}if(Et){if(tr>=gr)return Or;en(Xt,ir)}else{if(zn>=qr)return Or;en(hr,Ht)}return li(),si(),Or}),Object(v.useEffect)(function(){return li(),oi&&(Ci.current=window.setTimeout(function(){Si(0)},100)),li},[oi]);function _i(){var ir=arguments.length>0&&arguments[0]!==void 0?arguments[0]:he,Ht=ii.get(ir);if(!Ht)return;if(Et){var Or=vt;Ee?Ht.right<vt?Or=Ht.right:Ht.right+Ht.width>vt+tr&&(Or=Ht.right+Ht.width-tr):Ht.left<-vt?Or=-Ht.left:Ht.left+Ht.width>-vt+tr&&(Or=-(Ht.left+Ht.width-tr)),hr(0),Xt(ai(Or)[0])}else{var en=ar;Ht.top<-ar?en=-Ht.top:Ht.top+Ht.height>-ar+zn&&(en=-(Ht.top+Ht.height-zn)),Xt(0),hr(ai(en)[0])}}var na=d(ii,{width:tr,height:zn,left:vt,top:ar},{width:wr,height:ur},{width:$i,height:Ji},Object(I.a)(Object(I.a)({},q),{},{tabs:X})),wi=Object(N.a)(na,2),ia=wi[0],aa=wi[1],oa=X.map(function(ir){var Ht=ir.key;return v.createElement(r,{id:ie,prefixCls:j,key:Ht,rtl:Ee,tab:ir,closable:ir.closable,editable:Ye,active:Ht===he,tabPosition:it,tabBarGutter:St,renderWrapper:Mt,removeAriaLabel:Xe==null?void 0:Xe.removeAriaLabel,ref:nr(Ht),onClick:function(en){Rt(Ht,en)},onRemove:function(){xt(Ht)},onFocus:function(){_i(Ht),si(),Ee||(kt.current.scrollLeft=0),kt.current.scrollTop=0}})}),ui=C(function(){var ir,Ht,Or,en,qn,ei,ti,ri,Gn,hi=((ir=kt.current)===null||ir===void 0?void 0:ir.offsetWidth)||0,fi=((Ht=kt.current)===null||Ht===void 0?void 0:Ht.offsetHeight)||0,ki=((Or=Vt.current)===null||Or===void 0?void 0:Or.offsetWidth)||0,Ii=((en=Vt.current)===null||en===void 0?void 0:en.offsetHeight)||0,ha=((qn=Pt.current)===null||qn===void 0?void 0:qn.offsetWidth)||0,fa=((ei=Pt.current)===null||ei===void 0?void 0:ei.offsetHeight)||0;Lr(hi),Vi(fi),Yi(ki),Zi(Ii);var Ni=(((ti=Dt.current)===null||ti===void 0?void 0:ti.offsetWidth)||0)-ki,Ui=(((ri=Dt.current)===null||ri===void 0?void 0:ri.offsetHeight)||0)-Ii;Xr(Ni),Cr(Ui);var Bi=(Gn=Pt.current)===null||Gn===void 0?void 0:Gn.className.includes(xi);Dn(Ni-(Bi?0:ha)),xn(Ui-(Bi?0:fa)),ta(function(){var ji=new Map;return X.forEach(function(pa){var Fi=pa.key,ni=nr(Fi).current;ni&&ji.set(Fi,{width:ni.offsetWidth,height:ni.offsetHeight,left:ni.offsetLeft,top:ni.offsetTop})}),ji})}),sa=X.slice(0,ia),la=X.slice(aa+1),Oi=[].concat(Object(w.a)(sa),Object(w.a)(la)),ua=Object(v.useState)(),Ri=Object(N.a)(ua,2),da=Ri[0],ca=Ri[1],Ln=ii.get(he),Ai=Object(v.useRef)();function Di(){T.a.cancel(Ai.current)}Object(v.useEffect)(function(){var ir={};return Ln&&(Et?(Ee?ir.right=Ln.right:ir.left=Ln.left,ir.width=Ln.width):(ir.top=Ln.top,ir.height=Ln.height)),Di(),Ai.current=T()(function(){ca(ir)}),Di},[Ln,Et,Ee]),Object(v.useEffect)(function(){_i()},[he,Ln,ii,Et]),Object(v.useEffect)(function(){ui()},[Ee,St,he,X.map(function(ir){return ir.key}).join("_")]);var Pi=!!Oi.length,Zn="".concat(j,"-nav-wrap"),di,ci,Li,Mi;return Et?Ee?(ci=vt>0,di=vt+tr<gr):(di=vt<0,ci=-vt+tr<gr):(Li=ar<0,Mi=-ar+zn<qr),v.createElement("div",{ref:ue,role:"tablist",className:U()("".concat(j,"-nav"),K),style:re,onKeyDown:function(){si()}},v.createElement(Jt,{position:"left",extra:Pe,prefixCls:j}),v.createElement(O.a,{onResize:ui},v.createElement("div",{className:U()(Zn,(pe={},Object(oe.a)(pe,"".concat(Zn,"-ping-left"),di),Object(oe.a)(pe,"".concat(Zn,"-ping-right"),ci),Object(oe.a)(pe,"".concat(Zn,"-ping-top"),Li),Object(oe.a)(pe,"".concat(Zn,"-ping-bottom"),Mi),pe)),ref:kt},v.createElement(O.a,{onResize:ui},v.createElement("div",{ref:Dt,className:"".concat(j,"-nav-list"),style:{transform:"translate(".concat(vt,"px, ").concat(ar,"px)"),transition:oi?"none":void 0}},oa,v.createElement(Rn,{ref:Vt,prefixCls:j,locale:Xe,editable:Ye,style:{visibility:Pi?"hidden":null}}),v.createElement("div",{className:U()("".concat(j,"-ink-bar"),Object(oe.a)({},"".concat(j,"-ink-bar-animated"),me.inkBar)),style:da}))))),v.createElement(Yn,Object.assign({},q,{ref:Pt,prefixCls:j,tabs:Oi,className:!Pi&&xi})),v.createElement(Jt,{position:"right",extra:Pe,prefixCls:j}))}var cn=v.forwardRef(An);function Wi(q){var ue=q.id,pe=q.activeKey,ne=q.animated,j=q.tabPosition,X=q.rtl,K=q.destroyInactiveTabPane,re=v.useContext(ze),ie=re.prefixCls,me=re.tabs,he=ne.tabPane,Ee=me.findIndex(function(Pe){return Pe.key===pe});return v.createElement("div",{className:U()("".concat(ie,"-content-holder"))},v.createElement("div",{className:U()("".concat(ie,"-content"),"".concat(ie,"-content-").concat(j),Object(oe.a)({},"".concat(ie,"-content-animated"),he)),style:Ee&&he?Object(oe.a)({},X?"marginRight":"marginLeft","-".concat(Ee,"00%")):null},me.map(function(Pe){return v.cloneElement(Pe.node,{key:Pe.key,prefixCls:ie,tabKey:Pe.key,id:ue,animated:he,active:Pe.key===pe,destroyInactiveTabPane:K})})))}function pi(q){var ue=q.prefixCls,pe=q.forceRender,ne=q.className,j=q.style,X=q.id,K=q.active,re=q.animated,ie=q.destroyInactiveTabPane,me=q.tabKey,he=q.children,Ee=v.useState(pe),Pe=Object(N.a)(Ee,2),Ye=Pe[0],Xe=Pe[1];v.useEffect(function(){K?Xe(!0):ie&&Xe(!1)},[K,ie]);var it={};return K||(re?(it.visibility="hidden",it.height=0,it.overflowY="hidden"):it.display="none"),v.createElement("div",{id:X&&"".concat(X,"-panel-").concat(me),role:"tabpanel",tabIndex:K?0:-1,"aria-labelledby":X&&"".concat(X,"-tab-").concat(me),"aria-hidden":!K,style:Object(I.a)(Object(I.a)({},it),j),className:U()("".concat(ue,"-tabpane"),K&&"".concat(ue,"-tabpane-active"),ne)},(K||Ye||pe)&&he)}var mi=0;function Ki(q){return Object(M.a)(q).map(function(ue){if(v.isValidElement(ue)){var pe=ue.key!==void 0?String(ue.key):void 0;return Object(I.a)(Object(I.a)({key:pe},ue.props),{},{node:ue})}return null}).filter(function(ue){return ue})}function Hi(q,ue){var pe,ne=q.id,j=q.prefixCls,X=j===void 0?"rc-tabs":j,K=q.className,re=q.children,ie=q.direction,me=q.activeKey,he=q.defaultActiveKey,Ee=q.editable,Pe=q.animated,Ye=q.tabPosition,Xe=Ye===void 0?"top":Ye,it=q.tabBarGutter,St=q.tabBarStyle,Mt=q.tabBarExtraContent,Rt=q.locale,Ut=q.moreIcon,kt=q.moreTransitionName,Dt=q.destroyInactiveTabPane,Pt=q.renderTabBar,Vt=q.onChange,Ft=q.onTabClick,fr=q.onTabScroll,nr=Object(S.a)(q,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),xt=Ki(re),Et=ie==="rtl",Kt;Pe===!1?Kt={inkBar:!1,tabPane:!1}:Kt=Object(I.a)({inkBar:!0,tabPane:!1},Pe!==!0?Pe:null);var zt=Object(v.useState)(!1),vt=Object(N.a)(zt,2),Xt=vt[0],dr=vt[1];Object(v.useEffect)(function(){dr(yt())},[]);var $t=Object(R.a)(function(){var ur;return(ur=xt[0])===null||ur===void 0?void 0:ur.key},{value:me,defaultValue:he}),ar=Object(N.a)($t,2),hr=ar[0],Dr=ar[1],Vr=Object(v.useState)(function(){return xt.findIndex(function(ur){return ur.key===hr})}),gr=Object(N.a)(Vr,2),Xr=gr[0],yn=gr[1];Object(v.useEffect)(function(){var ur=xt.findIndex(function(Wn){return Wn.key===hr});if(ur===-1){var xn;ur=Math.max(0,Math.min(Xr,xt.length-1)),Dr((xn=xt[ur])===null||xn===void 0?void 0:xn.key)}yn(ur)},[xt.map(function(ur){return ur.key}).join("_"),hr,Xr]);var Zr=Object(R.a)(null,{value:ne}),qr=Object(N.a)(Zr,2),Cr=qr[0],Wr=qr[1],Pr=Xe;Xt&&!["left","right"].includes(Xe)&&(Pr="top"),Object(v.useEffect)(function(){ne||(Wr("rc-tabs-".concat(mi)),mi+=1)},[]);function wr(ur,xn){Ft==null||Ft(ur,xn),Dr(ur),Vt==null||Vt(ur)}var Dn={id:Cr,activeKey:hr,animated:Kt,tabPosition:Pr,rtl:Et,mobile:Xt},Pn,Fn=Object(I.a)(Object(I.a)({},Dn),{},{editable:Ee,locale:Rt,moreIcon:Ut,moreTransitionName:kt,tabBarGutter:it,onTabClick:wr,onTabScroll:fr,extra:Mt,style:St,panes:re});return Pt?Pn=Pt(Fn,cn):Pn=v.createElement(cn,Object.assign({},Fn)),v.createElement(ze.Provider,{value:{tabs:xt,prefixCls:X}},v.createElement("div",Object.assign({ref:ue,id:ne,className:U()(X,"".concat(X,"-").concat(Pr),(pe={},Object(oe.a)(pe,"".concat(X,"-mobile"),Xt),Object(oe.a)(pe,"".concat(X,"-editable"),Ee),Object(oe.a)(pe,"".concat(X,"-rtl"),Et),pe),K)},nr),Pn,v.createElement(Wi,Object.assign({destroyInactiveTabPane:Dt},Dn,{animated:Kt}))))}var vi=v.forwardRef(Hi);vi.TabPane=pi;var zi=vi,ma=Ge.b=zi},n6Qo:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return M});var oe=W("q1tI"),N=W("biw7"),S=W("fyJ8");function I(R){var w=R.className,b=R.index,T=R.children,O=R.colSpan,C=R.rowSpan,E=oe.useContext(N.a),y=E.prefixCls,h=E.fixedInfoList,r=h[b];return oe.createElement(S.a,Object.assign({className:w,index:b,component:"td",prefixCls:y,record:null,dataIndex:null,render:function(){return{children:T,props:{colSpan:O,rowSpan:C}}}},r))}function v(R){return oe.createElement("tr",Object.assign({},R))}function x(R){var w=R.children,b=oe.useContext(N.a),T=b.prefixCls;return oe.createElement("tfoot",{className:"".concat(T,"-summary")},w)}var U=Ge.b=x,M={Cell:I,Row:v}},p5ED:function(ft,Ge,W){"use strict";var oe=W("+L6B"),N=W("2/Rp"),S=W("5Dmo"),I=W("3S7+"),v=W("k1fw"),x=W("9og8"),U=W("tJVT"),M=W("WmNS"),R=W.n(M),w=W("q1tI"),b=W.n(w),T=W("vHTk"),O=W.n(T),C=W("yEEn"),E=W("ZW9T"),y=W("1vsH"),h=W("V0Rq"),r=W("m3rI"),o=function(f){var d=f.name,l=f.data,m=f.theme,c=f.type,i=f.filename,n=f.monacoEditor,t=f.className,e=f.style,p=f.close,g=f.onClose,_=f.hasMask,A=f.otherData,k=A===void 0?{}:A,F=Object(w.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),z=Object(U.a)(F,2),J=z[0],Y=z[1],$=Object(w.useState)(""),le=Object(U.a)($,2),be=le[0],ve=le[1],ke=Object(w.useState)(),Te=Object(U.a)(ke,2),xe=Te[0],_e=Te[1],Oe=window.ENV==="build"?"/react/build/office.html":"/office.html",ce,Z=1024*1024,je=10*Z,at=Object(w.useRef)();c==="office"&&(ce=Object(y.R)(l).filesize,ce>je&&(c="other")),i&&(n.filename=i),Object(w.useEffect)(function(){var we,Fe,$e=(we=document.cookie)===null||we===void 0||((Fe=we.replace(/\s/g,""))===null||Fe===void 0)?void 0:Fe.split(";");$e==null||$e.map(function(Qe){var Ve=Qe.split("=");Ve[0]==="_educoder_session"&&ve(Ve[1])})},[]),Object(w.useEffect)(function(){c==="office"&&rt()},[c]);var rt=function(){var we=Object(x.a)(R.a.mark(function Fe(){var $e,Qe,Ve;return R.a.wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:return console.log("data:",l),$e=l,l.startsWith("http")||($e=location.origin+$e),Qe=new URL($e).pathname.split("/").pop(),Be.next=6,Object(h.U)({attachment_id:Qe});case 6:Ve=Be.sent,_e(Ve);case 8:case"end":return Be.stop()}},Fe)}));return function(){return we.apply(this,arguments)}}(),Ke=function(){if(l.startsWith("http")||l.startsWith("/api")||l.startsWith("blob:")){He();return}Object(y.x)(i||"educoder",l,i||"educoder")},He=function(){Object(y.v)(i||"educoder",decodeURIComponent(l))};return b.a.createElement("div",{style:Object(v.a)({},e||{}),className:"".concat(_&&O.a.bgBlack," ").concat(c?O.a.wrp:"hide")},p&&b.a.createElement("div",{className:O.a.close,ref:at},b.a.createElement(I.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return at.current}},b.a.createElement("span",{onClick:He},b.a.createElement("i",{className:"icon-quxiaozhiding"}))),b.a.createElement(I.a,{title:"\u5173\u95ED",getPopupContainer:function(){return at.current}},b.a.createElement("span",{className:"",onClick:function(){g(),_e(null)}},b.a.createElement("i",{className:"icon-guanbi1"})))),b.a.createElement("div",{className:"".concat(O.a[t]," ").concat(t," ").concat(O.a.monaco," ").concat(c==="txt"?"show":"hide")},c==="txt"&&b.a.createElement(E.b,n)),c==="audio"&&b.a.createElement("audio",{src:"".concat((l==null?void 0:l.indexOf("http://"))>-1||(l==null?void 0:l.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(l),autoPlay:!0}),c==="video"&&b.a.createElement(b.a.Fragment,null,(l==null?void 0:l.indexOf("/api"))>-1?b.a.createElement("video",{controls:!0,src:"".concat(l),autoPlay:!0}):b.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(l),autoPlay:!0})),c==="office"&&xe&&b.a.createElement("iframe",{src:"".concat(Oe,"?key=").concat(xe.key,"&url=").concat(r.a.API_SERVER+xe.url,"&callbackUrl=").concat(r.a.API_SERVER+xe.callbackUrl,"&fileType=").concat(xe.fileType,"&title=").concat(xe.title,"&model=view")}),(c==="xlsx"||c==="doc"||c==="pptx"||c==="docx")&&b.a.createElement("iframe",{src:"".concat(Oe,"?key=").concat(k.key,"&url=").concat(r.a.API_SERVER+k.url,"&callbackUrl=").concat(r.a.API_SERVER+k.callbackUrl,"&fileType=").concat(k.fileType,"&title=").concat(k.title,"&model=").concat(k.model)}),c==="html"&&b.a.createElement("iframe",{src:l+"&disposition=inline"}),c==="pdf"&&b.a.createElement("embed",{className:O.a.embed,src:l,type:"application/pdf"}),c==="image"&&b.a.createElement("img",{src:"".concat((l==null?void 0:l.indexOf("http://"))>-1||(l==null?void 0:l.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(l)}),c==="other"&&b.a.createElement("div",null,b.a.createElement(N.a,{type:"primary",size:"large",onClick:Ke},b.a.createElement(C.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),c==="download"&&b.a.createElement(N.a,{type:"primary",size:"large",onClick:Ke},b.a.createElement(C.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};Ge.a=o},pIsd:function(ft,Ge,W){var oe=W("BJfS"),N=function(v){var x=/[height|width]$/;return x.test(v)},S=function(v){var x="",U=Object.keys(v);return U.forEach(function(M,R){var w=v[M];M=oe(M),N(M)&&typeof w=="number"&&(w=w+"px"),w===!0?x+=M:w===!1?x+="not "+M:x+="("+M+": "+w+")",R<U.length-1&&(x+=" and ")}),x},I=function(v){var x="";return typeof v=="string"?v:v instanceof Array?(v.forEach(function(U,M){x+=S(U),M<v.length-1&&(x+=", ")}),x):S(v)};ft.exports=I},"rAM+":function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return N});var oe=W("Qw5x");function N(S,I){var v;if(typeof Symbol=="undefined"||S[Symbol.iterator]==null){if(Array.isArray(S)||(v=Object(oe.a)(S))||I&&S&&typeof S.length=="number"){v&&(S=v);var x=0,U=function(){};return{s:U,n:function(){return x>=S.length?{done:!0}:{done:!1,value:S[x++]}},e:function(T){throw T},f:U}}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 M=!0,R=!1,w;return{s:function(){v=S[Symbol.iterator]()},n:function(){var T=v.next();return M=T.done,T},e:function(T){R=!0,w=T},f:function(){try{!M&&v.return!=null&&v.return()}finally{if(R)throw w}}}}},rUJ1:function(ft,Ge){const W=/[&<>"']/,oe=/[&<>"']/g,N=/[<>"']|&(?!#?\w+;)/,S=/[<>"']|&(?!#?\w+;)/g,I={"&":"&","<":"<",">":">",'"':""","'":"'"},v=c=>I[c];function x(c,i){if(i){if(W.test(c))return c.replace(oe,v)}else if(N.test(c))return c.replace(S,v);return c}const U=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function M(c){return c.replace(U,(i,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const R=/(^|[^\[])\^/g;function w(c,i){c=c.source||c,i=i||"";const n={replace:(t,e)=>(e=e.source||e,e=e.replace(R,"$1"),c=c.replace(t,e),n),getRegex:()=>new RegExp(c,i)};return n}const b=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(c,i,n){if(c){let t;try{t=decodeURIComponent(M(n)).replace(b,"").toLowerCase()}catch(e){return null}if(t.indexOf("javascript:")===0||t.indexOf("vbscript:")===0||t.indexOf("data:")===0)return null}i&&!T.test(n)&&(n=r(i,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(t){return null}return n}const C={},E=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function r(c,i){C[" "+c]||(E.test(c)?C[" "+c]=c+"/":C[" "+c]=d(c,"/",!0)),c=C[" "+c];const n=c.indexOf(":")===-1;return i.substring(0,2)==="//"?n?i:c.replace(y,"$1")+i:i.charAt(0)==="/"?n?i:c.replace(h,"$1")+i:c+i}const o={exec:function(){}};function s(c){let i=1,n,t;for(;i<arguments.length;i++){n=arguments[i];for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&(c[t]=n[t])}return c}function f(c,i){const n=c.replace(/\|/g,(p,g,_)=>{let A=!1,k=g;for(;--k>=0&&_[k]==="\\";)A=!A;return A?"|":" |"}),t=n.split(/ \|/);let e=0;if(t.length>i)t.splice(i);else for(;t.length<i;)t.push("");for(;e<t.length;e++)t[e]=t[e].trim().replace(/\\\|/g,"|");return t}function d(c,i,n){const t=c.length;if(t===0)return"";let e=0;for(;e<t;){const p=c.charAt(t-e-1);if(p===i&&!n)e++;else if(p!==i&&n)e++;else break}return c.substr(0,t-e)}function l(c,i){if(c.indexOf(i[1])===-1)return-1;const n=c.length;let t=0,e=0;for(;e<n;e++)if(c[e]==="\\")e++;else if(c[e]===i[0])t++;else if(c[e]===i[1]&&(t--,t<0))return e;return-1}function m(c){c&&c.sanitize&&!c.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")}ft.exports={escape:x,unescape:M,edit:w,cleanUrl:O,resolveUrl:r,noopTest:o,merge:s,splitCells:f,rtrim:d,findClosingBracket:l,checkSanitizeDeprecation:m}},sR1s:function(ft,Ge,W){"use strict";W.d(Ge,"b",function(){return I}),W.d(Ge,"a",function(){return v}),W.d(Ge,"c",function(){return x}),W.d(Ge,"d",function(){return U});var oe=W("U8pU"),N="RC_TABLE_KEY";function S(M){return M==null?[]:Array.isArray(M)?M:[M]}function I(M,R){if(!R&&typeof R!="number")return M;for(var w=S(R),b=M,T=0;T<w.length;T+=1){if(!b)return null;var O=w[T];b=b[O]}return b}function v(M){var R=[],w={};return M.forEach(function(b){for(var T=b||{},O=T.key,C=T.dataIndex,E=O||S(C).join("-")||N;w[E];)E="".concat(E,"_next");w[E]=!0,R.push(E)}),R}function x(){var M={};function R(O,C){C&&Object.keys(C).forEach(function(E){var y=C[E];y&&Object(oe.a)(y)==="object"?(O[E]=O[E]||{},R(O[E],y)):O[E]=y})}for(var w=arguments.length,b=new Array(w),T=0;T<w;T++)b[T]=arguments[T];return b.forEach(function(O){R(M,O)}),M}function U(M){return M!=null}},sboe:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return S});var oe=W("q1tI"),N=W.n(oe),S=oe.createContext(null)},t23M:function(ft,Ge,W){"use strict";var oe=W("VTBJ"),N=W("1OyB"),S=W("vuIU"),I=W("Ji7U"),v=W("LK+K"),x=W("q1tI"),U=W.n(x),M=W("m+aA"),R=W("Zm9Q"),w=W("Kwbf"),b=W("c+Xe"),T=W("bdgK"),O="rc-observer-key",C=function(E){Object(I.a)(h,E);var y=Object(v.a)(h);function h(){var r;return Object(N.a)(this,h),r=y.apply(this,arguments),r.resizeObserver=null,r.childNode=null,r.currentElement=null,r.state={width:0,height:0,offsetHeight:0,offsetWidth:0},r.onResize=function(o){var s=r.props.onResize,f=o[0].target,d=f.getBoundingClientRect(),l=d.width,m=d.height,c=f.offsetWidth,i=f.offsetHeight,n=Math.floor(l),t=Math.floor(m);if(r.state.width!==n||r.state.height!==t||r.state.offsetWidth!==c||r.state.offsetHeight!==i){var e={width:n,height:t,offsetWidth:c,offsetHeight:i};r.setState(e),s&&Promise.resolve().then(function(){s(Object(oe.a)(Object(oe.a)({},e),{},{offsetWidth:c,offsetHeight:i}))})}},r.setChildNode=function(o){r.childNode=o},r}return Object(S.a)(h,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var o=this.props.disabled;if(o){this.destroyObserver();return}var s=Object(M.a)(this.childNode||this),f=s!==this.currentElement;f&&(this.destroyObserver(),this.currentElement=s),!this.resizeObserver&&s&&(this.resizeObserver=new T.default(this.onResize),this.resizeObserver.observe(s))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var o=this.props.children,s=Object(R.a)(o);if(s.length>1)Object(w.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(s.length===0)return Object(w.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var f=s[0];if(x.isValidElement(f)&&Object(b.c)(f)){var d=f.ref;s[0]=x.cloneElement(f,{ref:Object(b.a)(d,this.setChildNode)})}return s.length===1?s[0]:s.map(function(l,m){return!x.isValidElement(l)||"key"in l&&l.key!==null?l:x.cloneElement(l,{key:"".concat(O,"-").concat(m)})})}}]),h}(x.Component);C.displayName="ResizeObserver",Ge.a=C},t6v1:function(ft,Ge,W){ft.exports=W.p+"static/a2.d632a3a4.svg"},uf8j:function(ft,Ge,W){ft.exports=W.p+"static/a.2d0eaf1f.svg"},ulZh:function(ft,Ge,W){typeof window!="undefined"&&function(N,S){ft.exports=S()}(this,function(){return function(oe){var N={};function S(I){if(N[I])return N[I].exports;var v=N[I]={i:I,l:!1,exports:{}};return oe[I].call(v.exports,v,v.exports,S),v.l=!0,v.exports}return S.m=oe,S.c=N,S.d=function(I,v,x){S.o(I,v)||Object.defineProperty(I,v,{enumerable:!0,get:x})},S.r=function(I){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(I,"__esModule",{value:!0})},S.t=function(I,v){if(v&1&&(I=S(I)),v&8)return I;if(v&4&&typeof I=="object"&&I&&I.__esModule)return I;var x=Object.create(null);if(S.r(x),Object.defineProperty(x,"default",{enumerable:!0,value:I}),v&2&&typeof I!="string")for(var U in I)S.d(x,U,function(M){return I[M]}.bind(null,U));return x},S.n=function(I){var v=I&&I.__esModule?function(){return I.default}:function(){return I};return S.d(v,"a",v),v},S.o=function(I,v){return Object.prototype.hasOwnProperty.call(I,v)},S.p="/dist/",S(S.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(oe,N,S){"use strict";var I=Object.prototype.hasOwnProperty,v="~";function x(){}Object.create&&(x.prototype=Object.create(null),new x().__proto__||(v=!1));function U(b,T,O){this.fn=b,this.context=T,this.once=O||!1}function M(b,T,O,C,E){if(typeof O!="function")throw new TypeError("The listener must be a function");var y=new U(O,C||b,E),h=v?v+T:T;return b._events[h]?b._events[h].fn?b._events[h]=[b._events[h],y]:b._events[h].push(y):(b._events[h]=y,b._eventsCount++),b}function R(b,T){--b._eventsCount===0?b._events=new x:delete b._events[T]}function w(){this._events=new x,this._eventsCount=0}w.prototype.eventNames=function(){var T=[],O,C;if(this._eventsCount===0)return T;for(C in O=this._events)I.call(O,C)&&T.push(v?C.slice(1):C);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(O)):T},w.prototype.listeners=function(T){var O=v?v+T:T,C=this._events[O];if(!C)return[];if(C.fn)return[C.fn];for(var E=0,y=C.length,h=new Array(y);E<y;E++)h[E]=C[E].fn;return h},w.prototype.listenerCount=function(T){var O=v?v+T:T,C=this._events[O];return C?C.fn?1:C.length:0},w.prototype.emit=function(T,O,C,E,y,h){var r=v?v+T:T;if(!this._events[r])return!1;var o=this._events[r],s=arguments.length,f,d;if(o.fn){o.once&&this.removeListener(T,o.fn,void 0,!0);switch(s){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,O),!0;case 3:return o.fn.call(o.context,O,C),!0;case 4:return o.fn.call(o.context,O,C,E),!0;case 5:return o.fn.call(o.context,O,C,E,y),!0;case 6:return o.fn.call(o.context,O,C,E,y,h),!0}for(d=1,f=new Array(s-1);d<s;d++)f[d-1]=arguments[d];o.fn.apply(o.context,f)}else{var l=o.length,m;for(d=0;d<l;d++){o[d].once&&this.removeListener(T,o[d].fn,void 0,!0);switch(s){case 1:o[d].fn.call(o[d].context);break;case 2:o[d].fn.call(o[d].context,O);break;case 3:o[d].fn.call(o[d].context,O,C);break;case 4:o[d].fn.call(o[d].context,O,C,E);break;default:if(!f)for(m=1,f=new Array(s-1);m<s;m++)f[m-1]=arguments[m];o[d].fn.apply(o[d].context,f)}}}return!0},w.prototype.on=function(T,O,C){return M(this,T,O,C,!1)},w.prototype.once=function(T,O,C){return M(this,T,O,C,!0)},w.prototype.removeListener=function(T,O,C,E){var y=v?v+T:T;if(!this._events[y])return this;if(!O)return R(this,y),this;var h=this._events[y];if(h.fn)h.fn===O&&(!E||h.once)&&(!C||h.context===C)&&R(this,y);else{for(var r=0,o=[],s=h.length;r<s;r++)(h[r].fn!==O||E&&!h[r].once||C&&h[r].context!==C)&&o.push(h[r]);o.length?this._events[y]=o.length===1?o[0]:o:R(this,y)}return this},w.prototype.removeAllListeners=function(T){var O;return T?(O=v?v+T:T,this._events[O]&&R(this,O)):(this._events=new x,this._eventsCount=0),this},w.prototype.off=w.prototype.removeListener,w.prototype.addListener=w.prototype.on,w.prefixed=v,w.EventEmitter=w,oe.exports=w},"./node_modules/url-toolkit/src/url-toolkit.js":function(oe,N,S){(function(I){var v=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,x=/^([^\/?#]*)([^]*)$/,U=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(w,b,T){if(T=T||{},w=w.trim(),b=b.trim(),!b){if(!T.alwaysNormalize)return w;var O=R.parseURL(w);if(!O)throw new Error("Error trying to parse base URL.");return O.path=R.normalizePath(O.path),R.buildURLFromParts(O)}var C=R.parseURL(b);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return T.alwaysNormalize?(C.path=R.normalizePath(C.path),R.buildURLFromParts(C)):b;var E=R.parseURL(w);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var y=x.exec(E.path);E.netLoc=y[1],E.path=y[2]}E.netLoc&&!E.path&&(E.path="/");var h={scheme:E.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(h.netLoc=E.netLoc,C.path[0]!=="/"))if(!C.path)h.path=E.path,C.params||(h.params=E.params,C.query||(h.query=E.query));else{var r=E.path,o=r.substring(0,r.lastIndexOf("/")+1)+C.path;h.path=R.normalizePath(o)}return h.path===null&&(h.path=T.alwaysNormalize?R.normalizePath(C.path):C.path),R.buildURLFromParts(h)},parseURL:function(w){var b=v.exec(w);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(w){for(w=w.split("").reverse().join("").replace(U,"");w.length!==(w=w.replace(M,"")).length;);return w.split("").reverse().join("")},buildURLFromParts:function(w){return w.scheme+w.netLoc+w.path+w.params+w.query+w.fragment}};oe.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(oe,N,S){function I(T){var O={};function C(y){if(O[y])return O[y].exports;var h=O[y]={i:y,l:!1,exports:{}};return T[y].call(h.exports,h,h.exports,C),h.l=!0,h.exports}C.m=T,C.c=O,C.i=function(y){return y},C.d=function(y,h,r){C.o(y,h)||Object.defineProperty(y,h,{configurable:!1,enumerable:!0,get:r})},C.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},C.n=function(y){var h=y&&y.__esModule?function(){return y.default}:function(){return y};return C.d(h,"a",h),h},C.o=function(y,h){return Object.prototype.hasOwnProperty.call(y,h)},C.p="/",C.oe=function(y){throw console.error(y),y};var E=C(C.s=ENTRY_MODULE);return E.default||E}var v="[\\.|\\-|\\+|\\w|/|@]+",x="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+v+").*?\\)";function U(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function M(T){return!isNaN(1*T)}function R(T,O,C){var E={};E[C]=[];var y=O.toString(),h=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return E;for(var r=h[1],o=new RegExp("(\\\\n|\\W)"+U(r)+x,"g"),s;s=o.exec(y);){if(s[3]==="dll-reference")continue;E[C].push(s[3])}for(o=new RegExp("\\("+U(r)+'\\("(dll-reference\\s('+v+'))"\\)\\)'+x,"g");s=o.exec(y);)T[s[2]]||(E[C].push(s[1]),T[s[2]]=S(s[1]).m),E[s[2]]=E[s[2]]||[],E[s[2]].push(s[4]);for(var f=Object.keys(E),d=0;d<f.length;d++)for(var l=0;l<E[f[d]].length;l++)M(E[f[d]][l])&&(E[f[d]][l]=1*E[f[d]][l]);return E}function w(T){var O=Object.keys(T);return O.reduce(function(C,E){return C||T[E].length>0},!1)}function b(T,O){for(var C={main:[O]},E={main:[]},y={main:{}};w(C);)for(var h=Object.keys(C),r=0;r<h.length;r++){var o=h[r],s=C[o],f=s.pop();if(y[o]=y[o]||{},y[o][f]||!T[o][f])continue;y[o][f]=!0,E[o]=E[o]||[],E[o].push(f);for(var d=R(T,T[o][f],o),l=Object.keys(d),m=0;m<l.length;m++)C[l[m]]=C[l[m]]||[],C[l[m]]=C[l[m]].concat(d[l[m]])}return E}oe.exports=function(T,O){O=O||{};var C={main:S.m},E=O.all?{main:Object.keys(C.main)}:b(C,T),y="";Object.keys(E).filter(function(f){return f!=="main"}).forEach(function(f){for(var d=0;E[f][d];)d++;E[f].push(d),C[f][d]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+f+" = ("+I.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+E[f].map(function(l){return""+JSON.stringify(l)+": "+C[f][l].toString()}).join(",")+`});
|
|
`}),y=y+"new (("+I.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+E.main.map(function(f){return""+JSON.stringify(f)+": "+C.main[f].toString()}).join(",")+"}))(self);";var h=new window.Blob([y],{type:"text/javascript"});if(O.bare)return h;var r=window.URL||window.webkitURL||window.mozURL||window.msURL,o=r.createObjectURL(h),s=new window.Worker(o);return s.objectURL=o,s}},"./src/config.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"hlsDefaultConfig",function(){return m}),S.d(N,"mergeConfig",function(){return i}),S.d(N,"enableStreamingMode",function(){return n});var I=S("./src/controller/abr-controller.ts"),v=S("./src/controller/audio-stream-controller.ts"),x=S("./src/controller/audio-track-controller.ts"),U=S("./src/controller/subtitle-stream-controller.ts"),M=S("./src/controller/subtitle-track-controller.ts"),R=S("./src/controller/buffer-controller.ts"),w=S("./src/controller/timeline-controller.ts"),b=S("./src/controller/cap-level-controller.ts"),T=S("./src/controller/fps-controller.ts"),O=S("./src/controller/eme-controller.ts"),C=S("./src/controller/cmcd-controller.ts"),E=S("./src/utils/xhr-loader.ts"),y=S("./src/utils/fetch-loader.ts"),h=S("./src/utils/cues.ts"),r=S("./src/utils/mediakeys-helper.ts"),o=S("./src/utils/logger.ts");function s(){return s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var p=arguments[e];for(var g in p)Object.prototype.hasOwnProperty.call(p,g)&&(t[g]=p[g])}return t},s.apply(this,arguments)}function f(t,e){var p=Object.keys(t);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(t);e&&(g=g.filter(function(_){return Object.getOwnPropertyDescriptor(t,_).enumerable})),p.push.apply(p,g)}return p}function d(t){for(var e=1;e<arguments.length;e++){var p=arguments[e]!=null?arguments[e]:{};e%2?f(Object(p),!0).forEach(function(g){l(t,g,p[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(p)):f(Object(p)).forEach(function(g){Object.defineProperty(t,g,Object.getOwnPropertyDescriptor(p,g))})}return t}function l(t,e,p){return e in t?Object.defineProperty(t,e,{value:p,enumerable:!0,configurable:!0,writable:!0}):t[e]=p,t}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:E.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:I.default,bufferController:R.default,capLevelController:b.default,fpsController:T.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:r.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},c()),{},{subtitleStreamController:U.SubtitleStreamController,subtitleTrackController:M.default,timelineController:w.TimelineController,audioStreamController:v.default,audioTrackController:x.default,emeController:O.default,cmcdController:C.default});function c(){return{cueHandler:h.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 i(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},t,e)}function n(t){var e=t.loader;if(e!==y.default&&e!==E.default)o.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1;else{var p=Object(y.fetchSupported)();p&&(t.loader=y.default,t.progressive=!0,t.enableSoftwareAES=!0,o.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/polyfills/number.ts"),v=S("./src/utils/ewma-bandwidth-estimator.ts"),x=S("./src/events.ts"),U=S("./src/utils/buffer-helper.ts"),M=S("./src/errors.ts"),R=S("./src/types/loader.ts"),w=S("./src/utils/logger.ts");function b(C,E){for(var y=0;y<E.length;y++){var h=E[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(C,h.key,h)}}function T(C,E,y){return E&&b(C.prototype,E),y&&b(C,y),C}var O=function(){function C(y){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=y;var h=y.config;this.bwEstimator=new v.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var E=C.prototype;return E.registerListeners=function(){var h=this.hls;h.on(x.Events.FRAG_LOADING,this.onFragLoading,this),h.on(x.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(x.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(x.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var h=this.hls;h.off(x.Events.FRAG_LOADING,this.onFragLoading,this),h.off(x.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(x.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(x.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},E.onFragLoading=function(h,r){var o=r.frag;if(o.type===R.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=o,this.partCurrent=(s=r.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},E.onLevelLoaded=function(h,r){var o=this.hls.config;r.details.live?this.bwEstimator.update(o.abrEwmaSlowLive,o.abrEwmaFastLive):this.bwEstimator.update(o.abrEwmaSlowVoD,o.abrEwmaFastVoD)},E._abandonRulesCheck=function(){var h=this.fragCurrent,r=this.partCurrent,o=this.hls,s=o.autoLevelEnabled,f=o.config,d=o.media;if(!h||!d)return;var l=r?r.stats:h.stats,m=r?r.duration:h.duration;if(l.aborted){w.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||d.paused||!d.playbackRate||!d.readyState)return;var c=performance.now()-l.loading.start,i=Math.abs(d.playbackRate);if(c<=500*m/i)return;var n=o.levels,t=o.minAutoLevel,e=n[h.level],p=l.total||Math.max(l.loaded,Math.round(m*e.maxBitrate/8)),g=Math.max(1,l.bwEstimate?l.bwEstimate/8:l.loaded*1e3/c),_=(p-l.loaded)/g,A=d.currentTime,k=(U.BufferHelper.bufferInfo(d,A,f.maxBufferHole).end-A)/i;if(k>=2*m/i||_<=k)return;var F=Number.POSITIVE_INFINITY,z;for(z=h.level-1;z>t;z--){var J=n[z].maxBitrate;if(F=m*J/(8*.8*g),F<k)break}if(F>=_)return;var Y=this.bwEstimator.getEstimate();w.logger.warn("Fragment "+h.sn+(r?" part "+r.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+z+`
|
|
Current BW estimate: `+(Object(I.isFiniteNumber)(Y)?(Y/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+_.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+F.toFixed(3)+` s
|
|
Time to underbuffer: `+k.toFixed(3)+" s"),o.nextLoadLevel=z,this.bwEstimator.sample(c,l.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),o.trigger(x.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:r,stats:l})},E.onFragLoaded=function(h,r){var o=r.frag,s=r.part;if(o.type===R.PlaylistLevelType.MAIN&&Object(I.isFiniteNumber)(o.sn)){var f=s?s.stats:o.stats,d=s?s.duration:o.duration;if(this.clearTimer(),this.lastLoadedFragLevel=o.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var l=this.hls.levels[o.level],m=(l.loaded?l.loaded.bytes:0)+f.loaded,c=(l.loaded?l.loaded.duration:0)+d;l.loaded={bytes:m,duration:c},l.realBitrate=Math.round(8*m/c)}if(o.bitrateTest){var i={stats:f,frag:o,part:s,id:o.type};this.onFragBuffered(x.Events.FRAG_BUFFERED,i),o.bitrateTest=!1}}},E.onFragBuffered=function(h,r){var o=r.frag,s=r.part,f=s?s.stats:o.stats;if(f.aborted)return;if(o.type!==R.PlaylistLevelType.MAIN||o.sn==="initSegment")return;var d=f.parsing.end-f.loading.start;this.bwEstimator.sample(d,f.loaded),f.bwEstimate=this.bwEstimator.getEstimate(),o.bitrateTest?this.bitrateTestDelay=d/1e3:this.bitrateTestDelay=0},E.onError=function(h,r){switch(r.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},E.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},E.getNextABRAutoLevel=function(){var h=this.fragCurrent,r=this.partCurrent,o=this.hls,s=o.maxAutoLevel,f=o.config,d=o.minAutoLevel,l=o.media,m=r?r.duration:h?h.duration:0,c=l?l.currentTime:0,i=l&&l.playbackRate!==0?Math.abs(l.playbackRate):1,n=this.bwEstimator?this.bwEstimator.getEstimate():f.abrEwmaDefaultEstimate,t=(U.BufferHelper.bufferInfo(l,c,f.maxBufferHole).end-c)/i,e=this.findBestLevel(n,d,s,t,f.abrBandWidthFactor,f.abrBandWidthUpFactor);if(e>=0)return e;w.logger.trace((t?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var p=m?Math.min(m,f.maxStarvationDelay):f.maxStarvationDelay,g=f.abrBandWidthFactor,_=f.abrBandWidthUpFactor;if(!t){var A=this.bitrateTestDelay;if(A){var k=m?Math.min(m,f.maxLoadingDelay):f.maxLoadingDelay;p=k-A,w.logger.trace("bitrate test took "+Math.round(1e3*A)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*p)+" ms"),g=_=1}}return e=this.findBestLevel(n,d,s,t+p,g,_),Math.max(e,0)},E.findBestLevel=function(h,r,o,s,f,d){for(var l,m=this.fragCurrent,c=this.partCurrent,i=this.lastLoadedFragLevel,n=this.hls.levels,t=n[i],e=!!(t!=null&&(l=t.details)!==null&&l!==void 0&&l.live),p=t==null?void 0:t.codecSet,g=c?c.duration:m?m.duration:0,_=o;_>=r;_--){var A=n[_];if(!A||p&&A.codecSet!==p)continue;var k=A.details,F=(c?k==null?void 0:k.partTarget:k==null?void 0:k.averagetargetduration)||g,z=void 0;_<=i?z=f*h:z=d*h;var J=n[_].maxBitrate,Y=J*F/z;if(w.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+_+"/"+Math.round(z)+"/"+J+"/"+F+"/"+s+"/"+Y),z>J&&(!Y||e&&!this.bitrateTestDelay||Y<s))return _}return-1},T(C,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,r=this.bwEstimator;if(h!==-1&&(!r||!r.canEstimate()))return h;var o=this.getNextABRAutoLevel();return h!==-1&&(o=Math.min(h,o)),o},set:function(h){this._nextAutoLevel=h}}]),C}();N.default=O},"./src/controller/audio-stream-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/polyfills/number.ts"),v=S("./src/controller/base-stream-controller.ts"),x=S("./src/events.ts"),U=S("./src/utils/buffer-helper.ts"),M=S("./src/controller/fragment-tracker.ts"),R=S("./src/types/level.ts"),w=S("./src/types/loader.ts"),b=S("./src/loader/fragment.ts"),T=S("./src/demux/chunk-cache.ts"),O=S("./src/demux/transmuxer-interface.ts"),C=S("./src/types/transmuxer.ts"),E=S("./src/controller/fragment-finders.ts"),y=S("./src/utils/discontinuities.ts"),h=S("./src/errors.ts"),r=S("./src/utils/logger.ts");function o(){return o=Object.assign||function(m){for(var c=1;c<arguments.length;c++){var i=arguments[c];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(m[n]=i[n])}return m},o.apply(this,arguments)}function s(m,c){m.prototype=Object.create(c.prototype),m.prototype.constructor=m,f(m,c)}function f(m,c){return f=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},f(m,c)}var d=100,l=function(m){s(c,m);function c(n,t){var e;return e=m.call(this,n,t,"[audio-stream-controller]")||this,e.videoBuffer=null,e.videoTrackCC=-1,e.waitingVideoCC=-1,e.audioSwitch=!1,e.trackId=-1,e.waitingData=null,e.mainDetails=null,e.bufferFlushed=!1,e._registerListeners(),e}var i=c.prototype;return i.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},i._registerListeners=function(){var t=this.hls;t.on(x.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(x.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(x.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(x.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(x.Events.ERROR,this.onError,this),t.on(x.Events.BUFFER_RESET,this.onBufferReset,this),t.on(x.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(x.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(x.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(x.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i._unregisterListeners=function(){var t=this.hls;t.off(x.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(x.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(x.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(x.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(x.Events.ERROR,this.onError,this),t.off(x.Events.BUFFER_RESET,this.onBufferReset,this),t.off(x.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(x.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(x.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(x.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i.onInitPtsFound=function(t,e){var p=e.frag,g=e.id,_=e.initPTS;if(g==="main"){var A=p.cc;this.initPTS[p.cc]=_,this.log("InitPTS for cc: "+A+" found from main: "+_),this.videoTrackCC=A,this.state===v.State.WAITING_INIT_PTS&&this.tick()}},i.startLoad=function(t){if(!this.levels){this.startPosition=t,this.state=v.State.STOPPED;return}var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(d),this.fragLoadError=0,e>0&&t===-1?(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=v.State.IDLE):(this.loadedmetadata=!1,this.state=v.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},i.doTick=function(){switch(this.state){case v.State.IDLE:this.doTickIdle();break;case v.State.WAITING_TRACK:{var t,e=this.levels,p=this.trackId,g=e==null||((t=e[p])===null||t===void 0)?void 0:t.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=v.State.WAITING_INIT_PTS}break}case v.State.FRAG_LOADING_WAITING_RETRY:{var _,A=performance.now(),k=this.retryDate;(!k||A>=k||(_=this.media)!==null&&_!==void 0&&_.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=v.State.IDLE);break}case v.State.WAITING_INIT_PTS:{var F=this.waitingData;if(F){var z=F.frag,J=F.part,Y=F.cache,$=F.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=v.State.FRAG_LOADING;var le=Y.flush(),be={frag:z,part:J,payload:le,networkDetails:null};this._handleFragmentLoadProgress(be),$&&m.prototype._handleFragmentLoadComplete.call(this,be)}else if(this.videoTrackCC!==this.waitingVideoCC)r.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ve=this.getLoadPosition(),ke=U.BufferHelper.bufferInfo(this.mediaBuffer,ve,this.config.maxBufferHole),Te=Object(E.fragmentWithinToleranceTest)(ke.end,this.config.maxFragLookUpTolerance,z);Te<0&&(r.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+ke.end+" is needed"),this.clearWaitingFragment())}}else this.state=v.State.IDLE}}this.onTickEnd()},i.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=v.State.IDLE)},i.onTickEnd=function(){var t=this.media;if(!t||!t.readyState)return;var e=this.mediaBuffer?this.mediaBuffer:t,p=e.buffered;!this.loadedmetadata&&p.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime},i.doTickIdle=function(){var t,e,p=this.hls,g=this.levels,_=this.media,A=this.trackId,k=p.config;if(!g||!g[A])return;if(!_&&(this.startFragRequested||!k.startFragPrefetch))return;var F=g[A],z=F.details;if(!z||z.live&&this.levelLastLoaded!==A||this.waitForCdnTuneIn(z)){this.state=v.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,w.PlaylistLevelType.AUDIO));var J=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,w.PlaylistLevelType.AUDIO);if(J===null)return;var Y=J.len,$=this.getMaxBufferLength(),le=this.audioSwitch;if(Y>=$&&!le)return;if(!le&&this._streamEnded(J,z)){p.trigger(x.Events.BUFFER_EOS,{type:"audio"}),this.state=v.State.ENDED;return}var be=z.fragments,ve=be[0].start,ke=J.end;if(le){var Te=this.getLoadPosition();ke=Te,z.PTSKnown&&Te<ve&&((J.end>ve||J.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),_.currentTime=ve+.05))}var xe=this.getNextFragment(ke,z);if(!xe){this.bufferFlushed=!0;return}((t=xe.decryptdata)===null||t===void 0?void 0:t.keyFormat)==="identity"&&!((e=xe.decryptdata)!==null&&e!==void 0&&e.key)?this.loadKey(xe,z):this.loadFragment(xe,z,ke)},i.getMaxBufferLength=function(){var t=m.prototype.getMaxBufferLength.call(this),e=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,w.PlaylistLevelType.MAIN);return e===null?t:Math.max(t,e.len)},i.onMediaDetaching=function(){this.videoBuffer=null,m.prototype.onMediaDetaching.call(this)},i.onAudioTracksUpdated=function(t,e){var p=e.audioTracks;this.resetTransmuxer(),this.levels=p.map(function(g){return new R.Level(g)})},i.onAudioTrackSwitching=function(t,e){var p=!!e.url;this.trackId=e.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),p?this.setInterval(d):this.resetTransmuxer(),p?(this.audioSwitch=!0,this.state=v.State.IDLE):this.state=v.State.STOPPED,this.tick()},i.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},i.onLevelLoaded=function(t,e){this.mainDetails=e.details},i.onAudioTrackLoaded=function(t,e){var p,g=this.levels,_=e.details,A=e.id;if(!g){this.warn("Audio tracks were reset while loading level "+A);return}this.log("Track "+A+" loaded ["+_.startSN+","+_.endSN+"],duration:"+_.totalduration);var k=g[A],F=0;if(_.live||(p=k.details)!==null&&p!==void 0&&p.live){var z=this.mainDetails;if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed||!z)return;!k.details&&_.hasProgramDateTime&&z.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(_,z),F=_.fragments[0].start):F=this.alignPlaylists(_,k.details)}k.details=_,this.levelLastLoaded=A,!this.startFragRequested&&(this.mainDetails||!_.live)&&this.setStartPosition(k.details,F),this.state===v.State.WAITING_TRACK&&!this.waitForCdnTuneIn(_)&&(this.state=v.State.IDLE),this.tick()},i._handleFragmentLoadProgress=function(t){var e,p=t.frag,g=t.part,_=t.payload,A=this.config,k=this.trackId,F=this.levels;if(!F){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+p.sn+" of level "+p.level+" will not be buffered");return}var z=F[k];console.assert(z,"Audio track is defined on fragment load progress");var J=z.details;console.assert(J,"Audio track details are defined on fragment load progress");var Y=A.defaultAudioCodec||z.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new O.default(this.hls,w.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var le=this.initPTS[p.cc],be=(e=p.initSegment)===null||e===void 0?void 0:e.data;if(le!==void 0){var ve=!1,ke=g?g.index:-1,Te=ke!==-1,xe=new C.ChunkMetadata(p.level,p.sn,p.stats.chunkCount,_.byteLength,ke,Te);$.push(_,be,Y,"",p,g,J.totalduration,ve,xe,le)}else{r.logger.log("Unknown video PTS for cc "+p.cc+", waiting for video PTS before demuxing audio frag "+p.sn+" of ["+J.startSN+" ,"+J.endSN+"],track "+k);var _e=this.waitingData=this.waitingData||{frag:p,part:g,cache:new T.default,complete:!1},Oe=_e.cache;Oe.push(new Uint8Array(_)),this.waitingVideoCC=this.videoTrackCC,this.state=v.State.WAITING_INIT_PTS}},i._handleFragmentLoadComplete=function(t){if(this.waitingData){this.waitingData.complete=!0;return}m.prototype._handleFragmentLoadComplete.call(this,t)},i.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},i.onBufferCreated=function(t,e){var p=e.tracks.audio;p&&(this.mediaBuffer=p.buffer),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},i.onFragBuffered=function(t,e){var p=e.frag,g=e.part;if(p.type!==w.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(p)){this.warn("Fragment "+p.sn+(g?" p: "+g.index:"")+" of level "+p.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}p.sn!=="initSegment"&&(this.fragPrevious=p,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(x.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(p,g)},i.onError=function(t,e){switch(e.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.AUDIO,e);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==v.State.ERROR&&this.state!==v.State.STOPPED&&(this.state=e.fatal?v.State.ERROR:v.State.IDLE,this.warn(e.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(e.parent==="audio"&&(this.state===v.State.PARSING||this.state===v.State.PARSED)){var p=!0,g=this.getFwdBufferInfo(this.mediaBuffer,w.PlaylistLevelType.AUDIO);g&&g.len>.5&&(p=!this.reduceMaxBufferLength(g.len)),p&&(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}},i.onBufferFlushed=function(t,e){var p=e.type;p===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},i._handleTransmuxComplete=function(t){var e,p="audio",g=this.hls,_=t.remuxResult,A=t.chunkMeta,k=this.getCurrentContext(A);if(!k){this.warn("The loading context changed while buffering fragment "+A.sn+" of level "+A.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(A.level);return}var F=k.frag,z=k.part,J=_.audio,Y=_.text,$=_.id3,le=_.initSegment;if(this.fragContextChanged(F))return;if(this.state=v.State.PARSING,this.audioSwitch&&J&&this.completeAudioSwitch(),le!=null&&le.tracks&&(this._bufferInitSegment(le.tracks,F,A),g.trigger(x.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:p,tracks:le.tracks})),J){var be=J.startPTS,ve=J.endPTS,ke=J.startDTS,Te=J.endDTS;z&&(z.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:be,endPTS:ve,startDTS:ke,endDTS:Te}),F.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,be,ve,ke,Te),this.bufferFragmentData(J,F,z,A)}if($!=null&&(e=$.samples)!==null&&e!==void 0&&e.length){var xe=o({frag:F,id:p},$);g.trigger(x.Events.FRAG_PARSING_METADATA,xe)}if(Y){var _e=o({frag:F,id:p},Y);g.trigger(x.Events.FRAG_PARSING_USERDATA,_e)}},i._bufferInitSegment=function(t,e,p){if(this.state!==v.State.PARSING)return;t.video&&delete t.video;var g=t.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(x.Events.BUFFER_CODECS,t);var _=g.initSegment;if(_!=null&&_.byteLength){var A={type:"audio",frag:e,part:null,chunkMeta:p,parent:e.type,data:_};this.hls.trigger(x.Events.BUFFER_APPENDING,A)}this.tick()},i.loadFragment=function(t,e,p){var g=this.fragmentTracker.getState(t);this.fragCurrent=t,(this.audioSwitch||g===M.FragmentState.NOT_LOADED||g===M.FragmentState.PARTIAL)&&(t.sn==="initSegment"?this._loadInitSegment(t):e.live&&!Object(I.isFiniteNumber)(this.initPTS[t.cc])?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=v.State.WAITING_INIT_PTS):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,t,e,p)))},i.completeAudioSwitch=function(){var t=this.hls,e=this.media,p=this.trackId;e&&(this.log("Switching audio track : flushing all audio"),m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,t.trigger(x.Events.AUDIO_TRACK_SWITCHED,{id:p})},c}(v.default);N.default=l},"./src/controller/audio-track-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),v=S("./src/errors.ts"),x=S("./src/controller/base-playlist-controller.ts"),U=S("./src/types/loader.ts");function M(O,C){for(var E=0;E<C.length;E++){var y=C[E];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(O,y.key,y)}}function R(O,C,E){return C&&M(O.prototype,C),E&&M(O,E),O}function w(O,C){O.prototype=Object.create(C.prototype),O.prototype.constructor=O,b(O,C)}function b(O,C){return b=Object.setPrototypeOf||function(y,h){return y.__proto__=h,y},b(O,C)}var T=function(O){w(C,O);function C(y){var h;return h=O.call(this,y,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var E=C.prototype;return E.registerListeners=function(){var h=this.hls;h.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(I.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var h=this.hls;h.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(I.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},E.onManifestParsed=function(h,r){this.tracks=r.audioTracks||[]},E.onAudioTrackLoaded=function(h,r){var o=r.id,s=r.details,f=this.tracksInGroup[o];if(!f){this.warn("Invalid audio track id "+o);return}var d=f.details;f.details=r.details,this.log("audioTrack "+o+" loaded ["+s.startSN+"-"+s.endSN+"]"),o===this.trackId&&(this.retryCount=0,this.playlistLoaded(o,r,d))},E.onLevelLoading=function(h,r){this.switchLevel(r.level)},E.onLevelSwitching=function(h,r){this.switchLevel(r.level)},E.switchLevel=function(h){var r=this.hls.levels[h];if(!(r!=null&&r.audioGroupIds))return;var o=r.audioGroupIds[r.urlId];if(this.groupId!==o){this.groupId=o;var s=this.tracks.filter(function(d){return!o||d.groupId===o});this.selectDefaultTrack&&!s.some(function(d){return d.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var f={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+o+'" group-id'),this.hls.trigger(I.Events.AUDIO_TRACKS_UPDATED,f),this.selectInitialTrack()}},E.onError=function(h,r){if(O.prototype.onError.call(this,h,r),r.fatal||!r.context)return;r.context.type===U.PlaylistContextType.AUDIO_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},E.setAudioTrack=function(h){var r=this.tracksInGroup;if(h<0||h>=r.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var o=r[this.trackId];this.log("Now switching to audio-track index "+h);var s=r[h],f=s.id,d=s.groupId,l=d===void 0?"":d,m=s.name,c=s.type,i=s.url;if(this.trackId=h,this.trackName=m,this.selectDefaultTrack=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHING,{id:f,groupId:l,name:m,type:c,url:i}),s.details&&!s.details.live)return;var n=this.switchParams(s.url,o==null?void 0:o.details);this.loadPlaylist(n)},E.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var r=this.trackName,o=this.findTrackId(r)||this.findTrackId();o!==-1?this.setAudioTrack(o):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},E.findTrackId=function(h){for(var r=this.tracksInGroup,o=0;o<r.length;o++){var s=r[o];if((!this.selectDefaultTrack||s.default)&&(!h||h===s.name))return s.id}return-1},E.loadPlaylist=function(h){var r=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(r)){var o=r.id,s=r.groupId,f=r.url;if(h)try{f=h.addDirectives(f)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("loading audio-track playlist for id: "+o),this.clearTimer(),this.hls.trigger(I.Events.AUDIO_TRACK_LOADING,{url:f,id:o,groupId:s,deliveryDirectives:h||null})}},R(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),C}(x.default);N.default=T},"./src/controller/base-playlist-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return R});var I=S("./src/polyfills/number.ts"),v=S("./src/types/level.ts"),x=S("./src/controller/level-helper.ts"),U=S("./src/utils/logger.ts"),M=S("./src/errors.ts"),R=function(){function w(T,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=U.logger.log.bind(U.logger,O+":"),this.warn=U.logger.warn.bind(U.logger,O+":"),this.hls=T}var b=w.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(O,C){C.fatal&&C.type===M.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(O,C){var E=C==null?void 0:C.renditionReports;if(E)for(var y=0;y<E.length;y++){var h=E[y],r=""+h.URI;if(r===O.substr(-r.length)){var o=parseInt(h["LAST-MSN"]),s=parseInt(h["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var f=Math.min(C.age-C.partTarget,C.targetduration);s!==void 0&&f>C.partTarget&&(s+=1)}if(Object(I.isFiniteNumber)(o))return new v.HlsUrlParameters(o,Object(I.isFiniteNumber)(s)?s:void 0,v.HlsSkip.No)}}},b.loadPlaylist=function(O){},b.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},b.playlistLoaded=function(O,C,E){var y=this,h=C.details,r=C.stats,o=r.loading.end?Math.max(0,self.performance.now()-r.loading.end):0;if(h.advancedDateTime=Date.now()-o,h.live||E!=null&&E.live){if(h.reloaded(E),E&&this.log("live playlist "+O+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),E&&h.fragments.length>0&&Object(x.mergeDetails)(E,h),!this.canLoad||!h.live)return;var s,f=void 0,d=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var l=this.hls.config.lowLatencyMode,m=h.lastPartSn,c=h.endSN,i=h.lastPartIndex,n=i!==-1,t=m===c,e=l?0:i;n?(f=t?c+1:m,d=t?e:i+1):f=c+1;var p=h.age,g=p+h.ageHeader,_=Math.min(g-h.partTarget,h.targetduration*1.5);if(_>0){if(E&&_>E.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+E.tuneInGoal+" to: "+_+" with playlist age: "+h.age),_=0;else{var A=Math.floor(_/h.targetduration);if(f+=A,d!==void 0){var k=Math.round(_%h.targetduration/h.partTarget);d+=k}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+p.toFixed(2)+"s goal: "+_+" skip sn "+A+" to part "+d)}h.tuneInGoal=_}if(s=this.getDeliveryDirectives(h,C.deliveryDirectives,f,d),l||!t){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(h,C.deliveryDirectives,f,d);var F=Object(x.computeReloadInterval)(h,r);f!==void 0&&h.canBlockReload&&(F-=h.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(F)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(s)},F)}else this.clearTimer()},b.getDeliveryDirectives=function(O,C,E,y){var h=Object(v.getSkipValue)(O,E);return C!=null&&C.skip&&O.deltaUpdateFailed&&(E=C.msn,y=C.part,h=v.HlsSkip.No),new v.HlsUrlParameters(E,y,h)},b.retryLoadingOrFail=function(O){var C=this,E=this.hls.config,y=this.retryCount<E.levelLoadingMaxRetry;if(y){var h;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(h=O.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var r=Math.min(Math.pow(2,this.retryCount)*E.levelLoadingRetryDelay,E.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},r),this.warn("retry playlist loading #"+this.retryCount+" in "+r+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return y},w}()},"./src/controller/base-stream-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"State",function(){return c}),S.d(N,"default",function(){return i});var I=S("./src/polyfills/number.ts"),v=S("./src/task-loop.ts"),x=S("./src/controller/fragment-tracker.ts"),U=S("./src/utils/buffer-helper.ts"),M=S("./src/utils/logger.ts"),R=S("./src/events.ts"),w=S("./src/errors.ts"),b=S("./src/types/transmuxer.ts"),T=S("./src/utils/mp4-tools.ts"),O=S("./src/utils/discontinuities.ts"),C=S("./src/controller/fragment-finders.ts"),E=S("./src/controller/level-helper.ts"),y=S("./src/loader/fragment-loader.ts"),h=S("./src/crypt/decrypter.ts"),r=S("./src/utils/time-ranges.ts"),o=S("./src/types/loader.ts");function s(n,t){for(var e=0;e<t.length;e++){var p=t[e];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(n,p.key,p)}}function f(n,t,e){return t&&s(n.prototype,t),e&&s(n,e),n}function d(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function l(n,t){n.prototype=Object.create(t.prototype),n.prototype.constructor=n,m(n,t)}function m(n,t){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(n,t)}var c={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"},i=function(n){l(t,n);function t(p,g,_){var A;return A=n.call(this)||this,A.hls=void 0,A.fragPrevious=null,A.fragCurrent=null,A.fragmentTracker=void 0,A.transmuxer=null,A._state=c.STOPPED,A.media=void 0,A.mediaBuffer=void 0,A.config=void 0,A.bitrateTest=!1,A.lastCurrentTime=0,A.nextLoadPosition=0,A.startPosition=0,A.loadedmetadata=!1,A.fragLoadError=0,A.retryDate=0,A.levels=null,A.fragmentLoader=void 0,A.levelLastLoaded=null,A.startFragRequested=!1,A.decrypter=void 0,A.initPTS=[],A.onvseeking=null,A.onvended=null,A.logPrefix="",A.log=void 0,A.warn=void 0,A.logPrefix=_,A.log=M.logger.log.bind(M.logger,_+":"),A.warn=M.logger.warn.bind(M.logger,_+":"),A.hls=p,A.fragmentLoader=new y.default(p.config),A.fragmentTracker=g,A.config=p.config,A.decrypter=new h.default(p,p.config),p.on(R.Events.KEY_LOADED,A.onKeyLoaded,d(A)),A}var e=t.prototype;return e.doTick=function(){this.onTickEnd()},e.onTickEnd=function(){},e.startLoad=function(g){},e.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=c.STOPPED},e._streamEnded=function(g,_){var A=this.fragCurrent,k=this.fragmentTracker;if(!_.live&&A&&A.sn===_.endSN&&!g.nextStart){var F=k.getState(A);return F===x.FragmentState.PARTIAL||F===x.FragmentState.OK}return!1},e.onMediaAttached=function(g,_){var A=this.media=this.mediaBuffer=_.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),A.addEventListener("seeking",this.onvseeking),A.addEventListener("ended",this.onvended);var k=this.config;this.levels&&k.autoStartLoad&&this.state===c.STOPPED&&this.startLoad(k.startPosition)},e.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},e.onMediaSeeking=function(){var g=this.config,_=this.fragCurrent,A=this.media,k=this.mediaBuffer,F=this.state,z=A?A.currentTime:0,J=U.BufferHelper.bufferInfo(k||A,z,g.maxBufferHole);if(this.log("media seeking to "+(Object(I.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+F),F===c.ENDED)this.resetLoadingState();else if(_&&!J.len){var Y=g.maxFragLookUpTolerance,$=_.start-Y,le=_.start+_.duration+Y,be=z>le;(z<$||be)&&(be&&_.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),_.loader.abort()),this.resetLoadingState())}A&&(this.lastCurrentTime=z),!this.loadedmetadata&&!J.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},e.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},e.onKeyLoaded=function(g,_){if(this.state!==c.KEY_LOADING||_.frag!==this.fragCurrent||!this.levels)return;this.state=c.IDLE;var A=this.levels[_.frag.level].details;A&&this.loadFragment(_.frag,A,_.frag.start)},e.onHandlerDestroying=function(){this.stopLoad(),n.prototype.onHandlerDestroying.call(this)},e.onHandlerDestroyed=function(){this.state=c.STOPPED,this.hls.off(R.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,n.prototype.onHandlerDestroyed.call(this)},e.loadKey=function(g,_){this.log("Loading key for "+g.sn+" of ["+_.startSN+"-"+_.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=c.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(R.Events.KEY_LOADING,{frag:g})},e.loadFragment=function(g,_,A){this._loadFragForPlayback(g,_,A)},e._loadFragForPlayback=function(g,_,A){var k=this,F=function(J){if(k.fragContextChanged(g)){k.warn("Fragment "+g.sn+(J.part?" p: "+J.part.index:"")+" of level "+g.level+" was dropped during download."),k.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,k._handleFragmentLoadProgress(J)};this._doFragLoad(g,_,A,F).then(function(z){if(!z)return;k.fragLoadError=0;var J=k.state;if(k.fragContextChanged(g)){(J===c.FRAG_LOADING||J===c.BACKTRACKING||!k.fragCurrent&&J===c.PARSING)&&(k.fragmentTracker.removeFragment(g),k.state=c.IDLE);return}if("payload"in z&&(k.log("Loaded fragment "+g.sn+" of level "+g.level),k.hls.trigger(R.Events.FRAG_LOADED,z),k.state===c.BACKTRACKING)){k.fragmentTracker.backtrack(g,z),k.resetFragmentLoading(g);return}k._handleFragmentLoadComplete(z)}).catch(function(z){k.warn(z),k.resetFragmentLoading(g)})},e.flushMainBuffer=function(g,_,A){if(A===void 0&&(A=null),!(g-_))return;var k={startOffset:g,endOffset:_,type:A};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,k)},e._loadInitSegment=function(g){var _=this;this._doFragLoad(g).then(function(A){if(!A||_.fragContextChanged(g)||!_.levels)throw new Error("init load aborted");return A}).then(function(A){var k=_.hls,F=A.payload,z=g.decryptdata;if(F&&F.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var J=self.performance.now();return _.decrypter.webCryptoDecrypt(new Uint8Array(F),z.key.buffer,z.iv.buffer).then(function(Y){var $=self.performance.now();return k.trigger(R.Events.FRAG_DECRYPTED,{frag:g,payload:Y,stats:{tstart:J,tdecrypt:$}}),A.payload=Y,A})}return A}).then(function(A){var k=_.fragCurrent,F=_.hls,z=_.levels;if(!z)throw new Error("init load aborted, missing levels");var J=z[g.level].details;console.assert(J,"Level details are defined when init segment is loaded");var Y=g.stats;_.state=c.IDLE,_.fragLoadError=0,g.data=new Uint8Array(A.payload),Y.parsing.start=Y.buffering.start=self.performance.now(),Y.parsing.end=Y.buffering.end=self.performance.now(),A.frag===k&&F.trigger(R.Events.FRAG_BUFFERED,{stats:Y,frag:k,part:null,id:g.type}),_.tick()}).catch(function(A){_.warn(A),_.resetFragmentLoading(g)})},e.fragContextChanged=function(g){var _=this.fragCurrent;return!g||!_||g.level!==_.level||g.sn!==_.sn||g.urlId!==_.urlId},e.fragBufferedComplete=function(g,_){var A=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(_?" part: "+_.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+r.default.toString(U.BufferHelper.getBuffered(A))),this.state=c.IDLE,this.tick()},e._handleFragmentLoadComplete=function(g){var _=this.transmuxer;if(!_)return;var A=g.frag,k=g.part,F=g.partsLoaded,z=!F||F.length===0||F.some(function(Y){return!Y}),J=new b.ChunkMetadata(A.level,A.sn,A.stats.chunkCount+1,0,k?k.index:-1,!z);_.flush(J)},e._handleFragmentLoadProgress=function(g){},e._doFragLoad=function(g,_,A,k){var F=this;if(A===void 0&&(A=null),!this.levels)throw new Error("frag load aborted, missing levels");if(A=Math.max(g.start,A||0),this.config.lowLatencyMode&&_){var z=_.partList;if(z&&k){A>g.end&&_.fragmentHint&&(g=_.fragmentHint);var J=this.getNextPart(z,g,A);if(J>-1){var Y=z[J];return this.log("Loading part sn: "+g.sn+" p: "+Y.index+" cc: "+g.cc+" of playlist ["+_.startSN+"-"+_.endSN+"] parts [0-"+J+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(A.toFixed(3))),this.nextLoadPosition=Y.start+Y.duration,this.state=c.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:g,part:z[J],targetBufferTime:A}),this.doFragPartsLoad(g,z,J,k).catch(function($){return F.handleFragLoadError($)})}else if(!g.url||this.loadedEndOfParts(z,A))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(_?"of ["+_.startSN+"-"+_.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(A.toFixed(3))),Object(I.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=c.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:g,targetBufferTime:A}),this.fragmentLoader.load(g,k).catch(function($){return F.handleFragLoadError($)})},e.doFragPartsLoad=function(g,_,A,k){var F=this;return new Promise(function(z,J){var Y=[],$=function le(be){var ve=_[be];F.fragmentLoader.loadPart(g,ve,k).then(function(ke){Y[ve.index]=ke;var Te=ke.part;F.hls.trigger(R.Events.FRAG_LOADED,ke);var xe=_[be+1];if(xe&&xe.fragment===g)le(be+1);else return z({frag:g,part:Te,partsLoaded:Y})}).catch(J)};$(A)})},e.handleFragLoadError=function(g){var _=g.data;return _&&_.details===w.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(_.frag,_.part):this.hls.trigger(R.Events.ERROR,_),null},e._handleTransmuxerFlush=function(g){var _=this.getCurrentContext(g);if(!_||this.state!==c.PARSING){this.fragCurrent||(this.state=c.IDLE);return}var A=_.frag,k=_.part,F=_.level,z=self.performance.now();A.stats.parsing.end=z,k&&(k.stats.parsing.end=z),this.updateLevelTiming(A,k,F,g.partial)},e.getCurrentContext=function(g){var _=this.levels,A=g.level,k=g.sn,F=g.part;if(!_||!_[A])return this.warn("Levels object was unset while buffering fragment "+k+" of level "+A+". The current chunk will not be buffered."),null;var z=_[A],J=F>-1?Object(E.getPartWith)(z,k,F):null,Y=J?J.fragment:Object(E.getFragmentWithSN)(z,k,this.fragCurrent);return Y?{frag:Y,part:J,level:z}:null},e.bufferFragmentData=function(g,_,A,k){if(!g||this.state!==c.PARSING)return;var F=g.data1,z=g.data2,J=F;if(F&&z&&(J=Object(T.appendUint8Array)(F,z)),!J||!J.length)return;var Y={type:g.type,frag:_,part:A,chunkMeta:k,parent:_.type,data:J};this.hls.trigger(R.Events.BUFFER_APPENDING,Y),g.dropped&&g.independent&&!A&&this.flushBufferGap(_)},e.flushBufferGap=function(g){var _=this.media;if(!_)return;if(!U.BufferHelper.isBuffered(_,_.currentTime)){this.flushMainBuffer(0,g.start);return}var A=_.currentTime,k=U.BufferHelper.bufferInfo(_,A,0),F=g.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,F*.25),J=Math.max(Math.min(g.start-z,k.end-z),A+z);g.start-J>z&&this.flushMainBuffer(J,g.start)},e.getFwdBufferInfo=function(g,_){var A=this.config,k=this.getLoadPosition();if(!Object(I.isFiniteNumber)(k))return null;var F=U.BufferHelper.bufferInfo(g,k,A.maxBufferHole);if(F.len===0&&F.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(k,_);if(z&&F.nextStart<z.end)return U.BufferHelper.bufferInfo(g,k,Math.max(F.nextStart,A.maxBufferHole))}return F},e.getMaxBufferLength=function(g){var _=this.config,A;return g?A=Math.max(8*_.maxBufferSize/g,_.maxBufferLength):A=_.maxBufferLength,Math.min(A,_.maxMaxBufferLength)},e.reduceMaxBufferLength=function(g){var _=this.config,A=g||_.maxBufferLength;return _.maxMaxBufferLength>=A?(_.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+_.maxMaxBufferLength+"s"),!0):!1},e.getNextFragment=function(g,_){var A,k,F=_.fragments,z=F.length;if(!z)return null;var J=this.config,Y=F[0].start,$;if(_.live){var le=J.initialLiveManifestSize;if(z<le)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+le+")"),null;!_.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(_,F),this.startPosition=$?this.hls.liveSyncPosition||$.start:g)}else g<=Y&&($=F[0]);if(!$){var be=J.lowLatencyMode?_.partEnd:_.fragmentEnd;$=this.getFragmentAtPosition(g,be,_)}return(A=$)!==null&&A!==void 0&&A.initSegment&&!((k=$)!==null&&k!==void 0&&k.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},e.getNextPart=function(g,_,A){for(var k=-1,F=!1,z=!0,J=0,Y=g.length;J<Y;J++){var $=g[J];if(z=z&&!$.independent,k>-1&&A<$.start)break;var le=$.loaded;!le&&(F||$.independent||z)&&$.fragment===_&&(k=J),F=le}return k},e.loadedEndOfParts=function(g,_){var A=g[g.length-1];return A&&_>A.start&&A.loaded},e.getInitialLiveFragment=function(g,_){var A=this.fragPrevious,k=null;if(A){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+A.programDateTime),k=Object(C.findFragmentByPDT)(_,A.endProgramDateTime,this.config.maxFragLookUpTolerance)),!k){var F=A.sn+1;if(F>=g.startSN&&F<=g.endSN){var z=_[F-g.startSN];A.cc===z.cc&&(k=z,this.log("Live playlist, switching playlist, load frag with next SN: "+k.sn))}k||(k=Object(C.findFragWithCC)(_,A.cc),k&&this.log("Live playlist, switching playlist, load frag with same CC: "+k.sn))}}else{var J=this.hls.liveSyncPosition;J!==null&&(k=this.getFragmentAtPosition(J,this.bitrateTest?g.fragmentEnd:g.edge,g))}return k},e.getFragmentAtPosition=function(g,_,A){var k=this.config,F=this.fragPrevious,z=A.fragments,J=A.endSN,Y=A.fragmentHint,$=k.maxFragLookUpTolerance,le=!!(k.lowLatencyMode&&A.partList&&Y);le&&Y&&!this.bitrateTest&&(z=z.concat(Y),J=Y.sn);var be;if(g<_){var ve=g>_-$?0:$;be=Object(C.findFragmentByPTS)(F,z,g,ve)}else be=z[z.length-1];if(be){var ke=be.sn-A.startSN,Te=F&&be.level===F.level,xe=z[ke+1],_e=this.fragmentTracker.getState(be);if(_e===x.FragmentState.BACKTRACKED){be=null;for(var Oe=ke;z[Oe]&&this.fragmentTracker.getState(z[Oe])===x.FragmentState.BACKTRACKED;)F?be=z[Oe--]:be=z[--Oe];be||(be=xe)}else F&&be.sn===F.sn&&!le&&(Te&&(be.sn<J&&this.fragmentTracker.getState(xe)!==x.FragmentState.OK?(this.log("SN "+be.sn+" just loaded, load next one: "+xe.sn),be=xe):be=null))}return be},e.synchronizeToLiveEdge=function(g){var _=this.config,A=this.media;if(!A)return;var k=this.hls.liveSyncPosition,F=A.currentTime,z=g.fragments[0].start,J=g.edge,Y=F>=z-_.maxFragLookUpTolerance&&F<=J;if(k!==null&&A.duration>k&&(F<k||!Y)){var $=_.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:_.liveMaxLatencyDurationCount*g.targetduration;(!Y&&A.readyState<4||F<J-$)&&(this.loadedmetadata||(this.nextLoadPosition=k),A.readyState&&(this.warn("Playback: "+F.toFixed(3)+" is located too far from the end of live sliding playlist: "+J+", reset currentTime to : "+k.toFixed(3)),A.currentTime=k))}},e.alignPlaylists=function(g,_){var A=this.levels,k=this.levelLastLoaded,F=this.fragPrevious,z=k!==null?A[k]:null,J=g.fragments.length;if(!J)return this.warn("No fragments in live playlist"),0;var Y=g.fragments[0].start,$=!_,le=g.alignedSliding&&Object(I.isFiniteNumber)(Y);if($||!le&&!Y){Object(O.alignStream)(F,z,g);var be=g.fragments[0].start;return this.log("Live playlist sliding: "+be.toFixed(2)+" start-sn: "+(_?_.startSN:"na")+"->"+g.startSN+" prev-sn: "+(F?F.sn:"na")+" fragments: "+J),be}return Y},e.waitForCdnTuneIn=function(g){var _=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*_)},e.setStartPosition=function(g,_){var A=this.startPosition;if(A<_&&(A=-1),A===-1||this.lastCurrentTime===-1){var k=g.startTimeOffset;Object(I.isFiniteNumber)(k)?(A=_+k,k<0&&(A+=g.totalduration),A=Math.min(Math.max(_,A),_+g.totalduration),this.log("Start time offset "+k+" found in playlist, adjust startPosition to "+A),this.startPosition=A):g.live?A=this.hls.liveSyncPosition||_:this.startPosition=A=0,this.lastCurrentTime=A}this.nextLoadPosition=A},e.getLoadPosition=function(){var g=this.media,_=0;return this.loadedmetadata&&g?_=g.currentTime:this.nextLoadPosition&&(_=this.nextLoadPosition),_},e.handleFragLoadAborted=function(g,_){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(_?" part"+_.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},e.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=c.IDLE)},e.onFragmentOrKeyLoadError=function(g,_){if(_.fatal)return;var A=_.frag;if(!A||A.type!==g)return;var k=this.fragCurrent;console.assert(k&&A.sn===k.sn&&A.level===k.level&&A.urlId===k.urlId,"Frag load error must match current frag to retry");var F=this.config;if(this.fragLoadError+1<=F.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(A.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*F.fragLoadingRetryDelay,F.fragLoadingMaxRetryTimeout);this.warn("Fragment "+A.sn+" of "+g+" "+A.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,this.fragLoadError++,this.state=c.FRAG_LOADING_WAITING_RETRY}else _.levelRetry?(g===o.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=c.IDLE):(M.logger.error(_.details+" reaches max retry, redispatch as fatal ..."),_.fatal=!0,this.hls.stopLoad(),this.state=c.ERROR)},e.afterBufferFlushed=function(g,_,A){if(!g)return;var k=U.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(_,k,A),this.state===c.ENDED&&this.resetLoadingState()},e.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=c.IDLE},e.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var _=this.levels?this.levels[g].details:null;if(_!=null&&_.live)return this.startPosition=-1,this.setStartPosition(_,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},e.updateLevelTiming=function(g,_,A,k){var F=this,z=A.details;console.assert(!!z,"level.details must be defined");var J=Object.keys(g.elementaryStreams).reduce(function(Y,$){var le=g.elementaryStreams[$];if(le){var be=le.endPTS-le.startPTS;if(be<=0)return F.warn("Could not parse fragment "+g.sn+" "+$+" duration reliably ("+be+") resetting transmuxer to fallback to playlist timing"),F.resetTransmuxer(),Y||!1;var ve=k?0:Object(E.updateFragPTSDTS)(z,g,le.startPTS,le.endPTS,le.startDTS,le.endDTS);return F.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:z,level:A,drift:ve,type:$,frag:g,start:le.startPTS,end:le.endPTS}),!0}return Y},!1);J?(this.state=c.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:g,part:_})):this.resetLoadingState()},e.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},f(t,[{key:"state",get:function(){return this._state},set:function(g){var _=this._state;_!==g&&(this._state=g,this.log(_+"->"+g))}}]),t}(v.default)},"./src/controller/buffer-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return C});var I=S("./src/polyfills/number.ts"),v=S("./src/events.ts"),x=S("./src/utils/logger.ts"),U=S("./src/errors.ts"),M=S("./src/utils/buffer-helper.ts"),R=S("./src/utils/mediasource-helper.ts"),w=S("./src/loader/fragment.ts"),b=S("./src/controller/buffer-operation-queue.ts"),T=Object(R.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function E(h){var r=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 o=r.hls,s=r.media,f=r.mediaSource;x.logger.log("[buffer-controller]: Media source opened"),s&&(r.updateMediaElementDuration(),o.trigger(v.Events.MEDIA_ATTACHED,{media:s})),f&&f.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},this._onMediaSourceClose=function(){x.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){x.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var y=E.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.registerListeners=function(){var r=this.hls;r.on(v.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.on(v.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(v.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(v.Events.BUFFER_RESET,this.onBufferReset,this),r.on(v.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.on(v.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.on(v.Events.BUFFER_EOS,this.onBufferEos,this),r.on(v.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.on(v.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.on(v.Events.FRAG_PARSED,this.onFragParsed,this),r.on(v.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var r=this.hls;r.off(v.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(v.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(v.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(v.Events.BUFFER_RESET,this.onBufferReset,this),r.off(v.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.off(v.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.off(v.Events.BUFFER_EOS,this.onBufferEos,this),r.off(v.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.off(v.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.off(v.Events.FRAG_PARSED,this.onFragParsed,this),r.off(v.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(r,o){var s=2;(o.audio&&!o.video||!o.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,x.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(r,o){var s=this.media=o.media;if(s&&T){var f=this.mediaSource=new T;f.addEventListener("sourceopen",this._onMediaSourceOpen),f.addEventListener("sourceended",this._onMediaSourceEnded),f.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(f),this._objectUrl=s.src}},y.onMediaDetaching=function(){var r=this.media,o=this.mediaSource,s=this._objectUrl;if(o){if(x.logger.log("[buffer-controller]: media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(f){x.logger.warn("[buffer-controller]: onMediaDetaching: "+f.message+" while calling endOfStream")}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),r&&(s&&self.URL.revokeObjectURL(s),r.src===s?(r.removeAttribute("src"),r.load()):x.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(v.Events.MEDIA_DETACHED,void 0)},y.onBufferReset=function(){var r=this;this.getSourceBufferTypes().forEach(function(o){var s=r.sourceBuffer[o];try{s&&(r.removeBufferListeners(o),r.mediaSource&&r.mediaSource.removeSourceBuffer(s),r.sourceBuffer[o]=void 0)}catch(f){x.logger.warn("[buffer-controller]: Failed to reset the "+o+" buffer",f)}}),this._initSourceBuffer()},y.onBufferCodecs=function(r,o){var s=this,f=this.getSourceBufferTypes().length;if(Object.keys(o).forEach(function(d){if(f){var l=s.tracks[d];if(l&&typeof l.buffer.changeType=="function"){var m=o[d],c=m.codec,i=m.levelCodec,n=m.container,t=(l.levelCodec||l.codec).replace(O,"$1"),e=(i||c).replace(O,"$1");if(t!==e){var p=n+";codecs="+(i||c);s.appendChangeType(d,p)}}}else s.pendingTracks[d]=o[d]}),f)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(r,o){var s=this,f=this.operationQueue,d={execute:function(){var m=s.sourceBuffer[r];m&&(x.logger.log("[buffer-controller]: changing "+r+" sourceBuffer type to "+o),m.changeType(o)),f.shiftAndExecuteNext(r)},onStart:function(){},onComplete:function(){},onError:function(m){x.logger.warn("[buffer-controller]: Failed to change "+r+" SourceBuffer type",m)}};f.append(d,r)},y.onBufferAppending=function(r,o){var s=this,f=this.hls,d=this.operationQueue,l=this.tracks,m=o.data,c=o.type,i=o.frag,n=o.part,t=o.chunkMeta,e=t.buffering[c],p=self.performance.now();e.start=p;var g=i.stats.buffering,_=n?n.stats.buffering:null;g.start===0&&(g.start=p),_&&_.start===0&&(_.start=p);var A=l.audio,k=c==="audio"&&t.id===1&&(A==null?void 0:A.container)==="audio/mpeg",F={execute:function(){if(e.executeStart=self.performance.now(),k){var J=s.sourceBuffer[c];if(J){var Y=i.start-J.timestampOffset;Math.abs(Y)>=.1&&(x.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+i.start+" (delta: "+Y+") sn: "+i.sn+")"),J.timestampOffset=i.start)}}s.appendExecutor(m,c)},onStart:function(){},onComplete:function(){var J=self.performance.now();e.executeEnd=e.end=J,g.first===0&&(g.first=J),_&&_.first===0&&(_.first=J);var Y=s.sourceBuffer,$={};for(var le in Y)$[le]=M.BufferHelper.getBuffered(Y[le]);s.appendError=0,s.hls.trigger(v.Events.BUFFER_APPENDED,{type:c,frag:i,part:n,chunkMeta:t,parent:i.type,timeRanges:$})},onError:function(J){x.logger.error("[buffer-controller]: Error encountered while trying to append to the "+c+" SourceBuffer",J);var Y={type:U.ErrorTypes.MEDIA_ERROR,parent:i.type,details:U.ErrorDetails.BUFFER_APPEND_ERROR,err:J,fatal:!1};J.code===DOMException.QUOTA_EXCEEDED_ERR?Y.details=U.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,Y.details=U.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>f.config.appendErrorMaxRetry&&(x.logger.error("[buffer-controller]: Failed "+f.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),Y.fatal=!0)),f.trigger(v.Events.ERROR,Y)}};d.append(F,c)},y.onBufferFlushing=function(r,o){var s=this,f=this.operationQueue,d=function(m){return{execute:s.removeExecutor.bind(s,m,o.startOffset,o.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(v.Events.BUFFER_FLUSHED,{type:m})},onError:function(i){x.logger.warn("[buffer-controller]: Failed to remove from "+m+" SourceBuffer",i)}}};o.type?f.append(d(o.type),o.type):this.getSourceBufferTypes().forEach(function(l){f.append(d(l),l)})},y.onFragParsed=function(r,o){var s=this,f=o.frag,d=o.part,l=[],m=d?d.elementaryStreams:f.elementaryStreams;m[w.ElementaryStreamTypes.AUDIOVIDEO]?l.push("audiovideo"):(m[w.ElementaryStreamTypes.AUDIO]&&l.push("audio"),m[w.ElementaryStreamTypes.VIDEO]&&l.push("video"));var c=function(){var n=self.performance.now();f.stats.buffering.end=n,d&&(d.stats.buffering.end=n);var t=d?d.stats:f.stats;s.hls.trigger(v.Events.FRAG_BUFFERED,{frag:f,part:d,stats:t,id:f.type})};l.length===0&&x.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+f.type+" level: "+f.level+" sn: "+f.sn),this.blockBuffers(c,l)},y.onFragChanged=function(r,o){this.flushBackBuffer()},y.onBufferEos=function(r,o){var s=this,f=this.getSourceBufferTypes().reduce(function(d,l){var m=s.sourceBuffer[l];return(!o.type||o.type===l)&&(m&&!m.ended&&(m.ended=!0,x.logger.log("[buffer-controller]: "+l+" sourceBuffer now EOS"))),d&&!!(!m||m.ended)},!0);f&&this.blockBuffers(function(){var d=s.mediaSource;if(!d||d.readyState!=="open")return;d.endOfStream()})},y.onLevelUpdated=function(r,o){var s=o.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var r=this.hls,o=this.details,s=this.media,f=this.sourceBuffer;if(!s||o===null)return;var d=this.getSourceBufferTypes();if(!d.length)return;var l=o.live&&r.config.liveBackBufferLength!==null?r.config.liveBackBufferLength:r.config.backBufferLength;if(!Object(I.isFiniteNumber)(l)||l<0)return;var m=s.currentTime,c=o.levelTargetDuration,i=Math.max(l,c),n=Math.floor(m/c)*c-i;d.forEach(function(t){var e=f[t];if(e){var p=M.BufferHelper.getBuffered(e);p.length>0&&n>p.start(0)&&(r.trigger(v.Events.BACK_BUFFER_REACHED,{bufferEnd:n}),o.live&&r.trigger(v.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n}),r.trigger(v.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:t}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var r=this.details,o=this.hls,s=this.media,f=this.mediaSource,d=r.fragments[0].start+r.totalduration,l=s.duration,m=Object(I.isFiniteNumber)(f.duration)?f.duration:0;r.live&&o.config.liveDurationInfinity?(x.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),f.duration=Infinity,this.updateSeekableRange(r)):(d>m&&d>l||!Object(I.isFiniteNumber)(l))&&(x.logger.log("[buffer-controller]: Updating Media Source duration to "+d.toFixed(3)),f.duration=d)},y.updateSeekableRange=function(r){var o=this.mediaSource,s=r.fragments,f=s.length;if(f&&r.live&&o!==null&&o!==void 0&&o.setLiveSeekableRange){var d=Math.max(0,s[0].start),l=Math.max(d,d+r.totalduration);o.setLiveSeekableRange(d,l)}},y.checkPendingTracks=function(){var r=this.bufferCodecEventsExpected,o=this.operationQueue,s=this.pendingTracks,f=Object.keys(s).length;if(f&&!r||f===2){this.createSourceBuffers(s),this.pendingTracks={};var d=this.getSourceBufferTypes();if(d.length===0){this.hls.trigger(v.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}d.forEach(function(l){o.executeNext(l)})}},y.createSourceBuffers=function(r){var o=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var f=0;for(var d in r)if(!o[d]){var l=r[d];if(!l)throw Error("source buffer exists for track "+d+", however track does not");var m=l.levelCodec||l.codec,c=l.container+";codecs="+m;x.logger.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var i=o[d]=s.addSourceBuffer(c),n=d;this.addBufferListener(n,"updatestart",this._onSBUpdateStart),this.addBufferListener(n,"updateend",this._onSBUpdateEnd),this.addBufferListener(n,"error",this._onSBUpdateError),this.tracks[d]={buffer:i,codec:m,container:l.container,levelCodec:l.levelCodec,id:l.id},f++}catch(t){x.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(v.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:c})}}f&&this.hls.trigger(v.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(r){var o=this.operationQueue,s=o.current(r);s.onStart()},y._onSBUpdateEnd=function(r){var o=this.operationQueue,s=o.current(r);s.onComplete(),o.shiftAndExecuteNext(r)},y._onSBUpdateError=function(r,o){x.logger.error("[buffer-controller]: "+r+" SourceBuffer error",o),this.hls.trigger(v.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(r);s&&s.onError(o)},y.removeExecutor=function(r,o,s){var f=this.media,d=this.mediaSource,l=this.operationQueue,m=this.sourceBuffer,c=m[r];if(!f||!d||!c){x.logger.warn("[buffer-controller]: Attempting to remove from the "+r+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(r);return}var i=Object(I.isFiniteNumber)(f.duration)?f.duration:Infinity,n=Object(I.isFiniteNumber)(d.duration)?d.duration:Infinity,t=Math.max(0,o),e=Math.min(s,i,n);e>t?(x.logger.log("[buffer-controller]: Removing ["+t+","+e+"] from the "+r+" SourceBuffer"),console.assert(!c.updating,r+" sourceBuffer must not be updating"),c.remove(t,e)):l.shiftAndExecuteNext(r)},y.appendExecutor=function(r,o){var s=this.operationQueue,f=this.sourceBuffer,d=f[o];if(!d){x.logger.warn("[buffer-controller]: Attempting to append to the "+o+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(o);return}d.ended=!1,console.assert(!d.updating,o+" sourceBuffer must not be updating"),d.appendBuffer(r)},y.blockBuffers=function(r,o){var s=this;if(o===void 0&&(o=this.getSourceBufferTypes()),!o.length){x.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(r);return}var f=this.operationQueue,d=o.map(function(l){return f.appendBlocker(l)});Promise.all(d).then(function(){r(),o.forEach(function(l){var m=s.sourceBuffer[l];(!m||!m.updating)&&f.shiftAndExecuteNext(l)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(r,o,s){var f=this.sourceBuffer[r];if(!f)return;var d=s.bind(this,r);this.listeners[r].push({event:o,listener:d}),f.addEventListener(o,d)},y.removeBufferListeners=function(r){var o=this.sourceBuffer[r];if(!o)return;this.listeners[r].forEach(function(s){o.removeEventListener(s.event,s.listener)})},E}()},"./src/controller/buffer-operation-queue.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return v});var I=S("./src/utils/logger.ts"),v=function(){function x(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var U=x.prototype;return U.append=function(R,w){var b=this.queues[w];b.push(R),b.length===1&&this.buffers[w]&&this.executeNext(w)},U.insertAbort=function(R,w){var b=this.queues[w];b.unshift(R),this.executeNext(w)},U.appendBlocker=function(R){var w,b=new Promise(function(O){w=O}),T={execute:w,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,R),b},U.executeNext=function(R){var w=this.buffers,b=this.queues,T=w[R],O=b[R];if(O.length){var C=O[0];try{C.execute()}catch(E){I.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(E),(!T||!T.updating)&&(O.shift(),this.executeNext(R))}}},U.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},U.current=function(R){return this.queues[R][0]},x}()},"./src/controller/cap-level-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts");function v(M,R){for(var w=0;w<R.length;w++){var b=R[w];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(M,b.key,b)}}function x(M,R,w){return R&&v(M.prototype,R),w&&v(M,w),M}var U=function(){function M(w){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=w,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=M.prototype;return R.setStreamController=function(b){this.streamController=b},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var b=this.hls;b.on(I.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var b=this.hls;b.off(I.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(b,T){M.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},R.onMediaAttaching=function(b,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},R.onManifestParsed=function(b,T){var O=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,O.config.capLevelToPlayerSize&&T.video&&this.startCapping()},R.onBufferCodecs=function(b,T){var O=this.hls;O.config.capLevelToPlayerSize&&T.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(b.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},R.getMaxLevel=function(b){var T=this,O=this.hls.levels;if(!O.length)return-1;var C=O.filter(function(E,y){return M.isLevelAllowed(y,T.restrictedLevels)&&y<=b});return this.clientRect=null,M.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},R.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()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var b=this.media,T={width:0,height:0};if(b){var O=b.getBoundingClientRect();T.width=O.width,T.height=O.height,!T.width&&!T.height&&(T.width=O.right-O.left||b.width||0,T.height=O.bottom-O.top||b.height||0)}return this.clientRect=T,T},M.isLevelAllowed=function(b,T){return T===void 0&&(T=[]),T.indexOf(b)===-1},M.getMaxLevelByMediaSize=function(b,T,O){if(!b||!b.length)return-1;for(var C=function(o,s){return s?o.width!==s.width||o.height!==s.height:!0},E=b.length-1,y=0;y<b.length;y+=1){var h=b[y];if((h.width>=T||h.height>=O)&&C(h,b[y+1])){E=y;break}}return E},x(M,[{key:"mediaWidth",get:function(){return this.getDimensions().width*M.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*M.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var b=1;try{b=self.devicePixelRatio}catch(T){}return b}}]),M}();N.default=U},"./src/controller/cmcd-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return C});var I=S("./src/events.ts"),v=S("./src/types/cmcd.ts"),x=S("./src/utils/buffer-helper.ts"),U=S("./src/utils/logger.ts");function M(E,y){for(var h=0;h<y.length;h++){var r=y[h];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(E,r.key,r)}}function R(E,y,h){return y&&M(E.prototype,y),h&&M(E,h),E}function w(E,y){var h=typeof Symbol!="undefined"&&E[Symbol.iterator]||E["@@iterator"];if(h)return(h=h.call(E)).next.bind(h);if(Array.isArray(E)||(h=b(E))||y&&E&&typeof E.length=="number"){h&&(E=h);var r=0;return function(){return r>=E.length?{done:!0}:{done:!1,value:E[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(E,y){if(!E)return;if(typeof E=="string")return T(E,y);var h=Object.prototype.toString.call(E).slice(8,-1);if(h==="Object"&&E.constructor&&(h=E.constructor.name),h==="Map"||h==="Set")return Array.from(E);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return T(E,y)}function T(E,y){(y==null||y>E.length)&&(y=E.length);for(var h=0,r=new Array(y);h<y;h++)r[h]=E[h];return r}function O(){return O=Object.assign||function(E){for(var y=1;y<arguments.length;y++){var h=arguments[y];for(var r in h)Object.prototype.hasOwnProperty.call(h,r)&&(E[r]=h[r])}return E},O.apply(this,arguments)}var C=function(){function E(h){var r=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(f){try{r.apply(f,{ot:v.CMCDObjectType.MANIFEST,su:!r.initialized})}catch(d){U.logger.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(f){try{var d=f.frag,l=r.hls.levels[d.level],m=r.getObjectType(d),c={d:d.duration*1e3,ot:m};(m===v.CMCDObjectType.VIDEO||m===v.CMCDObjectType.AUDIO||m==v.CMCDObjectType.MUXED)&&(c.br=l.bitrate/1e3,c.tb=r.getTopBandwidth(m),c.bl=r.getBufferLength(m)),r.apply(f,c)}catch(i){U.logger.warn("Could not generate segment CMCD data.",i)}},this.hls=h;var o=this.config=h.config,s=o.cmcd;s!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||E.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var y=E.prototype;return y.registerListeners=function(){var r=this.hls;r.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var r=this.hls;r.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(r,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(r,o){var s,f;this.audioBuffer=(s=o.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(f=o.tracks.video)===null||f===void 0?void 0:f.buffer},y.createData=function(){var r;return{v:v.CMCDVersion,sf:v.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(r=this.media)===null||r===void 0?void 0:r.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},y.apply=function(r,o){o===void 0&&(o={}),O(o,this.createData());var s=o.ot===v.CMCDObjectType.INIT||o.ot===v.CMCDObjectType.VIDEO||o.ot===v.CMCDObjectType.MUXED;if(this.starved&&s&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering),this.useHeaders){var f=E.toHeaders(o);if(!Object.keys(f).length)return;r.headers||(r.headers={}),O(r.headers,f)}else{var d=E.toQuery(o);if(!d)return;r.url=E.appendQueryToUri(r.url,d)}},y.getObjectType=function(r){var o=r.type;return o==="subtitle"?v.CMCDObjectType.TIMED_TEXT:r.sn==="initSegment"?v.CMCDObjectType.INIT:o==="audio"?v.CMCDObjectType.AUDIO:o==="main"?this.hls.audioTracks.length?v.CMCDObjectType.VIDEO:v.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(r){for(var o=0,s=r===v.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,f=w(s),d;!(d=f()).done;){var l=d.value;l.bitrate>o&&(o=l.bitrate)}return o>0?o:NaN},y.getBufferLength=function(r){var o=this.hls.media,s=r===v.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!o)return NaN;var f=x.BufferHelper.bufferInfo(s,o.currentTime,this.config.maxBufferHole);return f.len*1e3},y.createPlaylistLoader=function(){var r=this.config.pLoader,o=this.applyPlaylistData,s=r||this.config.loader;return function(){function f(l){this.loader=void 0,this.loader=new s(l)}var d=f.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(m,c,i){o(m),this.loader.load(m,c,i)},R(f,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),f}()},y.createFragmentLoader=function(){var r=this.config.fLoader,o=this.applyFragmentData,s=r||this.config.loader;return function(){function f(l){this.loader=void 0,this.loader=new s(l)}var d=f.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(m,c,i){o(m),this.loader.load(m,c,i)},R(f,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),f}()},E.uuid=function(){var r=URL.createObjectURL(new Blob),o=r.toString();return URL.revokeObjectURL(r),o.substr(o.lastIndexOf("/")+1)},E.serialize=function(r){for(var o=[],s=function(k){return!Number.isNaN(k)&&k!=null&&k!==""&&k!==!1},f=function(k){return Math.round(k)},d=function(k){return f(k/100)*100},l=function(k){return encodeURIComponent(k)},m={br:f,d:f,bl:d,dl:d,mtp:d,nor:l,rtp:d,tb:f},c=Object.keys(r||{}).sort(),i=w(c),n;!(n=i()).done;){var t=n.value,e=r[t];if(!s(e))continue;if(t==="v"&&e===1)continue;if(t=="pr"&&e===1)continue;var p=m[t];p&&(e=p(e));var g=typeof e,_=void 0;t==="ot"||t==="sf"||t==="st"?_=t+"="+e:g==="boolean"?_=t:g==="number"?_=t+"="+e:_=t+"="+JSON.stringify(e),o.push(_)}return o.join(",")},E.toHeaders=function(r){for(var o=Object.keys(r),s={},f=["Object","Request","Session","Status"],d=[{},{},{},{}],l={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,c=o;m<c.length;m++){var i=c[m],n=l[i]!=null?l[i]:1;d[n][i]=r[i]}for(var t=0;t<d.length;t++){var e=E.serialize(d[t]);e&&(s["CMCD-"+f[t]]=e)}return s},E.toQuery=function(r){return"CMCD="+encodeURIComponent(E.serialize(r))},E.appendQueryToUri=function(r,o){if(!o)return r;var s=r.includes("?")?"&":"?";return""+r+s+o},E}()},"./src/controller/eme-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),v=S("./src/errors.ts"),x=S("./src/utils/logger.ts"),U=S("./src/utils/mediakeys-helper.ts");function M(C,E){for(var y=0;y<E.length;y++){var h=E[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(C,h.key,h)}}function R(C,E,y){return E&&M(C.prototype,E),y&&M(C,y),C}var w=3,b=function(E,y,h){var r={audioCapabilities:[],videoCapabilities:[]};return E.forEach(function(o){r.audioCapabilities.push({contentType:'audio/mp4; codecs="'+o+'"',robustness:h.audioRobustness||""})}),y.forEach(function(o){r.videoCapabilities.push({contentType:'video/mp4; codecs="'+o+'"',robustness:h.videoRobustness||""})}),[r]},T=function(E,y,h,r){switch(E){case U.KeySystems.WIDEVINE:return b(y,h,r);default:throw new Error("Unknown key-system: "+E)}},O=function(){function C(y){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=y,this._config=y.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 E=C.prototype;return E.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},E._registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E._unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E.getLicenseServerUrl=function(h){switch(h){case U.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},E._attemptKeySystemAccess=function(h,r,o){var s=this,f=T(h,r,o,this._drmSystemOptions);x.logger.log("Requesting encrypted media key-system access");var d=this.requestMediaKeySystemAccess(h,f);this.mediaKeysPromise=d.then(function(l){return s._onMediaKeySystemAccessObtained(h,l)}),d.catch(function(l){x.logger.error('Failed to obtain key-system "'+h+'" access:',l)})},E._onMediaKeySystemAccessObtained=function(h,r){var o=this;x.logger.log('Access for key-system "'+h+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:r,mediaKeySystemDomain:h};this._mediaKeysList.push(s);var f=Promise.resolve().then(function(){return r.createMediaKeys()}).then(function(d){return s.mediaKeys=d,x.logger.log('Media-keys created for key-system "'+h+'"'),o._onMediaKeysCreated(),d});return f.catch(function(d){x.logger.error("Failed to create media-keys:",d)}),f},E._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(r){r.mediaKeysSession||(r.mediaKeysSession=r.mediaKeys.createSession(),h._onNewMediaKeySession(r.mediaKeysSession))})},E._onNewMediaKeySession=function(h){var r=this;x.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(o){r._onKeySessionMessage(h,o.message)},!1)},E._onKeySessionMessage=function(h,r){x.logger.log("Got EME message event, creating license request"),this._requestLicense(r,function(o){x.logger.log("Received license data (length: "+(o&&o.byteLength)+"), updating key-session"),h.update(o)})},E.onMediaEncrypted=function(h){var r=this;if(x.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){x.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.KEY_SYSTEM_ERROR,details:v.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var o=function(f){if(!r._media)return;r._attemptSetMediaKeys(f),r._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(o).catch(o)},E._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var r=this._mediaKeysList[0];if(!r||!r.mediaKeys){x.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.KEY_SYSTEM_ERROR,details:v.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}x.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(r.mediaKeys),this._hasSetMediaKeys=!0}},E._generateRequestWithPreferredKeySession=function(h,r){var o=this,s=this._mediaKeysList[0];if(!s){x.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.KEY_SYSTEM_ERROR,details:v.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){x.logger.warn("Key-Session already initialized but requested again");return}var f=s.mediaKeysSession;if(!f){x.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.KEY_SYSTEM_ERROR,details:v.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!r){x.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.KEY_SYSTEM_ERROR,details:v.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}x.logger.log('Generating key-session request for "'+h+'" init data type'),s.mediaKeysSessionInitialized=!0,f.generateRequest(h,r).then(function(){x.logger.debug("Key-session generation succeeded")}).catch(function(d){x.logger.error("Error generating key-session request:",d),o.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.KEY_SYSTEM_ERROR,details:v.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},E._createLicenseXhr=function(h,r,o){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,h,r,o);var f=this._licenseXhrSetup;if(f)try{f.call(this.hls,s,h),f=void 0}catch(d){x.logger.error(d)}try{s.readyState||s.open("POST",h,!0),f&&f.call(this.hls,s,h)}catch(d){throw new Error("issue setting up KeySystem license XHR "+d)}return s},E._onLicenseRequestReadyStageChange=function(h,r,o,s){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,x.logger.log("License request succeeded");var f=h.response,d=this._licenseResponseCallback;if(d)try{f=d.call(this.hls,h,r)}catch(m){x.logger.error(m)}s(f)}else{if(x.logger.error("License Request XHR failed ("+r+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>w){this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.KEY_SYSTEM_ERROR,details:v.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var l=w-this._requestLicenseFailureCount+1;x.logger.warn("Retrying license request, "+l+" attempts left"),this._requestLicense(o,s)}break}},E._generateLicenseRequestChallenge=function(h,r){switch(h.mediaKeySystemDomain){case U.KeySystems.WIDEVINE:return r}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},E._requestLicense=function(h,r){x.logger.log("Requesting content license for key-system");var o=this._mediaKeysList[0];if(!o){x.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.KEY_SYSTEM_ERROR,details:v.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(o.mediaKeySystemDomain),f=this._createLicenseXhr(s,h,r);x.logger.log("Sending license request to URL: "+s);var d=this._generateLicenseRequestChallenge(o,h);f.send(d)}catch(l){x.logger.error("Failure requesting DRM license: "+l),this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.KEY_SYSTEM_ERROR,details:v.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},E.onMediaAttached=function(h,r){if(!this._emeEnabled)return;var o=r.media;this._media=o,o.addEventListener("encrypted",this._onMediaEncrypted)},E.onMediaDetached=function(){var h=this._media,r=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(r.map(function(o){if(o.mediaKeysSession)return o.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},E.onManifestParsed=function(h,r){if(!this._emeEnabled)return;var o=r.levels.map(function(f){return f.audioCodec}).filter(function(f){return!!f}),s=r.levels.map(function(f){return f.videoCodec}).filter(function(f){return!!f});this._attemptKeySystemAccess(U.KeySystems.WIDEVINE,o,s)},R(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();N.default=O},"./src/controller/fps-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),v=S("./src/utils/logger.ts"),x=function(){function U(R){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=R,this.registerListeners()}var M=U.prototype;return M.setStreamController=function(w){this.streamController=w},M.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},M.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching)},M.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},M.onMediaAttaching=function(w,b){var T=this.hls.config;if(T.capLevelOnFPSDrop){var O=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},M.checkFPS=function(w,b,T){var O=performance.now();if(b){if(this.lastTime){var C=O-this.lastTime,E=T-this.lastDroppedFrames,y=b-this.lastDecodedFrames,h=1e3*E/C,r=this.hls;if(r.trigger(I.Events.FPS_DROP,{currentDropped:E,currentDecoded:y,totalDroppedFrames:T}),h>0&&E>r.config.fpsDroppedMonitoringThreshold*y){var o=r.currentLevel;v.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+o),o>0&&(r.autoLevelCapping===-1||r.autoLevelCapping>=o)&&(o=o-1,r.trigger(I.Events.FPS_DROP_LEVEL_CAPPING,{level:o,droppedLevel:r.currentLevel}),r.autoLevelCapping=o,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=T,this.lastDecodedFrames=b}},M.checkFPSInterval=function(){var w=this.media;if(w)if(this.isVideoPlaybackQualityAvailable){var b=w.getVideoPlaybackQuality();this.checkFPS(w,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(w,w.webkitDecodedFrameCount,w.webkitDroppedFrameCount)},U}();N.default=x},"./src/controller/fragment-finders.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"findFragmentByPDT",function(){return x}),S.d(N,"findFragmentByPTS",function(){return U}),S.d(N,"fragmentWithinToleranceTest",function(){return M}),S.d(N,"pdtWithinToleranceTest",function(){return R}),S.d(N,"findFragWithCC",function(){return w});var I=S("./src/polyfills/number.ts"),v=S("./src/utils/binary-search.ts");function x(b,T,O){if(T===null||!Array.isArray(b)||!b.length||!Object(I.isFiniteNumber)(T))return null;var C=b[0].programDateTime;if(T<(C||0))return null;var E=b[b.length-1].endProgramDateTime;if(T>=(E||0))return null;O=O||0;for(var y=0;y<b.length;++y){var h=b[y];if(R(T,O,h))return h}return null}function U(b,T,O,C){O===void 0&&(O=0),C===void 0&&(C=0);var E=null;if(b?E=T[b.sn-T[0].sn+1]||null:O===0&&T[0].start===0&&(E=T[0]),E&&M(O,C,E)===0)return E;var y=v.default.search(T,M.bind(null,O,C));return y||E}function M(b,T,O){b===void 0&&(b=0),T===void 0&&(T=0);var C=Math.min(T,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-C<=b?1:O.start-C>b&&O.start?-1:0}function R(b,T,O){var C=Math.min(T,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,E=O.endProgramDateTime||0;return E-C>b}function w(b,T){return v.default.search(b,function(O){return O.cc<T?1:O.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"FragmentState",function(){return x}),S.d(N,"FragmentTracker",function(){return U});var I=S("./src/events.ts"),v=S("./src/types/loader.ts"),x;(function(w){w.NOT_LOADED="NOT_LOADED",w.BACKTRACKED="BACKTRACKED",w.APPENDING="APPENDING",w.PARTIAL="PARTIAL",w.OK="OK"})(x||(x={}));var U=function(){function w(T){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=T,this._registerListeners()}var b=w.prototype;return b._registerListeners=function(){var O=this.hls;O.on(I.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(I.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var O=this.hls;O.off(I.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(I.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(O,C){if(C===v.PlaylistLevelType.MAIN){var E=this.activeFragment,y=this.activeParts;if(!E)return null;if(y)for(var h=y.length;h--;){var r=y[h],o=r?r.end:E.appendedPTS;if(r.start<=O&&o!==void 0&&O<=o)return h>9&&(this.activeParts=y.slice(h-9)),r}else if(E.start<=O&&E.appendedPTS!==void 0&&O<=E.appendedPTS)return E}return this.getBufferedFrag(O,C)},b.getBufferedFrag=function(O,C){for(var E=this.fragments,y=Object.keys(E),h=y.length;h--;){var r=E[y[h]];if((r==null?void 0:r.body.type)===C&&r.buffered){var o=r.body;if(o.start<=O&&O<=o.end)return o}}return null},b.detectEvictedFragments=function(O,C,E){var y=this;Object.keys(this.fragments).forEach(function(h){var r=y.fragments[h];if(!r)return;if(!r.buffered){r.body.type===E&&y.removeFragment(r.body);return}var o=r.range[O];if(!o)return;o.time.some(function(s){var f=!y.isTimeBuffered(s.startPTS,s.endPTS,C);return f&&y.removeFragment(r.body),f})})},b.detectPartialFragments=function(O){var C=this,E=this.timeRanges,y=O.frag,h=O.part;if(!E||y.sn==="initSegment")return;var r=R(y),o=this.fragments[r];if(!o)return;Object.keys(E).forEach(function(s){var f=y.elementaryStreams[s];if(!f)return;var d=E[s],l=h!==null||f.partial===!0;o.range[s]=C.getBufferedTimes(y,h,l,d)}),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body)},b.fragBuffered=function(O){var C=R(O),E=this.fragments[C];E&&(E.backtrack=E.loaded=null,E.buffered=!0)},b.getBufferedTimes=function(O,C,E,y){for(var h={time:[],partial:E},r=C?C.start:O.start,o=C?C.end:O.end,s=O.minEndPTS||o,f=O.maxStartPTS||r,d=0;d<y.length;d++){var l=y.start(d)-this.bufferPadding,m=y.end(d)+this.bufferPadding;if(f>=l&&s<=m){h.time.push({startPTS:Math.max(r,y.start(d)),endPTS:Math.min(o,y.end(d))});break}else if(r<m&&o>l)h.partial=!0,h.time.push({startPTS:Math.max(r,y.start(d)),endPTS:Math.min(o,y.end(d))});else if(o<=l)break}return h},b.getPartialFragment=function(O){var C=null,E,y,h,r=0,o=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(f){var d=s[f];if(!d)return;M(d)&&(y=d.body.start-o,h=d.body.end+o,O>=y&&O<=h&&(E=Math.min(O-y,h-O),r<=E&&(C=d.body,r=E)))}),C},b.getState=function(O){var C=R(O),E=this.fragments[C];return E?E.buffered?M(E)?x.PARTIAL:x.OK:E.backtrack?x.BACKTRACKED:x.APPENDING:x.NOT_LOADED},b.backtrack=function(O,C){var E=R(O),y=this.fragments[E];if(!y||y.backtrack)return null;var h=y.backtrack=C||y.loaded;return y.loaded=null,h},b.getBacktrackData=function(O){var C=R(O),E=this.fragments[C];if(E){var y,h=E.backtrack;if(h!=null&&(y=h.payload)!==null&&y!==void 0&&y.byteLength)return h;this.removeFragment(O)}return null},b.isTimeBuffered=function(O,C,E){for(var y,h,r=0;r<E.length;r++){if(y=E.start(r)-this.bufferPadding,h=E.end(r)+this.bufferPadding,O>=y&&C<=h)return!0;if(C<=y)return!1}return!1},b.onFragLoaded=function(O,C){var E=C.frag,y=C.part;if(E.sn==="initSegment"||E.bitrateTest||y)return;var h=R(E);this.fragments[h]={body:E,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(O,C){var E=this,y=C.frag,h=C.part,r=C.timeRanges;if(y.type===v.PlaylistLevelType.MAIN)if(this.activeFragment=y,h){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(h)}else this.activeParts=null;this.timeRanges=r,Object.keys(r).forEach(function(s){var f=r[s];if(E.detectEvictedFragments(s,f),!h)for(var d=0;d<f.length;d++)y.appendedPTS=Math.max(f.end(d),y.appendedPTS||0)})},b.onFragBuffered=function(O,C){this.detectPartialFragments(C)},b.hasFragment=function(O){var C=R(O);return!!this.fragments[C]},b.removeFragmentsInRange=function(O,C,E){var y=this;Object.keys(this.fragments).forEach(function(h){var r=y.fragments[h];if(!r)return;if(r.buffered){var o=r.body;o.type===E&&o.start<C&&o.end>O&&y.removeFragment(o)}})},b.removeFragment=function(O){var C=R(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[C]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},w}();function M(w){var b,T;return w.buffered&&(((b=w.range.video)===null||b===void 0?void 0:b.partial)||((T=w.range.audio)===null||T===void 0?void 0:T.partial))}function R(w){return w.type+"_"+w.level+"_"+w.urlId+"_"+w.sn}},"./src/controller/gap-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"STALL_MINIMUM_DURATION_MS",function(){return M}),S.d(N,"MAX_START_GAP_JUMP",function(){return R}),S.d(N,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return w}),S.d(N,"SKIP_BUFFER_RANGE_START",function(){return b}),S.d(N,"default",function(){return T});var I=S("./src/utils/buffer-helper.ts"),v=S("./src/errors.ts"),x=S("./src/events.ts"),U=S("./src/utils/logger.ts"),M=250,R=2,w=.1,b=.05,T=function(){function O(E,y,h,r){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=E,this.media=y,this.fragmentTracker=h,this.hls=r}var C=O.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(y){var h=this.config,r=this.media,o=this.stalled,s=r.currentTime,f=r.seeking,d=this.seeking&&!f,l=!this.seeking&&f;if(this.seeking=f,s!==y){if(this.moved=!0,o!==null){if(this.stallReported){var m=self.performance.now()-o;U.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(m)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((l||d)&&(this.stalled=null),r.paused||r.ended||r.playbackRate===0||!I.BufferHelper.getBuffered(r).length)return;var c=I.BufferHelper.bufferInfo(r,s,0),i=c.len>0,n=c.nextStart||0;if(!i&&!n)return;if(f){var t=c.len>R,e=!n||n-s>R&&!this.fragmentTracker.getPartialFragment(s);if(t||e)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var p,g=Math.max(n,c.start||0)-s,_=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,A=_==null||((p=_.details)===null||p===void 0)?void 0:p.live,k=A?_.details.targetduration*2:R;if(g>0&&g<=k){this._trySkipBufferHole(null);return}}var F=self.performance.now();if(o===null){this.stalled=F;return}var z=F-o;!f&&z>=M&&this._reportStall(c.len);var J=I.BufferHelper.bufferInfo(r,s,h.maxBufferHole);this._tryFixBufferStall(J,z)},C._tryFixBufferStall=function(y,h){var r=this.config,o=this.fragmentTracker,s=this.media,f=s.currentTime,d=o.getPartialFragment(f);if(d){var l=this._trySkipBufferHole(d);if(l)return}y.len>r.maxBufferHole&&h>r.highBufferWatchdogPeriod*1e3&&(U.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(y){var h=this.hls,r=this.media,o=this.stallReported;o||(this.stallReported=!0,U.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+y+")"),h.trigger(x.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},C._trySkipBufferHole=function(y){for(var h=this.config,r=this.hls,o=this.media,s=o.currentTime,f=0,d=I.BufferHelper.getBuffered(o),l=0;l<d.length;l++){var m=d.start(l);if(s+h.maxBufferHole>=f&&s<m){var c=Math.max(m+b,o.currentTime+w);return U.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+c),this.moved=!0,this.stalled=null,o.currentTime=c,y&&r.trigger(x.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+c,frag:y}),c}f=d.end(l)}return 0},C._tryNudgeBuffer=function(){var y=this.config,h=this.hls,r=this.media,o=r.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<y.nudgeMaxRetry){var f=o+s*y.nudgeOffset;U.logger.warn("Nudging 'currentTime' from "+o+" to "+f),r.currentTime=f,h.trigger(x.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else U.logger.error("Playhead still not moving while enough data buffered @"+o+" after "+y.nudgeMaxRetry+" nudges"),h.trigger(x.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),v=S("./src/utils/texttrack-utils.ts"),x=S("./src/demux/id3.ts"),U=.25,M=function(){function R(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var w=R.prototype;return w.destroy=function(){this._unregisterListeners()},w._registerListeners=function(){var T=this.hls;T.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(I.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var T=this.hls;T.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(I.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.onMediaAttached=function(T,O){this.media=O.media},w.onMediaDetaching=function(){if(!this.id3Track)return;Object(v.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},w.getID3Track=function(T){if(!this.media)return;for(var O=0;O<T.length;O++){var C=T[O];if(C.kind==="metadata"&&C.label==="id3")return Object(v.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},w.onFragParsingMetadata=function(T,O){if(!this.media)return;var C=O.frag,E=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<E.length;h++){var r=x.getID3Frames(E[h].data);if(r){var o=E[h].pts,s=h<E.length-1?E[h+1].pts:C.end,f=s-o;f<=0&&(s=o+U);for(var d=0;d<r.length;d++){var l=r[d];if(!x.isTimeStampFrame(l)){var m=new y(o,s,"");m.value=l,this.id3Track.addCue(m)}}}}},w.onBufferFlushing=function(T,O){var C=O.startOffset,E=O.endOffset,y=O.type;if(!y||y==="audio"){var h=this.id3Track;h&&Object(v.removeCuesInRange)(h,C,E)}},R}();N.default=M},"./src/controller/latency-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return R});var I=S("./src/errors.ts"),v=S("./src/events.ts"),x=S("./src/utils/logger.ts");function U(w,b){for(var T=0;T<b.length;T++){var O=b[T];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(w,O.key,O)}}function M(w,b,T){return b&&U(w.prototype,b),T&&U(w,T),w}var R=function(){function w(T){var O=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 O.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var b=w.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(v.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(v.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(v.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(v.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(v.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(v.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(v.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(v.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(v.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(v.Events.ERROR,this.onError)},b.onMediaAttached=function(O,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(O,C){var E=C.details;this.levelDetails=E,E.advanced&&this.timeupdate(),!E.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(O,C){if(C.details!==I.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,x.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var O=this.media,C=this.levelDetails;if(!O||!C)return;this.currentTime=O.currentTime;var E=this.computeLatency();if(E===null)return;this._latency=E;var y=this.config,h=y.lowLatencyMode,r=y.maxLiveSyncPlaybackRate;if(!h||r===1)return;var o=this.targetLatency;if(o===null)return;var s=E-o,f=Math.min(this.maxLatency,o+C.targetduration),d=s<f;if(C.live&&d&&s>.05&&this.forwardBufferLength>1){var l=Math.min(2,Math.max(1,r)),m=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;O.playbackRate=Math.min(l,Math.max(1,m))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},b.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},b.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},M(w,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,C=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:C?O.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var C=O.holdBack,E=O.partHoldBack,y=O.targetduration,h=this.config,r=h.liveSyncDuration,o=h.liveSyncDurationCount,s=h.lowLatencyMode,f=this.hls.userConfig,d=s&&E||C;(f.liveSyncDuration||f.liveSyncDurationCount||d===0)&&(d=r!==void 0?r:o*y);var l=y,m=1;return d+Math.min(this.stallCount*m,l)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),C=this.targetLatency,E=this.levelDetails;if(O===null||C===null||E===null)return null;var y=E.edge,h=O-C-this.edgeStalled,r=y-E.totalduration,o=y-(this.config.lowLatencyMode&&E.partTarget||E.targetduration);return Math.min(Math.max(r,h),o)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var C=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-C,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,C=this.levelDetails;if(!O||!C)return 0;var E=O.buffered.length;return E?O.buffered.end(E-1):C.edge-this.currentTime}}]),w}()},"./src/controller/level-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return h});var I=S("./src/types/level.ts"),v=S("./src/events.ts"),x=S("./src/errors.ts"),U=S("./src/utils/codecs.ts"),M=S("./src/controller/level-helper.ts"),R=S("./src/controller/base-playlist-controller.ts"),w=S("./src/types/loader.ts");function b(){return b=Object.assign||function(r){for(var o=1;o<arguments.length;o++){var s=arguments[o];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(r[f]=s[f])}return r},b.apply(this,arguments)}function T(r,o){for(var s=0;s<o.length;s++){var f=o[s];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(r,f.key,f)}}function O(r,o,s){return o&&T(r.prototype,o),s&&T(r,s),r}function C(r,o){r.prototype=Object.create(o.prototype),r.prototype.constructor=r,E(r,o)}function E(r,o){return E=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},E(r,o)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(r){C(o,r);function o(f){var d;return d=r.call(this,f,"[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 s=o.prototype;return s._registerListeners=function(){var d=this.hls;d.on(v.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(v.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(v.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(v.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var d=this.hls;d.off(v.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(v.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(v.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(v.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(v.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,r.prototype.destroy.call(this)},s.startLoad=function(){var d=this._levels;d.forEach(function(l){l.loadError=0}),r.prototype.startLoad.call(this)},s.onManifestLoaded=function(d,l){var m=[],c=[],i=[],n,t={},e,p=!1,g=!1,_=!1;if(l.levels.forEach(function(z){var J=z.attrs;p=p||!!(z.width&&z.height),g=g||!!z.videoCodec,_=_||!!z.audioCodec,y&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var Y=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;e=t[Y],e?e.url.push(z.url):(e=new I.Level(z),t[Y]=e,m.push(e)),J&&(J.AUDIO&&Object(M.addGroupId)(e,"audio",J.AUDIO),J.SUBTITLES&&Object(M.addGroupId)(e,"text",J.SUBTITLES))}),(p||g)&&_&&(m=m.filter(function(z){var J=z.videoCodec,Y=z.width,$=z.height;return!!J||!!(Y&&$)})),m=m.filter(function(z){var J=z.audioCodec,Y=z.videoCodec;return(!J||Object(U.isCodecSupportedInMp4)(J,"audio"))&&(!Y||Object(U.isCodecSupportedInMp4)(Y,"video"))}),l.audioTracks&&(c=l.audioTracks.filter(function(z){return!z.audioCodec||Object(U.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(M.assignTrackIdsByGroup)(c)),l.subtitles&&(i=l.subtitles,Object(M.assignTrackIdsByGroup)(i)),m.length>0){n=m[0].bitrate,m.sort(function(z,J){return z.bitrate-J.bitrate}),this._levels=m;for(var A=0;A<m.length;A++)if(m[A].bitrate===n){this._firstLevel=A,this.log("manifest loaded, "+m.length+" level(s) found, first bitrate: "+n);break}var k=_&&!g,F={levels:m,audioTracks:c,subtitleTracks:i,firstLevel:this._firstLevel,stats:l.stats,audio:_,video:g,altAudio:!k&&c.some(function(z){return!!z.url})};this.hls.trigger(v.Events.MANIFEST_PARSED,F),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(v.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:l.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(d,l){if(r.prototype.onError.call(this,d,l),l.fatal)return;var m=l.context,c=this._levels[this.currentLevelIndex];if(m&&(m.type===w.PlaylistContextType.AUDIO_TRACK&&c.audioGroupIds&&m.groupId===c.audioGroupIds[c.urlId]||m.type===w.PlaylistContextType.SUBTITLE_TRACK&&c.textGroupIds&&m.groupId===c.textGroupIds[c.urlId])){this.redundantFailover(this.currentLevelIndex);return}var i=!1,n=!0,t;switch(l.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:if(l.frag){var e=this._levels[l.frag.level];e?(e.fragmentError++,e.fragmentError>this.hls.config.fragLoadingMaxRetry&&(t=l.frag.level)):t=l.frag.level}break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:m&&(m.deliveryDirectives&&(n=!1),t=m.level),i=!0;break;case x.ErrorDetails.REMUX_ALLOC_ERROR:t=l.level,i=!0;break}t!==void 0&&this.recoverLevel(l,t,i,n)},s.recoverLevel=function(d,l,m,c){var i=d.details,n=this._levels[l];if(n.loadError++,m){var t=this.retryLoadingOrFail(d);if(t)d.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(c){var e=n.url.length;if(e>1&&n.loadError<e)d.levelRetry=!0,this.redundantFailover(l);else if(this.manualLevelIndex===-1){var p=l===0?this._levels.length-1:l-1;this.currentLevelIndex!==p&&this._levels[p].loadError===0&&(this.warn(i+": switch to "+p),d.levelRetry=!0,this.hls.nextAutoLevel=p)}}},s.redundantFailover=function(d){var l=this._levels[d],m=l.url.length;if(m>1){var c=(l.urlId+1)%m;this.warn("Switching to redundant URL-id "+c),this._levels.forEach(function(i){i.urlId=c}),this.level=d}},s.onFragLoaded=function(d,l){var m=l.frag;if(m!==void 0&&m.type===w.PlaylistLevelType.MAIN){var c=this._levels[m.level];c!==void 0&&(c.fragmentError=0,c.loadError=0)}},s.onLevelLoaded=function(d,l){var m,c=l.level,i=l.details,n=this._levels[c];if(!n){var t;this.warn("Invalid level index "+c),(t=l.deliveryDirectives)!==null&&t!==void 0&&t.skip&&(i.deltaUpdateFailed=!0);return}c===this.currentLevelIndex?(n.fragmentError===0&&(n.loadError=0,this.retryCount=0),this.playlistLoaded(c,l,n.details)):(m=l.deliveryDirectives)!==null&&m!==void 0&&m.skip&&(i.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(d,l){var m=this.hls.levels[this.currentLevelIndex];if(!m)return;if(m.audioGroupIds){for(var c=-1,i=this.hls.audioTracks[l.id].groupId,n=0;n<m.audioGroupIds.length;n++)if(m.audioGroupIds[n]===i){c=n;break}c!==m.urlId&&(m.urlId=c,this.startLoad())}},s.loadPlaylist=function(d){var l=this.currentLevelIndex,m=this._levels[l];if(this.canLoad&&m&&m.url.length>0){var c=m.urlId,i=m.url[c];if(d)try{i=d.addDirectives(i)}catch(n){this.warn("Could not construct new URL with HLS Delivery Directives: "+n)}this.log("Attempt loading level index "+l+(d?" at sn "+d.msn+" part "+d.part:"")+" with URL-id "+c+" "+i),this.clearTimer(),this.hls.trigger(v.Events.LEVEL_LOADING,{url:i,level:l,id:c,deliveryDirectives:d||null})}},s.removeLevel=function(d,l){var m=function(n,t){return t!==l},c=this._levels.filter(function(i,n){return n!==d?!0:i.url.length>1&&l!==void 0?(i.url=i.url.filter(m),i.audioGroupIds&&(i.audioGroupIds=i.audioGroupIds.filter(m)),i.textGroupIds&&(i.textGroupIds=i.textGroupIds.filter(m)),i.urlId=0,!0):!1}).map(function(i,n){var t=i.details;return t!=null&&t.fragments&&t.fragments.forEach(function(e){e.level=n}),i});this._levels=c,this.hls.trigger(v.Events.LEVELS_UPDATED,{levels:c})},O(o,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(d){var l,m=this._levels;if(m.length===0)return;if(this.currentLevelIndex===d&&(l=m[d])!==null&&l!==void 0&&l.details)return;if(d<0||d>=m.length){var c=d<0;if(this.hls.trigger(v.Events.ERROR,{type:x.ErrorTypes.OTHER_ERROR,details:x.ErrorDetails.LEVEL_SWITCH_ERROR,level:d,fatal:c,reason:"invalid level idx"}),c)return;d=Math.min(d,m.length-1)}this.clearTimer();var i=this.currentLevelIndex,n=m[i],t=m[d];this.log("switching to level "+d+" from "+i),this.currentLevelIndex=d;var e=b({},t,{level:d,maxBitrate:t.maxBitrate,uri:t.uri,urlId:t.urlId});delete e._urlId,this.hls.trigger(v.Events.LEVEL_SWITCHING,e);var p=t.details;if(!p||p.live){var g=this.switchParams(t.uri,n==null?void 0:n.details);this.loadPlaylist(g)}}},{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)}}]),o}(R.default)},"./src/controller/level-helper.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"addGroupId",function(){return x}),S.d(N,"assignTrackIdsByGroup",function(){return U}),S.d(N,"updatePTS",function(){return M}),S.d(N,"updateFragPTSDTS",function(){return w}),S.d(N,"mergeDetails",function(){return b}),S.d(N,"mapPartIntersection",function(){return T}),S.d(N,"mapFragmentIntersection",function(){return O}),S.d(N,"adjustSliding",function(){return C}),S.d(N,"addSliding",function(){return E}),S.d(N,"computeReloadInterval",function(){return y}),S.d(N,"getFragmentWithSN",function(){return h}),S.d(N,"getPartWith",function(){return r});var I=S("./src/polyfills/number.ts"),v=S("./src/utils/logger.ts");function x(o,s,f){switch(s){case"audio":o.audioGroupIds||(o.audioGroupIds=[]),o.audioGroupIds.push(f);break;case"text":o.textGroupIds||(o.textGroupIds=[]),o.textGroupIds.push(f);break}}function U(o){var s={};o.forEach(function(f){var d=f.groupId||"";f.id=s[d]=s[d]||0,s[d]++})}function M(o,s,f){var d=o[s],l=o[f];R(d,l)}function R(o,s){var f=s.startPTS;if(Object(I.isFiniteNumber)(f)){var d=0,l;s.sn>o.sn?(d=f-o.start,l=o):(d=o.start-f,l=s),l.duration!==d&&(l.duration=d)}else if(s.sn>o.sn){var m=o.cc===s.cc;m&&o.minEndPTS?s.start=o.start+(o.minEndPTS-o.start):s.start=o.start+o.duration}else s.start=Math.max(o.start-s.duration,0)}function w(o,s,f,d,l,m){var c=d-f;c<=0&&(v.logger.warn("Fragment should have a positive duration",s),d=f+s.duration,m=l+s.duration);var i=f,n=d,t=s.startPTS,e=s.endPTS;if(Object(I.isFiniteNumber)(t)){var p=Math.abs(t-f);Object(I.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(p,s.deltaPTS):s.deltaPTS=p,i=Math.max(f,t),f=Math.min(f,t),l=Math.min(l,s.startDTS),n=Math.min(d,e),d=Math.max(d,e),m=Math.max(m,s.endDTS)}s.duration=d-f;var g=f-s.start;s.appendedPTS=d,s.start=s.startPTS=f,s.maxStartPTS=i,s.startDTS=l,s.endPTS=d,s.minEndPTS=n,s.endDTS=m;var _=s.sn;if(!o||_<o.startSN||_>o.endSN)return 0;var A,k=_-o.startSN,F=o.fragments;for(F[k]=s,A=k;A>0;A--)R(F[A],F[A-1]);for(A=k;A<F.length-1;A++)R(F[A],F[A+1]);return o.fragmentHint&&R(F[F.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,g}function b(o,s){for(var f=null,d=o.fragments,l=d.length-1;l>=0;l--){var m=d[l].initSegment;if(m){f=m;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;var c=0,i;if(O(o,s,function(A,k){A.relurl&&(c=A.cc-k.cc),Object(I.isFiniteNumber)(A.startPTS)&&Object(I.isFiniteNumber)(A.endPTS)&&(k.start=k.startPTS=A.startPTS,k.startDTS=A.startDTS,k.appendedPTS=A.appendedPTS,k.maxStartPTS=A.maxStartPTS,k.endPTS=A.endPTS,k.endDTS=A.endDTS,k.minEndPTS=A.minEndPTS,k.duration=A.endPTS-A.startPTS,k.duration&&(i=k),s.PTSKnown=s.alignedSliding=!0),k.elementaryStreams=A.elementaryStreams,k.loader=A.loader,k.stats=A.stats,k.urlId=A.urlId,A.initSegment&&(k.initSegment=A.initSegment,f=A.initSegment)}),f){var n=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;n.forEach(function(A){var k;(!A.initSegment||A.initSegment.relurl===((k=f)===null||k===void 0?void 0:k.relurl))&&(A.initSegment=f)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(A){return!A}),s.deltaUpdateFailed)){v.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var t=s.skippedSegments;t--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var e=s.fragments;if(c){v.logger.warn("discontinuity sliding from playlist, take drift into account");for(var p=0;p<e.length;p++)e[p].cc+=c}s.skippedSegments&&(s.startCC=s.fragments[0].cc),T(o.partList,s.partList,function(A,k){k.elementaryStreams=A.elementaryStreams,k.stats=A.stats}),i?w(s,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS):C(o,s),e.length&&(s.totalduration=s.edge-e[0].start),s.driftStartTime=o.driftStartTime,s.driftStart=o.driftStart;var g=s.advancedDateTime;if(s.advanced&&g){var _=s.edge;s.driftStart||(s.driftStartTime=g,s.driftStart=_),s.driftEndTime=g,s.driftEnd=_}else s.driftEndTime=o.driftEndTime,s.driftEnd=o.driftEnd,s.advancedDateTime=o.advancedDateTime}function T(o,s,f){if(o&&s)for(var d=0,l=0,m=o.length;l<=m;l++){var c=o[l],i=s[l+d];c&&i&&c.index===i.index&&c.fragment.sn===i.fragment.sn?f(c,i):d--}}function O(o,s,f){for(var d=s.skippedSegments,l=Math.max(o.startSN,s.startSN)-s.startSN,m=(o.fragmentHint?1:0)+(d?s.endSN:Math.min(o.endSN,s.endSN))-s.startSN,c=s.startSN-o.startSN,i=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,n=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments,t=l;t<=m;t++){var e=n[c+t],p=i[t];d&&!p&&t<d&&(p=s.fragments[t]=e),e&&p&&f(e,p)}}function C(o,s){var f=s.startSN+s.skippedSegments-o.startSN,d=o.fragments;if(f<0||f>=d.length)return;E(s,d[f].start)}function E(o,s){if(s){for(var f=o.fragments,d=o.skippedSegments;d<f.length;d++)f[d].start+=s;o.fragmentHint&&(o.fragmentHint.start+=s)}}function y(o,s){var f=1e3*o.levelTargetDuration,d=f/2,l=o.age,m=l>0&&l<f*3,c=s.loading.end-s.loading.start,i,n=o.availabilityDelay;if(o.updated===!1)if(m){var t=333*o.misses;i=Math.max(Math.min(d,c*2),t),o.availabilityDelay=(o.availabilityDelay||0)+i}else i=d;else m?(n=Math.min(n||f/2,l),o.availabilityDelay=n,i=n+f-l):i=f-c;return Math.round(i)}function h(o,s,f){if(!o||!o.details)return null;var d=o.details,l=d.fragments[s-d.startSN];return l||(l=d.fragmentHint,l&&l.sn===s?l:s<d.startSN&&f&&f.sn===s?f:null)}function r(o,s,f){if(!o||!o.details)return null;var d=o.details.partList;if(d)for(var l=d.length;l--;){var m=d[l];if(m.index===f&&m.fragment.sn===s)return m}return null}},"./src/controller/stream-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return d});var I=S("./src/polyfills/number.ts"),v=S("./src/controller/base-stream-controller.ts"),x=S("./src/is-supported.ts"),U=S("./src/events.ts"),M=S("./src/utils/buffer-helper.ts"),R=S("./src/controller/fragment-tracker.ts"),w=S("./src/types/loader.ts"),b=S("./src/loader/fragment.ts"),T=S("./src/demux/transmuxer-interface.ts"),O=S("./src/types/transmuxer.ts"),C=S("./src/controller/gap-controller.ts"),E=S("./src/errors.ts"),y=S("./src/utils/logger.ts");function h(l,m){for(var c=0;c<m.length;c++){var i=m[c];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(l,i.key,i)}}function r(l,m,c){return m&&h(l.prototype,m),c&&h(l,c),l}function o(l,m){l.prototype=Object.create(m.prototype),l.prototype.constructor=l,s(l,m)}function s(l,m){return s=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},s(l,m)}var f=100,d=function(l){o(m,l);function m(i,n){var t;return t=l.call(this,i,n,"[stream-controller]")||this,t.audioCodecSwap=!1,t.gapController=null,t.level=-1,t._forceStartLoad=!1,t.altAudio=!1,t.audioOnly=!1,t.fragPlaying=null,t.onvplaying=null,t.onvseeked=null,t.fragLastKbps=0,t.stalled=!1,t.couldBacktrack=!1,t.audioCodecSwitch=!1,t.videoBuffer=null,t._registerListeners(),t}var c=m.prototype;return c._registerListeners=function(){var n=this.hls;n.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.on(U.Events.ERROR,this.onError,this),n.on(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.on(U.Events.BUFFER_CREATED,this.onBufferCreated,this),n.on(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.on(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),n.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var n=this.hls;n.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),n.off(U.Events.ERROR,this.onError,this),n.off(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),n.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),n.off(U.Events.BUFFER_CREATED,this.onBufferCreated,this),n.off(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),n.off(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),n.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},c.startLoad=function(n){if(this.levels){var t=this.lastCurrentTime,e=this.hls;if(this.stopLoad(),this.setInterval(f),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var p=e.startLevel;p===-1&&(e.config.testBandwidth?(p=0,this.bitrateTest=!0):p=e.nextAutoLevel),this.level=e.nextLoadLevel=p,this.loadedmetadata=!1}t>0&&n===-1&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),n=t),this.state=v.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=n,this.tick()}else this._forceStartLoad=!0,this.state=v.State.STOPPED},c.stopLoad=function(){this._forceStartLoad=!1,l.prototype.stopLoad.call(this)},c.doTick=function(){switch(this.state){case v.State.IDLE:this.doTickIdle();break;case v.State.WAITING_LEVEL:{var n,t=this.levels,e=this.level,p=t==null||((n=t[e])===null||n===void 0)?void 0:n.details;if(p&&(!p.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(p))break;this.state=v.State.IDLE;break}break}case v.State.FRAG_LOADING_WAITING_RETRY:{var g,_=self.performance.now(),A=this.retryDate;(!A||_>=A||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=v.State.IDLE)}break;default:break}this.onTickEnd()},c.onTickEnd=function(){l.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},c.doTickIdle=function(){var n,t,e=this.hls,p=this.levelLastLoaded,g=this.levels,_=this.media,A=e.config,k=e.nextLoadLevel;if(p===null||!_&&(this.startFragRequested||!A.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[k])return;var F=g[k];this.level=e.nextLoadLevel=k;var z=F.details;if(!z||this.state===v.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==k){this.state=v.State.WAITING_LEVEL;return}var J=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:_,w.PlaylistLevelType.MAIN);if(J===null)return;var Y=J.len,$=this.getMaxBufferLength(F.maxBitrate);if(Y>=$)return;if(this._streamEnded(J,z)){var le={};this.altAudio&&(le.type="video"),this.hls.trigger(U.Events.BUFFER_EOS,le),this.state=v.State.ENDED;return}var be=J.end,ve=this.getNextFragment(be,z);if(this.couldBacktrack&&!this.fragPrevious&&ve&&ve.sn!=="initSegment"){var ke=ve.sn-z.startSN;ke>1&&(ve=z.fragments[ke-1],this.fragmentTracker.removeFragment(ve))}if(ve&&this.fragmentTracker.getState(ve)===R.FragmentState.OK&&this.nextLoadPosition>be){var Te=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(_,Te,w.PlaylistLevelType.MAIN),ve=this.getNextFragment(this.nextLoadPosition,z)}if(!ve)return;ve.initSegment&&!ve.initSegment.data&&!this.bitrateTest&&(ve=ve.initSegment),((n=ve.decryptdata)===null||n===void 0?void 0:n.keyFormat)==="identity"&&!((t=ve.decryptdata)!==null&&t!==void 0&&t.key)?this.loadKey(ve,z):this.loadFragment(ve,z,be)},c.loadFragment=function(n,t,e){var p,g=this.fragmentTracker.getState(n);if(this.fragCurrent=n,g===R.FragmentState.BACKTRACKED){var _=this.fragmentTracker.getBacktrackData(n);if(_){this._handleFragmentLoadProgress(_),this._handleFragmentLoadComplete(_);return}else g=R.FragmentState.NOT_LOADED}g===R.FragmentState.NOT_LOADED||g===R.FragmentState.PARTIAL?n.sn==="initSegment"?this._loadInitSegment(n):this.bitrateTest?(n.bitrateTest=!0,this.log("Fragment "+n.sn+" of level "+n.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(n)):(this.startFragRequested=!0,l.prototype.loadFragment.call(this,n,t,e)):g===R.FragmentState.APPENDING?this.reduceMaxBufferLength(n.duration)&&this.fragmentTracker.removeFragment(n):((p=this.media)===null||p===void 0?void 0:p.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},c.getAppendedFrag=function(n){var t=this.fragmentTracker.getAppendedFrag(n,w.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},c.getBufferedFrag=function(n){return this.fragmentTracker.getBufferedFrag(n,w.PlaylistLevelType.MAIN)},c.followingBufferedFrag=function(n){return n?this.getBufferedFrag(n.end+.5):null},c.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},c.nextLevelSwitch=function(){var n=this.levels,t=this.media;if(t!=null&&t.readyState){var e,p=this.getAppendedFrag(t.currentTime);if(p&&p.start>1&&this.flushMainBuffer(0,p.start-1),!t.paused&&n){var g=this.hls.nextLoadLevel,_=n[g],A=this.fragLastKbps;A&&this.fragCurrent?e=this.fragCurrent.duration*_.maxBitrate/(1e3*A)+1:e=0}else e=0;var k=this.getBufferedFrag(t.currentTime+e);if(k){var F=this.followingBufferedFrag(k);if(F){this.abortCurrentFrag();var z=F.maxStartPTS?F.maxStartPTS:F.start,J=F.duration,Y=Math.max(k.end,z+Math.min(Math.max(J-this.config.maxFragLookUpTolerance,J*.5),J*.75));this.flushMainBuffer(Y,Number.POSITIVE_INFINITY)}}}},c.abortCurrentFrag=function(){var n=this.fragCurrent;this.fragCurrent=null,n!=null&&n.loader&&n.loader.abort(),this.state===v.State.KEY_LOADING&&(this.state=v.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},c.flushMainBuffer=function(n,t){l.prototype.flushMainBuffer.call(this,n,t,this.altAudio?"video":null)},c.onMediaAttached=function(n,t){l.prototype.onMediaAttached.call(this,n,t);var e=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),e.addEventListener("playing",this.onvplaying),e.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,e,this.fragmentTracker,this.hls)},c.onMediaDetaching=function(){var n=this.media;n&&(n.removeEventListener("playing",this.onvplaying),n.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),l.prototype.onMediaDetaching.call(this)},c.onMediaPlaying=function(){this.tick()},c.onMediaSeeked=function(){var n=this.media,t=n?n.currentTime:null;Object(I.isFiniteNumber)(t)&&this.log("Media seeked to "+t.toFixed(3)),this.tick()},c.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(U.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},c.onManifestParsed=function(n,t){var e=!1,p=!1,g;t.levels.forEach(function(_){g=_.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(e=!0),g.indexOf("mp4a.40.5")!==-1&&(p=!0))}),this.audioCodecSwitch=e&&p&&!Object(x.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},c.onLevelLoading=function(n,t){var e=this.levels;if(!e||this.state!==v.State.IDLE)return;var p=e[t.level];(!p.details||p.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(p.details))&&(this.state=v.State.WAITING_LEVEL)},c.onLevelLoaded=function(n,t){var e,p=this.levels,g=t.level,_=t.details,A=_.totalduration;if(!p){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+_.startSN+","+_.endSN+"], cc ["+_.startCC+", "+_.endCC+"] duration:"+A);var k=this.fragCurrent;k&&(this.state===v.State.FRAG_LOADING||this.state===v.State.FRAG_LOADING_WAITING_RETRY)&&(k.level!==t.level&&k.loader&&(this.state=v.State.IDLE,k.loader.abort()));var F=p[g],z=0;if(_.live||(e=F.details)!==null&&e!==void 0&&e.live){if(_.fragments[0]||(_.deltaUpdateFailed=!0),_.deltaUpdateFailed)return;z=this.alignPlaylists(_,F.details)}if(F.details=_,this.levelLastLoaded=g,this.hls.trigger(U.Events.LEVEL_UPDATED,{details:_,level:g}),this.state===v.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(_))return;this.state=v.State.IDLE}this.startFragRequested?_.live&&this.synchronizeToLiveEdge(_):this.setStartPosition(_,z),this.tick()},c._handleFragmentLoadProgress=function(n){var t,e=n.frag,p=n.part,g=n.payload,_=this.levels;if(!_){this.warn("Levels were reset while fragment load was in progress. Fragment "+e.sn+" of level "+e.level+" will not be buffered");return}var A=_[e.level],k=A.details;if(!k){this.warn("Dropping fragment "+e.sn+" of level "+e.level+" after level details were reset");return}var F=A.videoCodec,z=k.PTSKnown||!k.live,J=(t=e.initSegment)===null||t===void 0?void 0:t.data,Y=this._getAudioCodec(A),$=this.transmuxer=this.transmuxer||new T.default(this.hls,w.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),le=p?p.index:-1,be=le!==-1,ve=new O.ChunkMetadata(e.level,e.sn,e.stats.chunkCount,g.byteLength,le,be),ke=this.initPTS[e.cc];$.push(g,J,Y,F,e,p,k.totalduration,z,ve,ke)},c.onAudioTrackSwitching=function(n,t){var e=this.altAudio,p=!!t.url,g=t.id;if(!p){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var _=this.fragCurrent;_!=null&&_.loader&&(this.log("Switching to main audio track, cancel main fragment load"),_.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var A=this.hls;e&&A.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),A.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:g})}},c.onAudioTrackSwitched=function(n,t){var e=t.id,p=!!this.hls.audioTracks[e].url;if(p){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=p,this.tick()},c.onBufferCreated=function(n,t){var e=t.tracks,p,g,_=!1;for(var A in e){var k=e[A];if(k.id==="main"){if(g=A,p=k,A==="video"){var F=e[A];F&&(this.videoBuffer=F.buffer)}}else _=!0}_&&p?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=p.buffer):this.mediaBuffer=this.media},c.onFragBuffered=function(n,t){var e=t.frag,p=t.part;if(e&&e.type!==w.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(e)){this.warn("Fragment "+e.sn+(p?" p: "+p.index:"")+" of level "+e.level+" finished buffering, but was aborted. state: "+this.state),this.state===v.State.PARSED&&(this.state=v.State.IDLE);return}var g=p?p.stats:e.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),e.sn!=="initSegment"&&(this.fragPrevious=e),this.fragBufferedComplete(e,p)},c.onError=function(n,t){switch(t.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.MAIN,t);break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==v.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=v.State.ERROR):!t.levelRetry&&this.state===v.State.WAITING_LEVEL&&(this.state=v.State.IDLE));break;case E.ErrorDetails.BUFFER_FULL_ERROR:if(t.parent==="main"&&(this.state===v.State.PARSING||this.state===v.State.PARSED)){var e=!0,p=this.getFwdBufferInfo(this.media,w.PlaylistLevelType.MAIN);p&&p.len>.5&&(e=!this.reduceMaxBufferLength(p.len)),e&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},c.checkBuffer=function(){var n=this.media,t=this.gapController;if(!n||!t||!n.readyState)return;var e=M.BufferHelper.getBuffered(n);!this.loadedmetadata&&e.length?(this.loadedmetadata=!0,this.seekToStartPos()):t.poll(this.lastCurrentTime),this.lastCurrentTime=n.currentTime},c.onFragLoadEmergencyAborted=function(){this.state=v.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},c.onBufferFlushed=function(n,t){var e=t.type;if(e!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var p=(e===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(p,e,w.PlaylistLevelType.MAIN)}},c.onLevelsUpdated=function(n,t){this.levels=t.levels},c.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},c.seekToStartPos=function(){var n=this.media,t=n.currentTime,e=this.startPosition;if(e>=0&&t<e){if(n.seeking){y.logger.log("could not seek to "+e+", already seeking at "+t);return}var p=M.BufferHelper.getBuffered(n),g=p.length?p.start(0):0,_=g-e;_>0&&(_<this.config.maxBufferHole||_<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+_+" to match buffer start"),e+=_,this.startPosition=e),this.log("seek to target start position "+e+" from current time "+t),n.currentTime=e}},c._getAudioCodec=function(n){var t=this.config.defaultAudioCodec||n.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t},c._loadBitrateTestFrag=function(n){var t=this;this._doFragLoad(n).then(function(e){var p=t.hls;if(!e||p.nextLoadLevel||t.fragContextChanged(n))return;t.fragLoadError=0,t.state=v.State.IDLE,t.startFragRequested=!1,t.bitrateTest=!1;var g=n.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),p.trigger(U.Events.FRAG_LOADED,e)})},c._handleTransmuxComplete=function(n){var t,e="main",p=this.hls,g=n.remuxResult,_=n.chunkMeta,A=this.getCurrentContext(_);if(!A){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var k=A.frag,F=A.part,z=A.level,J=g.video,Y=g.text,$=g.id3,le=g.initSegment,be=this.altAudio?void 0:g.audio;if(this.fragContextChanged(k))return;if(this.state=v.State.PARSING,le){le.tracks&&(this._bufferInitSegment(z,le.tracks,k,_),p.trigger(U.Events.FRAG_PARSING_INIT_SEGMENT,{frag:k,id:e,tracks:le.tracks}));var ve=le.initPTS,ke=le.timescale;Object(I.isFiniteNumber)(ve)&&(this.initPTS[k.cc]=ve,p.trigger(U.Events.INIT_PTS_FOUND,{frag:k,id:e,initPTS:ve,timescale:ke}))}if(J&&g.independent!==!1){if(z.details){var Te=J.startPTS,xe=J.endPTS,_e=J.startDTS,Oe=J.endDTS;if(F)F.elementaryStreams[J.type]={startPTS:Te,endPTS:xe,startDTS:_e,endDTS:Oe};else if(J.firstKeyFrame&&J.independent&&(this.couldBacktrack=!0),J.dropped&&J.independent){var ce=this.getLoadPosition()+this.config.maxBufferHole;if(ce<Te){this.backtrack(k);return}k.setElementaryStreamInfo(J.type,k.start,xe,k.start,Oe,!0)}k.setElementaryStreamInfo(J.type,Te,xe,_e,Oe),this.bufferFragmentData(J,k,F,_)}}else if(g.independent===!1){this.backtrack(k);return}if(be){var Z=be.startPTS,je=be.endPTS,at=be.startDTS,rt=be.endDTS;F&&(F.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:Z,endPTS:je,startDTS:at,endDTS:rt}),k.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,Z,je,at,rt),this.bufferFragmentData(be,k,F,_)}if($!=null&&(t=$.samples)!==null&&t!==void 0&&t.length){var Ke={frag:k,id:e,samples:$.samples};p.trigger(U.Events.FRAG_PARSING_METADATA,Ke)}if(Y){var He={frag:k,id:e,samples:Y.samples};p.trigger(U.Events.FRAG_PARSING_USERDATA,He)}},c._bufferInitSegment=function(n,t,e,p){var g=this;if(this.state!==v.State.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var _=t.audio,A=t.video,k=t.audiovideo;if(_){var F=n.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(F&&(F.indexOf("mp4a.40.5")!==-1?F="mp4a.40.2":F="mp4a.40.5"),_.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(F="mp4a.40.5")),z.indexOf("android")!==-1&&_.container!=="audio/mpeg"&&(F="mp4a.40.2",this.log("Android: force audio codec to "+F)),n.audioCodec&&n.audioCodec!==F&&this.log('Swapping manifest audio codec "'+n.audioCodec+'" for "'+F+'"'),_.levelCodec=F,_.id="main",this.log("Init audio buffer, container:"+_.container+", codecs[selected/level/parsed]=["+(F||"")+"/"+(n.audioCodec||"")+"/"+_.codec+"]")}A&&(A.levelCodec=n.videoCodec,A.id="main",this.log("Init video buffer, container:"+A.container+", codecs[level/parsed]=["+(n.videoCodec||"")+"/"+A.codec+"]")),k&&this.log("Init audiovideo buffer, container:"+k.container+", codecs[level/parsed]=["+(n.attrs.CODECS||"")+"/"+k.codec+"]"),this.hls.trigger(U.Events.BUFFER_CODECS,t),Object.keys(t).forEach(function(J){var Y=t[J],$=Y.initSegment;$!=null&&$.byteLength&&g.hls.trigger(U.Events.BUFFER_APPENDING,{type:J,data:$,frag:e,part:null,chunkMeta:p,parent:e.type})}),this.tick()},c.backtrack=function(n){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(n);var t=this.fragmentTracker.backtrack(n);this.fragPrevious=null,this.nextLoadPosition=n.start,t?this.resetFragmentLoading(n):this.state=v.State.BACKTRACKING},c.checkFragmentChanged=function(){var n=this.media,t=null;if(n&&n.readyState>1&&n.seeking===!1){var e=n.currentTime;if(M.BufferHelper.isBuffered(n,e)?t=this.getAppendedFrag(e):M.BufferHelper.isBuffered(n,e+.1)&&(t=this.getAppendedFrag(e+.1)),t){var p=this.fragPlaying,g=t.level;(!p||t.sn!==p.sn||p.level!==g||t.urlId!==p.urlId)&&(this.hls.trigger(U.Events.FRAG_CHANGED,{frag:t}),(!p||p.level!==g)&&this.hls.trigger(U.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=t)}}},r(m,[{key:"nextLevel",get:function(){var n=this.nextBufferedFrag;return n?n.level:-1}},{key:"currentLevel",get:function(){var n=this.media;if(n){var t=this.getAppendedFrag(n.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var n=this.media;if(n){var t=this.getAppendedFrag(n.currentTime);return this.followingBufferedFrag(t)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),m}(v.default)},"./src/controller/subtitle-stream-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"SubtitleStreamController",function(){return o});var I=S("./src/events.ts"),v=S("./src/utils/logger.ts"),x=S("./src/utils/buffer-helper.ts"),U=S("./src/controller/fragment-finders.ts"),M=S("./src/utils/discontinuities.ts"),R=S("./src/controller/level-helper.ts"),w=S("./src/controller/fragment-tracker.ts"),b=S("./src/controller/base-stream-controller.ts"),T=S("./src/types/loader.ts"),O=S("./src/types/level.ts");function C(s,f){for(var d=0;d<f.length;d++){var l=f[d];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(s,l.key,l)}}function E(s,f,d){return f&&C(s.prototype,f),d&&C(s,d),s}function y(s,f){s.prototype=Object.create(f.prototype),s.prototype.constructor=s,h(s,f)}function h(s,f){return h=Object.setPrototypeOf||function(l,m){return l.__proto__=m,l},h(s,f)}var r=500,o=function(s){y(f,s);function f(l,m){var c;return c=s.call(this,l,m,"[subtitle-stream-controller]")||this,c.levels=[],c.currentTrackId=-1,c.tracksBuffered=[],c.mainDetails=null,c._registerListeners(),c}var d=f.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var m=this.hls;m.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(I.Events.ERROR,this.onError,this),m.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.on(I.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.on(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.on(I.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d._unregisterListeners=function(){var m=this.hls;m.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(I.Events.ERROR,this.onError,this),m.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.off(I.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.off(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.off(I.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(r),this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},d.onLevelLoaded=function(m,c){this.mainDetails=c.details},d.onSubtitleFragProcessed=function(m,c){var i=c.frag,n=c.success;if(this.fragPrevious=i,this.state=b.State.IDLE,!n)return;var t=this.tracksBuffered[this.currentTrackId];if(!t)return;for(var e,p=i.start,g=0;g<t.length;g++)if(p>=t[g].start&&p<=t[g].end){e=t[g];break}var _=i.start+i.duration;e?e.end=_:(e={start:p,end:_},t.push(e)),this.fragmentTracker.fragBuffered(i)},d.onBufferFlushing=function(m,c){var i=c.startOffset,n=c.endOffset;if(i===0&&n!==Number.POSITIVE_INFINITY){var t=this.currentTrackId,e=this.levels;if(!e.length||!e[t]||!e[t].details)return;var p=e[t].details,g=p.targetduration,_=n-g;if(_<=0)return;c.endOffsetSubtitles=Math.max(0,_),this.tracksBuffered.forEach(function(A){for(var k=0;k<A.length;){if(A[k].end<=_){A.shift();continue}else if(A[k].start<_)A[k].start=_;else break;k++}}),this.fragmentTracker.removeFragmentsInRange(i,_,T.PlaylistLevelType.SUBTITLE)}},d.onError=function(m,c){var i,n=c.frag;if(!n||n.type!==T.PlaylistLevelType.SUBTITLE)return;(i=this.fragCurrent)!==null&&i!==void 0&&i.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},d.onSubtitleTracksUpdated=function(m,c){var i=this,n=c.subtitleTracks;this.tracksBuffered=[],this.levels=n.map(function(t){return new O.Level(t)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(t){i.tracksBuffered[t.id]=[]}),this.mediaBuffer=null},d.onSubtitleTrackSwitch=function(m,c){if(this.currentTrackId=c.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(r)},d.onSubtitleTrackLoaded=function(m,c){var i,n=c.details,t=c.id,e=this.currentTrackId,p=this.levels;if(!p.length)return;var g=p[e];if(t>=p.length||t!==e||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,n.live||(i=g.details)!==null&&i!==void 0&&i.live){var _=this.mainDetails;if(n.deltaUpdateFailed||!_)return;var A=_.fragments[0];if(!g.details)n.hasProgramDateTime&&_.hasProgramDateTime?Object(M.alignMediaPlaylistByPDT)(n,_):A&&Object(R.addSliding)(n,A.start);else{var k=this.alignPlaylists(n,g.details);k===0&&A&&Object(R.addSliding)(n,A.start)}}if(g.details=n,this.levelLastLoaded=t,this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var F=Object(U.findFragmentByPTS)(null,n.fragments,this.media.currentTime,0);F||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},d._handleFragmentLoadComplete=function(m){var c=m.frag,i=m.payload,n=c.decryptdata,t=this.hls;if(this.fragContextChanged(c))return;if(i&&i.byteLength>0&&n&&n.key&&n.iv&&n.method==="AES-128"){var e=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer).then(function(p){var g=performance.now();t.trigger(I.Events.FRAG_DECRYPTED,{frag:c,payload:p,stats:{tstart:e,tdecrypt:g}})})}},d.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var m,c=this.currentTrackId,i=this.levels;if(!i.length||!i[c]||!i[c].details)return;var n=i[c].details,t=n.targetduration,e=this.config,p=this.media,g=x.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,p.currentTime-t,e.maxBufferHole),_=g.end,A=g.len,k=this.getMaxBufferLength()+t;if(A>k)return;console.assert(n,"Subtitle track details are defined on idle subtitle stream controller tick");var F=n.fragments,z=F.length,J=n.edge,Y,$=this.fragPrevious;if(_<J){var le=e.maxFragLookUpTolerance;$&&n.hasProgramDateTime&&(Y=Object(U.findFragmentByPDT)(F,$.endProgramDateTime,le)),Y||(Y=Object(U.findFragmentByPTS)($,F,_,le),!Y&&$&&$.start<F[0].start&&(Y=F[0]))}else Y=F[z-1];(m=Y)!==null&&m!==void 0&&m.encrypted?(v.logger.log("Loading key for "+Y.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(I.Events.KEY_LOADING,{frag:Y})):Y&&this.fragmentTracker.getState(Y)===w.FragmentState.NOT_LOADED&&this.loadFragment(Y,n,_)}},d.loadFragment=function(m,c,i){this.fragCurrent=m,s.prototype.loadFragment.call(this,m,c,i)},E(f,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),f}(b.default)},"./src/controller/subtitle-track-controller.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/events.ts"),v=S("./src/utils/texttrack-utils.ts"),x=S("./src/controller/base-playlist-controller.ts"),U=S("./src/types/loader.ts");function M(C,E){for(var y=0;y<E.length;y++){var h=E[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(C,h.key,h)}}function R(C,E,y){return E&&M(C.prototype,E),y&&M(C,y),C}function w(C,E){C.prototype=Object.create(E.prototype),C.prototype.constructor=C,b(C,E)}function b(C,E){return b=Object.setPrototypeOf||function(h,r){return h.__proto__=r,h},b(C,E)}var T=function(C){w(E,C);function E(h){var r;return r=C.call(this,h,"[subtitle-track-controller]")||this,r.media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r.subtitleDisplay=!0,r.registerListeners(),r}var y=E.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},y.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_SWITCHING,this.onLevelSwitching,this),r.on(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on(I.Events.ERROR,this.onError,this)},y.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_LOADING,this.onLevelLoading,this),r.off(I.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(I.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off(I.Events.ERROR,this.onError,this)},y.onMediaAttached=function(r,o){if(this.media=o.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)},y.pollTrackChange=function(r){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,r)},y.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 r=O(this.media.textTracks);r.forEach(function(o){Object(v.clearCurrentCues)(o)}),this.subtitleTrack=-1,this.media=null},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(r,o){this.tracks=o.subtitleTracks},y.onSubtitleTrackLoaded=function(r,o){var s=o.id,f=o.details,d=this.trackId,l=this.tracksInGroup[d];if(!l){this.warn("Invalid subtitle track id "+s);return}var m=l.details;l.details=o.details,this.log("subtitle track "+s+" loaded ["+f.startSN+"-"+f.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,m))},y.onLevelLoading=function(r,o){this.switchLevel(o.level)},y.onLevelSwitching=function(r,o){this.switchLevel(o.level)},y.switchLevel=function(r){var o=this.hls.levels[r];if(!(o!=null&&o.textGroupIds))return;var s=o.textGroupIds[o.urlId];if(this.groupId!==s){var f=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,d=this.tracks.filter(function(c){return!s||c.groupId===s});this.tracksInGroup=d;var l=this.findTrackId(f==null?void 0:f.name)||this.findTrackId();this.groupId=s;var m={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(I.Events.SUBTITLE_TRACKS_UPDATED,m),l!==-1&&this.setSubtitleTrack(l,f)}},y.findTrackId=function(r){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var f=o[s];if((!this.selectDefaultTrack||f.default)&&(!r||r===f.name))return f.id}return-1},y.onError=function(r,o){if(C.prototype.onError.call(this,r,o),o.fatal||!o.context)return;o.context.type===U.PlaylistContextType.SUBTITLE_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},y.loadPlaylist=function(r){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,f=o.groupId,d=o.url;if(r)try{d=r.addDirectives(d)}catch(l){this.warn("Could not construct new URL with HLS Delivery Directives: "+l)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADING,{url:d,id:s,groupId:f,deliveryDirectives:r||null})}},y.toggleTrackModes=function(r){var o=this,s=this.media,f=this.subtitleDisplay,d=this.trackId;if(!s)return;var l=O(s.textTracks),m=l.filter(function(n){return n.groupId===o.groupId});if(r===-1)[].slice.call(l).forEach(function(n){n.mode="disabled"});else{var c=m[d];c&&(c.mode="disabled")}var i=m[r];i&&(i.mode=f?"showing":"hidden")},y.setSubtitleTrack=function(r,o){var s,f=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=r;return}if(this.trackId!==r&&this.toggleTrackModes(r),this.trackId===r&&(r===-1||(s=f[r])!==null&&s!==void 0&&s.details)||r<-1||r>=f.length)return;this.clearTimer();var d=f[r];if(this.log("Switching to subtitle track "+r),this.trackId=r,d){var l=d.id,m=d.groupId,c=m===void 0?"":m,i=d.name,n=d.type,t=d.url;this.hls.trigger(I.Events.SUBTITLE_TRACK_SWITCH,{id:l,groupId:c,name:i,type:n,url:t});var e=this.switchParams(d.url,o==null?void 0:o.details);this.loadPlaylist(e)}else this.hls.trigger(I.Events.SUBTITLE_TRACK_SWITCH,{id:r})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var r=-1,o=O(this.media.textTracks),s=0;s<o.length;s++)if(o[s].mode==="hidden")r=s;else if(o[s].mode==="showing"){r=s;break}this.subtitleTrack!==r&&(this.subtitleTrack=r)},R(E,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1;var o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(r,o)}}]),E}(x.default);function O(C){for(var E=[],y=0;y<C.length;y++){var h=C[y];h.kind==="subtitles"&&h.label&&E.push(C[y])}return E}N.default=T},"./src/controller/timeline-controller.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"TimelineController",function(){return O});var I=S("./src/polyfills/number.ts"),v=S("./src/events.ts"),x=S("./src/utils/cea-608-parser.ts"),U=S("./src/utils/output-filter.ts"),M=S("./src/utils/webvtt-parser.ts"),R=S("./src/utils/texttrack-utils.ts"),w=S("./src/utils/imsc1-ttml-parser.ts"),b=S("./src/types/loader.ts"),T=S("./src/utils/logger.ts"),O=function(){function h(o){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=y(),this.captionsProperties=void 0,this.hls=o,this.config=o.config,this.Cues=o.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 s=new U.default(this,"textTrack1"),f=new U.default(this,"textTrack2"),d=new U.default(this,"textTrack3"),l=new U.default(this,"textTrack4");this.cea608Parser1=new x.default(1,s,f),this.cea608Parser2=new x.default(3,d,l)}o.on(v.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(v.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(v.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(v.Events.MANIFEST_LOADED,this.onManifestLoaded,this),o.on(v.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(v.Events.FRAG_LOADING,this.onFragLoading,this),o.on(v.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(v.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),o.on(v.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),o.on(v.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(v.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),o.on(v.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var r=h.prototype;return r.destroy=function(){var s=this.hls;s.off(v.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(v.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(v.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(v.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(v.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(v.Events.FRAG_LOADING,this.onFragLoading,this),s.off(v.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(v.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(v.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(v.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(v.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(v.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},r.addCues=function(s,f,d,l,m){for(var c=!1,i=m.length;i--;){var n=m[i],t=E(n[0],n[1],f,d);if(t>=0&&(n[0]=Math.min(n[0],f),n[1]=Math.max(n[1],d),c=!0,t/(d-f)>.5))return}if(c||m.push([f,d]),this.config.renderTextTracksNatively){var e=this.captionsTracks[s];this.Cues.newCue(e,f,d,l)}else{var p=this.Cues.newCue(null,f,d,l);this.hls.trigger(v.Events.CUES_PARSED,{type:"captions",cues:p,track:s})}},r.onInitPtsFound=function(s,f){var d=this,l=f.frag,m=f.id,c=f.initPTS,i=f.timescale,n=this.unparsedVttFrags;m==="main"&&(this.initPTS[l.cc]=c,this.timescale[l.cc]=i),n.length&&(this.unparsedVttFrags=[],n.forEach(function(t){d.onFragLoaded(v.Events.FRAG_LOADED,t)}))},r.getExistingTrack=function(s){var f=this.media;if(f)for(var d=0;d<f.textTracks.length;d++){var l=f.textTracks[d];if(l[s])return l}return null},r.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},r.createNativeTrack=function(s){if(this.captionsTracks[s])return;var f=this.captionsProperties,d=this.captionsTracks,l=this.media,m=f[s],c=m.label,i=m.languageCode,n=this.getExistingTrack(s);if(n)d[s]=n,Object(R.clearCurrentCues)(d[s]),Object(R.sendAddTrackEvent)(d[s],l);else{var t=this.createTextTrack("captions",c,i);t&&(t[s]=!0,d[s]=t)}},r.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var f=this.captionsProperties[s];if(!f)return;var d=f.label,l={_id:s,label:d,kind:"captions",default:f.media?!!f.media.default:!1,closedCaptions:f.media};this.nonNativeCaptionsTracks[s]=l,this.hls.trigger(v.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[l]})},r.createTextTrack=function(s,f,d){var l=this.media;return l?l.addTextTrack(s,f,d):void 0},r.onMediaAttaching=function(s,f){this.media=f.media,this._cleanTracks()},r.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(f){Object(R.clearCurrentCues)(s[f]),delete s[f]}),this.nonNativeCaptionsTracks={}},r.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),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())},r._cleanTracks=function(){var s=this.media;if(!s)return;var f=s.textTracks;if(f)for(var d=0;d<f.length;d++)Object(R.clearCurrentCues)(f[d])},r.onSubtitleTracksUpdated=function(s,f){var d=this;this.textTracks=[];var l=f.subtitleTracks||[],m=l.some(function(t){return t.textCodec===w.IMSC1_CODEC});if(this.config.enableWebVTT||m&&this.config.enableIMSC1){var c=this.tracks&&l&&this.tracks.length===l.length;if(this.tracks=l||[],this.config.renderTextTracksNatively){var i=this.media?this.media.textTracks:[];this.tracks.forEach(function(t,e){var p;if(e<i.length){for(var g=null,_=0;_<i.length;_++)if(C(i[_],t)){g=i[_];break}g&&(p=g)}p?Object(R.clearCurrentCues)(p):(p=d.createTextTrack("subtitles",t.name,t.lang),p&&(p.mode="disabled")),p&&(p.groupId=t.groupId,d.textTracks.push(p))})}else if(!c&&this.tracks&&this.tracks.length){var n=this.tracks.map(function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}});this.hls.trigger(v.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:n})}}},r.onManifestLoaded=function(s,f){var d=this;this.config.enableCEA708Captions&&f.captions&&f.captions.forEach(function(l){var m=/(?:CC|SERVICE)([1-4])/.exec(l.instreamId);if(!m)return;var c="textTrack"+m[1],i=d.captionsProperties[c];if(!i)return;i.label=l.name,l.lang&&(i.languageCode=l.lang),i.media=l})},r.onFragLoading=function(s,f){var d=this.cea608Parser1,l=this.cea608Parser2,m=this.lastSn,c=this.lastPartIndex;if(!this.enabled||!(d&&l))return;if(f.frag.type===b.PlaylistLevelType.MAIN){var i,n,t=f.frag.sn,e=(i=f==null||((n=f.part)===null||n===void 0)?void 0:n.index)!=null?i:-1;t===m+1||t===m&&e===c+1||(d.reset(),l.reset()),this.lastSn=t,this.lastPartIndex=e}},r.onFragLoaded=function(s,f){var d=f.frag,l=f.payload,m=this.initPTS,c=this.unparsedVttFrags;if(d.type===b.PlaylistLevelType.SUBTITLE)if(l.byteLength){if(!Object(I.isFiniteNumber)(m[d.cc])){c.push(f),m.length&&this.hls.trigger(v.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Missing initial subtitle PTS")});return}var i=d.decryptdata;if(i==null||i.key==null||i.method!=="AES-128"){var n=this.tracks[d.level],t=this.vttCCs;t[d.cc]||(t[d.cc]={start:d.start,prevCC:this.prevCC,new:!0},this.prevCC=d.cc),n&&n.textCodec===w.IMSC1_CODEC?this._parseIMSC1(d,l):this._parseVTTs(d,l,t)}}else this.hls.trigger(v.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Empty subtitle payload")})},r._parseIMSC1=function(s,f){var d=this,l=this.hls;Object(w.parseIMSC1)(f,this.initPTS[s.cc],this.timescale[s.cc],function(m){d._appendCues(m,s.level),l.trigger(v.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(m){T.logger.log("Failed to parse IMSC1: "+m),l.trigger(v.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:m})})},r._parseVTTs=function(s,f,d){var l=this,m=this.hls;Object(M.parseWebVTT)(f,this.initPTS[s.cc],this.timescale[s.cc],d,s.cc,s.start,function(c){l._appendCues(c,s.level),m.trigger(v.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(c){l._fallbackToIMSC1(s,f),T.logger.log("Failed to parse VTT cue: "+c),m.trigger(v.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:c})})},r._fallbackToIMSC1=function(s,f){var d=this,l=this.tracks[s.level];l.textCodec||Object(w.parseIMSC1)(f,this.initPTS[s.cc],this.timescale[s.cc],function(){l.textCodec=w.IMSC1_CODEC,d._parseIMSC1(s,f)},function(){l.textCodec="wvtt"})},r._appendCues=function(s,f){var d=this.hls;if(this.config.renderTextTracksNatively){var l=this.textTracks[f];if(l.mode==="disabled")return;s.forEach(function(i){return Object(R.addCueToTrack)(l,i)})}else{var m=this.tracks[f],c=m.default?"default":"subtitles"+f;d.trigger(v.Events.CUES_PARSED,{type:"subtitles",cues:s,track:c})}},r.onFragDecrypted=function(s,f){var d=f.frag;if(d.type===b.PlaylistLevelType.SUBTITLE){if(!Object(I.isFiniteNumber)(this.initPTS[d.cc])){this.unparsedVttFrags.push(f);return}this.onFragLoaded(v.Events.FRAG_LOADED,f)}},r.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},r.onFragParsingUserdata=function(s,f){var d=this.cea608Parser1,l=this.cea608Parser2;if(!this.enabled||!(d&&l))return;for(var m=0;m<f.samples.length;m++){var c=f.samples[m].bytes;if(c){var i=this.extractCea608Data(c);d.addData(f.samples[m].pts,i[0]),l.addData(f.samples[m].pts,i[1])}}},r.onBufferFlushing=function(s,f){var d=f.startOffset,l=f.endOffset,m=f.endOffsetSubtitles,c=f.type,i=this.media;if(!i||i.currentTime<l)return;if(!c||c==="video"){var n=this.captionsTracks;Object.keys(n).forEach(function(e){return Object(R.removeCuesInRange)(n[e],d,l)})}if(this.config.renderTextTracksNatively&&(d===0&&m!==void 0)){var t=this.textTracks;Object.keys(t).forEach(function(e){return Object(R.removeCuesInRange)(t[e],d,m)})}},r.extractCea608Data=function(s){for(var f=s[0]&31,d=2,l=[[],[]],m=0;m<f;m++){var c=s[d++],i=127&s[d++],n=127&s[d++],t=(4&c)!==0,e=3&c;if(i===0&&n===0)continue;t&&((e===0||e===1)&&(l[e].push(i),l[e].push(n)))}return l},h}();function C(h,r){return h&&h.label===r.name&&!(h.textTrack1||h.textTrack2)}function E(h,r,o,s){return Math.min(r,s)-Math.max(h,o)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function v(U,M){this.subtle=void 0,this.aesIV=void 0,this.subtle=U,this.aesIV=M}var x=v.prototype;return x.decrypt=function(M,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,M)},v}()},"./src/crypt/aes-decryptor.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"removePadding",function(){return v}),S.d(N,"default",function(){return x});var I=S("./src/utils/typed-array.ts");function v(U){var M=U.byteLength,R=M&&new DataView(U.buffer).getUint8(M-1);return R?Object(I.sliceUint8)(U,0,M-R):U}var x=function(){function U(){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 M=U.prototype;return M.uint8ArrayToUint32Array_=function(w){for(var b=new DataView(w),T=new Uint32Array(4),O=0;O<4;O++)T[O]=b.getUint32(O*4);return T},M.initTable=function(){var w=this.sBox,b=this.invSBox,T=this.subMix,O=T[0],C=T[1],E=T[2],y=T[3],h=this.invSubMix,r=h[0],o=h[1],s=h[2],f=h[3],d=new Uint32Array(256),l=0,m=0,c=0;for(c=0;c<256;c++)c<128?d[c]=c<<1:d[c]=c<<1^283;for(c=0;c<256;c++){var i=m^m<<1^m<<2^m<<3^m<<4;i=i>>>8^i&255^99,w[l]=i,b[i]=l;var n=d[l],t=d[n],e=d[t],p=d[i]*257^i*16843008;O[l]=p<<24|p>>>8,C[l]=p<<16|p>>>16,E[l]=p<<8|p>>>24,y[l]=p,p=e*16843009^t*65537^n*257^l*16843008,r[i]=p<<24|p>>>8,o[i]=p<<16|p>>>16,s[i]=p<<8|p>>>24,f[i]=p,l?(l=n^d[d[d[e^n]]],m^=d[d[m]]):l=m=1}},M.expandKey=function(w){for(var b=this.uint8ArrayToUint32Array_(w),T=!0,O=0;O<b.length&&T;)T=b[O]===this.key[O],O++;if(T)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 E=this.ksRows=(C+6+1)*4,y,h,r=this.keySchedule=new Uint32Array(E),o=this.invKeySchedule=new Uint32Array(E),s=this.sBox,f=this.rcon,d=this.invSubMix,l=d[0],m=d[1],c=d[2],i=d[3],n,t;for(y=0;y<E;y++){if(y<C){n=r[y]=b[y];continue}t=n,y%C===0?(t=t<<8|t>>>24,t=s[t>>>24]<<24|s[t>>>16&255]<<16|s[t>>>8&255]<<8|s[t&255],t^=f[y/C|0]<<24):C>6&&y%C===4&&(t=s[t>>>24]<<24|s[t>>>16&255]<<16|s[t>>>8&255]<<8|s[t&255]),r[y]=n=(r[y-C]^t)>>>0}for(h=0;h<E;h++)y=E-h,h&3?t=r[y]:t=r[y-4],h<4||y<=4?o[h]=t:o[h]=l[s[t>>>24]]^m[s[t>>>16&255]]^c[s[t>>>8&255]]^i[s[t&255]],o[h]=o[h]>>>0},M.networkToHostOrderSwap=function(w){return w<<24|(w&65280)<<8|(w&16711680)>>8|w>>>24},M.decrypt=function(w,b,T){for(var O=this.keySize+6,C=this.invKeySchedule,E=this.invSBox,y=this.invSubMix,h=y[0],r=y[1],o=y[2],s=y[3],f=this.uint8ArrayToUint32Array_(T),d=f[0],l=f[1],m=f[2],c=f[3],i=new Int32Array(w),n=new Int32Array(i.length),t,e,p,g,_,A,k,F,z,J,Y,$,le,be,ve=this.networkToHostOrderSwap;b<i.length;){for(z=ve(i[b]),J=ve(i[b+1]),Y=ve(i[b+2]),$=ve(i[b+3]),_=z^C[0],A=$^C[1],k=Y^C[2],F=J^C[3],le=4,be=1;be<O;be++)t=h[_>>>24]^r[A>>16&255]^o[k>>8&255]^s[F&255]^C[le],e=h[A>>>24]^r[k>>16&255]^o[F>>8&255]^s[_&255]^C[le+1],p=h[k>>>24]^r[F>>16&255]^o[_>>8&255]^s[A&255]^C[le+2],g=h[F>>>24]^r[_>>16&255]^o[A>>8&255]^s[k&255]^C[le+3],_=t,A=e,k=p,F=g,le=le+4;t=E[_>>>24]<<24^E[A>>16&255]<<16^E[k>>8&255]<<8^E[F&255]^C[le],e=E[A>>>24]<<24^E[k>>16&255]<<16^E[F>>8&255]<<8^E[_&255]^C[le+1],p=E[k>>>24]<<24^E[F>>16&255]<<16^E[_>>8&255]<<8^E[A&255]^C[le+2],g=E[F>>>24]<<24^E[_>>16&255]<<16^E[A>>8&255]<<8^E[k&255]^C[le+3],n[b]=ve(t^d),n[b+1]=ve(g^l),n[b+2]=ve(p^m),n[b+3]=ve(e^c),d=z,l=J,m=Y,c=$,b=b+4}return n.buffer},U}()},"./src/crypt/decrypter.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return b});var I=S("./src/crypt/aes-crypto.ts"),v=S("./src/crypt/fast-aes-key.ts"),x=S("./src/crypt/aes-decryptor.ts"),U=S("./src/utils/logger.ts"),M=S("./src/utils/mp4-tools.ts"),R=S("./src/utils/typed-array.ts"),w=16,b=function(){function T(C,E,y){var h=y===void 0?{}:y,r=h.removePKCS7Padding,o=r===void 0?!0:r;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=E,this.removePKCS7Padding=o,o)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(f){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=T.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var E=this.currentResult;if(!E){this.reset();return}var y=new Uint8Array(E);return this.reset(),this.removePKCS7Padding?Object(x.removePadding)(y):y},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(E,y,h,r){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(E),y,h);var o=this.flush();o&&r(o.buffer)}else this.webCryptoDecrypt(new Uint8Array(E),y,h).then(r)},O.softwareDecrypt=function(E,y,h){var r=this.currentIV,o=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(E=Object(M.appendUint8Array)(s,E),this.remainderData=null);var f=this.getValidChunk(E);if(!f.length)return null;r&&(h=r);var d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new x.default),d.expandKey(y);var l=o;return this.currentResult=d.decrypt(f.buffer,0,h),this.currentIV=Object(R.sliceUint8)(f,-16).buffer,l||null},O.webCryptoDecrypt=function(E,y,h){var r=this,o=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new v.default(o,y)),this.fastAesKey.expandKey().then(function(s){if(!o)return Promise.reject(new Error("web crypto not initialized"));var f=new I.default(o,h);return f.decrypt(E.buffer,s)}).catch(function(s){return r.onWebCryptoError(s,E,y,h)})},O.onWebCryptoError=function(E,y,h,r){return U.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",E),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,h,r)},O.getValidChunk=function(E){var y=E,h=E.length-E.length%w;return h!==E.length&&(y=Object(R.sliceUint8)(E,0,h),this.remainderData=Object(R.sliceUint8)(E,h)),y},O.logOnce=function(E){if(!this.logEnabled)return;U.logger.log("[decrypter.ts]: "+E),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function v(U,M){this.subtle=void 0,this.key=void 0,this.subtle=U,this.key=M}var x=v.prototype;return x.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},v}()},"./src/demux/aacdemuxer.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/demux/base-audio-demuxer.ts"),v=S("./src/demux/adts.ts"),x=S("./src/utils/logger.ts"),U=S("./src/demux/id3.ts");function M(b,T){b.prototype=Object.create(T.prototype),b.prototype.constructor=b,R(b,T)}function R(b,T){return R=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},R(b,T)}var w=function(b){M(T,b);function T(C,E){var y;return y=b.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=C,y.config=E,y}var O=T.prototype;return O.resetInitSegment=function(E,y,h){b.prototype.resetInitSegment.call(this,E,y,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:E,duration:h,inputTimeScale:9e4,dropped:0}},T.probe=function(E){if(!E)return!1;for(var y=U.getID3Data(E,0)||[],h=y.length,r=E.length;h<r;h++)if(v.probe(E,h))return x.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(E,y){return v.canParse(E,y)},O.appendFrame=function(E,y,h){v.initTrackConfig(E,this.observer,y,h,E.manifestCodec);var r=v.appendFrame(E,y,h,this.initPTS,this.frameIndex);if(r&&r.missing===0)return r},T}(I.default);w.minProbeByteLength=9,N.default=w},"./src/demux/adts.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"getAudioConfig",function(){return U}),S.d(N,"isHeaderPattern",function(){return M}),S.d(N,"getHeaderLength",function(){return R}),S.d(N,"getFullFrameLength",function(){return w}),S.d(N,"canGetFrameLength",function(){return b}),S.d(N,"isHeader",function(){return T}),S.d(N,"canParse",function(){return O}),S.d(N,"probe",function(){return C}),S.d(N,"initTrackConfig",function(){return E}),S.d(N,"getFrameDuration",function(){return y}),S.d(N,"parseFrameHeader",function(){return h}),S.d(N,"appendFrame",function(){return r});var I=S("./src/utils/logger.ts"),v=S("./src/errors.ts"),x=S("./src/events.ts");function U(o,s,f,d){var l,m,c,i,n=navigator.userAgent.toLowerCase(),t=d,e=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];l=((s[f+2]&192)>>>6)+1;var p=(s[f+2]&60)>>>2;if(p>e.length-1){o.trigger(x.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+p});return}return c=(s[f+2]&1)<<2,c|=(s[f+3]&192)>>>6,I.logger.log("manifest codec:"+d+", ADTS type:"+l+", samplingIndex:"+p),/firefox/i.test(n)?p>=6?(l=5,i=new Array(4),m=p-3):(l=2,i=new Array(2),m=p):n.indexOf("android")!==-1?(l=2,i=new Array(2),m=p):(l=5,i=new Array(4),d&&(d.indexOf("mp4a.40.29")!==-1||d.indexOf("mp4a.40.5")!==-1)||!d&&p>=6?m=p-3:((d&&d.indexOf("mp4a.40.2")!==-1&&(p>=6&&c===1||/vivaldi/i.test(n))||!d&&c===1)&&(l=2,i=new Array(2)),m=p)),i[0]=l<<3,i[0]|=(p&14)>>1,i[1]|=(p&1)<<7,i[1]|=c<<3,l===5&&(i[1]|=(m&14)>>1,i[2]=(m&1)<<7,i[2]|=2<<2,i[3]=0),{config:i,samplerate:e[p],channelCount:c,codec:"mp4a.40."+l,manifestCodec:t}}function M(o,s){return o[s]===255&&(o[s+1]&246)===240}function R(o,s){return o[s+1]&1?7:9}function w(o,s){return(o[s+3]&3)<<11|o[s+4]<<3|(o[s+5]&224)>>>5}function b(o,s){return s+5<o.length}function T(o,s){return s+1<o.length&&M(o,s)}function O(o,s){return b(o,s)&&M(o,s)&&w(o,s)<=o.length-s}function C(o,s){if(T(o,s)){var f=R(o,s);if(s+f>=o.length)return!1;var d=w(o,s);if(d<=f)return!1;var l=s+d;return l===o.length||T(o,l)}return!1}function E(o,s,f,d,l){if(!o.samplerate){var m=U(s,f,d,l);if(!m)return;o.config=m.config,o.samplerate=m.samplerate,o.channelCount=m.channelCount,o.codec=m.codec,o.manifestCodec=m.manifestCodec,I.logger.log("parsed codec:"+o.codec+", rate:"+m.samplerate+", channels:"+m.channelCount)}}function y(o){return 1024*9e4/o}function h(o,s,f,d,l){var m=R(o,s),c=w(o,s);if(c-=m,c>0){var i=f+d*l;return{headerLength:m,frameLength:c,stamp:i}}}function r(o,s,f,d,l){var m=y(o.samplerate),c=h(s,f,d,l,m);if(c){var i=c.frameLength,n=c.headerLength,t=c.stamp,e=n+i,p=Math.max(0,f+e-s.length),g;p?(g=new Uint8Array(e-n),g.set(s.subarray(f+n,s.length),0)):g=s.subarray(f+n,f+e);var _={unit:g,pts:t};return p||o.samples.push(_),{sample:_,length:e,missing:p}}}},"./src/demux/base-audio-demuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"initPTSFn",function(){return w});var I=S("./src/polyfills/number.ts"),v=S("./src/demux/id3.ts"),x=S("./src/demux/dummy-demuxed-track.ts"),U=S("./src/utils/mp4-tools.ts"),M=S("./src/utils/typed-array.ts"),R=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=b.prototype;return T.resetInitSegment=function(C,E,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(C,E){return!1},T.appendFrame=function(C,E,y){},T.demux=function(C,E){this.cachedData&&(C=Object(U.appendUint8Array)(this.cachedData,C),this.cachedData=null);var y=v.getID3Data(C,0),h=y?y.length:0,r,o,s=this._audioTrack,f=this._id3Track,d=y?v.getTimeStamp(y):void 0,l=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=w(d,E)),y&&y.length>0&&f.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),o=this.initPTS;h<l;){if(this.canParse(C,h)){var m=this.appendFrame(s,C,h);m?(this.frameIndex++,o=m.sample.pts,h+=m.length,r=h):h=l}else v.canParse(C,h)?(y=v.getID3Data(C,h),f.samples.push({pts:o,dts:o,data:y}),h+=y.length,r=h):h++;if(h===l&&r!==l){var c=Object(M.sliceUint8)(C,r);this.cachedData?this.cachedData=Object(U.appendUint8Array)(this.cachedData,c):this.cachedData=c}}return{audioTrack:s,avcTrack:Object(x.dummyTrack)(),id3Track:f,textTrack:Object(x.dummyTrack)()}},T.demuxSampleAes=function(C,E,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(C){var E=this.cachedData;return E&&(this.cachedData=null,this.demux(E,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(x.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(x.dummyTrack)()}},T.destroy=function(){},b}(),w=function(T,O){return Object(I.isFiniteNumber)(T)?T*90:O*9e4};N.default=R},"./src/demux/chunk-cache.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function x(){this.chunks=[],this.dataLength=0}var U=x.prototype;return U.push=function(R){this.chunks.push(R),this.dataLength+=R.length},U.flush=function(){var R=this.chunks,w=this.dataLength,b;if(R.length)R.length===1?b=R[0]:b=v(R,w);else return new Uint8Array(0);return this.reset(),b},U.reset=function(){this.chunks.length=0,this.dataLength=0},x}();function v(x,U){for(var M=new Uint8Array(U),R=0,w=0;w<x.length;w++){var b=x[w];M.set(b,R),R+=b.length}return M}},"./src/demux/dummy-demuxed-track.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"dummyTrack",function(){return I});function I(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/logger.ts"),v=function(){function x(M){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=M,this.bytesAvailable=M.byteLength,this.word=0,this.bitsAvailable=0}var U=x.prototype;return U.loadWord=function(){var R=this.data,w=this.bytesAvailable,b=R.byteLength-w,T=new Uint8Array(4),O=Math.min(4,w);if(O===0)throw new Error("no bytes available");T.set(R.subarray(b,b+O)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},U.skipBits=function(R){var w;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,w=R>>3,R-=w>>3,this.bytesAvailable-=w,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},U.readBits=function(R){var w=Math.min(this.bitsAvailable,R),b=this.word>>>32-w;return R>32&&I.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=w,this.bitsAvailable>0?this.word<<=w:this.bytesAvailable>0&&this.loadWord(),w=R-w,w>0&&this.bitsAvailable?b<<w|this.readBits(w):b},U.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},U.skipUEG=function(){this.skipBits(1+this.skipLZ())},U.skipEG=function(){this.skipBits(1+this.skipLZ())},U.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},U.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},U.readBoolean=function(){return this.readBits(1)===1},U.readUByte=function(){return this.readBits(8)},U.readUShort=function(){return this.readBits(16)},U.readUInt=function(){return this.readBits(32)},U.skipScalingList=function(R){for(var w=8,b=8,T,O=0;O<R;O++)b!==0&&(T=this.readEG(),b=(w+T+256)%256),w=b===0?w:b},U.readSPS=function(){var R=0,w=0,b=0,T=0,O,C,E,y=this.readUByte.bind(this),h=this.readBits.bind(this),r=this.readUEG.bind(this),o=this.readBoolean.bind(this),s=this.skipBits.bind(this),f=this.skipEG.bind(this),d=this.skipUEG.bind(this),l=this.skipScalingList.bind(this);y();var m=y();if(h(5),s(3),y(),d(),m===100||m===110||m===122||m===244||m===44||m===83||m===86||m===118||m===128){var c=r();if(c===3&&s(1),d(),d(),s(1),o())for(C=c!==3?8:12,E=0;E<C;E++)o()&&(E<6?l(16):l(64))}d();var i=r();if(i===0)r();else if(i===1)for(s(1),f(),f(),O=r(),E=0;E<O;E++)f();d(),s(1);var n=r(),t=r(),e=h(1);e===0&&s(1),s(1),o()&&(R=r(),w=r(),b=r(),T=r());var p=[1,1];if(o()&&o()){var g=y();switch(g){case 1:p=[1,1];break;case 2:p=[12,11];break;case 3:p=[10,11];break;case 4:p=[16,11];break;case 5:p=[40,33];break;case 6:p=[24,11];break;case 7:p=[20,11];break;case 8:p=[32,11];break;case 9:p=[80,33];break;case 10:p=[18,11];break;case 11:p=[15,11];break;case 12:p=[64,33];break;case 13:p=[160,99];break;case 14:p=[4,3];break;case 15:p=[3,2];break;case 16:p=[2,1];break;case 255:{p=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((n+1)*16-R*2-w*2),height:(2-e)*(t+1)*16-(e?2:4)*(b+T),pixelRatio:p}},U.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},x}();N.default=v},"./src/demux/id3.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"isHeader",function(){return I}),S.d(N,"isFooter",function(){return v}),S.d(N,"getID3Data",function(){return x}),S.d(N,"canParse",function(){return M}),S.d(N,"getTimeStamp",function(){return R}),S.d(N,"isTimeStampFrame",function(){return w}),S.d(N,"getID3Frames",function(){return T}),S.d(N,"decodeFrame",function(){return O}),S.d(N,"utf8ArrayToStr",function(){return r}),S.d(N,"testables",function(){return o});var I=function(l,m){return m+10<=l.length&&(l[m]===73&&l[m+1]===68&&l[m+2]===51&&(l[m+3]<255&&l[m+4]<255&&(l[m+6]<128&&l[m+7]<128&&l[m+8]<128&&l[m+9]<128)))},v=function(l,m){return m+10<=l.length&&(l[m]===51&&l[m+1]===68&&l[m+2]===73&&(l[m+3]<255&&l[m+4]<255&&(l[m+6]<128&&l[m+7]<128&&l[m+8]<128&&l[m+9]<128)))},x=function(l,m){for(var c=m,i=0;I(l,m);){i+=10;var n=U(l,m+6);i+=n,v(l,m+10)&&(i+=10),m+=i}return i>0?l.subarray(c,c+i):void 0},U=function(l,m){var c=0;return c=(l[m]&127)<<21,c|=(l[m+1]&127)<<14,c|=(l[m+2]&127)<<7,c|=l[m+3]&127,c},M=function(l,m){return I(l,m)&&U(l,m+6)+10<=l.length-m},R=function(l){for(var m=T(l),c=0;c<m.length;c++){var i=m[c];if(w(i))return h(i)}return},w=function(l){return l&&l.key==="PRIV"&&l.info==="com.apple.streaming.transportStreamTimestamp"},b=function(l){var m=String.fromCharCode(l[0],l[1],l[2],l[3]),c=U(l,4),i=10;return{type:m,size:c,data:l.subarray(i,i+c)}},T=function(l){for(var m=0,c=[];I(l,m);){var i=U(l,m+6);m+=10;for(var n=m+i;m+8<n;){var t=b(l.subarray(m)),e=O(t);e&&c.push(e),m+=t.size+10}v(l,m)&&(m+=10)}return c},O=function(l){return l.type==="PRIV"?C(l):l.type[0]==="W"?y(l):E(l)},C=function(l){if(l.size<2)return;var m=r(l.data,!0),c=new Uint8Array(l.data.subarray(m.length+1));return{key:l.type,info:m,data:c.buffer}},E=function(l){if(l.size<2)return;if(l.type==="TXXX"){var m=1,c=r(l.data.subarray(m),!0);m+=c.length+1;var i=r(l.data.subarray(m));return{key:l.type,info:c,data:i}}var n=r(l.data.subarray(1));return{key:l.type,data:n}},y=function(l){if(l.type==="WXXX"){if(l.size<2)return;var m=1,c=r(l.data.subarray(m),!0);m+=c.length+1;var i=r(l.data.subarray(m));return{key:l.type,info:c,data:i}}var n=r(l.data);return{key:l.type,data:n}},h=function(l){if(l.data.byteLength===8){var m=new Uint8Array(l.data),c=m[3]&1,i=(m[4]<<23)+(m[5]<<15)+(m[6]<<7)+m[7];return i/=45,c&&(i+=4772185884e-2),Math.round(i)}return},r=function(l,m){m===void 0&&(m=!1);var c=f();if(c){var i=c.decode(l);if(m){var n=i.indexOf("\0");return n!==-1?i.substring(0,n):i}return i.replace(/\0/g,"")}for(var t=l.length,e,p,g,_="",A=0;A<t;){if(e=l[A++],e===0&&m)return _;if(e===0||e===3)continue;switch(e>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:_+=String.fromCharCode(e);break;case 12:case 13:p=l[A++],_+=String.fromCharCode((e&31)<<6|p&63);break;case 14:p=l[A++],g=l[A++],_+=String.fromCharCode((e&15)<<12|(p&63)<<6|(g&63)<<0);break;default:}}return _},o={decodeTextFrame:E},s;function f(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/demux/base-audio-demuxer.ts"),v=S("./src/demux/id3.ts"),x=S("./src/utils/logger.ts"),U=S("./src/demux/mpegaudio.ts");function M(b,T){b.prototype=Object.create(T.prototype),b.prototype.constructor=b,R(b,T)}function R(b,T){return R=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},R(b,T)}var w=function(b){M(T,b);function T(){return b.apply(this,arguments)||this}var O=T.prototype;return O.resetInitSegment=function(E,y,h){b.prototype.resetInitSegment.call(this,E,y,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:E,duration:h,inputTimeScale:9e4,dropped:0}},T.probe=function(E){if(!E)return!1;for(var y=v.getID3Data(E,0)||[],h=y.length,r=E.length;h<r;h++)if(U.probe(E,h))return x.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(E,y){return U.canParse(E,y)},O.appendFrame=function(E,y,h){return this.initPTS===null?void 0:U.appendFrame(E,y,h,this.initPTS,this.frameIndex)},T}(I.default);w.minProbeByteLength=4,N.default=w},"./src/demux/mp4demuxer.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/mp4-tools.ts"),v=S("./src/demux/dummy-demuxed-track.ts"),x=function(){function U(R,w){this.remainderData=null,this.config=void 0,this.config=w}var M=U.prototype;return M.resetTimeStamp=function(){},M.resetInitSegment=function(){},M.resetContiguity=function(){},U.probe=function(w){return Object(I.findBox)({data:w,start:0,end:Math.min(w.length,16384)},["moof"]).length>0},M.demux=function(w){var b=w,T=Object(v.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(I.appendUint8Array)(this.remainderData,w));var O=Object(I.segmentValidRange)(b);this.remainderData=O.remainder,T.samples=O.valid||new Uint8Array}else T.samples=b;return{audioTrack:Object(v.dummyTrack)(),avcTrack:T,id3Track:Object(v.dummyTrack)(),textTrack:Object(v.dummyTrack)()}},M.flush=function(){var w=Object(v.dummyTrack)();return w.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(v.dummyTrack)(),avcTrack:w,id3Track:Object(v.dummyTrack)(),textTrack:Object(v.dummyTrack)()}},M.demuxSampleAes=function(w,b,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},M.destroy=function(){},U}();x.minProbeByteLength=1024,N.default=x},"./src/demux/mpegaudio.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"appendFrame",function(){return R}),S.d(N,"parseHeader",function(){return w}),S.d(N,"isHeaderPattern",function(){return b}),S.d(N,"isHeader",function(){return T}),S.d(N,"canParse",function(){return O}),S.d(N,"probe",function(){return C});var I=null,v=[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],x=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],U=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function R(E,y,h,r,o){if(h+24>y.length)return;var s=w(y,h);if(s&&h+s.frameLength<=y.length){var f=s.samplesPerFrame*9e4/s.sampleRate,d=r+o*f,l={unit:y.subarray(h,h+s.frameLength),pts:d,dts:d};return E.config=[],E.channelCount=s.channelCount,E.samplerate=s.sampleRate,E.samples.push(l),{sample:l,length:s.frameLength,missing:0}}}function w(E,y){var h=E[y+1]>>3&3,r=E[y+1]>>1&3,o=E[y+2]>>4&15,s=E[y+2]>>2&3;if(h!==1&&o!==0&&o!==15&&s!==3){var f=E[y+2]>>1&1,d=E[y+3]>>6,l=h===3?3-r:r===3?3:4,m=v[l*14+o-1]*1e3,c=h===3?0:h===2?1:2,i=x[c*3+s],n=d===3?1:2,t=U[h][r],e=M[r],p=t*8*e,g=Math.floor(t*m/i+f)*e;if(I===null){var _=navigator.userAgent||"",A=_.match(/Chrome\/(\d+)/i);I=A?parseInt(A[1]):0}var k=!!I&&I<=87;return k&&r===2&&m>=224e3&&d===0&&(E[y+3]=E[y+3]|128),{sampleRate:i,channelCount:n,frameLength:g,samplesPerFrame:p}}}function b(E,y){return E[y]===255&&(E[y+1]&224)===224&&(E[y+1]&6)!==0}function T(E,y){return y+1<E.length&&b(E,y)}function O(E,y){var h=4;return b(E,y)&&h<=E.length-y}function C(E,y){if(y+1<E.length&&b(E,y)){var h=4,r=w(E,y),o=h;r!=null&&r.frameLength&&(o=r.frameLength);var s=y+o;return s===E.length||T(E,s)}return!1}},"./src/demux/sample-aes.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/crypt/decrypter.ts"),v=S("./src/demux/tsdemuxer.ts"),x=function(){function U(R,w,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new I.default(R,w,{removePKCS7Padding:!1})}var M=U.prototype;return M.decryptBuffer=function(w,b){this.decrypter.decrypt(w,this.keyData.key.buffer,this.keyData.iv.buffer,b)},M.decryptAacSample=function(w,b,T,O){var C=w[b].unit,E=C.subarray(16,C.length-C.length%16),y=E.buffer.slice(E.byteOffset,E.byteOffset+E.length),h=this;this.decryptBuffer(y,function(r){var o=new Uint8Array(r);C.set(o,16),O||h.decryptAacSamples(w,b+1,T)})},M.decryptAacSamples=function(w,b,T){for(;;b++){if(b>=w.length){T();return}if(w[b].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(w,b,T,O),!O)return}},M.getAvcEncryptedData=function(w){for(var b=Math.floor((w.length-48)/160)*16+16,T=new Int8Array(b),O=0,C=32;C<=w.length-16;C+=160,O+=16)T.set(w.subarray(C,C+16),O);return T},M.getAvcDecryptedUnit=function(w,b){for(var T=new Uint8Array(b),O=0,C=32;C<=w.length-16;C+=160,O+=16)w.set(T.subarray(O,O+16),C);return w},M.decryptAvcSample=function(w,b,T,O,C,E){var y=Object(v.discardEPB)(C.data),h=this.getAvcEncryptedData(y),r=this;this.decryptBuffer(h.buffer,function(o){C.data=r.getAvcDecryptedUnit(y,o),E||r.decryptAvcSamples(w,b,T+1,O)})},M.decryptAvcSamples=function(w,b,T,O){if(w instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,T=0){if(b>=w.length){O();return}for(var C=w[b].units;!(T>=C.length);T++){var E=C[T];if(E.data.length<=48||E.type!==1&&E.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(w,b,T,O,E,y),!y)return}}},U}();N.default=x},"./src/demux/transmuxer-interface.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return C});var I=S("./node_modules/webworkify-webpack/index.js"),v=S.n(I),x=S("./src/events.ts"),U=S("./src/demux/transmuxer.ts"),M=S("./src/utils/logger.ts"),R=S("./src/errors.ts"),w=S("./src/utils/mediasource-helper.ts"),b=S("./node_modules/eventemitter3/index.js"),T=S.n(b),O=Object(w.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function E(h,r,o,s){var f=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=h,this.id=r,this.onTransmuxComplete=o,this.onFlush=s;var d=h.config,l=function(t,e){e=e||{},e.frag=f.frag,e.id=f.id,h.trigger(t,e)};this.observer=new b.EventEmitter,this.observer.on(x.Events.FRAG_DECRYPTED,l),this.observer.on(x.Events.ERROR,l);var m={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},c=navigator.vendor;if(d.enableWorker&&typeof Worker!="undefined"){M.logger.log("demuxing in webworker");var i;try{i=this.worker=I("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),i.addEventListener("message",this.onwmsg),i.onerror=function(n){h.trigger(x.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(n.message+" ("+n.filename+":"+n.lineno+")")})},i.postMessage({cmd:"init",typeSupported:m,vendor:c,id:r,config:JSON.stringify(d)})}catch(n){M.logger.warn("Error in worker:",n),M.logger.error("Error while initializing DemuxerWorker, fallback to inline"),i&&self.URL.revokeObjectURL(i.objectURL),this.transmuxer=new U.default(this.observer,m,d,c,r),this.worker=null}}else this.transmuxer=new U.default(this.observer,m,d,c,r)}var y=E.prototype;return y.destroy=function(){var r=this.worker;if(r)r.removeEventListener("message",this.onwmsg),r.terminate(),this.worker=null;else{var o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},y.push=function(r,o,s,f,d,l,m,c,i,n){var t=this;i.transmuxing.start=self.performance.now();var e=this.transmuxer,p=this.worker,g=l?l.start:d.start,_=d.decryptdata,A=this.frag,k=!(A&&d.cc===A.cc),F=!(A&&i.level===A.level),z=A?i.sn-A.sn:-1,J=this.part?i.part-this.part.index:1,Y=!F&&(z===1||z===0&&J===1),$=self.performance.now();(F||z||d.stats.parsing.start===0)&&(d.stats.parsing.start=$),l&&(J||!Y)&&(l.stats.parsing.start=$);var le=new U.TransmuxState(k,Y,c,F,g);if(!Y||k){M.logger.log("[transmuxer-interface, "+d.type+"]: Starting new transmux session for sn: "+i.sn+" p: "+i.part+" level: "+i.level+" id: "+i.id+`
|
|
discontinuity: `+k+`
|
|
trackSwitch: `+F+`
|
|
contiguous: `+Y+`
|
|
accurateTimeOffset: `+c+`
|
|
timeOffset: `+g);var be=new U.TransmuxConfig(s,f,o,m,n);this.configureTransmuxer(be)}if(this.frag=d,this.part=l,p)p.postMessage({cmd:"demux",data:r,decryptdata:_,chunkMeta:i,state:le},r instanceof ArrayBuffer?[r]:[]);else if(e){var ve=e.push(r,_,i,le);Object(U.isPromise)(ve)?ve.then(function(ke){t.handleTransmuxComplete(ke)}):this.handleTransmuxComplete(ve)}},y.flush=function(r){var o=this;r.transmuxing.start=self.performance.now();var s=this.transmuxer,f=this.worker;if(f)f.postMessage({cmd:"flush",chunkMeta:r});else if(s){var d=s.flush(r);Object(U.isPromise)(d)?d.then(function(l){o.handleFlushResult(l,r)}):this.handleFlushResult(d,r)}},y.handleFlushResult=function(r,o){var s=this;r.forEach(function(f){s.handleTransmuxComplete(f)}),this.onFlush(o)},y.onWorkerMessage=function(r){var o=r.data,s=this.hls;switch(o.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(o.data);break}case"flush":{this.onFlush(o.data);break}default:{o.data=o.data||{},o.data.frag=this.frag,o.data.id=this.id,s.trigger(o.event,o.data);break}}},y.configureTransmuxer=function(r){var o=this.worker,s=this.transmuxer;o?o.postMessage({cmd:"configure",config:r}):s&&s.configure(r)},y.handleTransmuxComplete=function(r){r.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(r)},E}()},"./src/demux/transmuxer-worker.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return R});var I=S("./src/demux/transmuxer.ts"),v=S("./src/events.ts"),x=S("./src/utils/logger.ts"),U=S("./node_modules/eventemitter3/index.js"),M=S.n(U);function R(C){var E=new U.EventEmitter,y=function(r,o){C.postMessage({event:r,data:o})};E.on(v.Events.FRAG_DECRYPTED,y),E.on(v.Events.ERROR,y),C.addEventListener("message",function(h){var r=h.data;switch(r.cmd){case"init":{var o=JSON.parse(r.config);C.transmuxer=new I.default(E,r.typeSupported,o,r.vendor,r.id),Object(x.enableLogs)(o.debug),y("init",null);break}case"configure":{C.transmuxer.configure(r.config);break}case"demux":{var s=C.transmuxer.push(r.data,r.decryptdata,r.chunkMeta,r.state);Object(I.isPromise)(s)?s.then(function(l){w(C,l)}):w(C,s);break}case"flush":{var f=r.chunkMeta,d=C.transmuxer.flush(f);Object(I.isPromise)(d)?d.then(function(l){T(C,l,f)}):T(C,d,f);break}default:break}})}function w(C,E){if(O(E.remuxResult))return;var y=[],h=E.remuxResult,r=h.audio,o=h.video;r&&b(y,r),o&&b(y,o),C.postMessage({event:"transmuxComplete",data:E},y)}function b(C,E){E.data1&&C.push(E.data1.buffer),E.data2&&C.push(E.data2.buffer)}function T(C,E,y){E.forEach(function(h){w(C,h)}),C.postMessage({event:"flush",data:y})}function O(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return o}),S.d(N,"isPromise",function(){return d}),S.d(N,"TransmuxConfig",function(){return l}),S.d(N,"TransmuxState",function(){return m});var I=S("./src/events.ts"),v=S("./src/errors.ts"),x=S("./src/crypt/decrypter.ts"),U=S("./src/demux/aacdemuxer.ts"),M=S("./src/demux/mp4demuxer.ts"),R=S("./src/demux/tsdemuxer.ts"),w=S("./src/demux/mp3demuxer.ts"),b=S("./src/remux/mp4-remuxer.ts"),T=S("./src/remux/passthrough-remuxer.ts"),O=S("./src/demux/chunk-cache.ts"),C=S("./src/utils/mp4-tools.ts"),E=S("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(c){E.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var h=[{demux:R.default,remux:b.default},{demux:M.default,remux:T.default},{demux:U.default,remux:b.default},{demux:w.default,remux:b.default}],r=1024;h.forEach(function(c){var i=c.demux;r=Math.max(r,i.minProbeByteLength)});var o=function(){function c(n,t,e,p,g){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 O.default,this.observer=n,this.typeSupported=t,this.config=e,this.vendor=p,this.id=g}var i=c.prototype;return i.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},i.push=function(t,e,p,g){var _=this,A=p.transmuxing;A.executeStart=y();var k=new Uint8Array(t),F=this.cache,z=this.config,J=this.currentTransmuxState,Y=this.transmuxConfig;g&&(this.currentTransmuxState=g);var $=s(k,e);if($&&$.method==="AES-128"){var le=this.getDecrypter();if(z.enableSoftwareAES){var be=le.softwareDecrypt(k,$.key.buffer,$.iv.buffer);if(!be)return A.executeEnd=y(),f(p);k=new Uint8Array(be)}else return this.decryptionPromise=le.webCryptoDecrypt(k,$.key.buffer,$.iv.buffer).then(function(Fe){var $e=_.push(Fe,null,p);return _.decryptionPromise=null,$e}),this.decryptionPromise}var ve=g||J,ke=ve.contiguous,Te=ve.discontinuity,xe=ve.trackSwitch,_e=ve.accurateTimeOffset,Oe=ve.timeOffset,ce=Y.audioCodec,Z=Y.videoCodec,je=Y.defaultInitPts,at=Y.duration,rt=Y.initSegmentData;if((Te||xe)&&this.resetInitSegment(rt,ce,Z,at),Te&&this.resetInitialTimestamp(je),ke||this.resetContiguity(),this.needsProbing(k,Te,xe)){if(F.dataLength){var Ke=F.flush();k=Object(C.appendUint8Array)(Ke,k)}this.configureTransmuxer(k,Y)}var He=this.transmux(k,$,Oe,_e,p),we=this.currentTransmuxState;return we.contiguous=!0,we.discontinuity=!1,we.trackSwitch=!1,A.executeEnd=y(),He},i.flush=function(t){var e=this,p=t.transmuxing;p.executeStart=y();var g=this.decrypter,_=this.cache,A=this.currentTransmuxState,k=this.decryptionPromise;if(k)return k.then(function(){return e.flush(t)});var F=[],z=A.timeOffset;if(g){var J=g.flush();J&&F.push(this.push(J,null,t))}var Y=_.dataLength;_.reset();var $=this.demuxer,le=this.remuxer;if(!$||!le)return Y>=r&&this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),p.executeEnd=y(),[f(t)];var be=$.flush(z);return d(be)?be.then(function(ve){return e.flushRemux(F,ve,t),F}):(this.flushRemux(F,be,t),F)},i.flushRemux=function(t,e,p){var g=e.audioTrack,_=e.avcTrack,A=e.id3Track,k=e.textTrack,F=this.currentTransmuxState,z=F.accurateTimeOffset,J=F.timeOffset;E.logger.log("[transmuxer.ts]: Flushed fragment "+p.sn+(p.part>-1?" p: "+p.part:"")+" of level "+p.level);var Y=this.remuxer.remux(g,_,A,k,J,z,!0,this.id);t.push({remuxResult:Y,chunkMeta:p}),p.transmuxing.executeEnd=y()},i.resetInitialTimestamp=function(t){var e=this.demuxer,p=this.remuxer;if(!e||!p)return;e.resetTimeStamp(t),p.resetTimeStamp(t)},i.resetContiguity=function(){var t=this.demuxer,e=this.remuxer;if(!t||!e)return;t.resetContiguity(),e.resetNextTimestamp()},i.resetInitSegment=function(t,e,p,g){var _=this.demuxer,A=this.remuxer;if(!_||!A)return;_.resetInitSegment(e,p,g),A.resetInitSegment(t,e,p)},i.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},i.transmux=function(t,e,p,g,_){var A;return e&&e.method==="SAMPLE-AES"?A=this.transmuxSampleAes(t,e,p,g,_):A=this.transmuxUnencrypted(t,p,g,_),A},i.transmuxUnencrypted=function(t,e,p,g){var _=this.demuxer.demux(t,e,!1,!this.config.progressive),A=_.audioTrack,k=_.avcTrack,F=_.id3Track,z=_.textTrack,J=this.remuxer.remux(A,k,F,z,e,p,!1,this.id);return{remuxResult:J,chunkMeta:g}},i.transmuxSampleAes=function(t,e,p,g,_){var A=this;return this.demuxer.demuxSampleAes(t,e,p).then(function(k){var F=A.remuxer.remux(k.audioTrack,k.avcTrack,k.id3Track,k.textTrack,p,g,!1,A.id);return{remuxResult:F,chunkMeta:_}})},i.configureTransmuxer=function(t,e){for(var p=this.config,g=this.observer,_=this.typeSupported,A=this.vendor,k=e.audioCodec,F=e.defaultInitPts,z=e.duration,J=e.initSegmentData,Y=e.videoCodec,$,le=0,be=h.length;le<be;le++)if(h[le].demux.probe(t)){$=h[le];break}$||(E.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:M.default,remux:T.default});var ve=this.demuxer,ke=this.remuxer,Te=$.remux,xe=$.demux;(!ke||!(ke instanceof Te))&&(this.remuxer=new Te(g,p,_,A)),(!ve||!(ve instanceof xe))&&(this.demuxer=new xe(g,p,_),this.probe=xe.probe),this.resetInitSegment(J,k,Y,z),this.resetInitialTimestamp(F)},i.needsProbing=function(t,e,p){return!this.demuxer||!this.remuxer||e||p},i.getDecrypter=function(){var t=this.decrypter;return t||(t=this.decrypter=new x.default(this.observer,this.config)),t},c}();function s(c,i){var n=null;return c.byteLength>0&&i!=null&&i.key!=null&&i.iv!==null&&i.method!=null&&(n=i),n}var f=function(i){return{remuxResult:{},chunkMeta:i}};function d(c){return"then"in c&&c.then instanceof Function}var l=function(i,n,t,e,p){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=i,this.videoCodec=n,this.initSegmentData=t,this.duration=e,this.defaultInitPts=p},m=function(i,n,t,e,p){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=i,this.contiguous=n,this.accurateTimeOffset=t,this.trackSwitch=e,this.timeOffset=p}},"./src/demux/tsdemuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"discardEPB",function(){return f});var I=S("./src/demux/adts.ts"),v=S("./src/demux/mpegaudio.ts"),x=S("./src/demux/exp-golomb.ts"),U=S("./src/demux/id3.ts"),M=S("./src/demux/sample-aes.ts"),R=S("./src/events.ts"),w=S("./src/utils/mp4-tools.ts"),b=S("./src/utils/logger.ts"),T=S("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},C=function(){function d(m,c,i){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=c,this.typeSupported=i}d.probe=function(c){var i=d.syncOffset(c);return i<0?!1:(i&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+i+", junk ahead ?"),!0)},d.syncOffset=function(c){for(var i=Math.min(1e3,c.length-3*188),n=0;n<i;){if(c[n]===71&&c[n+188]===71&&c[n+2*188]===71)return n;n++}return-1},d.createTrack=function(c,i){return{container:c==="video"||c==="audio"?"video/mp2t":void 0,type:c,id:O[c],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:c==="audio"?i:void 0}};var l=d.prototype;return l.resetInitSegment=function(c,i,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video",n),this._audioTrack=d.createTrack("audio",n),this._id3Track=d.createTrack("id3",n),this._txtTrack=d.createTrack("text",n),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=c,this.videoCodec=i,this._duration=n},l.resetTimeStamp=function(){},l.resetContiguity=function(){var c=this._audioTrack,i=this._avcTrack,n=this._id3Track;c&&(c.pesData=null),i&&(i.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},l.demux=function(c,i,n,t){n===void 0&&(n=!1),t===void 0&&(t=!1),n||(this.sampleAes=null);var e,p=this._avcTrack,g=this._audioTrack,_=this._id3Track,A=p.pid,k=p.pesData,F=g.pid,z=_.pid,J=g.pesData,Y=_.pesData,$=!1,le=this.pmtParsed,be=this._pmtId,ve=c.length;if(this.remainderData&&(c=Object(w.appendUint8Array)(this.remainderData,c),ve=c.length,this.remainderData=null),ve<188&&!t)return this.remainderData=c,{audioTrack:g,avcTrack:p,id3Track:_,textTrack:this._txtTrack};var ke=Math.max(0,d.syncOffset(c));ve-=(ve+ke)%188,ve<c.byteLength&&!t&&(this.remainderData=new Uint8Array(c.buffer,ve,c.buffer.byteLength-ve));for(var Te=ke;Te<ve;Te+=188)if(c[Te]===71){var xe=!!(c[Te+1]&64),_e=((c[Te+1]&31)<<8)+c[Te+2],Oe=(c[Te+3]&48)>>4,ce=void 0;if(Oe>1){if(ce=Te+5+c[Te+4],ce===Te+188)continue}else ce=Te+4;switch(_e){case A:xe&&(k&&(e=r(k))&&this.parseAVCPES(e,!1),k={data:[],size:0}),k&&(k.data.push(c.subarray(ce,Te+188)),k.size+=Te+188-ce);break;case F:xe&&(J&&(e=r(J))&&(g.isAAC?this.parseAACPES(e):this.parseMPEGPES(e)),J={data:[],size:0}),J&&(J.data.push(c.subarray(ce,Te+188)),J.size+=Te+188-ce);break;case z:xe&&(Y&&(e=r(Y))&&this.parseID3PES(e),Y={data:[],size:0}),Y&&(Y.data.push(c.subarray(ce,Te+188)),Y.size+=Te+188-ce);break;case 0:xe&&(ce+=c[ce]+1),be=this._pmtId=y(c,ce);break;case be:{xe&&(ce+=c[ce]+1);var Z=h(c,ce,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,n);A=Z.avc,A>0&&(p.pid=A),F=Z.audio,F>0&&(g.pid=F,g.isAAC=Z.isAAC),z=Z.id3,z>0&&(_.pid=z),$&&!le&&(b.logger.log("reparse from beginning"),$=!1,Te=ke-188),le=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});p.pesData=k,g.pesData=J,_.pesData=Y;var je={audioTrack:g,avcTrack:p,id3Track:_,textTrack:this._txtTrack};return t&&this.extractRemainingSamples(je),je},l.flush=function(){var c=this.remainderData;this.remainderData=null;var i;return c?i=this.demux(c,-1,!1,!0):i={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(i),this.sampleAes?this.decrypt(i,this.sampleAes):i},l.extractRemainingSamples=function(c){var i=c.audioTrack,n=c.avcTrack,t=c.id3Track,e=n.pesData,p=i.pesData,g=t.pesData,_;e&&(_=r(e))?(this.parseAVCPES(_,!0),n.pesData=null):n.pesData=e,p&&(_=r(p))?(i.isAAC?this.parseAACPES(_):this.parseMPEGPES(_),i.pesData=null):(p!=null&&p.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=p),g&&(_=r(g))?(this.parseID3PES(_),t.pesData=null):t.pesData=g},l.demuxSampleAes=function(c,i,n){var t=this.demux(c,n,!0,!this.config.progressive),e=this.sampleAes=new M.default(this.observer,this.config,i);return this.decrypt(t,e)},l.decrypt=function(c,i){return new Promise(function(n){var t=c.audioTrack,e=c.avcTrack;t.samples&&t.isAAC?i.decryptAacSamples(t.samples,0,function(){e.samples?i.decryptAvcSamples(e.samples,0,0,function(){n(c)}):n(c)}):e.samples&&i.decryptAvcSamples(e.samples,0,0,function(){n(c)})})},l.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},l.parseAVCPES=function(c,i){var n=this,t=this._avcTrack,e=this.parseAVCNALu(c.data),p=!1,g=this.avcSample,_,A=!1;c.data=null,g&&e.length&&!t.audFound&&(o(g,t),g=this.avcSample=E(!1,c.pts,c.dts,"")),e.forEach(function(k){switch(k.type){case 1:{_=!0,g||(g=n.avcSample=E(!0,c.pts,c.dts,"")),p&&(g.debug+="NDR "),g.frame=!0;var F=k.data;if(A&&F.length>4){var z=new x.default(F).readSliceType();(z===2||z===4||z===7||z===9)&&(g.key=!0)}break}case 5:_=!0,g||(g=n.avcSample=E(!0,c.pts,c.dts,"")),p&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{_=!0,p&&g&&(g.debug+="SEI ");var J=new x.default(f(k.data));J.readUByte();for(var Y=0,$=0,le=!1,be=0;!le&&J.bytesAvailable>1;){Y=0;do be=J.readUByte(),Y+=be;while(be===255);$=0;do be=J.readUByte(),$+=be;while(be===255);if(Y===4&&J.bytesAvailable!==0){le=!0;var ve=J.readUByte();if(ve===181){var ke=J.readUShort();if(ke===49){var Te=J.readUInt();if(Te===1195456820){var xe=J.readUByte();if(xe===3){for(var _e=J.readUByte(),Oe=J.readUByte(),ce=31&_e,Z=[_e,Oe],je=0;je<ce;je++)Z.push(J.readUByte()),Z.push(J.readUByte()),Z.push(J.readUByte());s(n._txtTrack.samples,{type:3,pts:c.pts,bytes:Z})}}}}}else if(Y===5&&J.bytesAvailable!==0){if(le=!0,$>16){for(var at=[],rt=0;rt<16;rt++)at.push(J.readUByte().toString(16)),(rt===3||rt===5||rt===7||rt===9)&&at.push("-");for(var Ke=$-16,He=new Uint8Array(Ke),we=0;we<Ke;we++)He[we]=J.readUByte();s(n._txtTrack.samples,{pts:c.pts,payloadType:Y,uuid:at.join(""),userData:Object(U.utf8ArrayToStr)(He),userDataBytes:He})}}else if($<J.bytesAvailable)for(var Fe=0;Fe<$;Fe++)J.readUByte()}break}case 7:if(_=!0,A=!0,p&&g&&(g.debug+="SPS "),!t.sps){var $e=new x.default(k.data),Qe=$e.readSPS();t.width=Qe.width,t.height=Qe.height,t.pixelRatio=Qe.pixelRatio,t.sps=[k.data],t.duration=n._duration;for(var Ve=k.data.subarray(1,4),Ue="avc1.",Be=0;Be<3;Be++){var ct=Ve[Be].toString(16);ct.length<2&&(ct="0"+ct),Ue+=ct}t.codec=Ue}break;case 8:_=!0,p&&g&&(g.debug+="PPS "),t.pps||(t.pps=[k.data]);break;case 9:_=!1,t.audFound=!0,g&&o(g,t),g=n.avcSample=E(!1,c.pts,c.dts,p?"AUD ":"");break;case 12:_=!1;break;default:_=!1,g&&(g.debug+="unknown NAL "+k.type+" ");break}if(g&&_){var st=g.units;st.push(k)}}),i&&g&&(o(g,t),this.avcSample=null)},l.getLastNalUnit=function(){var c,i=this.avcSample,n;if(!i||i.units.length===0){var t=this._avcTrack.samples;i=t[t.length-1]}if((c=i)!==null&&c!==void 0&&c.units){var e=i.units;n=e[e.length-1]}return n},l.parseAVCNALu=function(c){var i=c.byteLength,n=this._avcTrack,t=n.naluState||0,e=t,p=[],g=0,_,A,k,F=-1,z=0;for(t===-1&&(F=0,z=c[0]&31,t=0,g=1);g<i;){if(_=c[g++],!t){t=_?0:1;continue}if(t===1){t=_?0:2;continue}if(!_)t=3;else if(_===1){if(F>=0){var J={data:c.subarray(F,g-t-1),type:z};p.push(J)}else{var Y=this.getLastNalUnit();if(Y&&(e&&g<=4-e&&(Y.state&&(Y.data=Y.data.subarray(0,Y.data.byteLength-e))),A=g-t-1,A>0)){var $=new Uint8Array(Y.data.byteLength+A);$.set(Y.data,0),$.set(c.subarray(0,A),Y.data.byteLength),Y.data=$,Y.state=0}}g<i?(k=c[g]&31,F=g,z=k,t=0):t=-1}else t=0}if(F>=0&&t>=0){var le={data:c.subarray(F,i),type:z,state:t};p.push(le)}if(p.length===0){var be=this.getLastNalUnit();if(be){var ve=new Uint8Array(be.data.byteLength+c.byteLength);ve.set(be.data,0),ve.set(c,be.data.byteLength),be.data=ve}}return n.naluState=t,p},l.parseAACPES=function(c){var i=0,n=this._audioTrack,t=this.aacOverFlow,e=c.data;if(t){this.aacOverFlow=null;var p=t.sample.unit.byteLength,g=Math.min(t.missing,p),_=p-g;t.sample.unit.set(e.subarray(0,g),_),n.samples.push(t.sample),i=t.missing}var A,k;for(A=i,k=e.length;A<k-1&&!I.isHeader(e,A);A++);if(A!==i){var F,z;if(A<k-1?(F="AAC PES did not start with ADTS header,offset:"+A,z=!1):(F="no ADTS header found in AAC PES",z=!0),b.logger.warn("parsing error:"+F),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:F}),z)return}I.initTrackConfig(n,this.observer,e,A,this.audioCodec);var J;if(c.pts!==void 0)J=c.pts;else if(t){var Y=I.getFrameDuration(n.samplerate);J=t.sample.pts+Y}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;A<k;)if(I.isHeader(e,A)){if(A+5<k){var le=I.appendFrame(n,e,A,J,$);if(le)if(le.missing)this.aacOverFlow=le;else{A+=le.length,$++;continue}}break}else A++},l.parseMPEGPES=function(c){var i=c.data,n=i.length,t=0,e=0,p=c.pts;if(p===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;e<n;)if(v.isHeader(i,e)){var g=v.appendFrame(this._audioTrack,i,e,p,t);if(g)e+=g.length,t++;else break}else e++},l.parseID3PES=function(c){if(c.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(c)},d}();C.minProbeByteLength=188;function E(d,l,m,c){return{key:d,frame:!1,pts:l,dts:m,units:[],debug:c,length:0}}function y(d,l){return(d[l+10]&31)<<8|d[l+11]}function h(d,l,m,c){var i={audio:-1,avc:-1,id3:-1,isAAC:!0},n=(d[l+1]&15)<<8|d[l+2],t=l+3+n-4,e=(d[l+10]&15)<<8|d[l+11];for(l+=12+e;l<t;){var p=(d[l+1]&31)<<8|d[l+2];switch(d[l]){case 207:if(!c){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:i.audio===-1&&(i.audio=p);break;case 21:i.id3===-1&&(i.id3=p);break;case 219:if(!c){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:i.avc===-1&&(i.avc=p);break;case 3:case 4:m?i.audio===-1&&(i.audio=p,i.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}l+=((d[l+3]&15)<<8|d[l+4])+5}return i}function r(d){var l=0,m,c,i,n,t,e=d.data;if(!d||d.size===0)return null;for(;e[0].length<19&&e.length>1;){var p=new Uint8Array(e[0].length+e[1].length);p.set(e[0]),p.set(e[1],e[0].length),e[0]=p,e.splice(1,1)}m=e[0];var g=(m[0]<<16)+(m[1]<<8)+m[2];if(g===1){if(c=(m[4]<<8)+m[5],c&&c>d.size-6)return null;var _=m[7];_&192&&(n=(m[9]&14)*536870912+(m[10]&255)*4194304+(m[11]&254)*16384+(m[12]&255)*128+(m[13]&254)/2,_&64?(t=(m[14]&14)*536870912+(m[15]&255)*4194304+(m[16]&254)*16384+(m[17]&255)*128+(m[18]&254)/2,n-t>60*9e4&&(b.logger.warn(Math.round((n-t)/9e4)+"s delta between PTS and DTS, align them"),n=t)):t=n),i=m[8];var A=i+9;if(d.size<=A)return null;d.size-=A;for(var k=new Uint8Array(d.size),F=0,z=e.length;F<z;F++){m=e[F];var J=m.byteLength;if(A)if(A>J){A-=J;continue}else m=m.subarray(A),J-=A,A=0;k.set(m,l),l+=J}return c&&(c-=i+3),{data:k,pts:n,dts:t,len:c}}return null}function o(d,l){if(d.units.length&&d.frame){if(d.pts===void 0){var m=l.samples,c=m.length;if(c){var i=m[c-1];d.pts=i.pts,d.dts=i.dts}else{l.dropped++;return}}l.samples.push(d)}d.debug.length&&b.logger.log(d.pts+"/"+d.dts+":"+d.debug)}function s(d,l){var m=d.length;if(m>0){if(l.pts>=d[m-1].pts)d.push(l);else for(var c=m-1;c>=0;c--)if(l.pts<d[c].pts){d.splice(c,0,l);break}}else d.push(l)}function f(d){for(var l=d.byteLength,m=[],c=1;c<l-2;)d[c]===0&&d[c+1]===0&&d[c+2]===3?(m.push(c+2),c+=2):c++;if(m.length===0)return d;var i=l-m.length,n=new Uint8Array(i),t=0;for(c=0;c<i;t++,c++)t===m[0]&&(t++,m.shift()),n[c]=d[t];return n}N.default=C},"./src/errors.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"ErrorTypes",function(){return I}),S.d(N,"ErrorDetails",function(){return v});var I;(function(x){x.NETWORK_ERROR="networkError",x.MEDIA_ERROR="mediaError",x.KEY_SYSTEM_ERROR="keySystemError",x.MUX_ERROR="muxError",x.OTHER_ERROR="otherError"})(I||(I={}));var v;(function(x){x.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",x.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",x.KEY_SYSTEM_NO_SESSION="keySystemNoSession",x.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",x.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",x.MANIFEST_LOAD_ERROR="manifestLoadError",x.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",x.MANIFEST_PARSING_ERROR="manifestParsingError",x.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",x.LEVEL_EMPTY_ERROR="levelEmptyError",x.LEVEL_LOAD_ERROR="levelLoadError",x.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",x.LEVEL_SWITCH_ERROR="levelSwitchError",x.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",x.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",x.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",x.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",x.FRAG_LOAD_ERROR="fragLoadError",x.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",x.FRAG_DECRYPT_ERROR="fragDecryptError",x.FRAG_PARSING_ERROR="fragParsingError",x.REMUX_ALLOC_ERROR="remuxAllocError",x.KEY_LOAD_ERROR="keyLoadError",x.KEY_LOAD_TIMEOUT="keyLoadTimeOut",x.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",x.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",x.BUFFER_APPEND_ERROR="bufferAppendError",x.BUFFER_APPENDING_ERROR="bufferAppendingError",x.BUFFER_STALLED_ERROR="bufferStalledError",x.BUFFER_FULL_ERROR="bufferFullError",x.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",x.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",x.INTERNAL_EXCEPTION="internalException",x.INTERNAL_ABORTED="aborted",x.UNKNOWN="unknown"})(v||(v={}))},"./src/events.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"Events",function(){return I});var I;(function(v){v.MEDIA_ATTACHING="hlsMediaAttaching",v.MEDIA_ATTACHED="hlsMediaAttached",v.MEDIA_DETACHING="hlsMediaDetaching",v.MEDIA_DETACHED="hlsMediaDetached",v.BUFFER_RESET="hlsBufferReset",v.BUFFER_CODECS="hlsBufferCodecs",v.BUFFER_CREATED="hlsBufferCreated",v.BUFFER_APPENDING="hlsBufferAppending",v.BUFFER_APPENDED="hlsBufferAppended",v.BUFFER_EOS="hlsBufferEos",v.BUFFER_FLUSHING="hlsBufferFlushing",v.BUFFER_FLUSHED="hlsBufferFlushed",v.MANIFEST_LOADING="hlsManifestLoading",v.MANIFEST_LOADED="hlsManifestLoaded",v.MANIFEST_PARSED="hlsManifestParsed",v.LEVEL_SWITCHING="hlsLevelSwitching",v.LEVEL_SWITCHED="hlsLevelSwitched",v.LEVEL_LOADING="hlsLevelLoading",v.LEVEL_LOADED="hlsLevelLoaded",v.LEVEL_UPDATED="hlsLevelUpdated",v.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",v.LEVELS_UPDATED="hlsLevelsUpdated",v.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",v.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",v.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",v.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",v.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",v.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",v.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",v.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",v.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",v.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",v.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",v.CUES_PARSED="hlsCuesParsed",v.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",v.INIT_PTS_FOUND="hlsInitPtsFound",v.FRAG_LOADING="hlsFragLoading",v.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",v.FRAG_LOADED="hlsFragLoaded",v.FRAG_DECRYPTED="hlsFragDecrypted",v.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",v.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",v.FRAG_PARSING_METADATA="hlsFragParsingMetadata",v.FRAG_PARSED="hlsFragParsed",v.FRAG_BUFFERED="hlsFragBuffered",v.FRAG_CHANGED="hlsFragChanged",v.FPS_DROP="hlsFpsDrop",v.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",v.ERROR="hlsError",v.DESTROYING="hlsDestroying",v.KEY_LOADING="hlsKeyLoading",v.KEY_LOADED="hlsKeyLoaded",v.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",v.BACK_BUFFER_REACHED="hlsBackBufferReached"})(I||(I={}))},"./src/hls.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return d});var I=S("./node_modules/url-toolkit/src/url-toolkit.js"),v=S.n(I),x=S("./src/loader/playlist-loader.ts"),U=S("./src/loader/key-loader.ts"),M=S("./src/controller/id3-track-controller.ts"),R=S("./src/controller/latency-controller.ts"),w=S("./src/controller/level-controller.ts"),b=S("./src/controller/fragment-tracker.ts"),T=S("./src/controller/stream-controller.ts"),O=S("./src/is-supported.ts"),C=S("./src/utils/logger.ts"),E=S("./src/config.ts"),y=S("./node_modules/eventemitter3/index.js"),h=S.n(y),r=S("./src/events.ts"),o=S("./src/errors.ts");function s(l,m){for(var c=0;c<m.length;c++){var i=m[c];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(l,i.key,i)}}function f(l,m,c){return m&&s(l.prototype,m),c&&s(l,c),l}var d=function(){l.isSupported=function(){return Object(O.isSupported)()};function l(c){c===void 0&&(c={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.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 i=this.config=Object(E.mergeConfig)(l.DefaultConfig,c);this.userConfig=c,Object(C.enableLogs)(i.debug),this._autoLevelCapping=-1,i.progressive&&Object(E.enableStreamingMode)(i);var n=i.abrController,t=i.bufferController,e=i.capLevelController,p=i.fpsController,g=this.abrController=new n(this),_=this.bufferController=new t(this),A=this.capLevelController=new e(this),k=new p(this),F=new x.default(this),z=new U.default(this),J=new M.default(this),Y=this.levelController=new w.default(this),$=new b.FragmentTracker(this),le=this.streamController=new T.default(this,$);A.setStreamController(le),k.setStreamController(le);var be=[Y,le];this.networkControllers=be;var ve=[F,z,g,_,A,k,J,$];this.audioTrackController=this.createController(i.audioTrackController,null,be),this.createController(i.audioStreamController,$,be),this.subtitleTrackController=this.createController(i.subtitleTrackController,null,be),this.createController(i.subtitleStreamController,$,be),this.createController(i.timelineController,null,ve),this.emeController=this.createController(i.emeController,null,ve),this.cmcdController=this.createController(i.cmcdController,null,ve),this.latencyController=this.createController(R.default,null,ve),this.coreComponents=ve}var m=l.prototype;return m.createController=function(i,n,t){if(i){var e=n?new i(this,n):new i(this);return t&&t.push(e),e}return null},m.on=function(i,n,t){t===void 0&&(t=this),this._emitter.on(i,n,t)},m.once=function(i,n,t){t===void 0&&(t=this),this._emitter.once(i,n,t)},m.removeAllListeners=function(i){this._emitter.removeAllListeners(i)},m.off=function(i,n,t,e){t===void 0&&(t=this),this._emitter.off(i,n,t,e)},m.listeners=function(i){return this._emitter.listeners(i)},m.emit=function(i,n,t){return this._emitter.emit(i,n,t)},m.trigger=function(i,n){if(this.config.debug)return this.emit(i,i,n);try{return this.emit(i,i,n)}catch(t){C.logger.error("An internal error happened while handling event "+i+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(r.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:i,error:t})}return!1},m.listenerCount=function(i){return this._emitter.listenerCount(i)},m.destroy=function(){C.logger.log("destroy"),this.trigger(r.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(i){return i.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(i){return i.destroy()}),this.coreComponents.length=0},m.attachMedia=function(i){C.logger.log("attachMedia"),this._media=i,this.trigger(r.Events.MEDIA_ATTACHING,{media:i})},m.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(r.Events.MEDIA_DETACHING,void 0),this._media=null},m.loadSource=function(i){this.stopLoad();var n=this.media,t=this.url,e=this.url=I.buildAbsoluteURL(self.location.href,i,{alwaysNormalize:!0});C.logger.log("loadSource:"+e),n&&t&&t!==e&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(n)),this.trigger(r.Events.MANIFEST_LOADING,{url:i})},m.startLoad=function(i){i===void 0&&(i=-1),C.logger.log("startLoad("+i+")"),this.networkControllers.forEach(function(n){n.startLoad(i)})},m.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(i){i.stopLoad()})},m.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},m.recoverMediaError=function(){C.logger.log("recoverMediaError");var i=this._media;this.detachMedia(),i&&this.attachMedia(i)},m.removeLevel=function(i,n){n===void 0&&(n=0),this.levelController.removeLevel(i,n)},f(l,[{key:"levels",get:function(){var i=this.levelController.levels;return i||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(i){C.logger.log("set currentLevel:"+i),this.loadLevel=i,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(i){C.logger.log("set nextLevel:"+i),this.levelController.manualLevel=i,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(i){C.logger.log("set loadLevel:"+i),this.levelController.manualLevel=i}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(i){this.levelController.nextLoadLevel=i}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(i){C.logger.log("set firstLevel:"+i),this.levelController.firstLevel=i}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(i){C.logger.log("set startLevel:"+i),i!==-1&&(i=Math.max(i,this.minAutoLevel)),this.levelController.startLevel=i}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(i){var n=!!i;n!==this.config.capLevelToPlayerSize&&(n?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=n)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(i){this._autoLevelCapping!==i&&(C.logger.log("set autoLevelCapping:"+i),this._autoLevelCapping=i)}},{key:"bandwidthEstimate",get:function(){var i=this.abrController.bwEstimator;return i?i.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var i=this.levels,n=this.config.minAutoBitrate;if(!i)return 0;for(var t=i.length,e=0;e<t;e++)if(i[e].maxBitrate>n)return e;return 0}},{key:"maxAutoLevel",get:function(){var i=this.levels,n=this.autoLevelCapping,t;return n===-1&&i&&i.length?t=i.length-1:t=n,t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(i){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,i)}},{key:"audioTracks",get:function(){var i=this.audioTrackController;return i?i.audioTracks:[]}},{key:"audioTrack",get:function(){var i=this.audioTrackController;return i?i.audioTrack:-1},set:function(i){var n=this.audioTrackController;n&&(n.audioTrack=i)}},{key:"subtitleTracks",get:function(){var i=this.subtitleTrackController;return i?i.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var i=this.subtitleTrackController;return i?i.subtitleTrack:-1},set:function(i){var n=this.subtitleTrackController;n&&(n.subtitleTrack=i)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var i=this.subtitleTrackController;return i?i.subtitleDisplay:!1},set:function(i){var n=this.subtitleTrackController;n&&(n.subtitleDisplay=i)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(i){this.config.lowLatencyMode=i}},{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 r.Events}},{key:"ErrorTypes",get:function(){return o.ErrorTypes}},{key:"ErrorDetails",get:function(){return o.ErrorDetails}},{key:"DefaultConfig",get:function(){return l.defaultConfig?l.defaultConfig:E.hlsDefaultConfig},set:function(i){l.defaultConfig=i}}]),l}();d.defaultConfig=void 0},"./src/is-supported.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"isSupported",function(){return x}),S.d(N,"changeTypeSupported",function(){return U});var I=S("./src/utils/mediasource-helper.ts");function v(){return self.SourceBuffer||self.WebKitSourceBuffer}function x(){var M=Object(I.getMediaSource)();if(!M)return!1;var R=v(),w=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!w&&!!b}function U(){var M,R=v();return typeof(R==null||((M=R.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return C}),S.d(N,"LoadError",function(){return y});var I=S("./src/polyfills/number.ts"),v=S("./src/errors.ts");function x(h,r){h.prototype=Object.create(r.prototype),h.prototype.constructor=h,b(h,r)}function U(h){var r=typeof Map=="function"?new Map:void 0;return U=function(s){if(s===null||!w(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r!="undefined"){if(r.has(s))return r.get(s);r.set(s,f)}function f(){return M(s,arguments,T(this).constructor)}return f.prototype=Object.create(s.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),b(f,s)},U(h)}function M(h,r,o){return R()?M=Reflect.construct:M=function(f,d,l){var m=[null];m.push.apply(m,d);var c=Function.bind.apply(f,m),i=new c;return l&&b(i,l.prototype),i},M.apply(null,arguments)}function R(){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(h){return!1}}function w(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function b(h,r){return b=Object.setPrototypeOf||function(s,f){return s.__proto__=f,s},b(h,r)}function T(h){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},T(h)}var O=Math.pow(2,17),C=function(){function h(o){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=o}var r=h.prototype;return r.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},r.abort=function(){this.loader&&this.loader.abort()},r.load=function(s,f){var d=this,l=s.url;if(!l)return Promise.reject(new y({type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(l?"part list":"url")));this.abort();var m=this.config,c=m.fLoader,i=m.loader;return new Promise(function(n,t){d.loader&&d.loader.destroy();var e=d.loader=s.loader=c?new c(m):new i(m),p=E(s),g={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:O};s.stats=e.stats,e.load(p,g,{onSuccess:function(A,k,F,z){d.resetLoader(s,e),n({frag:s,part:null,payload:A.data,networkDetails:z})},onError:function(A,k,F){d.resetLoader(s,e),t(new y({type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:A,networkDetails:F}))},onAbort:function(A,k,F){d.resetLoader(s,e),t(new y({type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:F}))},onTimeout:function(A,k,F){d.resetLoader(s,e),t(new y({type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:F}))},onProgress:function(A,k,F,z){f&&f({frag:s,part:null,payload:F,networkDetails:z})}})})},r.loadPart=function(s,f,d){var l=this;this.abort();var m=this.config,c=m.fLoader,i=m.loader;return new Promise(function(n,t){l.loader&&l.loader.destroy();var e=l.loader=s.loader=c?new c(m):new i(m),p=E(s,f),g={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:O};f.stats=e.stats,e.load(p,g,{onSuccess:function(A,k,F,z){l.resetLoader(s,e),l.updateStatsFromPart(s,f);var J={frag:s,part:f,payload:A.data,networkDetails:z};d(J),n(J)},onError:function(A,k,F){l.resetLoader(s,e),t(new y({type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:f,response:A,networkDetails:F}))},onAbort:function(A,k,F){s.stats.aborted=f.stats.aborted,l.resetLoader(s,e),t(new y({type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:f,networkDetails:F}))},onTimeout:function(A,k,F){l.resetLoader(s,e),t(new y({type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:f,networkDetails:F}))}})})},r.updateStatsFromPart=function(s,f){var d=s.stats,l=f.stats,m=l.total;if(d.loaded+=l.loaded,m){var c=Math.round(s.duration/f.duration),i=Math.min(Math.round(d.loaded/m),c),n=c-i,t=n*Math.round(d.loaded/i);d.total=d.loaded+t}else d.total=Math.max(d.loaded,d.total);var e=d.loading,p=l.loading;e.start?e.first+=p.first-p.start:(e.start=p.start,e.first=p.first),e.end=p.end},r.resetLoader=function(s,f){s.loader=null,this.loader===f&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),f.destroy()},h}();function E(h,r){r===void 0&&(r=null);var o=r||h,s={frag:h,part:r,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},f=o.byteRangeStartOffset,d=o.byteRangeEndOffset;return Object(I.isFiniteNumber)(f)&&Object(I.isFiniteNumber)(d)&&(s.rangeStart=f,s.rangeEnd=d),s}var y=function(h){x(r,h);function r(o){for(var s,f=arguments.length,d=new Array(f>1?f-1:0),l=1;l<f;l++)d[l-1]=arguments[l];return s=h.call.apply(h,[this].concat(d))||this,s.data=void 0,s.data=o,s}return r}(U(Error))},"./src/loader/fragment.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"ElementaryStreamTypes",function(){return C}),S.d(N,"BaseSegment",function(){return E}),S.d(N,"Fragment",function(){return y}),S.d(N,"Part",function(){return h});var I=S("./src/polyfills/number.ts"),v=S("./node_modules/url-toolkit/src/url-toolkit.js"),x=S.n(v),U=S("./src/utils/logger.ts"),M=S("./src/loader/level-key.ts"),R=S("./src/loader/load-stats.ts");function w(r,o){r.prototype=Object.create(o.prototype),r.prototype.constructor=r,b(r,o)}function b(r,o){return b=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},b(r,o)}function T(r,o){for(var s=0;s<o.length;s++){var f=o[s];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(r,f.key,f)}}function O(r,o,s){return o&&T(r.prototype,o),s&&T(r,s),r}var C;(function(r){r.AUDIO="audio",r.VIDEO="video",r.AUDIOVIDEO="audiovideo"})(C||(C={}));var E=function(){function r(s){var f;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(f={},f[C.AUDIO]=null,f[C.VIDEO]=null,f[C.AUDIOVIDEO]=null,f),this.baseurl=s}var o=r.prototype;return o.setByteRange=function(f,d){var l=f.split("@",2),m=[];l.length===1?m[0]=d?d.byteRangeEndOffset:0:m[0]=parseInt(l[1]),m[1]=parseInt(l[0])+m[0],this._byteRange=m},O(r,[{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(v.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(f){this._url=f}}]),r}(),y=function(r){w(o,r);function o(f,d){var l;return l=r.call(this,d)||this,l._decryptdata=null,l.rawProgramDateTime=null,l.programDateTime=null,l.tagList=[],l.duration=0,l.sn=0,l.levelkey=void 0,l.type=void 0,l.loader=null,l.level=-1,l.cc=0,l.startPTS=void 0,l.endPTS=void 0,l.appendedPTS=void 0,l.startDTS=void 0,l.endDTS=void 0,l.start=0,l.deltaPTS=void 0,l.maxStartPTS=void 0,l.minEndPTS=void 0,l.stats=new R.LoadStats,l.urlId=0,l.data=void 0,l.bitrateTest=!1,l.title=null,l.initSegment=null,l.type=f,l}var s=o.prototype;return s.createInitializationVector=function(d){for(var l=new Uint8Array(16),m=12;m<16;m++)l[m]=d>>8*(15-m)&255;return l},s.setDecryptDataFromLevelKey=function(d,l){var m=d;return(d==null?void 0:d.method)==="AES-128"&&d.uri&&!d.iv&&(m=M.LevelKey.fromURI(d.uri),m.method=d.method,m.iv=this.createInitializationVector(l),m.keyFormat="identity"),m},s.setElementaryStreamInfo=function(d,l,m,c,i,n){n===void 0&&(n=!1);var t=this.elementaryStreams,e=t[d];if(!e){t[d]={startPTS:l,endPTS:m,startDTS:c,endDTS:i,partial:n};return}e.startPTS=Math.min(e.startPTS,l),e.endPTS=Math.max(e.endPTS,m),e.startDTS=Math.min(e.startDTS,c),e.endDTS=Math.max(e.endDTS,i)},s.clearElementaryStreamInfo=function(){var d=this.elementaryStreams;d[C.AUDIO]=null,d[C.VIDEO]=null,d[C.AUDIOVIDEO]=null},O(o,[{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&&U.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(I.isFiniteNumber)(this.programDateTime))return null;var d=Object(I.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)}}]),o}(E),h=function(r){w(o,r);function o(s,f,d,l,m){var c;c=r.call(this,d)||this,c.fragOffset=0,c.duration=0,c.gap=!1,c.independent=!1,c.relurl=void 0,c.fragment=void 0,c.index=void 0,c.stats=new R.LoadStats,c.duration=s.decimalFloatingPoint("DURATION"),c.gap=s.bool("GAP"),c.independent=s.bool("INDEPENDENT"),c.relurl=s.enumeratedString("URI"),c.fragment=f,c.index=l;var i=s.enumeratedString("BYTERANGE");return i&&c.setByteRange(i,m),m&&(c.fragOffset=m.fragOffset+m.duration),c}return O(o,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var f=this.elementaryStreams;return!!(f.audio||f.video||f.audiovideo)}}]),o}(E)},"./src/loader/key-loader.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return U});var I=S("./src/events.ts"),v=S("./src/errors.ts"),x=S("./src/utils/logger.ts"),U=function(){function M(w){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=w,this._registerListeners()}var R=M.prototype;return R._registerListeners=function(){this.hls.on(I.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(I.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var T=this.loaders[b];T&&T.destroy()}this.loaders={}},R.onKeyLoading=function(b,T){var O=T.frag,C=O.type,E=this.loaders[C];if(!O.decryptdata){x.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=O.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(E&&(x.logger.warn("abort previous key loader for type:"+C),E.abort()),!y){x.logger.warn("key uri is falsy");return}var r=h.loader,o=O.loader=this.loaders[C]=new r(h);this.decrypturl=y,this.decryptkey=null;var s={url:y,frag:O,responseType:"arraybuffer"},f={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(s,f,d)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(I.Events.KEY_LOADED,{frag:O}))},R.loadsuccess=function(b,T,O){var C=O.frag;if(!C.decryptdata){x.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(I.Events.KEY_LOADED,{frag:C})},R.loaderror=function(b,T){var O=T.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:b})},R.loadtimeout=function(b,T){var O=T.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(I.Events.ERROR,{type:v.ErrorTypes.NETWORK_ERROR,details:v.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},M}()},"./src/loader/level-details.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"LevelDetails",function(){return M});var I=S("./src/polyfills/number.ts");function v(R,w){for(var b=0;b<w.length;b++){var T=w[b];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function x(R,w,b){return w&&v(R.prototype,w),b&&v(R,b),R}var U=10,M=function(){function R(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 w=R.prototype;return w.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-T.lastPartSn,C=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!C||!!O,this.advanced=this.endSN>T.endSN||O>0||O===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},x(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(I.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||U}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var O=this.driftEnd-this.driftStart;return O*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.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 T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"LevelKey",function(){return M});var I=S("./node_modules/url-toolkit/src/url-toolkit.js"),v=S.n(I);function x(R,w){for(var b=0;b<w.length;b++){var T=w[b];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function U(R,w,b){return w&&x(R.prototype,w),b&&x(R,b),R}var M=function(){R.fromURL=function(b,T){return new R(b,T)},R.fromURI=function(b){return new R(b)};function R(w,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(I.buildAbsoluteURL)(w,b,{alwaysNormalize:!0}):this._uri=w}return U(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"LoadStats",function(){return I});var I=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return o});var I=S("./src/polyfills/number.ts"),v=S("./node_modules/url-toolkit/src/url-toolkit.js"),x=S.n(v),U=S("./src/loader/fragment.ts"),M=S("./src/loader/level-details.ts"),R=S("./src/loader/level-key.ts"),w=S("./src/utils/attr-list.ts"),b=S("./src/utils/logger.ts"),T=S("./src/utils/codecs.ts"),O=/#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,E=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),y=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("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function r(m){var c,i;return h.test((c=(i=v.parseURL(m))===null||i===void 0?void 0:i.path)!=null?c:"")}var o=function(){function m(){}return m.findGroup=function(i,n){for(var t=0;t<i.length;t++){var e=i[t];if(e.id===n)return e}},m.convertAVC1ToAVCOTI=function(i){var n=i.split(".");if(n.length>2){var t=n.shift()+".";return t+=parseInt(n.shift()).toString(16),t+=("000"+parseInt(n.shift()).toString(16)).substr(-4),t}return i},m.resolve=function(i,n){return v.buildAbsoluteURL(n,i,{alwaysNormalize:!0})},m.parseMasterPlaylist=function(i,n){var t=[],e={},p=!1;O.lastIndex=0;for(var g;(g=O.exec(i))!=null;)if(g[1]){var _=new w.AttrList(g[1]),A={attrs:_,bitrate:_.decimalInteger("AVERAGE-BANDWIDTH")||_.decimalInteger("BANDWIDTH"),name:_.NAME,url:m.resolve(g[2],n)},k=_.decimalResolution("RESOLUTION");k&&(A.width=k.width,A.height=k.height),s((_.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),A),A.videoCodec&&A.videoCodec.indexOf("avc1")!==-1&&(A.videoCodec=m.convertAVC1ToAVCOTI(A.videoCodec)),t.push(A)}else if(g[3]){var F=new w.AttrList(g[3]);F["DATA-ID"]&&(p=!0,e[F["DATA-ID"]]=F)}return{levels:t,sessionData:p?e:null}},m.parseMasterPlaylistMedia=function(i,n,t,e){e===void 0&&(e=[]);var p,g=[],_=0;for(C.lastIndex=0;(p=C.exec(i))!==null;){var A=new w.AttrList(p[1]);if(A.TYPE===t){var k={attrs:A,bitrate:0,id:_++,groupId:A["GROUP-ID"],instreamId:A["INSTREAM-ID"],name:A.NAME||A.LANGUAGE||"",type:t,default:A.bool("DEFAULT"),autoselect:A.bool("AUTOSELECT"),forced:A.bool("FORCED"),lang:A.LANGUAGE,url:A.URI?m.resolve(A.URI,n):""};if(e.length){var F=m.findGroup(e,k.groupId)||e[0];f(k,F,"audioCodec"),f(k,F,"textCodec")}g.push(k)}}return g},m.parseLevelPlaylist=function(i,n,t,e,p){var g=new M.LevelDetails(n),_=g.fragments,A=null,k=0,F=0,z=0,J=0,Y=null,$=new U.Fragment(e,n),le,be,ve,ke=-1,Te=!1;for(E.lastIndex=0,g.m3u8=i;(le=E.exec(i))!==null;){Te&&(Te=!1,$=new U.Fragment(e,n),$.start=z,$.sn=k,$.cc=J,$.level=t,A&&($.initSegment=A,$.rawProgramDateTime=A.rawProgramDateTime));var xe=le[1];if(xe){$.duration=parseFloat(xe);var _e=(" "+le[2]).slice(1);$.title=_e||null,$.tagList.push(_e?["INF",xe,_e]:["INF",xe])}else if(le[3])Object(I.isFiniteNumber)($.duration)&&($.start=z,ve&&($.levelkey=ve),$.sn=k,$.level=t,$.cc=J,$.urlId=p,_.push($),$.relurl=(" "+le[3]).slice(1),l($,Y),Y=$,z+=$.duration,k++,F=0,Te=!0);else if(le[4]){var Oe=(" "+le[4]).slice(1);Y?$.setByteRange(Oe,Y):$.setByteRange(Oe)}else if(le[5])$.rawProgramDateTime=(" "+le[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),ke===-1&&(ke=_.length);else{if(le=le[0].match(y),!le){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(be=1;be<le.length&&!(typeof le[be]!="undefined");be++);var ce=(" "+le[be]).slice(1),Z=(" "+le[be+1]).slice(1),je=le[be+2]?(" "+le[be+2]).slice(1):"";switch(ce){case"PLAYLIST-TYPE":g.type=Z.toUpperCase();break;case"MEDIA-SEQUENCE":k=g.startSN=parseInt(Z);break;case"SKIP":{var at=new w.AttrList(Z),rt=at.decimalInteger("SKIPPED-SEGMENTS");if(Object(I.isFiniteNumber)(rt)){g.skippedSegments=rt;for(var Ke=rt;Ke--;)_.unshift(null);k+=rt}var He=at.enumeratedString("RECENTLY-REMOVED-DATERANGES");He&&(g.recentlyRemovedDateranges=He.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(Z);break;case"VERSION":g.version=parseInt(Z);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(Z||je)&&$.tagList.push(je?[Z,je]:[Z]);break;case"DIS":J++;case"GAP":$.tagList.push([ce]);break;case"BITRATE":$.tagList.push([ce,Z]);break;case"DISCONTINUITY-SEQ":J=parseInt(Z);break;case"KEY":{var we,Fe=new w.AttrList(Z),$e=Fe.enumeratedString("METHOD"),Qe=Fe.URI,Ve=Fe.hexadecimalInteger("IV"),Ue=Fe.enumeratedString("KEYFORMATVERSIONS"),Be=Fe.enumeratedString("KEYID"),ct=(we=Fe.enumeratedString("KEYFORMAT"))!=null?we:"identity",st=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(st.indexOf(ct)>-1){b.logger.warn("Keyformat "+ct+" is not supported from the manifest");continue}else if(ct!=="identity")continue;$e&&(ve=R.LevelKey.fromURL(n,Qe),Qe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf($e)>=0&&(ve.method=$e,ve.keyFormat=ct,Be&&(ve.keyID=Be),Ue&&(ve.keyFormatVersions=Ue),ve.iv=Ve));break}case"START":{var lt=new w.AttrList(Z),nt=lt.decimalFloatingPoint("TIME-OFFSET");Object(I.isFiniteNumber)(nt)&&(g.startTimeOffset=nt);break}case"MAP":{var ht=new w.AttrList(Z);$.relurl=ht.URI,ht.BYTERANGE&&$.setByteRange(ht.BYTERANGE),$.level=t,$.sn="initSegment",ve&&($.levelkey=ve),$.initSegment=null,A=$,Te=!0;break}case"SERVER-CONTROL":{var ut=new w.AttrList(Z);g.canBlockReload=ut.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=ut.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&ut.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=ut.optionalFloat("PART-HOLD-BACK",0),g.holdBack=ut.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var fe=new w.AttrList(Z);g.partTarget=fe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ye=g.partList;ye||(ye=g.partList=[]);var Re=F>0?ye[ye.length-1]:void 0,Ie=F++,Ce=new U.Part(new w.AttrList(Z),$,n,Ie,Re);ye.push(Ce),$.duration+=Ce.duration;break}case"PRELOAD-HINT":{var Ae=new w.AttrList(Z);g.preloadHint=Ae;break}case"RENDITION-REPORT":{var ae=new w.AttrList(Z);g.renditionReports=g.renditionReports||[],g.renditionReports.push(ae);break}default:b.logger.warn("line parsed but not handled: "+le);break}}}Y&&!Y.relurl?(_.pop(),z-=Y.duration,g.partList&&(g.fragmentHint=Y)):g.partList&&(l($,Y),$.cc=J,g.fragmentHint=$);var ee=_.length,te=_[0],H=_[ee-1];if(z+=g.skippedSegments*g.targetduration,z>0&&ee&&H){g.averagetargetduration=z/ee;var G=H.sn;g.endSN=G!=="initSegment"?G:0,te&&(g.startCC=te.cc,te.initSegment||g.fragments.every(function(V){return V.relurl&&r(V.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new U.Fragment(e,n),$.relurl=H.relurl,$.level=t,$.sn="initSegment",te.initSegment=$,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(z+=g.fragmentHint.duration),g.totalduration=z,g.endCC=J,ke>0&&d(_,ke),g},m}();function s(m,c){["video","audio","text"].forEach(function(i){var n=m.filter(function(e){return Object(T.isCodecType)(e,i)});if(n.length){var t=n.filter(function(e){return e.lastIndexOf("avc1",0)===0||e.lastIndexOf("mp4a",0)===0});c[i+"Codec"]=t.length>0?t[0]:n[0],m=m.filter(function(e){return n.indexOf(e)===-1})}}),c.unknownCodecs=m}function f(m,c,i){var n=c[i];n&&(m[i]=n)}function d(m,c){for(var i=m[c],n=c;n--;){var t=m[n];if(!t)return;t.programDateTime=i.programDateTime-t.duration*1e3,i=t}}function l(m,c){m.rawProgramDateTime?m.programDateTime=Date.parse(m.rawProgramDateTime):c!=null&&c.programDateTime&&(m.programDateTime=c.endProgramDateTime),Object(I.isFiniteNumber)(m.programDateTime)||(m.programDateTime=null,m.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/polyfills/number.ts"),v=S("./src/events.ts"),x=S("./src/errors.ts"),U=S("./src/utils/logger.ts"),M=S("./src/utils/mp4-tools.ts"),R=S("./src/loader/m3u8-parser.ts"),w=S("./src/types/loader.ts"),b=S("./src/utils/attr-list.ts");function T(E){var y=E.type;switch(y){case w.PlaylistContextType.AUDIO_TRACK:return w.PlaylistLevelType.AUDIO;case w.PlaylistContextType.SUBTITLE_TRACK:return w.PlaylistLevelType.SUBTITLE;default:return w.PlaylistLevelType.MAIN}}function O(E,y){var h=E.url;return(h===void 0||h.indexOf("data:")===0)&&(h=y.url),h}var C=function(){function E(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var y=E.prototype;return y.registerListeners=function(){var r=this.hls;r.on(v.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(v.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(v.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.on(v.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var r=this.hls;r.off(v.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(v.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(v.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.off(v.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(r){var o=this.hls.config,s=o.pLoader,f=o.loader,d=s||f,l=new d(o);return r.loader=l,this.loaders[r.type]=l,l},y.getInternalLoader=function(r){return this.loaders[r.type]},y.resetInternalLoader=function(r){this.loaders[r]&&delete this.loaders[r]},y.destroyInternalLoaders=function(){for(var r in this.loaders){var o=this.loaders[r];o&&o.destroy(),this.resetInternalLoader(r)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(r,o){var s=o.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:w.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},y.onLevelLoading=function(r,o){var s=o.id,f=o.level,d=o.url,l=o.deliveryDirectives;this.load({id:s,groupId:null,level:f,responseType:"text",type:w.PlaylistContextType.LEVEL,url:d,deliveryDirectives:l})},y.onAudioTrackLoading=function(r,o){var s=o.id,f=o.groupId,d=o.url,l=o.deliveryDirectives;this.load({id:s,groupId:f,level:null,responseType:"text",type:w.PlaylistContextType.AUDIO_TRACK,url:d,deliveryDirectives:l})},y.onSubtitleTrackLoading=function(r,o){var s=o.id,f=o.groupId,d=o.url,l=o.deliveryDirectives;this.load({id:s,groupId:f,level:null,responseType:"text",type:w.PlaylistContextType.SUBTITLE_TRACK,url:d,deliveryDirectives:l})},y.load=function(r){var o,s=this.hls.config,f=this.getInternalLoader(r);if(f){var d=f.context;if(d&&d.url===r.url){U.logger.trace("[playlist-loader]: playlist request ongoing");return}U.logger.log("[playlist-loader]: aborting previous loader for type: "+r.type),f.abort()}var l,m,c,i;switch(r.type){case w.PlaylistContextType.MANIFEST:l=s.manifestLoadingMaxRetry,m=s.manifestLoadingTimeOut,c=s.manifestLoadingRetryDelay,i=s.manifestLoadingMaxRetryTimeout;break;case w.PlaylistContextType.LEVEL:case w.PlaylistContextType.AUDIO_TRACK:case w.PlaylistContextType.SUBTITLE_TRACK:l=0,m=s.levelLoadingTimeOut;break;default:l=s.levelLoadingMaxRetry,m=s.levelLoadingTimeOut,c=s.levelLoadingRetryDelay,i=s.levelLoadingMaxRetryTimeout;break}if(f=this.createInternalLoader(r),(o=r.deliveryDirectives)!==null&&o!==void 0&&o.part){var n;if(r.type===w.PlaylistContextType.LEVEL&&r.level!==null?n=this.hls.levels[r.level].details:r.type===w.PlaylistContextType.AUDIO_TRACK&&r.id!==null?n=this.hls.audioTracks[r.id].details:r.type===w.PlaylistContextType.SUBTITLE_TRACK&&r.id!==null&&(n=this.hls.subtitleTracks[r.id].details),n){var t=n.partTarget,e=n.targetduration;t&&e&&(m=Math.min(Math.max(t*3,e*.8)*1e3,m))}}var p={timeout:m,maxRetry:l,retryDelay:c,maxRetryDelay:i,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};f.load(r,p,g)},y.loadsuccess=function(r,o,s,f){if(f===void 0&&(f=null),s.isSidxRequest){this.handleSidxRequest(r,s),this.handlePlaylistLoaded(r,o,s,f);return}this.resetInternalLoader(s.type);var d=r.data;if(d.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(r,s,"no EXTM3U delimiter",f);return}o.parsing.start=performance.now(),d.indexOf("#EXTINF:")>0||d.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(r,o,s,f):this.handleMasterPlaylist(r,o,s,f)},y.loaderror=function(r,o,s){s===void 0&&(s=null),this.handleNetworkError(o,s,!1,r)},y.loadtimeout=function(r,o,s){s===void 0&&(s=null),this.handleNetworkError(o,s,!0)},y.handleMasterPlaylist=function(r,o,s,f){var d=this.hls,l=r.data,m=O(r,s),c=R.default.parseMasterPlaylist(l,m),i=c.levels,n=c.sessionData;if(!i.length){this.handleManifestParsingError(r,s,"no level found in manifest",f);return}var t=i.map(function(k){return{id:k.attrs.AUDIO,audioCodec:k.audioCodec}}),e=i.map(function(k){return{id:k.attrs.SUBTITLES,textCodec:k.textCodec}}),p=R.default.parseMasterPlaylistMedia(l,m,"AUDIO",t),g=R.default.parseMasterPlaylistMedia(l,m,"SUBTITLES",e),_=R.default.parseMasterPlaylistMedia(l,m,"CLOSED-CAPTIONS");if(p.length){var A=p.some(function(k){return!k.url});!A&&i[0].audioCodec&&!i[0].attrs.AUDIO&&(U.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}d.trigger(v.Events.MANIFEST_LOADED,{levels:i,audioTracks:p,subtitles:g,captions:_,url:m,stats:o,networkDetails:f,sessionData:n})},y.handleTrackOrLevelPlaylist=function(r,o,s,f){var d=this.hls,l=s.id,m=s.level,c=s.type,i=O(r,s),n=Object(I.isFiniteNumber)(l)?l:0,t=Object(I.isFiniteNumber)(m)?m:n,e=T(s),p=R.default.parseLevelPlaylist(r.data,i,t,e,n);if(!p.fragments.length){d.trigger(v.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:i,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(c===w.PlaylistContextType.MANIFEST){var g={attrs:new b.AttrList({}),bitrate:0,details:p,name:"",url:i};d.trigger(v.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:i,stats:o,networkDetails:f,sessionData:null})}if(o.parsing.end=performance.now(),p.needSidxRanges){var _,A=(_=p.fragments[0].initSegment)===null||_===void 0?void 0:_.url;this.load({url:A,isSidxRequest:!0,type:c,level:m,levelDetails:p,id:l,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=p,this.handlePlaylistLoaded(r,o,s,f)},y.handleSidxRequest=function(r,o){var s=Object(M.parseSegmentIndex)(new Uint8Array(r.data));if(!s)return;var f=s.references,d=o.levelDetails;f.forEach(function(l,m){var c=l.info,i=d.fragments[m];i.byteRange.length===0&&i.setByteRange(String(1+c.end-c.start)+"@"+String(c.start)),i.initSegment&&i.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(r,o,s,f){this.hls.trigger(v.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:o.type===w.PlaylistContextType.MANIFEST,url:r.url,reason:s,response:r,context:o,networkDetails:f})},y.handleNetworkError=function(r,o,s,f){s===void 0&&(s=!1),U.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+r.type+" level: "+r.level+" id: "+r.id+' group-id: "'+r.groupId+'"');var d=x.ErrorDetails.UNKNOWN,l=!1,m=this.getInternalLoader(r);switch(r.type){case w.PlaylistContextType.MANIFEST:d=s?x.ErrorDetails.MANIFEST_LOAD_TIMEOUT:x.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case w.PlaylistContextType.LEVEL:d=s?x.ErrorDetails.LEVEL_LOAD_TIMEOUT:x.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case w.PlaylistContextType.AUDIO_TRACK:d=s?x.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:x.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case w.PlaylistContextType.SUBTITLE_TRACK:d=s?x.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:x.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1;break}m&&this.resetInternalLoader(r.type);var c={type:x.ErrorTypes.NETWORK_ERROR,details:d,fatal:l,url:r.url,loader:m,context:r,networkDetails:o};f&&(c.response=f),this.hls.trigger(v.Events.ERROR,c)},y.handlePlaylistLoaded=function(r,o,s,f){var d=s.type,l=s.level,m=s.id,c=s.groupId,i=s.loader,n=s.levelDetails,t=s.deliveryDirectives;if(!(n!=null&&n.targetduration)){this.handleManifestParsingError(r,s,"invalid target duration",f);return}if(!i)return;n.live&&(i.getCacheAge&&(n.ageHeader=i.getCacheAge()||0),(!i.getCacheAge||isNaN(n.ageHeader))&&(n.ageHeader=0));switch(d){case w.PlaylistContextType.MANIFEST:case w.PlaylistContextType.LEVEL:this.hls.trigger(v.Events.LEVEL_LOADED,{details:n,level:l||0,id:m||0,stats:o,networkDetails:f,deliveryDirectives:t});break;case w.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(v.Events.AUDIO_TRACK_LOADED,{details:n,id:m||0,groupId:c||"",stats:o,networkDetails:f,deliveryDirectives:t});break;case w.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(v.Events.SUBTITLE_TRACK_LOADED,{details:n,id:m||0,groupId:c||"",stats:o,networkDetails:f,deliveryDirectives:t});break}},E}();N.default=C},"./src/polyfills/number.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"isFiniteNumber",function(){return I}),S.d(N,"MAX_SAFE_INTEGER",function(){return v});var I=Number.isFinite||function(x){return typeof x=="number"&&isFinite(x)},v=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(oe,N,S){"use strict";S.r(N);var I=function(){function v(){}return v.getSilentFrame=function(U,M){switch(U){case"mp4a.40.2":if(M===1)return new Uint8Array([0,200,0,128,35,128]);if(M===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(M===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(M===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(M===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(M===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(M===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(M===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(M===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},v}();N.default=I},"./src/remux/mp4-generator.ts":function(oe,N,S){"use strict";S.r(N);var I=Math.pow(2,32)-1,v=function(){function x(){}return x.init=function(){x.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 M;for(M in x.types)x.types.hasOwnProperty(M)&&(x.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var R=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),w=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]);x.HDLR_TYPES={video:R,audio:w};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);x.STTS=x.STSC=x.STCO=T,x.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),x.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),x.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),x.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),E=new Uint8Array([0,0,0,1]);x.FTYP=x.box(x.types.ftyp,O,E,O,C),x.DINF=x.box(x.types.dinf,x.box(x.types.dref,b))},x.box=function(M){for(var R=8,w=arguments.length,b=new Array(w>1?w-1:0),T=1;T<w;T++)b[T-1]=arguments[T];for(var O=b.length,C=O;O--;)R+=b[O].byteLength;var E=new Uint8Array(R);for(E[0]=R>>24&255,E[1]=R>>16&255,E[2]=R>>8&255,E[3]=R&255,E.set(M,4),O=0,R=8;O<C;O++)E.set(b[O],R),R+=b[O].byteLength;return E},x.hdlr=function(M){return x.box(x.types.hdlr,x.HDLR_TYPES[M])},x.mdat=function(M){return x.box(x.types.mdat,M)},x.mdhd=function(M,R){R*=M;var w=Math.floor(R/(I+1)),b=Math.floor(R%(I+1));return x.box(x.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,w>>24,w>>16&255,w>>8&255,w&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},x.mdia=function(M){return x.box(x.types.mdia,x.mdhd(M.timescale,M.duration),x.hdlr(M.type),x.minf(M))},x.mfhd=function(M){return x.box(x.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255]))},x.minf=function(M){return M.type==="audio"?x.box(x.types.minf,x.box(x.types.smhd,x.SMHD),x.DINF,x.stbl(M)):x.box(x.types.minf,x.box(x.types.vmhd,x.VMHD),x.DINF,x.stbl(M))},x.moof=function(M,R,w){return x.box(x.types.moof,x.mfhd(M),x.traf(w,R))},x.moov=function(M){for(var R=M.length,w=[];R--;)w[R]=x.trak(M[R]);return x.box.apply(null,[x.types.moov,x.mvhd(M[0].timescale,M[0].duration)].concat(w).concat(x.mvex(M)))},x.mvex=function(M){for(var R=M.length,w=[];R--;)w[R]=x.trex(M[R]);return x.box.apply(null,[x.types.mvex].concat(w))},x.mvhd=function(M,R){R*=M;var w=Math.floor(R/(I+1)),b=Math.floor(R%(I+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,w>>24,w>>16&255,w>>8&255,w&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 x.box(x.types.mvhd,T)},x.sdtp=function(M){var R=M.samples||[],w=new Uint8Array(4+R.length),b,T;for(b=0;b<R.length;b++)T=R[b].flags,w[b+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return x.box(x.types.sdtp,w)},x.stbl=function(M){return x.box(x.types.stbl,x.stsd(M),x.box(x.types.stts,x.STTS),x.box(x.types.stsc,x.STSC),x.box(x.types.stsz,x.STSZ),x.box(x.types.stco,x.STCO))},x.avc1=function(M){var R=[],w=[],b,T,O;for(b=0;b<M.sps.length;b++)T=M.sps[b],O=T.byteLength,R.push(O>>>8&255),R.push(O&255),R=R.concat(Array.prototype.slice.call(T));for(b=0;b<M.pps.length;b++)T=M.pps[b],O=T.byteLength,w.push(O>>>8&255),w.push(O&255),w=w.concat(Array.prototype.slice.call(T));var C=x.box(x.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|M.sps.length].concat(R).concat([M.pps.length]).concat(w))),E=M.width,y=M.height,h=M.pixelRatio[0],r=M.pixelRatio[1];return x.box(x.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,E>>8&255,E&255,y>>8&255,y&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,x.box(x.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),x.box(x.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,r>>24,r>>16&255,r>>8&255,r&255])))},x.esds=function(M){var R=M.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(M.config).concat([6,1,2]))},x.mp4a=function(M){var R=M.samplerate;return x.box(x.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),x.box(x.types.esds,x.esds(M)))},x.mp3=function(M){var R=M.samplerate;return x.box(x.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},x.stsd=function(M){return M.type==="audio"?!M.isAAC&&M.codec==="mp3"?x.box(x.types.stsd,x.STSD,x.mp3(M)):x.box(x.types.stsd,x.STSD,x.mp4a(M)):x.box(x.types.stsd,x.STSD,x.avc1(M))},x.tkhd=function(M){var R=M.id,w=M.duration*M.timescale,b=M.width,T=M.height,O=Math.floor(w/(I+1)),C=Math.floor(w%(I+1));return x.box(x.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&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,T>>8&255,T&255,0,0]))},x.traf=function(M,R){var w=x.sdtp(M),b=M.id,T=Math.floor(R/(I+1)),O=Math.floor(R%(I+1));return x.box(x.types.traf,x.box(x.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),x.box(x.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,O>>24,O>>16&255,O>>8&255,O&255])),x.trun(M,w.length+16+20+8+16+8+8),w)},x.trak=function(M){return M.duration=M.duration||4294967295,x.box(x.types.trak,x.tkhd(M),x.mdia(M))},x.trex=function(M){var R=M.id;return x.box(x.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},x.trun=function(M,R){var w=M.samples||[],b=w.length,T=12+16*b,O=new Uint8Array(T),C,E,y,h,r,o;for(R+=8+T,O.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),C=0;C<b;C++)E=w[C],y=E.duration,h=E.size,r=E.flags,o=E.cts,O.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.paddingValue<<1|r.isNonSync,r.degradPrio&240<<8,r.degradPrio&15,o>>>24&255,o>>>16&255,o>>>8&255,o&255],12+16*C);return x.box(x.types.trun,O)},x.initSegment=function(M){x.types||x.init();var R=x.moov(M),w=new Uint8Array(x.FTYP.byteLength+R.byteLength);return w.set(x.FTYP),w.set(R,x.FTYP.byteLength),w},x}();v.types=void 0,v.HDLR_TYPES=void 0,v.STTS=void 0,v.STSC=void 0,v.STCO=void 0,v.STSZ=void 0,v.VMHD=void 0,v.SMHD=void 0,v.STSD=void 0,v.FTYP=void 0,v.DINF=void 0,N.default=v},"./src/remux/mp4-remuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return o}),S.d(N,"normalizePts",function(){return s});var I=S("./src/polyfills/number.ts"),v=S("./src/remux/aac-helper.ts"),x=S("./src/remux/mp4-generator.ts"),U=S("./src/events.ts"),M=S("./src/errors.ts"),R=S("./src/utils/logger.ts"),w=S("./src/types/loader.ts"),b=S("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(m){for(var c=1;c<arguments.length;c++){var i=arguments[c];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(m[n]=i[n])}return m},T.apply(this,arguments)}var O=10*1e3,C=1024,E=1152,y=null,h=null,r=!1,o=function(){function m(i,n,t,e){if(e===void 0&&(e=""),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=i,this.config=n,this.typeSupported=t,this.ISGenerated=!1,y===null){var p=navigator.userAgent||"",g=p.match(/Chrome\/(\d+)/i);y=g?parseInt(g[1]):0}if(h===null){var _=navigator.userAgent.match(/Safari\/(\d+)/i);h=_?parseInt(_[1]):0}r=!!y&&y<75||!!h&&h<600}var c=m.prototype;return c.destroy=function(){},c.resetTimeStamp=function(n){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=n},c.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},c.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},c.getVideoStartPts=function(n){var t=!1,e=n.reduce(function(p,g){var _=g.pts-p;return _<-4294967296?(t=!0,s(p,g.pts)):_>0?p:g.pts},n[0].pts);return t&&R.logger.debug("PTS rollover detected"),e},c.remux=function(n,t,e,p,g,_,A,k){var F,z,J,Y,$,le,be=g,ve=g,ke=n.pid>-1,Te=t.pid>-1,xe=t.samples.length,_e=n.samples.length>0,Oe=xe>1,ce=(!ke||_e)&&(!Te||Oe)||this.ISGenerated||A;if(ce){this.ISGenerated||(J=this.generateIS(n,t,g));var Z=this.isVideoContiguous,je=-1;if(Oe&&(je=f(t.samples),!Z&&this.config.forceKeyFrameOnDiscontinuity))if(le=!0,je>0){R.logger.warn("[mp4-remuxer]: Dropped "+je+" out of "+xe+" video samples due to a missing keyframe");var at=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(je),t.dropped+=je,ve+=(t.samples[0].pts-at)/(t.timescale||9e4)}else je===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+xe+" video samples"),le=!1);if(this.ISGenerated){if(_e&&Oe){var rt=this.getVideoStartPts(t.samples),Ke=s(n.samples[0].pts,rt)-rt,He=Ke/t.inputTimeScale;be+=Math.max(0,He),ve+=Math.max(0,-He)}if(_e){if(n.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),J=this.generateIS(n,t,g)),z=this.remuxAudio(n,be,this.isAudioContiguous,_,Te||Oe||k===w.PlaylistLevelType.AUDIO?ve:void 0),Oe){var we=z?z.endPTS-z.startPTS:0;t.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),J=this.generateIS(n,t,g)),F=this.remuxVideo(t,ve,Z,we)}}else Oe&&(F=this.remuxVideo(t,ve,Z,0));F&&(F.firstKeyFrame=je,F.independent=je!==-1)}}return this.ISGenerated&&(e.samples.length&&($=this.remuxID3(e,g)),p.samples.length&&(Y=this.remuxText(p,g))),{audio:z,video:F,initSegment:J,independent:le,text:Y,id3:$}},c.generateIS=function(n,t,e){var p=n.samples,g=t.samples,_=this.typeSupported,A={},k=!Object(I.isFiniteNumber)(this._initPTS),F="audio/mp4",z,J,Y;if(k&&(z=J=Infinity),n.config&&p.length&&(n.timescale=n.samplerate,n.isAAC||(_.mpeg?(F="audio/mpeg",n.codec=""):_.mp3&&(n.codec="mp3")),A.audio={id:"audio",container:F,codec:n.codec,initSegment:!n.isAAC&&_.mpeg?new Uint8Array(0):x.default.initSegment([n]),metadata:{channelCount:n.channelCount}},k&&(Y=n.inputTimeScale,z=J=p[0].pts-Math.round(Y*e))),t.sps&&t.pps&&g.length&&(t.timescale=t.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:x.default.initSegment([t]),metadata:{width:t.width,height:t.height}},k)){Y=t.inputTimeScale;var $=this.getVideoStartPts(g),le=Math.round(Y*e);J=Math.min(J,s(g[0].dts,$)-le),z=Math.min(z,$-le)}if(Object.keys(A).length)return this.ISGenerated=!0,k&&(this._initPTS=z,this._initDTS=J),{tracks:A,initPTS:z,timescale:Y}},c.remuxVideo=function(n,t,e,p){var g=n.inputTimeScale,_=n.samples,A=[],k=_.length,F=this._initPTS,z=this.nextAvcDts,J=8,Y,$,le,be=Number.POSITIVE_INFINITY,ve=Number.NEGATIVE_INFINITY,ke=0,Te=!1;if(!e||z===null){var xe=t*g,_e=_[0].pts-s(_[0].dts,_[0].pts);z=xe-_e}for(var Oe=0;Oe<k;Oe++){var ce=_[Oe];if(ce.pts=s(ce.pts-F,z),ce.dts=s(ce.dts-F,z),ce.dts>ce.pts){var Z=9e4*.2;ke=Math.max(Math.min(ke,ce.pts-ce.dts),-1*Z)}ce.dts<_[Oe>0?Oe-1:Oe].dts&&(Te=!0)}Te&&_.sort(function(Ct,_t){var ot=Ct.dts-_t.dts,It=Ct.pts-_t.pts;return ot||It}),$=_[0].dts,le=_[_.length-1].dts;var je=Math.round((le-$)/(k-1));if(ke<0){if(ke<je*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-je,!0)+" ms");for(var at=ke,rt=0;rt<k;rt++)_[rt].dts=at=Math.max(at,_[rt].pts-je),_[rt].pts=Math.max(at,_[rt].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(ke,!0)+" ms to overcome this issue");for(var Ke=0;Ke<k;Ke++)_[Ke].dts=_[Ke].dts+ke}$=_[0].dts}if(e){var He=$-z,we=He>je,Fe=He<-1;if(we||Fe){we?R.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(He,!0)+" ms ("+He+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-He,!0)+" ms ("+He+"dts) overlapping between fragments detected"),$=z;var $e=_[0].pts-He;_[0].dts=$,_[0].pts=$e,R.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)($e,!0)+"/"+Object(b.toMsFromMpegTsClock)($,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(He,!0)+" ms")}}r&&($=Math.max(0,$));for(var Qe=0,Ve=0,Ue=0;Ue<k;Ue++){for(var Be=_[Ue],ct=Be.units,st=ct.length,lt=0,nt=0;nt<st;nt++)lt+=ct[nt].data.length;Ve+=lt,Qe+=st,Be.length=lt,Be.dts=Math.max(Be.dts,$),Be.pts=Math.max(Be.pts,Be.dts,0),be=Math.min(Be.pts,be),ve=Math.max(Be.pts,ve)}le=_[k-1].dts;var ht=Ve+4*Qe+8,ut;try{ut=new Uint8Array(ht)}catch(Ct){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ht,reason:"fail allocating video mdat "+ht});return}var fe=new DataView(ut.buffer);fe.setUint32(0,ht),ut.set(x.default.types.mdat,4);for(var ye=0;ye<k;ye++){for(var Re=_[ye],Ie=Re.units,Ce=0,Ae=0,ae=Ie.length;Ae<ae;Ae++){var ee=Ie[Ae],te=ee.data,H=ee.data.byteLength;fe.setUint32(J,H),J+=4,ut.set(te,J),J+=H,Ce+=4+H}if(ye<k-1)Y=_[ye+1].dts-Re.dts;else{var G=this.config,V=Re.dts-_[ye>0?ye-1:ye].dts;if(G.stretchShortVideoTrack&&this.nextAudioPts!==null){var Q=Math.floor(G.maxBufferHole*g),de=(p?be+p*g:this.nextAudioPts)-Re.pts;de>Q?(Y=de-V,Y<0&&(Y=V),R.logger.log("[mp4-remuxer]: It is approximately "+de/90+" ms to the next segment; using duration "+Y/90+" ms for the last video frame.")):Y=V}else Y=V}var ge=Math.round(Re.pts-Re.dts);A.push(new d(Re.key,Y,Ce,ge))}if(A.length&&y&&y<70){var Me=A[0].flags;Me.dependsOn=2,Me.isNonSync=0}console.assert(Y!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=le+Y,this.isVideoContiguous=!0;var et=x.default.moof(n.sequenceNumber++,$,T({},n,{samples:A})),dt="video",qe={data1:et,data2:ut,startPTS:be/g,endPTS:(ve+Y)/g,startDTS:$/g,endDTS:z/g,type:dt,hasAudio:!1,hasVideo:!0,nb:A.length,dropped:n.dropped};return n.samples=[],n.dropped=0,console.assert(ut.length,"MDAT length must not be zero"),qe},c.remuxAudio=function(n,t,e,p,g){var _=n.inputTimeScale,A=n.samplerate?n.samplerate:_,k=_/A,F=n.isAAC?C:E,z=F*k,J=this._initPTS,Y=!n.isAAC&&this.typeSupported.mpeg,$=[],le=n.samples,be=Y?0:8,ve=this.nextAudioPts||-1,ke=t*_;if(this.isAudioContiguous=e=e||le.length&&ve>0&&(p&&Math.abs(ke-ve)<9e3||Math.abs(s(le[0].pts-J,ke)-ve)<20*z),le.forEach(function(te){te.pts=s(te.pts-J,ke)}),!e||ve<0){if(le=le.filter(function(te){return te.pts>=0}),!le.length)return;g===0?ve=0:p?ve=Math.max(0,ke):ve=le[0].pts}if(n.isAAC)for(var Te=g!==void 0,xe=this.config.maxAudioFramesDrift,_e=0,Oe=ve;_e<le.length;_e++){var ce=le[_e],Z=ce.pts,je=Z-Oe,at=Math.abs(1e3*je/_);if(je<=-xe*z&&Te)_e===0&&(R.logger.warn("Audio frame @ "+(Z/_).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*je/_)+" ms."),this.nextAudioPts=ve=Oe=Z);else if(je>=xe*z&&at<O&&Te){var rt=Math.round(je/z);Oe=Z-rt*z,Oe<0&&(rt--,Oe+=z),_e===0&&(this.nextAudioPts=ve=Oe),R.logger.warn("[mp4-remuxer]: Injecting "+rt+" audio frame @ "+(Oe/_).toFixed(3)+"s due to "+Math.round(1e3*je/_)+" ms gap.");for(var Ke=0;Ke<rt;Ke++){var He=Math.max(Oe,0),we=v.default.getSilentFrame(n.manifestCodec||n.codec,n.channelCount);we||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),we=ce.unit.subarray()),le.splice(_e,0,{unit:we,pts:He}),Oe+=z,_e++}}ce.pts=Oe,Oe+=z}for(var Fe=null,$e=null,Qe,Ve=0,Ue=le.length;Ue--;)Ve+=le[Ue].unit.byteLength;for(var Be=0,ct=le.length;Be<ct;Be++){var st=le[Be],lt=st.unit,nt=st.pts;if($e!==null){var ht=$[Be-1];ht.duration=Math.round((nt-$e)/k)}else if(e&&n.isAAC&&(nt=ve),Fe=nt,Ve>0){Ve+=be;try{Qe=new Uint8Array(Ve)}catch(te){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ve,reason:"fail allocating audio mdat "+Ve});return}if(!Y){var ut=new DataView(Qe.buffer);ut.setUint32(0,Ve),Qe.set(x.default.types.mdat,4)}}else return;Qe.set(lt,be);var fe=lt.byteLength;be+=fe,$.push(new d(!0,F,fe,0)),$e=nt}var ye=$.length;if(!ye)return;var Re=$[$.length-1];this.nextAudioPts=ve=$e+k*Re.duration;var Ie=Y?new Uint8Array(0):x.default.moof(n.sequenceNumber++,Fe/k,T({},n,{samples:$}));n.samples=[];var Ce=Fe/_,Ae=ve/_,ae="audio",ee={data1:Ie,data2:Qe,startPTS:Ce,endPTS:Ae,startDTS:Ce,endDTS:Ae,type:ae,hasAudio:!0,hasVideo:!1,nb:ye};return this.isAudioContiguous=!0,console.assert(Qe.length,"MDAT length must not be zero"),ee},c.remuxEmptyAudio=function(n,t,e,p){var g=n.inputTimeScale,_=n.samplerate?n.samplerate:g,A=g/_,k=this.nextAudioPts,F=(k!==null?k:p.startDTS*g)+this._initDTS,z=p.endDTS*g+this._initDTS,J=A*C,Y=Math.ceil((z-F)/J),$=v.default.getSilentFrame(n.manifestCodec||n.codec,n.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var le=[],be=0;be<Y;be++){var ve=F+be*J;le.push({unit:$,pts:ve,dts:ve})}return n.samples=le,this.remuxAudio(n,t,e,!1)},c.remuxID3=function(n,t){var e=n.samples.length;if(!e)return;for(var p=n.inputTimeScale,g=this._initPTS,_=this._initDTS,A=0;A<e;A++){var k=n.samples[A];k.pts=s(k.pts-g,t*p)/p,k.dts=s(k.dts-_,t*p)/p}var F=n.samples;return n.samples=[],{samples:F}},c.remuxText=function(n,t){var e=n.samples.length;if(!e)return;for(var p=n.inputTimeScale,g=this._initPTS,_=0;_<e;_++){var A=n.samples[_];A.pts=s(A.pts-g,t*p)/p}n.samples.sort(function(F,z){return F.pts-z.pts});var k=n.samples;return n.samples=[],{samples:k}},m}();function s(m,c){var i;if(c===null)return m;for(c<m?i=-8589934592:i=8589934592;Math.abs(m-c)>4294967296;)m+=i;return m}function f(m){for(var c=0;c<m.length;c++)if(m[c].key)return c;return-1}var d=function(c,i,n,t){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=i,this.size=n,this.cts=t,this.flags=new l(c)},l=function(c){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=c?2:1,this.isNonSync=c?0:1}},"./src/remux/passthrough-remuxer.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/polyfills/number.ts"),v=S("./src/utils/mp4-tools.ts"),x=S("./src/loader/fragment.ts"),U=S("./src/utils/logger.ts"),M=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 T=b.prototype;return T.destroy=function(){},T.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(C,E,y){this.audioCodec=E,this.videoCodec=y,this.generateInitSegment(C),this.emitInitSegment=!0},T.generateInitSegment=function(C){var E=this.audioCodec,y=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(v.parseInitSegment)(C);E||(E=w(h.audio,x.ElementaryStreamTypes.AUDIO)),y||(y=w(h.video,x.ElementaryStreamTypes.VIDEO));var r={};h.audio&&h.video?r.audiovideo={container:"video/mp4",codec:E+","+y,initSegment:C,id:"main"}:h.audio?r.audio={container:"audio/mp4",codec:E,initSegment:C,id:"audio"}:h.video?r.video={container:"video/mp4",codec:y,initSegment:C,id:"main"}:U.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r},T.remux=function(C,E,y,h,r){var o=this.initPTS,s=this.lastEndDTS,f={audio:void 0,video:void 0,text:h,id3:y,initSegment:void 0};Object(I.isFiniteNumber)(s)||(s=this.lastEndDTS=r||0);var d=E.samples;if(!d||!d.length)return f;var l={initPTS:void 0,timescale:1},m=this.initData;if((!m||!m.length)&&(this.generateInitSegment(d),m=this.initData),!m||!m.length)return U.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(l.tracks=this.initTracks,this.emitInitSegment=!1),Object(I.isFiniteNumber)(o)||(this.initPTS=l.initPTS=o=R(m,d,s));var c=Object(v.getDuration)(d,m),i=s,n=c+i;Object(v.offsetStartDTS)(m,d,o),c>0?this.lastEndDTS=n:(U.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var t=!!m.audio,e=!!m.video,p="";t&&(p+="audio"),e&&(p+="video");var g={data1:d,startPTS:i,startDTS:i,endPTS:n,endDTS:n,type:p,hasAudio:t,hasVideo:e,nb:1,dropped:0};return f.audio=g.type==="audio"?g:void 0,f.video=g.type!=="audio"?g:void 0,f.text=h,f.id3=y,f.initSegment=l,f},b}(),R=function(T,O,C){return Object(v.getStartDTS)(T,O)-C};function w(b,T){var O=b==null?void 0:b.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||T===x.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}N.default=M},"./src/task-loop.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function v(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var x=v.prototype;return x.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},x.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},x.onHandlerDestroyed=function(){},x.hasInterval=function(){return!!this._tickInterval},x.hasNextTick=function(){return!!this._tickTimer},x.setInterval=function(M){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,M),!0)},x.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},x.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},x.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},x.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},x.doTick=function(){},v}()},"./src/types/cmcd.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"CMCDVersion",function(){return I}),S.d(N,"CMCDObjectType",function(){return v}),S.d(N,"CMCDStreamingFormat",function(){return x}),S.d(N,"CMCDStreamType",function(){return U});var I=1,v;(function(M){M.MANIFEST="m",M.AUDIO="a",M.VIDEO="v",M.MUXED="av",M.INIT="i",M.CAPTION="c",M.TIMED_TEXT="tt",M.KEY="k",M.OTHER="o"})(v||(v={}));var x;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(x||(x={}));var U;(function(M){M.VOD="v",M.LIVE="l"})(U||(U={}))},"./src/types/level.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"HlsSkip",function(){return x}),S.d(N,"getSkipValue",function(){return U}),S.d(N,"HlsUrlParameters",function(){return M}),S.d(N,"Level",function(){return R});function I(w,b){for(var T=0;T<b.length;T++){var O=b[T];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(w,O.key,O)}}function v(w,b,T){return b&&I(w.prototype,b),T&&I(w,T),w}var x;(function(w){w.No="",w.Yes="YES",w.v2="v2"})(x||(x={}));function U(w,b){var T=w.canSkipUntil,O=w.canSkipDateRanges,C=w.endSN,E=b!==void 0?b-C:0;return T&&E<T?O?x.v2:x.Yes:x.No}var M=function(){function w(T,O,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=O,this.skip=C}var b=w.prototype;return b.addDirectives=function(O){var C=new self.URL(O);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()},w}(),R=function(){function w(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(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return v(w,[{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(T){var O=T%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),w}()},"./src/types/loader.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"PlaylistContextType",function(){return I}),S.d(N,"PlaylistLevelType",function(){return v});var I;(function(x){x.MANIFEST="manifest",x.LEVEL="level",x.AUDIO_TRACK="audioTrack",x.SUBTITLE_TRACK="subtitleTrack"})(I||(I={}));var v;(function(x){x.MAIN="main",x.AUDIO="audio",x.SUBTITLE="subtitle"})(v||(v={}))},"./src/types/transmuxer.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"ChunkMetadata",function(){return I});var I=function(U,M,R,w,b,T){w===void 0&&(w=0),b===void 0&&(b=-1),T===void 0&&(T=!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=v(),this.buffering={audio:v(),video:v(),audiovideo:v()},this.level=U,this.sn=M,this.id=R,this.size=w,this.part=b,this.partial=T};function v(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"AttrList",function(){return x});var I=/^(\d+)x(\d+)$/,v=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,x=function(){function U(R){typeof R=="string"&&(R=U.parseAttrList(R));for(var w in R)R.hasOwnProperty(w)&&(this[w]=R[w])}var M=U.prototype;return M.decimalInteger=function(w){var b=parseInt(this[w],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},M.hexadecimalInteger=function(w){if(this[w]){var b=(this[w]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var T=new Uint8Array(b.length/2),O=0;O<b.length/2;O++)T[O]=parseInt(b.slice(O*2,O*2+2),16);return T}else return null},M.hexadecimalIntegerAsNumber=function(w){var b=parseInt(this[w],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},M.decimalFloatingPoint=function(w){return parseFloat(this[w])},M.optionalFloat=function(w,b){var T=this[w];return T?parseFloat(T):b},M.enumeratedString=function(w){return this[w]},M.bool=function(w){return this[w]==="YES"},M.decimalResolution=function(w){var b=I.exec(this[w]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},U.parseAttrList=function(w){var b,T={},O='"';for(v.lastIndex=0;(b=v.exec(w))!==null;){var C=b[2];C.indexOf(O)===0&&C.lastIndexOf(O)===C.length-1&&(C=C.slice(1,-1)),T[b[1]]=C}return T},U}()},"./src/utils/binary-search.ts":function(oe,N,S){"use strict";S.r(N);var I={search:function(x,U){for(var M=0,R=x.length-1,w=null,b=null;M<=R;){w=(M+R)/2|0,b=x[w];var T=U(b);if(T>0)M=w+1;else if(T<0)R=w-1;else return b}return null}};N.default=I},"./src/utils/buffer-helper.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"BufferHelper",function(){return x});var I=S("./src/utils/logger.ts"),v={length:0,start:function(){return 0},end:function(){return 0}},x=function(){function U(){}return U.isBuffered=function(R,w){try{if(R){for(var b=U.getBuffered(R),T=0;T<b.length;T++)if(w>=b.start(T)&&w<=b.end(T))return!0}}catch(O){}return!1},U.bufferInfo=function(R,w,b){try{if(R){var T=U.getBuffered(R),O=[],C;for(C=0;C<T.length;C++)O.push({start:T.start(C),end:T.end(C)});return this.bufferedInfo(O,w,b)}}catch(E){}return{len:0,start:w,end:w,nextStart:void 0}},U.bufferedInfo=function(R,w,b){w=Math.max(0,w),R.sort(function(l,m){var c=l.start-m.start;return c||m.end-l.end});var T=[];if(b)for(var O=0;O<R.length;O++){var C=T.length;if(C){var E=T[C-1].end;R[O].start-E<b?R[O].end>E&&(T[C-1].end=R[O].end):T.push(R[O])}else T.push(R[O])}else T=R;for(var y=0,h,r=w,o=w,s=0;s<T.length;s++){var f=T[s].start,d=T[s].end;if(w+b>=f&&w<d)r=f,o=d,y=o-w;else if(w+b<f){h=f;break}}return{len:y,start:r||0,end:o||0,nextStart:h}},U.getBuffered=function(R){try{return R.buffered}catch(w){return I.logger.log("failed to get media.buffered",w),v}},U}()},"./src/utils/cea-608-parser.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"Row",function(){return o}),S.d(N,"CaptionScreen",function(){return s});var I=S("./src/utils/logger.ts"),v={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},x=function(n){var t=n;return v.hasOwnProperty(n)&&(t=v[n]),String.fromCharCode(t)},U=15,M=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},w={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},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(i){i[i.ERROR=0]="ERROR",i[i.TEXT=1]="TEXT",i[i.WARNING=2]="WARNING",i[i.INFO=2]="INFO",i[i.DEBUG=3]="DEBUG",i[i.DATA=3]="DATA"})(C||(C={}));var E=function(){function i(){this.time=null,this.verboseLevel=C.ERROR}var n=i.prototype;return n.log=function(e,p){this.verboseLevel>=e&&I.logger.log(this.time+" ["+e+"] "+p)},i}(),y=function(n){for(var t=[],e=0;e<n.length;e++)t.push(n[e].toString(16));return t},h=function(){function i(t,e,p,g,_){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=t||"white",this.underline=e||!1,this.italics=p||!1,this.background=g||"black",this.flash=_||!1}var n=i.prototype;return n.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},n.setStyles=function(e){for(var p=["foreground","underline","italics","background","flash"],g=0;g<p.length;g++){var _=p[g];e.hasOwnProperty(_)&&(this[_]=e[_])}},n.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},n.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},n.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},n.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},i}(),r=function(){function i(t,e,p,g,_,A){this.uchar=void 0,this.penState=void 0,this.uchar=t||" ",this.penState=new h(e,p,g,_,A)}var n=i.prototype;return n.reset=function(){this.uchar=" ",this.penState.reset()},n.setChar=function(e,p){this.uchar=e,this.penState.copy(p)},n.setPenState=function(e){this.penState.copy(e)},n.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},n.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},n.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},i}(),o=function(){function i(t){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var e=0;e<M;e++)this.chars.push(new r);this.logger=t,this.pos=0,this.currPenState=new h}var n=i.prototype;return n.equals=function(e){for(var p=!0,g=0;g<M;g++)if(!this.chars[g].equals(e.chars[g])){p=!1;break}return p},n.copy=function(e){for(var p=0;p<M;p++)this.chars[p].copy(e.chars[p])},n.isEmpty=function(){for(var e=!0,p=0;p<M;p++)if(!this.chars[p].isEmpty()){e=!1;break}return e},n.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>M&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=M)},n.moveCursor=function(e){var p=this.pos+e;if(e>1)for(var g=this.pos+1;g<p+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(p)},n.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},n.insertChar=function(e){e>=144&&this.backSpace();var p=x(e);if(this.pos>=M){this.logger.log(C.ERROR,"Cannot insert "+e.toString(16)+" ("+p+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(p,this.currPenState),this.moveCursor(1)},n.clearFromPos=function(e){var p;for(p=e;p<M;p++)this.chars[p].reset()},n.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},n.clearToEndOfRow=function(){this.clearFromPos(this.pos)},n.getTextString=function(){for(var e=[],p=!0,g=0;g<M;g++){var _=this.chars[g].uchar;_!==" "&&(p=!1),e.push(_)}return p?"":e.join("")},n.setPenStyles=function(e){this.currPenState.setStyles(e);var p=this.chars[this.pos];p.setPenState(this.currPenState)},i}(),s=function(){function i(t){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var e=0;e<U;e++)this.rows.push(new o(t));this.logger=t,this.currRow=U-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var n=i.prototype;return n.reset=function(){for(var e=0;e<U;e++)this.rows[e].clear();this.currRow=U-1},n.equals=function(e){for(var p=!0,g=0;g<U;g++)if(!this.rows[g].equals(e.rows[g])){p=!1;break}return p},n.copy=function(e){for(var p=0;p<U;p++)this.rows[p].copy(e.rows[p])},n.isEmpty=function(){for(var e=!0,p=0;p<U;p++)if(!this.rows[p].isEmpty()){e=!1;break}return e},n.backSpace=function(){var e=this.rows[this.currRow];e.backSpace()},n.clearToEndOfRow=function(){var e=this.rows[this.currRow];e.clearToEndOfRow()},n.insertChar=function(e){var p=this.rows[this.currRow];p.insertChar(e)},n.setPen=function(e){var p=this.rows[this.currRow];p.setPenStyles(e)},n.moveCursor=function(e){var p=this.rows[this.currRow];p.moveCursor(e)},n.setCursor=function(e){this.logger.log(C.INFO,"setCursor: "+e);var p=this.rows[this.currRow];p.setCursor(e)},n.setPAC=function(e){this.logger.log(C.INFO,"pacData = "+JSON.stringify(e));var p=e.row-1;if(this.nrRollUpRows&&p<this.nrRollUpRows-1&&(p=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==p){for(var g=0;g<U;g++)this.rows[g].clear();var _=this.currRow+1-this.nrRollUpRows,A=this.lastOutputScreen;if(A){var k=A.rows[_].cueStartTime,F=this.logger.time;if(k&&F!==null&&k<F)for(var z=0;z<this.nrRollUpRows;z++)this.rows[p-this.nrRollUpRows+z+1].copy(A.rows[_+z])}}this.currRow=p;var J=this.rows[this.currRow];if(e.indent!==null){var Y=e.indent,$=Math.max(Y-1,0);J.setCursor(e.indent),e.color=J.chars[$].penState.foreground}var le={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(le)},n.setBkgData=function(e){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},n.setRollUpRows=function(e){this.nrRollUpRows=e},n.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 e=this.currRow+1-this.nrRollUpRows,p=this.rows.splice(e,1)[0];p.clear(),this.rows.splice(this.currRow,0,p),this.logger.log(C.INFO,"Rolling up")},n.getDisplayText=function(e){e=e||!1;for(var p=[],g="",_=-1,A=0;A<U;A++){var k=this.rows[A].getTextString();k&&(_=A+1,e?p.push("Row "+_+": '"+k+"'"):p.push(k.trim()))}return p.length>0&&(e?g="["+p.join(" | ")+"]":g=p.join(`
|
|
`)),g},n.getTextAndFormat=function(){return this.rows},i}(),f=function(){function i(t,e,p){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=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new s(p),this.nonDisplayedMemory=new s(p),this.lastOutputScreen=new s(p),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=p}var n=i.prototype;return n.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},n.getHandler=function(){return this.outputFilter},n.setHandler=function(e){this.outputFilter=e},n.setPAC=function(e){this.writeScreen.setPAC(e)},n.setBkgData=function(e){this.writeScreen.setBkgData(e)},n.setMode=function(e){if(e===this.mode)return;this.mode=e,this.logger.log(C.INFO,"MODE="+e),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=e},n.insertChars=function(e){for(var p=0;p<e.length;p++)this.writeScreen.insertChar(e[p]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,g+": "+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())},n.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},n.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},n.ccAOF=function(){},n.ccAON=function(){},n.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},n.ccRU=function(e){this.logger.log(C.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},n.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},n.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},n.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},n.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},n.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},n.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},n.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},n.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},n.ccTO=function(e){this.logger.log(C.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},n.ccMIDROW=function(e){var p={flash:!1};if(p.underline=e%2===1,p.italics=e>=46,p.italics)p.foreground="white";else{var g=Math.floor(e/2)-16,_=["white","green","blue","cyan","red","yellow","magenta"];p.foreground=_[g]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(p)),this.writeScreen.setPen(p)},n.outputDataUpdate=function(e){e===void 0&&(e=!1);var p=this.logger.time;if(p===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=p:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,p,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:p),this.lastOutputScreen.copy(this.displayedMemory))},n.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},i}(),d=function(){function i(t,e,p){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new E;this.channels=[null,new f(t,e,g),new f(t+1,p,g)],this.cmdHistory=c(),this.logger=g}var n=i.prototype;return n.getHandler=function(e){return this.channels[e].getHandler()},n.setHandler=function(e,p){this.channels[e].setHandler(p)},n.addData=function(e,p){var g,_,A,k=!1;this.logger.time=e;for(var F=0;F<p.length;F+=2){if(_=p[F]&127,A=p[F+1]&127,_===0&&A===0)continue;if(this.logger.log(C.DATA,"["+y([p[F],p[F+1]])+"] -> ("+y([_,A])+")"),g=this.parseCmd(_,A),g||(g=this.parseMidrow(_,A)),g||(g=this.parsePAC(_,A)),g||(g=this.parseBackgroundAttributes(_,A)),!g&&(k=this.parseChars(_,A),k)){var z=this.currentChannel;if(z&&z>0){var J=this.channels[z];J.insertChars(k)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!k&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+y([_,A])+" orig: "+y([p[F],p[F+1]]))}},n.parseCmd=function(e,p){var g=this.cmdHistory,_=(e===20||e===28||e===21||e===29)&&p>=32&&p<=47,A=(e===23||e===31)&&p>=33&&p<=35;if(!(_||A))return!1;if(m(e,p,g))return l(null,null,g),this.logger.log(C.DEBUG,"Repeated command ("+y([e,p])+") is dropped"),!0;var k=e===20||e===21||e===23?1:2,F=this.channels[k];return e===20||e===21||e===28||e===29?p===32?F.ccRCL():p===33?F.ccBS():p===34?F.ccAOF():p===35?F.ccAON():p===36?F.ccDER():p===37?F.ccRU(2):p===38?F.ccRU(3):p===39?F.ccRU(4):p===40?F.ccFON():p===41?F.ccRDC():p===42?F.ccTR():p===43?F.ccRTD():p===44?F.ccEDM():p===45?F.ccCR():p===46?F.ccENM():p===47&&F.ccEOC():F.ccTO(p-32),l(e,p,g),this.currentChannel=k,!0},n.parseMidrow=function(e,p){var g=0;if((e===17||e===25)&&p>=32&&p<=47){if(e===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var _=this.channels[g];return _?(_.ccMIDROW(p),this.logger.log(C.DEBUG,"MIDROW ("+y([e,p])+")"),!0):!1}return!1},n.parsePAC=function(e,p){var g,_=this.cmdHistory,A=(e>=17&&e<=23||e>=25&&e<=31)&&p>=64&&p<=127,k=(e===16||e===24)&&p>=64&&p<=95;if(!(A||k))return!1;if(m(e,p,_))return l(null,null,_),!0;var F=e<=23?1:2;p>=64&&p<=95?g=F===1?R[e]:b[e]:g=F===1?w[e]:T[e];var z=this.channels[F];return z?(z.setPAC(this.interpretPAC(g,p)),l(e,p,_),this.currentChannel=F,!0):!1},n.interpretPAC=function(e,p){var g,_={color:null,italics:!1,indent:null,underline:!1,row:e};return p>95?g=p-96:g=p-64,_.underline=(g&1)===1,g<=13?_.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(_.italics=!0,_.color="white"):_.indent=Math.floor((g-16)/2)*4,_},n.parseChars=function(e,p){var g,_=null,A=null;if(e>=25?(g=2,A=e-8):(g=1,A=e),A>=17&&A<=19){var k;A===17?k=p+80:A===18?k=p+112:k=p+144,this.logger.log(C.INFO,"Special char '"+x(k)+"' in channel "+g),_=[k]}else e>=32&&e<=127&&(_=p===0?[e]:[e,p]);if(_){var F=y(_);this.logger.log(C.DEBUG,"Char codes = "+F.join(",")),l(e,p,this.cmdHistory)}return _},n.parseBackgroundAttributes=function(e,p){var g=(e===16||e===24)&&p>=32&&p<=47,_=(e===23||e===31)&&p>=45&&p<=47;if(!(g||_))return!1;var A,k={};e===16||e===24?(A=Math.floor((p-32)/2),k.background=O[A],p%2===1&&(k.background=k.background+"_semi")):p===45?k.background="transparent":(k.foreground="black",p===47&&(k.underline=!0));var F=e<=23?1:2,z=this.channels[F];return z.setBkgData(k),l(e,p,this.cmdHistory),!0},n.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var p=this.channels[e];p&&p.reset()}this.cmdHistory=c()},n.cueSplitAtTime=function(e){for(var p=0;p<this.channels.length;p++){var g=this.channels[p];g&&g.cueSplitAtTime(e)}},i}();function l(i,n,t){t.a=i,t.b=n}function m(i,n,t){return t.a===i&&t.b===n}function c(){return{a:null,b:null}}N.default=d},"./src/utils/codecs.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"isCodecType",function(){return v}),S.d(N,"isCodecSupportedInMp4",function(){return x});var I={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function v(U,M){var R=I[M];return!!R&&R[U.slice(0,4)]===!0}function x(U,M){return MediaSource.isTypeSupported((M||"video")+'/mp4;codecs="'+U+'"')}},"./src/utils/cues.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/vttparser.ts"),v=S("./src/utils/webvtt-parser.ts"),x=S("./src/utils/texttrack-utils.ts"),U=/\s/,M={newCue:function(w,b,T,O){for(var C=[],E,y,h,r,o,s=self.VTTCue||self.TextTrackCue,f=0;f<O.rows.length;f++)if(E=O.rows[f],h=!0,r=0,o="",!E.isEmpty()){for(var d=0;d<E.chars.length;d++)U.test(E.chars[d].uchar)&&h?r++:(o+=E.chars[d].uchar,h=!1);E.cueStartTime=b,b===T&&(T+=1e-4),r>=16?r--:r++;var l=Object(I.fixLineBreaks)(o.trim()),m=Object(v.generateCueId)(b,T,l);(!w||!w.cues||!w.cues.getCueById(m))&&(y=new s(b,T,l),y.id=m,y.line=f+1,y.align="left",y.position=10+Math.min(80,Math.floor(r*8/32)*10),C.push(y))}return w&&C.length&&(C.sort(function(c,i){return c.line==="auto"||i.line==="auto"?0:c.line>8&&i.line>8?i.line-c.line:c.line-i.line}),C.forEach(function(c){return Object(x.addCueToTrack)(w,c)})),C}};N.default=M},"./src/utils/discontinuities.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"findFirstFragWithCC",function(){return U}),S.d(N,"shouldAlignOnDiscontinuities",function(){return M}),S.d(N,"findDiscontinuousReferenceFrag",function(){return R}),S.d(N,"adjustSlidingStart",function(){return b}),S.d(N,"alignStream",function(){return T}),S.d(N,"alignPDT",function(){return C}),S.d(N,"alignFragmentByPDTDelta",function(){return E}),S.d(N,"alignMediaPlaylistByPDT",function(){return y});var I=S("./src/polyfills/number.ts"),v=S("./src/utils/logger.ts"),x=S("./src/controller/level-helper.ts");function U(h,r){for(var o=null,s=0,f=h.length;s<f;s++){var d=h[s];if(d&&d.cc===r){o=d;break}}return o}function M(h,r,o){return!!(r.details&&(o.endCC>o.startCC||h&&h.cc<o.startCC))}function R(h,r){var o=h.fragments,s=r.fragments;if(!s.length||!o.length){v.logger.log("No fragments to align");return}var f=U(o,s[0].cc);if(!f||f&&!f.startPTS){v.logger.log("No frag in previous level to align on");return}return f}function w(h,r){if(h){var o=h.start+r;h.start=h.startPTS=o,h.endPTS=o+h.duration}}function b(h,r){for(var o=r.fragments,s=0,f=o.length;s<f;s++)w(o[s],h);r.fragmentHint&&w(r.fragmentHint,h),r.alignedSliding=!0}function T(h,r,o){if(!r)return;O(h,o,r),!o.alignedSliding&&r.details&&C(o,r.details),!o.alignedSliding&&r.details&&!o.skippedSegments&&Object(x.adjustSliding)(r.details,o)}function O(h,r,o){if(M(h,o,r)){var s=R(o.details,r);s&&Object(I.isFiniteNumber)(s.start)&&(v.logger.log("Adjusting PTS using last level due to CC increase within current level "+r.url),b(s.start,r))}}function C(h,r){if(!r.fragments.length||!h.hasProgramDateTime||!r.hasProgramDateTime)return;var o=r.fragments[0].programDateTime,s=h.fragments[0].programDateTime,f=(s-o)/1e3+r.fragments[0].start;f&&Object(I.isFiniteNumber)(f)&&(v.logger.log("Adjusting PTS using programDateTime delta "+(s-o)+"ms, sliding:"+f.toFixed(3)+" "+h.url+" "),b(f,h))}function E(h,r){var o=h.programDateTime;if(!o)return;var s=(o-r)/1e3;h.start=h.startPTS=s,h.endPTS=s+h.duration}function y(h,r){if(!r.fragments.length||!h.hasProgramDateTime||!r.hasProgramDateTime)return;var o=r.fragments[0].programDateTime,s=r.fragments[0].start,f=o-s*1e3;h.fragments.forEach(function(d){E(d,f)}),h.fragmentHint&&E(h.fragmentHint,f),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/ewma.ts"),v=function(){function x(M,R,w){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=w,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new I.default(M),this.fast_=new I.default(R)}var U=x.prototype;return U.update=function(R,w){var b=this.slow_,T=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new I.default(R,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==w&&(this.fast_=new I.default(w,T.getEstimate(),T.getTotalWeight()))},U.sample=function(R,w){R=Math.max(R,this.minDelayMs_);var b=8*w,T=R/1e3,O=b/T;this.fast_.sample(T,O),this.slow_.sample(T,O)},U.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},U.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},U.destroy=function(){},x}();N.default=v},"./src/utils/ewma.ts":function(oe,N,S){"use strict";S.r(N);var I=function(){function v(U,M,R){M===void 0&&(M=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=U,this.alpha_=U?Math.exp(Math.log(.5)/U):0,this.estimate_=M,this.totalWeight_=R}var x=v.prototype;return x.sample=function(M,R){var w=Math.pow(this.alpha_,M);this.estimate_=R*(1-w)+w*this.estimate_,this.totalWeight_+=M},x.getTotalWeight=function(){return this.totalWeight_},x.getEstimate=function(){if(this.alpha_){var M=1-Math.pow(this.alpha_,this.totalWeight_);if(M)return this.estimate_/M}return this.estimate_},v}();N.default=I},"./src/utils/fetch-loader.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"fetchSupported",function(){return E});var I=S("./src/polyfills/number.ts"),v=S("./src/loader/load-stats.ts"),x=S("./src/demux/chunk-cache.ts");function U(s,f){s.prototype=Object.create(f.prototype),s.prototype.constructor=s,T(s,f)}function M(s){var f=typeof Map=="function"?new Map:void 0;return M=function(l){if(l===null||!b(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof f!="undefined"){if(f.has(l))return f.get(l);f.set(l,m)}function m(){return R(l,arguments,O(this).constructor)}return m.prototype=Object.create(l.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),T(m,l)},M(s)}function R(s,f,d){return w()?R=Reflect.construct:R=function(m,c,i){var n=[null];n.push.apply(n,c);var t=Function.bind.apply(m,n),e=new t;return i&&T(e,i.prototype),e},R.apply(null,arguments)}function w(){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(s){return!1}}function b(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function T(s,f){return T=Object.setPrototypeOf||function(l,m){return l.__proto__=m,l},T(s,f)}function O(s){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},O(s)}function C(){return C=Object.assign||function(s){for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var l in d)Object.prototype.hasOwnProperty.call(d,l)&&(s[l]=d[l])}return s},C.apply(this,arguments)}function E(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var y=function(){function s(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||r,this.controller=new self.AbortController,this.stats=new v.LoadStats}var f=s.prototype;return f.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},f.abortInternal=function(){var l=this.response;(!l||!l.ok)&&(this.stats.aborted=!0,this.controller.abort())},f.abort=function(){var l;this.abortInternal(),(l=this.callbacks)!==null&&l!==void 0&&l.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},f.load=function(l,m,c){var i=this,n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();var t=h(l,this.controller.signal),e=c.onProgress,p=l.responseType==="arraybuffer",g=p?"byteLength":"length";this.context=l,this.config=m,this.callbacks=c,this.request=this.fetchSetup(l,t),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){i.abortInternal(),c.onTimeout(n,l,i.response)},m.timeout),self.fetch(this.request).then(function(_){if(i.response=i.loader=_,!_.ok){var A=_.status,k=_.statusText;throw new o(k||"fetch, bad network response",A,_)}return n.loading.first=Math.max(self.performance.now(),n.loading.start),n.total=parseInt(_.headers.get("Content-Length")||"0"),e&&Object(I.isFiniteNumber)(m.highWaterMark)?i.loadProgressively(_,n,l,m.highWaterMark,e):p?_.arrayBuffer():_.text()}).then(function(_){var A=i.response;self.clearTimeout(i.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first),n.loaded=n.total=_[g];var k={url:A.url,data:_};e&&!Object(I.isFiniteNumber)(m.highWaterMark)&&e(n,l,_,A),c.onSuccess(k,n,l,A)}).catch(function(_){if(self.clearTimeout(i.requestTimeout),n.aborted)return;var A=_.code||0;c.onError({code:A,text:_.message},l,_.details)})},f.getCacheAge=function(){var l=null;if(this.response){var m=this.response.headers.get("age");l=m?parseFloat(m):null}return l},f.loadProgressively=function(l,m,c,i,n){i===void 0&&(i=0);var t=new x.default,e=l.body.getReader(),p=function g(){return e.read().then(function(_){if(_.done)return t.dataLength&&n(m,c,t.flush(),l),Promise.resolve(new ArrayBuffer(0));var A=_.value,k=A.length;return m.loaded+=k,k<i||t.dataLength?(t.push(A),t.dataLength>=i&&n(m,c,t.flush(),l)):n(m,c,A,l),g()}).catch(function(){return Promise.reject()})};return p()},s}();function h(s,f){var d={method:"GET",mode:"cors",credentials:"same-origin",signal:f,headers:new self.Headers(C({},s.headers))};return s.rangeEnd&&d.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),d}function r(s,f){return new self.Request(s.url,f)}var o=function(s){U(f,s);function f(d,l,m){var c;return c=s.call(this,d)||this,c.code=void 0,c.details=void 0,c.code=l,c.details=m,c}return f}(M(Error));N.default=y},"./src/utils/imsc1-ttml-parser.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"IMSC1_CODEC",function(){return b}),S.d(N,"parseIMSC1",function(){return E});var I=S("./src/utils/mp4-tools.ts"),v=S("./src/utils/vttparser.ts"),x=S("./src/utils/vttcue.ts"),U=S("./src/demux/id3.ts"),M=S("./src/utils/timescale-conversion.ts"),R=S("./src/utils/webvtt-parser.ts");function w(){return w=Object.assign||function(i){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e])}return i},w.apply(this,arguments)}var b="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function E(i,n,t,e,p){var g=Object(I.findBox)(new Uint8Array(i),["mdat"]);if(g.length===0){p(new Error("Could not parse IMSC1 mdat"));return}var _=g[0],A=Object(U.utf8ArrayToStr)(new Uint8Array(i,_.start,_.end-_.start)),k=Object(M.toTimescaleFromScale)(n,1,t);try{e(y(A,k))}catch(F){p(F)}}function y(i,n){var t=new DOMParser,e=t.parseFromString(i,"text/xml"),p=e.getElementsByTagName("tt")[0];if(!p)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},_=Object.keys(g).reduce(function(J,Y){return J[Y]=p.getAttribute("ttp:"+Y)||g[Y],J},{}),A=p.getAttribute("xml:space")!=="preserve",k=r(h(p,"styling","style")),F=r(h(p,"layout","region")),z=h(p,"body","[begin]");return[].map.call(z,function(J){var Y=o(J,A);if(!Y||!J.hasAttribute("begin"))return null;var $=l(J.getAttribute("begin"),_),le=l(J.getAttribute("dur"),_),be=l(J.getAttribute("end"),_);if($===null)throw d(J);if(be===null){if(le===null)throw d(J);be=$+le}var ve=new x.default($-n,be-n,Y);ve.id=Object(R.generateCueId)(ve.startTime,ve.endTime,ve.text);var ke=F[J.getAttribute("region")],Te=k[J.getAttribute("style")];ve.position=10,ve.size=80;var xe=s(ke,Te),_e=xe.textAlign;if(_e){var Oe=C[_e];Oe&&(ve.lineAlign=Oe),ve.align=_e}return w(ve,xe),ve}).filter(function(J){return J!==null})}function h(i,n,t){var e=i.getElementsByTagName(n)[0];return e?[].slice.call(e.querySelectorAll(t)):[]}function r(i){return i.reduce(function(n,t){var e=t.getAttribute("xml:id");return e&&(n[e]=t),n},{})}function o(i,n){return[].slice.call(i.childNodes).reduce(function(t,e,p){var g;return e.nodeName==="br"&&p?t+`
|
|
`:(g=e.childNodes)!==null&&g!==void 0&&g.length?o(e,n):n?t+e.textContent.trim().replace(/\s+/g," "):t+e.textContent},"")}function s(i,n){var t="http://www.w3.org/ns/ttml#styling",e=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return e.reduce(function(p,g){var _=f(n,t,g)||f(i,t,g);return _&&(p[g]=_),p},{})}function f(i,n,t){return i.hasAttributeNS(n,t)?i.getAttributeNS(n,t):null}function d(i){return new Error("Could not parse ttml timestamp "+i)}function l(i,n){if(!i)return null;var t=Object(v.parseTimeStamp)(i);return t===null&&(T.test(i)?t=m(i,n):O.test(i)&&(t=c(i,n))),t}function m(i,n){var t=T.exec(i),e=(t[4]|0)+(t[5]|0)/n.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+e/n.frameRate}function c(i,n){var t=O.exec(i),e=Number(t[1]),p=t[2];switch(p){case"h":return e*3600;case"m":return e*60;case"ms":return e*1e3;case"f":return e/n.frameRate;case"t":return e/n.tickRate}return e}},"./src/utils/logger.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"enableLogs",function(){return R}),S.d(N,"logger",function(){return w});var I=function(){},v={trace:I,debug:I,log:I,warn:I,info:I,error:I},x=v;function U(b){var T=self.console[b];return T?T.bind(self.console,"["+b+"] >"):I}function M(b){for(var T=arguments.length,O=new Array(T>1?T-1:0),C=1;C<T;C++)O[C-1]=arguments[C];O.forEach(function(E){x[E]=b[E]?b[E].bind(b):U(E)})}function R(b){if(self.console&&b===!0||typeof b=="object"){M(b,"debug","log","info","warn","error");try{x.log()}catch(T){x=v}}else x=v}var w=x},"./src/utils/mediakeys-helper.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"KeySystems",function(){return I}),S.d(N,"requestMediaKeySystemAccess",function(){return v});var I;(function(x){x.WIDEVINE="com.widevine.alpha",x.PLAYREADY="com.microsoft.playready"})(I||(I={}));var v=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"getMediaSource",function(){return I});function I(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"bin2str",function(){return M}),S.d(N,"readUint16",function(){return R}),S.d(N,"readUint32",function(){return w}),S.d(N,"writeUint32",function(){return b}),S.d(N,"findBox",function(){return T}),S.d(N,"parseSegmentIndex",function(){return O}),S.d(N,"parseInitSegment",function(){return C}),S.d(N,"getStartDTS",function(){return E}),S.d(N,"getDuration",function(){return y}),S.d(N,"computeRawDurationFromSamples",function(){return h}),S.d(N,"offsetStartDTS",function(){return r}),S.d(N,"segmentValidRange",function(){return o}),S.d(N,"appendUint8Array",function(){return s});var I=S("./src/utils/typed-array.ts"),v=S("./src/loader/fragment.ts"),x=Math.pow(2,32)-1,U=[].push;function M(f){return String.fromCharCode.apply(null,f)}function R(f,d){"data"in f&&(d+=f.start,f=f.data);var l=f[d]<<8|f[d+1];return l<0?65536+l:l}function w(f,d){"data"in f&&(d+=f.start,f=f.data);var l=f[d]<<24|f[d+1]<<16|f[d+2]<<8|f[d+3];return l<0?4294967296+l:l}function b(f,d,l){"data"in f&&(d+=f.start,f=f.data),f[d]=l>>24,f[d+1]=l>>16&255,f[d+2]=l>>8&255,f[d+3]=l&255}function T(f,d){var l=[];if(!d.length)return l;var m,c,i;"data"in f?(m=f.data,c=f.start,i=f.end):(m=f,c=0,i=m.byteLength);for(var n=c;n<i;){var t=w(m,n),e=M(m.subarray(n+4,n+8)),p=t>1?n+t:i;if(e===d[0])if(d.length===1)l.push({data:m,start:n+8,end:p});else{var g=T({data:m,start:n+8,end:p},d.slice(1));g.length&&U.apply(l,g)}n=p}return l}function O(f){var d=T(f,["moov"]),l=d[0],m=l?l.end:null,c=T(f,["sidx"]);if(!c||!c[0])return null;var i=[],n=c[0],t=n.data[0],e=t===0?8:16,p=w(n,e);e+=4;var g=0,_=0;t===0?e+=8:e+=16,e+=2;var A=n.end+_,k=R(n,e);e+=2;for(var F=0;F<k;F++){var z=e,J=w(n,z);z+=4;var Y=J&2147483647,$=(J&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var le=w(n,z);z+=4,i.push({referenceSize:Y,subsegmentDuration:le,info:{duration:le/p,start:A,end:A+Y-1}}),A+=Y,z+=4,e=z}return{earliestPresentationTime:g,timescale:p,version:t,referencesCount:k,references:i,moovEndOffset:m}}function C(f){for(var d=[],l=T(f,["moov","trak"]),m=0;m<l.length;m++){var c=l[m],i=T(c,["tkhd"])[0];if(i){var n=i.data[i.start],t=n===0?12:20,e=w(i,t),p=T(c,["mdia","mdhd"])[0];if(p){n=p.data[p.start],t=n===0?12:20;var g=w(p,t),_=T(c,["mdia","hdlr"])[0];if(_){var A=M(_.data.subarray(_.start+8,_.start+12)),k={soun:v.ElementaryStreamTypes.AUDIO,vide:v.ElementaryStreamTypes.VIDEO}[A];if(k){var F=T(c,["mdia","minf","stbl","stsd"])[0],z=void 0;F&&(z=M(F.data.subarray(F.start+12,F.start+16))),d[e]={timescale:g,type:k},d[k]={timescale:g,id:e,codec:z}}}}}}var J=T(f,["moov","mvex","trex"]);return J.forEach(function(Y){var $=w(Y,4),le=d[$];le&&(le.default={duration:w(Y,12),flags:w(Y,20)})}),d}function E(f,d){return T(d,["moof","traf"]).reduce(function(l,m){var c=T(m,["tfdt"])[0],i=c.data[c.start],n=T(m,["tfhd"]).reduce(function(t,e){var p=w(e,4),g=f[p];if(g){var _=w(c,4);i===1&&(_*=Math.pow(2,32),_+=w(c,8));var A=g.timescale||9e4,k=_/A;if(isFinite(k)&&(t===null||k<t))return k}return t},null);return n!==null&&isFinite(n)&&(l===null||n<l)?n:l},null)||0}function y(f,d){for(var l=0,m=0,c=0,i=T(f,["moof","traf"]),n=0;n<i.length;n++){var t=i[n],e=T(t,["tfhd"])[0],p=w(e,4),g=d[p];if(!g)continue;var _=g.default,A=w(e,0)|(_==null?void 0:_.flags),k=_==null?void 0:_.duration;A&8&&(A&2?k=w(e,12):k=w(e,8));for(var F=g.timescale||9e4,z=T(t,["trun"]),J=0;J<z.length;J++){if(k){var Y=w(z[J],4);l=k*Y}else l=h(z[J]);g.type===v.ElementaryStreamTypes.VIDEO?m+=l/F:g.type===v.ElementaryStreamTypes.AUDIO&&(c+=l/F)}}if(m===0&&c===0){var $=O(f);if($!=null&&$.references)return $.references.reduce(function(le,be){return le+be.info.duration||0},0)}return m||c}function h(f){var d=w(f,0),l=8;d&1&&(l+=4),d&4&&(l+=4);for(var m=0,c=w(f,4),i=0;i<c;i++){if(d&256){var n=w(f,l);m+=n,l+=4}d&512&&(l+=4),d&1024&&(l+=4),d&2048&&(l+=4)}return m}function r(f,d,l){T(d,["moof","traf"]).forEach(function(m){T(m,["tfhd"]).forEach(function(c){var i=w(c,4),n=f[i];if(!n)return;var t=n.timescale||9e4;T(m,["tfdt"]).forEach(function(e){var p=e.data[e.start],g=w(e,4);if(p===0)b(e,4,g-l*t);else{g*=Math.pow(2,32),g+=w(e,8),g-=l*t,g=Math.max(g,0);var _=Math.floor(g/(x+1)),A=Math.floor(g%(x+1));b(e,4,_),b(e,8,A)}})})})}function o(f){var d={valid:null,remainder:null},l=T(f,["moof"]);if(l){if(l.length<2)return d.remainder=f,d}else return d;var m=l[l.length-1];return d.valid=Object(I.sliceUint8)(f,0,m.start-8),d.remainder=Object(I.sliceUint8)(f,m.start-8),d}function s(f,d){var l=new Uint8Array(f.length+d.length);return l.set(f),l.set(d,f.length),l}},"./src/utils/output-filter.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"default",function(){return I});var I=function(){function v(U,M){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=U,this.trackName=M}var x=v.prototype;return x.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},x.newCue=function(M,R,w){(this.startTime===null||this.startTime>M)&&(this.startTime=M),this.endTime=R,this.screen=w,this.timelineController.createCaptionsTrack(this.trackName)},x.reset=function(){this.cueRanges=[]},v}()},"./src/utils/texttrack-utils.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"sendAddTrackEvent",function(){return v}),S.d(N,"addCueToTrack",function(){return x}),S.d(N,"clearCurrentCues",function(){return U}),S.d(N,"removeCuesInRange",function(){return M}),S.d(N,"getCuesInRange",function(){return w});var I=S("./src/utils/logger.ts");function v(b,T){var O;try{O=new Event("addtrack")}catch(C){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=b,T.dispatchEvent(O)}function x(b,T){var O=b.mode;if(O==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(T.id))try{if(b.addCue(T),!b.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(E){I.logger.debug("[texttrack-utils]: "+E);var C=new self.TextTrackCue(T.startTime,T.endTime,T.text);C.id=T.id,b.addCue(C)}O==="disabled"&&(b.mode=O)}function U(b){var T=b.mode;if(T==="disabled"&&(b.mode="hidden"),b.cues)for(var O=b.cues.length;O--;)b.removeCue(b.cues[O]);T==="disabled"&&(b.mode=T)}function M(b,T,O){var C=b.mode;if(C==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var E=w(b.cues,T,O),y=0;y<E.length;y++)b.removeCue(E[y]);C==="disabled"&&(b.mode=C)}function R(b,T){if(T<b[0].startTime)return 0;var O=b.length-1;if(T>b[O].endTime)return-1;for(var C=0,E=O;C<=E;){var y=Math.floor((E+C)/2);if(T<b[y].startTime)E=y-1;else if(T>b[y].startTime&&C<O)C=y+1;else return y}return b[C].startTime-T<T-b[E].startTime?C:E}function w(b,T,O){var C=[],E=R(b,T);if(E>-1)for(var y=E,h=b.length;y<h;y++){var r=b[y];if(r.startTime>=T&&r.endTime<=O)C.push(r);else if(r.startTime>O)return C}return C}},"./src/utils/time-ranges.ts":function(oe,N,S){"use strict";S.r(N);var I={toString:function(x){for(var U="",M=x.length,R=0;R<M;R++)U+="["+x.start(R).toFixed(3)+","+x.end(R).toFixed(3)+"]";return U}};N.default=I},"./src/utils/timescale-conversion.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"toTimescaleFromBase",function(){return v}),S.d(N,"toTimescaleFromScale",function(){return x}),S.d(N,"toMsFromMpegTsClock",function(){return U}),S.d(N,"toMpegTsClockFromTimescale",function(){return M});var I=9e4;function v(R,w,b,T){b===void 0&&(b=1),T===void 0&&(T=!1);var O=R*w*b;return T?Math.round(O):O}function x(R,w,b,T){return b===void 0&&(b=1),T===void 0&&(T=!1),v(R,w,1/b,T)}function U(R,w){return w===void 0&&(w=!1),v(R,1e3,1/I,w)}function M(R,w){return w===void 0&&(w=1),v(R,I,1/w)}},"./src/utils/typed-array.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"sliceUint8",function(){return I});function I(v,x,U){return Uint8Array.prototype.slice?v.slice(x,U):new Uint8Array(Array.prototype.slice.call(v,x,U))}},"./src/utils/vttcue.ts":function(oe,N,S){"use strict";S.r(N),N.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var I=["","lr","rl"],v=["start","middle","end","left","right"];function x(b,T){if(typeof T!="string")return!1;if(!Array.isArray(b))return!1;var O=T.toLowerCase();return~b.indexOf(O)?O:!1}function U(b){return x(I,b)}function M(b){return x(v,b)}function R(b){for(var T=arguments.length,O=new Array(T>1?T-1:0),C=1;C<T;C++)O[C-1]=arguments[C];for(var E=1;E<arguments.length;E++){var y=arguments[E];for(var h in y)b[h]=y[h]}return b}function w(b,T,O){var C=this,E={enumerable:!0};C.hasBeenReset=!1;var y="",h=!1,r=b,o=T,s=O,f=null,d="",l=!0,m="auto",c="start",i=50,n="middle",t=50,e="middle";Object.defineProperty(C,"id",R({},E,{get:function(){return y},set:function(g){y=""+g}})),Object.defineProperty(C,"pauseOnExit",R({},E,{get:function(){return h},set:function(g){h=!!g}})),Object.defineProperty(C,"startTime",R({},E,{get:function(){return r},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");r=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",R({},E,{get:function(){return o},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");o=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",R({},E,{get:function(){return s},set:function(g){s=""+g,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",R({},E,{get:function(){return f},set:function(g){f=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",R({},E,{get:function(){return d},set:function(g){var _=U(g);if(_===!1)throw new SyntaxError("An invalid or illegal string was specified.");d=_,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",R({},E,{get:function(){return l},set:function(g){l=!!g,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",R({},E,{get:function(){return m},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");m=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",R({},E,{get:function(){return c},set:function(g){var _=M(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");c=_,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",R({},E,{get:function(){return i},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");i=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",R({},E,{get:function(){return n},set:function(g){var _=M(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");n=_,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",R({},E,{get:function(){return t},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");t=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",R({},E,{get:function(){return e},set:function(g){var _=M(g);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");e=_,this.hasBeenReset=!0}})),C.displayState=void 0}return w.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},w}()},"./src/utils/vttparser.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"parseTimeStamp",function(){return x}),S.d(N,"fixLineBreaks",function(){return T}),S.d(N,"VTTParser",function(){return O});var I=S("./src/utils/vttcue.ts"),v=function(){function C(){}var E=C.prototype;return E.decode=function(h,r){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},C}();function x(C){function E(h,r,o,s){return(h|0)*3600+(r|0)*60+(o|0)+parseFloat(s||0)}var y=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?E(y[2],y[3],0,y[4]):E(y[1],y[2],y[3],y[4]):null}var U=function(){function C(){this.values=Object.create(null)}var E=C.prototype;return E.set=function(h,r){!this.get(h)&&r!==""&&(this.values[h]=r)},E.get=function(h,r,o){return o?this.has(h)?this.values[h]:r[o]:this.has(h)?this.values[h]:r},E.has=function(h){return h in this.values},E.alt=function(h,r,o){for(var s=0;s<o.length;++s)if(r===o[s]){this.set(h,r);break}},E.integer=function(h,r){/^-?\d+$/.test(r)&&this.set(h,parseInt(r,10))},E.percent=function(h,r){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(r)){var o=parseFloat(r);if(o>=0&&o<=100)return this.set(h,o),!0}return!1},C}();function M(C,E,y,h){var r=h?C.split(h):[C];for(var o in r){if(typeof r[o]!="string")continue;var s=r[o].split(y);if(s.length!==2)continue;var f=s[0],d=s[1];E(f,d)}}var R=new I.default(0,0,""),w=R.align==="middle"?"middle":"center";function b(C,E,y){var h=C;function r(){var f=x(C);if(f===null)throw new Error("Malformed timestamp: "+h);return C=C.replace(/^[^\sa-zA-Z-]+/,""),f}function o(f,d){var l=new U;M(f,function(i,n){var t;switch(i){case"region":for(var e=y.length-1;e>=0;e--)if(y[e].id===n){l.set(i,y[e].region);break}break;case"vertical":l.alt(i,n,["rl","lr"]);break;case"line":t=n.split(","),l.integer(i,t[0]),l.percent(i,t[0])&&l.set("snapToLines",!1),l.alt(i,t[0],["auto"]),t.length===2&&l.alt("lineAlign",t[1],["start",w,"end"]);break;case"position":t=n.split(","),l.percent(i,t[0]),t.length===2&&l.alt("positionAlign",t[1],["start",w,"end","line-left","line-right","auto"]);break;case"size":l.percent(i,n);break;case"align":l.alt(i,n,["start",w,"end","left","right"]);break}},/:/,/\s/),d.region=l.get("region",null),d.vertical=l.get("vertical","");var m=l.get("line","auto");m==="auto"&&R.line===-1&&(m=-1),d.line=m,d.lineAlign=l.get("lineAlign","start"),d.snapToLines=l.get("snapToLines",!0),d.size=l.get("size",100),d.align=l.get("align",w);var c=l.get("position","auto");c==="auto"&&R.position===50&&(c=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=c}function s(){C=C.replace(/^\s+/,"")}if(s(),E.startTime=r(),s(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);C=C.substr(3),s(),E.endTime=r(),s(),o(C,E)}function T(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var O=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new v,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var E=C.prototype;return E.parse=function(h){var r=this;h&&(r.buffer+=r.decoder.decode(h,{stream:!0}));function o(){var c=r.buffer,i=0;for(c=T(c);i<c.length&&c[i]!=="\r"&&c[i]!==`
|
|
`;)++i;var n=c.substr(0,i);return c[i]==="\r"&&++i,c[i]===`
|
|
`&&++i,r.buffer=c.substr(i),n}function s(c){M(c,function(i,n){},/:/)}try{var f="";if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;f=o();var d=f.match(/^()?WEBVTT([ \t].*)?$/);if(!d||!d[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var l=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;l?l=!1:f=o();switch(r.state){case"HEADER":/:/.test(f)?s(f):f||(r.state="ID");continue;case"NOTE":f||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(f)){r.state="NOTE";break}if(!f)continue;if(r.cue=new I.default(0,0,""),r.state="CUE",f.indexOf("-->")===-1){r.cue.id=f;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{b(f,r.cue,r.regionList)}catch(c){r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":{var m=f.indexOf("-->")!==-1;if(!f||m&&(l=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(r.cue===null)continue;r.cue.text&&(r.cue.text+=`
|
|
`),r.cue.text+=f}continue;case"BADCUE":f||(r.state="ID")}}}catch(c){r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},E.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
|
|
|
|
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(r){h.onparsingerror&&h.onparsingerror(r)}return h.onflush&&h.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(oe,N,S){"use strict";S.r(N),S.d(N,"generateCueId",function(){return O}),S.d(N,"parseWebVTT",function(){return E});var I=S("./src/polyfills/number.ts"),v=S("./src/utils/vttparser.ts"),x=S("./src/demux/id3.ts"),U=S("./src/utils/timescale-conversion.ts"),M=S("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,w=function(h,r,o){return o===void 0&&(o=0),h.substr(o,r.length)===r},b=function(h){var r=parseInt(h.substr(-3)),o=parseInt(h.substr(-6,2)),s=parseInt(h.substr(-9,2)),f=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(I.isFiniteNumber)(r)||!Object(I.isFiniteNumber)(o)||!Object(I.isFiniteNumber)(s)||!Object(I.isFiniteNumber)(f))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return r+=1e3*o,r+=60*1e3*s,r+=60*60*1e3*f,r},T=function(h){for(var r=5381,o=h.length;o;)r=r*33^h.charCodeAt(--o);return(r>>>0).toString()};function O(y,h,r){return T(y.toString())+T(h.toString())+T(r)}var C=function(h,r,o){var s=h[r],f=h[s.prevCC];if(!f||!f.new&&s.new){h.ccOffset=h.presentationOffset=s.start,s.new=!1;return}for(;(d=f)!==null&&d!==void 0&&d.new;){var d;h.ccOffset+=s.start-f.start,s.new=!1,s=f,f=h[s.prevCC]}h.presentationOffset=o};function E(y,h,r,o,s,f,d,l){var m=new v.VTTParser,c=Object(x.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(R,`
|
|
`).split(`
|
|
`),i=[],n=Object(U.toMpegTsClockFromTimescale)(h,r),t="00:00.000",e=0,p=0,g,_=!0,A=!1;m.oncue=function(k){var F=o[s],z=o.ccOffset,J=(e-n)/9e4;if(F!=null&&F.new&&(p!==void 0?z=o.ccOffset=F.start:C(o,s,J)),J&&(z=J-o.presentationOffset),A){var Y=k.endTime-k.startTime,$=Object(M.normalizePts)((k.startTime+z-p)*9e4,f*9e4)/9e4;k.startTime=$,k.endTime=$+Y}var le=k.text.trim();k.text=decodeURIComponent(encodeURIComponent(le)),k.id||(k.id=O(k.startTime,k.endTime,le)),k.endTime>0&&i.push(k)},m.onparsingerror=function(k){g=k},m.onflush=function(){if(g){l(g);return}d(i)},c.forEach(function(k){if(_)if(w(k,"X-TIMESTAMP-MAP=")){_=!1,A=!0,k.substr(16).split(",").forEach(function(F){w(F,"LOCAL:")?t=F.substr(6):w(F,"MPEGTS:")&&(e=parseInt(F.substr(7)))});try{p=b(t)/1e3}catch(F){A=!1,g=F}return}else k===""&&(_=!1);m.parse(k+`
|
|
`)}),m.flush()}},"./src/utils/xhr-loader.ts":function(oe,N,S){"use strict";S.r(N);var I=S("./src/utils/logger.ts"),v=S("./src/loader/load-stats.ts"),x=/^age:\s*[\d.]+\s*$/m,U=function(){function M(w){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=w?w.xhrSetup:null,this.stats=new v.LoadStats,this.retryDelay=0}var R=M.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.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()))},R.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(b,T,O){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=T,this.callbacks=O,this.retryDelay=T.retryDelay,this.loadInternal()},R.loadInternal=function(){var b=this.config,T=this.context;if(!b)return;var O=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var E=this.xhrSetup;try{if(E)try{E(O,T.url)}catch(r){O.open("GET",T.url,!0),E(O,T.url)}O.readyState||O.open("GET",T.url,!0);var y=this.context.headers;if(y)for(var h in y)O.setRequestHeader(h,y[h])}catch(r){this.callbacks.onError({code:O.status,text:r.message},T,O);return}T.rangeEnd&&O.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),O.send()},R.readystatechange=function(){var b=this.context,T=this.loader,O=this.stats;if(!b||!T)return;var C=T.readyState,E=this.config;if(O.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),C===4){T.onreadystatechange=null,T.onprogress=null;var y=T.status;if(y>=200&&y<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var h,r;if(b.responseType==="arraybuffer"?(h=T.response,r=h.byteLength):(h=T.responseText,r=h.length),O.loaded=O.total=r,!this.callbacks)return;var o=this.callbacks.onProgress;if(o&&o(O,b,h,T),!this.callbacks)return;var s={url:T.responseURL,data:h};this.callbacks.onSuccess(s,O,b,T)}else O.retry>=E.maxRetry||y>=400&&y<499?(I.logger.error(y+" while loading "+b.url),this.callbacks.onError({code:y,text:T.statusText},b,T)):(I.logger.warn(y+" 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,E.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout)},R.loadtimeout=function(){I.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(b){var T=this.stats;T.loaded=b.loaded,b.lengthComputable&&(T.total=b.total)},R.getCacheAge=function(){var b=null;if(this.loader&&x.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");b=T?parseFloat(T):null}return b},M}();N.default=U}}).default})},vHTk:function(ft,Ge,W){ft.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return lt});var oe=W("rePB"),N=W("VTBJ"),S=W("KQm4"),I=W("U8pU"),v=W("ODXe"),x=W("q1tI"),U=W("TSYQ"),M=W.n(U),R=W("Gytx"),w=W.n(R),b=W("Kwbf"),T=W("t23M"),O=W("qx4F"),C=W("6eGT"),E=W("IBYe"),y=W("Ff2n"),h=W("c+Xe"),r=W("fyJ8"),o=W("biw7");function s(fe,ye,Re,Ie,Ce){var Ae=Re[fe]||{},ae=Re[ye]||{},ee,te;Ae.fixed==="left"?ee=Ie.left[fe]:ae.fixed==="right"&&(te=Ie.right[ye]);var H=!1,G=!1,V=!1,Q=!1,de=Re[ye+1],ge=Re[fe-1];if(Ce==="rtl"){if(ee!==void 0){var Me=ge&&ge.fixed==="left";Q=!Me}else if(te!==void 0){var et=de&&de.fixed==="right";V=!et}}else if(ee!==void 0){var dt=de&&de.fixed==="left";H=!dt}else if(te!==void 0){var qe=ge&&ge.fixed==="right";G=!qe}return{fixLeft:ee,fixRight:te,lastFixLeft:H,firstFixRight:G,lastFixRight:V,firstFixLeft:Q,isSticky:Ie.isSticky}}var f=W("sR1s");function d(fe){var ye=fe.cells,Re=fe.stickyOffsets,Ie=fe.flattenColumns,Ce=fe.rowComponent,Ae=fe.cellComponent,ae=fe.onHeaderRow,ee=fe.index,te=x.useContext(o.a),H=te.prefixCls,G=te.direction,V;ae&&(V=ae(ye.map(function(de){return de.column}),ee));var Q=Object(f.a)(ye.map(function(de){return de.column}));return x.createElement(Ce,Object.assign({},V),ye.map(function(de,ge){var Me=de.column,et=s(de.colStart,de.colEnd,Ie,Re,G),dt;return Me&&Me.onHeaderCell&&(dt=de.column.onHeaderCell(Me)),x.createElement(r.a,Object.assign({},de,{ellipsis:Me.ellipsis,align:Me.align,component:Ae,prefixCls:H,key:Q[ge]},et,{additionalProps:dt,rowType:"header"}))}))}d.displayName="HeaderRow";var l=d;function m(fe){var ye=[];function Re(ae,ee){var te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;ye[te]=ye[te]||[];var H=ee,G=ae.filter(Boolean).map(function(V){var Q={key:V.key,className:V.className||"",children:V.title,column:V,colStart:H},de=1,ge=V.children;return ge&&ge.length>0&&(de=Re(ge,H,te+1).reduce(function(Me,et){return Me+et},0),Q.hasSubColumns=!0),"colSpan"in V&&(de=V.colSpan),"rowSpan"in V&&(Q.rowSpan=V.rowSpan),Q.colSpan=de,Q.colEnd=Q.colStart+de-1,ye[te].push(Q),H+=de,de});return G}Re(fe,0);for(var Ie=ye.length,Ce=function(ee){ye[ee].forEach(function(te){!("rowSpan"in te)&&!te.hasSubColumns&&(te.rowSpan=Ie-ee)})},Ae=0;Ae<Ie;Ae+=1)Ce(Ae);return ye}function c(fe){var ye=fe.stickyOffsets,Re=fe.columns,Ie=fe.flattenColumns,Ce=fe.onHeaderRow,Ae=x.useContext(o.a),ae=Ae.prefixCls,ee=Ae.getComponent,te=x.useMemo(function(){return m(Re)},[Re]),H=ee(["header","wrapper"],"thead"),G=ee(["header","row"],"tr"),V=ee(["header","cell"],"th");return x.createElement(H,{className:"".concat(ae,"-thead")},te.map(function(Q,de){var ge=x.createElement(l,{key:de,flattenColumns:Ie,cells:Q,stickyOffsets:ye,rowComponent:G,cellComponent:V,onHeaderRow:Ce,index:de});return ge}))}var i=c,n=W("hW8S");function t(fe){for(var ye=fe.colWidths,Re=fe.columns,Ie=fe.columCount,Ce=[],Ae=Ie||Re.length,ae=!1,ee=Ae-1;ee>=0;ee-=1){var te=ye[ee],H=Re&&Re[ee],G=H&&H[n.a];(te||G||ae)&&(Ce.unshift(x.createElement("col",Object.assign({key:ee,style:{width:te,minWidth:te}},G))),ae=!0)}return x.createElement("colgroup",null,Ce)}var e=t;function p(fe,ye){return Object(x.useMemo)(function(){for(var Re=[],Ie=0;Ie<ye;Ie+=1){var Ce=fe[Ie];if(Ce!==void 0)Re[Ie]=Ce;else return null}return Re},[fe.join("_"),ye])}var g=x.forwardRef(function(fe,ye){var Re=fe.noData,Ie=fe.columns,Ce=fe.flattenColumns,Ae=fe.colWidths,ae=fe.columCount,ee=fe.stickyOffsets,te=fe.direction,H=fe.fixHeader,G=fe.offsetHeader,V=fe.stickyClassName,Q=fe.onScroll,de=Object(y.a)(fe,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),ge=x.useContext(o.a),Me=ge.prefixCls,et=ge.scrollbarSize,dt=ge.isSticky,qe=dt&&!H?0:et,Ct=x.useRef(null),_t=x.useCallback(function(Bt){Object(h.b)(ye,Bt),Object(h.b)(Ct,Bt)},[]);x.useEffect(function(){var Bt;function Nt(Ze){var Yt=Ze.currentTarget,or=Ze.deltaX;or&&(Q({currentTarget:Yt,scrollLeft:Yt.scrollLeft+or}),Ze.preventDefault())}return(Bt=Ct.current)===null||Bt===void 0||Bt.addEventListener("wheel",Nt),function(){var Ze;(Ze=Ct.current)===null||Ze===void 0||Ze.removeEventListener("wheel",Nt)}},[]);var ot=Ce[Ce.length-1],It={fixed:ot?ot.fixed:null,onHeaderCell:function(){return{className:"".concat(Me,"-cell-scrollbar")}}},At=Object(x.useMemo)(function(){return qe?[].concat(Object(S.a)(Ie),[It]):Ie},[qe,Ie]),Ot=Object(x.useMemo)(function(){return qe?[].concat(Object(S.a)(Ce),[It]):Ce},[qe,Ce]),Wt=Object(x.useMemo)(function(){var Bt=ee.right,Nt=ee.left;return Object(N.a)(Object(N.a)({},ee),{},{left:te==="rtl"?[].concat(Object(S.a)(Nt.map(function(Ze){return Ze+qe})),[0]):Nt,right:te==="rtl"?Bt:[].concat(Object(S.a)(Bt.map(function(Ze){return Ze+qe})),[0]),isSticky:dt})},[qe,ee,dt]),gt=p(Ae,ae);return x.createElement("div",{style:Object(N.a)({overflow:"hidden"},dt?{top:G}:{}),ref:_t,className:M()("".concat(Me,"-header"),Object(oe.a)({},V,!!V))},x.createElement("table",{style:{tableLayout:"fixed",visibility:Re||gt?null:"hidden"}},x.createElement(e,{colWidths:gt?[].concat(Object(S.a)(gt),[qe]):[],columCount:ae+1,columns:Ot}),x.createElement(i,Object.assign({},de,{stickyOffsets:Wt,columns:At,flattenColumns:Ot}))))});g.displayName="FixedHeader";var _=g,A=x.createContext(null),k=A;function F(fe){var ye=fe.prefixCls,Re=fe.children,Ie=fe.component,Ce=fe.cellComponent,Ae=fe.fixHeader,ae=fe.fixColumn,ee=fe.horizonScroll,te=fe.className,H=fe.expanded,G=fe.componentWidth,V=fe.colSpan,Q=x.useContext(o.a),de=Q.scrollbarSize;return x.useMemo(function(){var ge=Re;return ae&&(ge=x.createElement("div",{style:{width:G-(Ae?de:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(ye,"-expanded-row-fixed")},ge)),x.createElement(Ie,{className:te,style:{display:H?null:"none"}},x.createElement(r.a,{component:Ce,prefixCls:ye,colSpan:V},ge))},[Re,Ie,Ae,ee,te,H,G,V,de])}var z=F;function J(fe){var ye=fe.className,Re=fe.style,Ie=fe.record,Ce=fe.index,Ae=fe.rowKey,ae=fe.getRowKey,ee=fe.rowExpandable,te=fe.expandedKeys,H=fe.onRow,G=fe.indent,V=G===void 0?0:G,Q=fe.rowComponent,de=fe.cellComponent,ge=fe.childrenColumnName,Me=x.useContext(o.a),et=Me.prefixCls,dt=Me.fixedInfoList,qe=x.useContext(k),Ct=qe.fixHeader,_t=qe.fixColumn,ot=qe.horizonScroll,It=qe.componentWidth,At=qe.flattenColumns,Ot=qe.expandableType,Wt=qe.expandRowByClick,gt=qe.onTriggerExpand,Bt=qe.rowClassName,Nt=qe.expandedRowClassName,Ze=qe.indentSize,Yt=qe.expandIcon,or=qe.expandedRowRender,Gt=qe.expandIconColumnIndex,rr=x.useState(!1),$r=Object(v.a)(rr,2),Ir=$r[0],yr=$r[1],pr=te&&te.has(fe.recordKey);x.useEffect(function(){pr&&yr(!0)},[pr]);var Mr=Ot==="row"&&(!ee||ee(Ie)),Nr=Ot==="nest",Kr=ge&&Ie&&Ie[ge],Sr=Mr||Nr,_r;H&&(_r=H(Ie,Ce));var tn=function(a){if(Wt&&Sr&>(Ie,a),_r&&_r.onClick){for(var u,D=arguments.length,B=new Array(D>1?D-1:0),L=1;L<D;L++)B[L-1]=arguments[L];(u=_r).onClick.apply(u,[a].concat(B))}},Ur;typeof Bt=="string"?Ur=Bt:typeof Bt=="function"&&(Ur=Bt(Ie,Ce,V));var wt=Object(f.a)(At),Yr=x.createElement(Q,Object.assign({},_r,{"data-row-key":Ae,className:M()(ye,"".concat(et,"-row"),"".concat(et,"-row-level-").concat(V),Ur,_r&&_r.className),style:Object(N.a)(Object(N.a)({},Re),_r?_r.style:null),onClick:tn}),At.map(function(P,a){var u=P.render,D=P.dataIndex,B=P.className,L=wt[a],se=dt[a],Ne;a===(Gt||0)&&Nr&&(Ne=x.createElement(x.Fragment,null,x.createElement("span",{style:{paddingLeft:"".concat(Ze*V,"px")},className:"".concat(et,"-row-indent indent-level-").concat(V)}),Yt({prefixCls:et,expanded:pr,expandable:Kr,record:Ie,onExpand:gt})));var tt;return P.onCell&&(tt=P.onCell(Ie,Ce)),x.createElement(r.a,Object.assign({className:B,ellipsis:P.ellipsis,align:P.align,component:de,prefixCls:et,key:L,record:Ie,index:Ce,dataIndex:D,render:u,shouldCellUpdate:P.shouldCellUpdate},se,{appendNode:Ne,additionalProps:tt}))})),kr;if(Mr&&(Ir||pr)){var Hr=or(Ie,Ce,V+1,pr),Br=Nt&&Nt(Ie,Ce,V);kr=x.createElement(z,{expanded:pr,className:M()("".concat(et,"-expanded-row"),"".concat(et,"-expanded-row-level-").concat(V+1),Br),prefixCls:et,fixHeader:Ct,fixColumn:_t,horizonScroll:ot,component:Q,componentWidth:It,cellComponent:de,colSpan:At.length},Hr)}var rn;return Kr&&pr&&(rn=(Ie[ge]||[]).map(function(P,a){var u=ae(P,a);return x.createElement(J,Object.assign({},fe,{key:u,rowKey:u,record:P,recordKey:u,index:a,indent:V+1}))})),x.createElement(x.Fragment,null,Yr,kr,rn)}J.displayName="BodyRow";var Y=J,$=x.createContext(null),le=$;function be(fe){var ye=fe.columnKey,Re=fe.onColumnResize,Ie=x.useRef();return x.useEffect(function(){Ie.current&&Re(ye,Ie.current.offsetWidth)},[]),x.createElement(T.a,{onResize:function(Ae){var ae=Ae.offsetWidth;Re(ye,ae)}},x.createElement("td",{ref:Ie,style:{padding:0,border:0,height:0}},x.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function ve(fe){var ye=fe.data,Re=fe.getRowKey,Ie=fe.measureColumnWidth,Ce=fe.expandedKeys,Ae=fe.onRow,ae=fe.rowExpandable,ee=fe.emptyNode,te=fe.childrenColumnName,H=x.useContext(le),G=H.onColumnResize,V=x.useContext(o.a),Q=V.prefixCls,de=V.getComponent,ge=x.useContext(k),Me=ge.fixHeader,et=ge.horizonScroll,dt=ge.flattenColumns,qe=ge.componentWidth;return x.useMemo(function(){var Ct=de(["body","wrapper"],"tbody"),_t=de(["body","row"],"tr"),ot=de(["body","cell"],"td"),It;ye.length?It=ye.map(function(Ot,Wt){var gt=Re(Ot,Wt);return x.createElement(Y,{key:gt,rowKey:gt,record:Ot,recordKey:gt,index:Wt,rowComponent:_t,cellComponent:ot,expandedKeys:Ce,onRow:Ae,getRowKey:Re,rowExpandable:ae,childrenColumnName:te})}):It=x.createElement(z,{expanded:!0,className:"".concat(Q,"-placeholder"),prefixCls:Q,fixHeader:Me,fixColumn:et,horizonScroll:et,component:_t,componentWidth:qe,cellComponent:ot,colSpan:dt.length},ee);var At=Object(f.a)(dt);return x.createElement(Ct,{className:"".concat(Q,"-tbody")},Ie&&x.createElement("tr",{"aria-hidden":"true",className:"".concat(Q,"-measure-row"),style:{height:0}},At.map(function(Ot){return x.createElement(be,{key:Ot,columnKey:Ot,onColumnResize:G})})),It)},[ye,Q,Ae,Ie,Ce,Re,de,qe,ee,dt])}var ke=x.memo(ve);ke.displayName="Body";var Te=ke,xe=W("wRmb"),_e=W("xEkU"),Oe=W.n(_e);function ce(fe){var ye=Object(x.useRef)(fe),Re=Object(x.useState)({}),Ie=Object(v.a)(Re,2),Ce=Ie[1],Ae=Object(x.useRef)(null),ae=Object(x.useRef)([]);function ee(te){Ae.current===null&&(ae.current=[],Ae.current=Oe()(function(){ae.current.forEach(function(H){ye.current=H(ye.current)}),Ae.current=null,Ce({})})),ae.current.push(te)}return Object(x.useEffect)(function(){return function(){Oe.a.cancel(Ae.current)}},[]),[ye.current,ee]}function Z(fe){var ye=Object(x.useRef)(fe),Re=Object(x.useRef)(null);function Ie(){window.clearTimeout(Re.current)}function Ce(ae){ye.current=ae,Ie(),Re.current=window.setTimeout(function(){ye.current=null,Re.current=null},100)}function Ae(){return ye.current}return Object(x.useEffect)(function(){return Ie},[]),[Ce,Ae]}function je(fe,ye,Re){var Ie=Object(x.useMemo)(function(){for(var Ce=[],Ae=[],ae=0,ee=0,te=0;te<ye;te+=1)if(Re==="rtl"){Ae[te]=ee,ee+=fe[te]||0;var H=ye-te-1;Ce[H]=ae,ae+=fe[H]||0}else{Ce[te]=ae,ae+=fe[te]||0;var G=ye-te-1;Ae[G]=ee,ee+=fe[G]||0}return{left:Ce,right:Ae}},[fe,ye,Re]);return Ie}var at=je;function rt(fe){var ye=fe.className,Re=fe.children;return x.createElement("div",{className:ye},Re)}var Ke=rt,He=W("n6Qo");function we(fe){var ye,Re=fe.prefixCls,Ie=fe.record,Ce=fe.onExpand,Ae=fe.expanded,ae=fe.expandable,ee="".concat(Re,"-row-expand-icon");if(!ae)return x.createElement("span",{className:M()(ee,"".concat(Re,"-row-spaced"))});var te=function(G){Ce(Ie,G),G.stopPropagation()};return x.createElement("span",{className:M()(ee,(ye={},Object(oe.a)(ye,"".concat(Re,"-row-expanded"),Ae),Object(oe.a)(ye,"".concat(Re,"-row-collapsed"),!Ae),ye)),onClick:te})}function Fe(fe,ye,Re){var Ie=[];function Ce(Ae){(Ae||[]).forEach(function(ae,ee){Ie.push(ye(ae,ee)),Ce(ae[Re])})}return Ce(fe),Ie}var $e=W("zT1h"),Qe=W("y0+3"),Ve=function(ye,Re){var Ie,Ce,Ae=ye.scrollBodyRef,ae=ye.onScroll,ee=ye.offsetScroll,te=x.useContext(o.a),H=te.prefixCls,G=((Ie=Ae.current)===null||Ie===void 0?void 0:Ie.scrollWidth)||0,V=((Ce=Ae.current)===null||Ce===void 0?void 0:Ce.clientWidth)||0,Q=G&&V*(V/G),de=x.useRef(),ge=ce({scrollLeft:0,isHiddenScrollBar:!1}),Me=Object(v.a)(ge,2),et=Me[0],dt=Me[1],qe=x.useRef({delta:0,x:0}),Ct=x.useState(!1),_t=Object(v.a)(Ct,2),ot=_t[0],It=_t[1],At=function(){It(!1)},Ot=function(Ze){Ze.persist(),qe.current.delta=Ze.pageX-et.scrollLeft,qe.current.x=0,It(!0),Ze.preventDefault()},Wt=function(Ze){var Yt,or=Ze||((Yt=window)===null||Yt===void 0?void 0:Yt.event),Gt=or.buttons;if(!ot||Gt===0){ot&&It(!1);return}var rr=qe.current.x+Ze.pageX-qe.current.x-qe.current.delta;rr<=0&&(rr=0),rr+Q>=V&&(rr=V-Q),ae({scrollLeft:rr/V*(G+2)}),qe.current.x=Ze.pageX},gt=function(){var Ze=Object(Qe.b)(Ae.current).top,Yt=Ze+Ae.current.offsetHeight,or=document.documentElement.scrollTop+window.innerHeight;Yt-Object(O.a)()<=or||Ze>=or-ee?dt(function(Gt){return Object(N.a)(Object(N.a)({},Gt),{},{isHiddenScrollBar:!0})}):dt(function(Gt){return Object(N.a)(Object(N.a)({},Gt),{},{isHiddenScrollBar:!1})})},Bt=function(Ze){dt(function(Yt){return Object(N.a)(Object(N.a)({},Yt),{},{scrollLeft:Ze/G*V||0})})};return x.useImperativeHandle(Re,function(){return{setScrollLeft:Bt}}),x.useEffect(function(){var Nt=Object($e.a)(document.body,"mouseup",At,!1),Ze=Object($e.a)(document.body,"mousemove",Wt,!1);return gt(),function(){Nt.remove(),Ze.remove()}},[Q,ot]),x.useEffect(function(){var Nt=Object($e.a)(window,"scroll",gt,!1),Ze=Object($e.a)(window,"resize",gt,!1);return function(){Nt.remove(),Ze.remove()}},[]),x.useEffect(function(){et.isHiddenScrollBar||dt(function(Nt){var Ze,Yt;return Object(N.a)(Object(N.a)({},Nt),{},{scrollLeft:Ae.current.scrollLeft/((Ze=Ae.current)===null||Ze===void 0?void 0:Ze.scrollWidth)*((Yt=Ae.current)===null||Yt===void 0?void 0:Yt.clientWidth)})})},[et.isHiddenScrollBar]),G<=V||!Q||et.isHiddenScrollBar?null:x.createElement("div",{style:{height:Object(O.a)(),width:V,bottom:ee},className:"".concat(H,"-sticky-scroll")},x.createElement("div",{onMouseDown:Ot,ref:de,className:M()("".concat(H,"-sticky-scroll-bar"),Object(oe.a)({},"".concat(H,"-sticky-scroll-bar-active"),ot)),style:{width:"".concat(Q,"px"),transform:"translate3d(".concat(et.scrollLeft,"px, 0, 0)")}}))},Ue=x.forwardRef(Ve);function Be(fe,ye){return x.useMemo(function(){var Re=!!fe;return{isSticky:Re,stickyClassName:Re?"".concat(ye,"-sticky-header"):"",offsetHeader:Object(I.a)(fe)==="object"&&fe.offsetHeader||0,offsetScroll:Object(I.a)(fe)==="object"&&fe.offsetScroll||0}},[fe,ye])}var ct=[],st={},lt="rc-table-internal-hook",nt=x.memo(function(fe){var ye=fe.children;return ye},function(fe,ye){return w()(fe.props,ye.props)?fe.pingLeft!==ye.pingLeft||fe.pingRight!==ye.pingRight:!1});function ht(fe){var ye,Re=fe.prefixCls,Ie=fe.className,Ce=fe.rowClassName,Ae=fe.style,ae=fe.data,ee=fe.rowKey,te=fe.scroll,H=fe.tableLayout,G=fe.direction,V=fe.title,Q=fe.footer,de=fe.summary,ge=fe.id,Me=fe.showHeader,et=fe.components,dt=fe.emptyText,qe=fe.onRow,Ct=fe.onHeaderRow,_t=fe.internalHooks,ot=fe.transformColumns,It=fe.internalRefs,At=fe.sticky,Ot=ae||ct,Wt=!!Ot.length,gt=x.useState(0),Bt=Object(v.a)(gt,2),Nt=Bt[0],Ze=Bt[1];x.useEffect(function(){Ze(Object(O.a)())});var Yt=x.useMemo(function(){return Object(f.c)(et,{})},[et]),or=x.useCallback(function(Se,Le){return Object(f.b)(Yt,Se)||Le},[Yt]),Gt=x.useMemo(function(){return typeof ee=="function"?ee:function(Se){var Le=Se&&Se[ee];return Le}},[ee]),rr=Object(n.c)(fe),$r=rr.expandIcon,Ir=rr.expandedRowKeys,yr=rr.defaultExpandedRowKeys,pr=rr.defaultExpandAllRows,Mr=rr.expandedRowRender,Nr=rr.onExpand,Kr=rr.onExpandedRowsChange,Sr=rr.expandRowByClick,_r=rr.rowExpandable,tn=rr.expandIconColumnIndex,Ur=rr.expandedRowClassName,wt=rr.childrenColumnName,Yr=rr.indentSize,kr=$r||we,Hr=wt||"children",Br=x.useMemo(function(){return Mr?"row":fe.expandable&&_t===lt&&fe.expandable.__PARENT_RENDER_ICON__||Ot.some(function(Se){return Se&&Object(I.a)(Se)==="object"&&Se[Hr]})?"nest":!1},[!!Mr,Ot]),rn=x.useState(function(){return yr||(pr?Fe(Ot,Gt,Hr):[])}),P=Object(v.a)(rn,2),a=P[0],u=P[1],D=x.useMemo(function(){return new Set(Ir||a||[])},[Ir,a]),B=x.useCallback(function(Se){var Le=Gt(Se,Ot.indexOf(Se)),Je,mt=D.has(Le);mt?(D.delete(Le),Je=Object(S.a)(D)):Je=[].concat(Object(S.a)(D),[Le]),u(Je),Nr&&Nr(!mt,Se),Kr&&Kr(Je)},[Gt,D,Ot,Nr,Kr]),L=x.useState(0),se=Object(v.a)(L,2),Ne=se[0],tt=se[1],pt=Object(xe.b)(Object(N.a)(Object(N.a)(Object(N.a)({},fe),rr),{},{expandable:!!Mr,expandedKeys:D,getRowKey:Gt,onTriggerExpand:B,expandIcon:kr,expandIconColumnIndex:tn,direction:G}),_t===lt?ot:null),We=Object(v.a)(pt,2),bt=We[0],Tt=We[1],Qt=x.useMemo(function(){return{columns:bt,flattenColumns:Tt}},[bt,Tt]),De=x.useRef(),br=x.useRef(),sr=x.useRef(),Rr=x.useState(!1),Cn=Object(v.a)(Rr,2),nn=Cn[0],jr=Cn[1],Qr=x.useState(!1),zr=Object(v.a)(Qr,2),an=zr[0],Tn=zr[1],hn=ce(new Map),bn=Object(v.a)(hn,2),Mn=bn[0],on=bn[1],Er=Object(f.a)(Tt),Jr=Er.map(function(Se){return Mn.get(Se)}),Sn=x.useMemo(function(){return Jr},[Jr.join("_")]),fn=at(Sn,Tt.length,G),qt=te&&Object(f.d)(te.y),Lt=te&&Object(f.d)(te.x),lr=Lt&&Tt.some(function(Se){var Le=Se.fixed;return Le}),jt=x.useRef(),mr=Be(At,Re),Zt=mr.isSticky,pn=mr.offsetHeader,vr=mr.offsetScroll,En=mr.stickyClassName,sn,mn,ln;qt&&(mn={overflowY:"scroll",maxHeight:te.y}),Lt&&(sn={overflowX:"auto"},qt||(mn={overflowY:"hidden"}),ln={width:te.x===!0?"auto":te.x,minWidth:"100%"});var Ar=x.useCallback(function(Se,Le){on(function(Je){var mt=new Map(Je);return mt.set(Se,Le),mt})},[]),_n=Z(null),un=Object(v.a)(_n,2),Kn=un[0],Hn=un[1];function wn(Se,Le){if(!Le)return;typeof Le=="function"?Le(Se):Le.scrollLeft!==Se&&(Le.scrollLeft=Se)}var vn=function(Le){var Je=Le.currentTarget,mt=Le.scrollLeft,yt=typeof mt=="number"?mt:Je.scrollLeft,er=Je||st;if(!Hn()||Hn()===er){var Tr;Kn(er),wn(yt,br.current),wn(yt,sr.current),wn(yt,(Tr=jt.current)===null||Tr===void 0?void 0:Tr.setScrollLeft)}if(Je){var xr=Je.scrollWidth,Jt=Je.clientWidth;jr(yt>0),Tn(yt<xr-Jt)}},kn=function(){sr.current&&vn({currentTarget:sr.current})},Fr=function(Le){var Je=Le.width;kn(),tt(De.current?De.current.offsetWidth:Je)};x.useEffect(function(){return kn},[]),x.useEffect(function(){Lt&&kn()},[Lt]),x.useEffect(function(){_t===lt&&It&&(It.body.current=sr.current)});var In=or(["table"],"table"),dn=x.useMemo(function(){return H||(lr?te.x==="max-content"?"auto":"fixed":qt||Tt.some(function(Se){var Le=Se.ellipsis;return Le})?"fixed":"auto")},[qt,lr,Tt,H]),Nn,On={colWidths:Sn,columCount:Tt.length,stickyOffsets:fn,onHeaderRow:Ct,fixHeader:qt},gn=x.useMemo(function(){return Wt?null:typeof dt=="function"?dt():dt},[Wt,dt]),Vn=x.createElement(Te,{data:Ot,measureColumnWidth:qt||Lt||Zt,expandedKeys:D,rowExpandable:_r,getRowKey:Gt,onRow:qe,emptyNode:gn,childrenColumnName:Hr}),Un=x.createElement(e,{colWidths:Tt.map(function(Se){var Le=Se.width;return Le}),columns:Tt}),Bn=de&&x.createElement(He.b,null,de(Ot)),Gr=or(["body"]);if(qt||Zt){var jn;typeof Gr=="function"?(jn=Gr(Ot,{scrollbarSize:Nt,ref:sr,onScroll:vn}),On.colWidths=Tt.map(function(Se,Le){var Je=Se.width,mt=Le===bt.length-1?Je-Nt:Je;return typeof mt=="number"&&!Number.isNaN(mt)?mt:(Object(b.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):jn=x.createElement("div",{style:Object(N.a)(Object(N.a)({},sn),mn),onScroll:vn,ref:sr,className:M()("".concat(Re,"-body"))},x.createElement(In,{style:Object(N.a)(Object(N.a)({},ln),{},{tableLayout:dn})},Un,Vn,Bn),Zt&&x.createElement(Ue,{ref:jt,offsetScroll:vr,scrollBodyRef:sr,onScroll:vn})),Nn=x.createElement(x.Fragment,null,Me!==!1&&x.createElement(_,Object.assign({noData:!Ot.length},On,Qt,{direction:G,offsetHeader:pn,stickyClassName:En,ref:br,onScroll:vn})),jn)}else Nn=x.createElement("div",{style:Object(N.a)(Object(N.a)({},sn),mn),className:M()("".concat(Re,"-content")),onScroll:vn,ref:sr},x.createElement(In,{style:Object(N.a)(Object(N.a)({},ln),{},{tableLayout:dn})},Un,Me!==!1&&x.createElement(i,Object.assign({},On,Qt)),Vn,Bn));var Xn=Object(n.b)(fe),Rn=x.createElement("div",Object.assign({className:M()(Re,Ie,(ye={},Object(oe.a)(ye,"".concat(Re,"-rtl"),G==="rtl"),Object(oe.a)(ye,"".concat(Re,"-ping-left"),nn),Object(oe.a)(ye,"".concat(Re,"-ping-right"),an),Object(oe.a)(ye,"".concat(Re,"-layout-fixed"),H==="fixed"),Object(oe.a)(ye,"".concat(Re,"-fixed-header"),qt),Object(oe.a)(ye,"".concat(Re,"-fixed-column"),lr),Object(oe.a)(ye,"".concat(Re,"-scroll-horizontal"),Lt),Object(oe.a)(ye,"".concat(Re,"-has-fix-left"),Tt[0]&&Tt[0].fixed),Object(oe.a)(ye,"".concat(Re,"-has-fix-right"),Tt[Tt.length-1]&&Tt[Tt.length-1].fixed==="right"),ye)),style:Ae,id:ge,ref:De},Xn),x.createElement(nt,{pingLeft:nn,pingRight:an,props:Object(N.a)(Object(N.a)({},fe),{},{stickyOffsets:fn,mergedExpandedKeys:D})},V&&x.createElement(Ke,{className:"".concat(Re,"-title")},V(Ot)),x.createElement("div",{className:"".concat(Re,"-container")},Nn),Q&&x.createElement(Ke,{className:"".concat(Re,"-footer")},Q(Ot))));Lt&&(Rn=x.createElement(T.a,{onResize:Fr},Rn));var $n=x.useMemo(function(){return{prefixCls:Re,getComponent:or,scrollbarSize:Nt,direction:G,fixedInfoList:Tt.map(function(Se,Le){return s(Le,Le,Tt,fn,G)}),isSticky:Zt}},[Re,or,Nt,G,Tt,fn,G,Zt]),Yn=x.useMemo(function(){return Object(N.a)(Object(N.a)({},Qt),{},{tableLayout:dn,rowClassName:Ce,expandedRowClassName:Ur,componentWidth:Ne,fixHeader:qt,fixColumn:lr,horizonScroll:Lt,expandIcon:kr,expandableType:Br,expandRowByClick:Sr,expandedRowRender:Mr,onTriggerExpand:B,expandIconColumnIndex:tn,indentSize:Yr})},[Qt,dn,Ce,Ur,Ne,qt,lr,Lt,kr,Br,Sr,Mr,B,tn,Yr]),ze=x.useMemo(function(){return{onColumnResize:Ar}},[Ar]);return x.createElement(o.a.Provider,{value:$n},x.createElement(k.Provider,{value:Yn},x.createElement(le.Provider,{value:ze},Rn)))}ht.Column=E.a,ht.ColumnGroup=C.a,ht.Summary=He.a,ht.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var ut=Ge.b=ht},wRmb:function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return w});var oe=W("rePB"),N=W("KQm4"),S=W("VTBJ"),I=W("Ff2n"),v=W("q1tI"),x=W.n(v),U=W("Kwbf"),M=W("Zm9Q"),R=W("hW8S");function w(E){return Object(M.a)(E).filter(function(y){return v.isValidElement(y)}).map(function(y){var h=y.key,r=y.props,o=r.children,s=Object(I.a)(r,["children"]),f=Object(S.a)({key:h},s);return o&&(f.children=w(o)),f})}function b(E){return E.reduce(function(y,h){var r=h.fixed,o=r===!0?"left":r,s=h.children;return s&&s.length>0?[].concat(Object(N.a)(y),Object(N.a)(b(s).map(function(f){return Object(S.a)({fixed:o},f)}))):[].concat(Object(N.a)(y),[Object(S.a)(Object(S.a)({},h),{},{fixed:o})])},[])}function T(E){for(var y=!0,h=0;h<E.length;h+=1){var r=E[h];if(y&&r.fixed!=="left")y=!1;else if(!y&&r.fixed==="left"){Object(U.a)(!1,"Index ".concat(h-1," of `columns` missing `fixed='left'` prop."));break}}for(var o=!0,s=E.length-1;s>=0;s-=1){var f=E[s];if(o&&f.fixed!=="right")o=!1;else if(!o&&f.fixed==="right"){Object(U.a)(!1,"Index ".concat(s+1," of `columns` missing `fixed='right'` prop."));break}}}function O(E){return E.map(function(y){var h=y.fixed,r=Object(I.a)(y,["fixed"]),o=h;return h==="left"?o="right":h==="right"&&(o="left"),Object(S.a)({fixed:o},r)})}function C(E,y){var h=E.prefixCls,r=E.columns,o=E.children,s=E.expandable,f=E.expandedKeys,d=E.getRowKey,l=E.onTriggerExpand,m=E.expandIcon,c=E.rowExpandable,i=E.expandIconColumnIndex,n=E.direction,t=E.expandRowByClick,e=v.useMemo(function(){return r||w(o)},[r,o]),p=v.useMemo(function(){if(s){var A,k=i||0,F=e[k],z=(A={},Object(oe.a)(A,R.a,{className:"".concat(h,"-expand-icon-col")}),Object(oe.a)(A,"title",""),Object(oe.a)(A,"fixed",F?F.fixed:null),Object(oe.a)(A,"className","".concat(h,"-row-expand-icon-cell")),Object(oe.a)(A,"render",function($,le,be){var ve=d(le,be),ke=f.has(ve),Te=c?c(le):!0,xe=m({prefixCls:h,expanded:ke,expandable:Te,record:le,onExpand:l});return t?v.createElement("span",{onClick:function(Oe){return Oe.stopPropagation()}},xe):xe}),A),J=e.slice();return k>=0&&J.splice(k,0,z),J}return e},[s,e,d,f,m,n]),g=v.useMemo(function(){var A=p;return y&&(A=y(A)),A.length||(A=[{render:function(){return null}}]),A},[y,p,n]),_=v.useMemo(function(){return n==="rtl"?O(b(g)):b(g)},[g,n]);return[g,_]}Ge.b=C},wwSX:function(ft,Ge,W){ft.exports=W.p+"static/b2.2c844a2a.svg"},"y0+3":function(ft,Ge,W){"use strict";W.d(Ge,"a",function(){return b}),W.d(Ge,"b",function(){return O});var oe=/margin|padding|width|height|max|min|offset/,N={left:!0,top:!0},S={cssFloat:1,styleFloat:1,float:1};function I(C){return C.nodeType===1?C.ownerDocument.defaultView.getComputedStyle(C,null):{}}function v(C,E,y){if(E=E.toLowerCase(),y==="auto"){if(E==="height")return C.offsetHeight;if(E==="width")return C.offsetWidth}return E in N||(N[E]=oe.test(E)),N[E]?parseFloat(y)||0:y}function x(C,E){var y=arguments.length,h=I(C);return E=S[E]?"cssFloat"in C.style?"cssFloat":"styleFloat":E,y===1?h:v(C,E,h[E]||C.style[E])}function U(C,E,y){var h=arguments.length;if(E=S[E]?"cssFloat"in C.style?"cssFloat":"styleFloat":E,h===3)return typeof y=="number"&&oe.test(E)&&(y="".concat(y,"px")),C.style[E]=y,y;for(var r in E)E.hasOwnProperty(r)&&U(C,r,E[r]);return I(C)}function M(C){return C===document.body?document.documentElement.clientWidth:C.offsetWidth}function R(C){return C===document.body?window.innerHeight||document.documentElement.clientHeight:C.offsetHeight}function w(){var C=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),E=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:C,height:E}}function b(){var C=document.documentElement.clientWidth,E=window.innerHeight||document.documentElement.clientHeight;return{width:C,height:E}}function T(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function O(C){var E=C.getBoundingClientRect(),y=document.documentElement;return{left:E.left+(window.pageXOffset||y.scrollLeft)-(y.clientLeft||document.body.clientLeft||0),top:E.top+(window.pageYOffset||y.scrollTop)-(y.clientTop||document.body.clientTop||0)}}},y3Jh:function(ft,Ge,W){"use strict";W.r(Ge);var oe=W("fV52"),N=W("3I+P"),S=W("g9YV"),I=W("wCAj"),v=W("Znn+"),x=W("ZTPi"),U=W("5NDa"),M=W("5rEg"),R=W("OaEy"),w=W("2fM7"),b=W("lUTK"),T=W("BvKs"),O=W("2qtc"),C=W("kLXV"),E=W("miYZ"),y=W("tsqr"),h=W("k1fw"),r=W("oBTY"),o=W("+L6B"),s=W("2/Rp"),f=W("qVdP"),d=W("jsC+"),l=W("9og8"),m=W("tJVT"),c=W("PpiC"),i=W("WmNS"),n=W.n(i),t=W("q1tI"),e=W.n(t),p=W("Ty5D"),g=W("9kvl"),_=W("9Bee"),A=W("wd/R"),k=W.n(A),F=W("m3rI"),z=W("ErOA"),J=W("5A5F"),Y=W.n(J),$=W("xKgJ"),le=W("zqRK"),be=W.n(le),ve=W("uf8j"),ke=W.n(ve),Te=W("yR49"),xe=W.n(Te),_e=W("3SPk"),Oe=W.n(_e),ce=W("eZjB"),Z=W.n(ce),je=W("t6v1"),at=W.n(je),rt=W("+92d"),Ke=W.n(rt),He=W("wwSX"),we=W.n(He),Fe=W("zlzj"),$e=W.n(Fe),Qe=W("+RDj"),Ve=W.n(Qe),Ue=W("LvDl"),Be=W.n(Ue),ct=W("1vsH"),st=W("yDOu"),lt=W.n(st),nt=function(ut){var fe,ye,Re,Ie,Ce,Ae,ae,ee,te,H,G,V,Q,de,ge,Me,et,dt=ut.globalSetting,qe=ut.user,Ct=ut.dispatch,_t=Object(c.a)(ut,["globalSetting","user","dispatch"]),ot=Object(p.h)(),It={page:1,per_page:30,tag_discipline_id:[-1],source_discipline_id:[-1],status:null,difficulty:null,search:"",save_search:"",sort_by:null,sort_direction:null,filter:(ot==null||((fe=ot.query)===null||fe===void 0)?void 0:fe.tab)||"public"},At=Object(t.useState)(0),Ot=Object(m.a)(At,2),Wt=Ot[0],gt=Ot[1],Bt=Object(t.useState)(0),Nt=Object(m.a)(Bt,2),Ze=Nt[0],Yt=Nt[1],or=Object(t.useState)(0),Gt=Object(m.a)(or,2),rr=Gt[0],$r=Gt[1],Ir=Object(t.useState)([]),yr=Object(m.a)(Ir,2),pr=yr[0],Mr=yr[1],Nr=Object(t.useState)([]),Kr=Object(m.a)(Nr,2),Sr=Kr[0],_r=Kr[1],tn=Object(t.useState)({}),Ur=Object(m.a)(tn,2),wt=Ur[0],Yr=Ur[1],kr=Object(t.useState)(!1),Hr=Object(m.a)(kr,2),Br=Hr[0],rn=Hr[1],P=Object(t.useState)([]),a=Object(m.a)(P,2),u=a[0],D=a[1],B=Object(t.useState)(!0),L=Object(m.a)(B,2),se=L[0],Ne=L[1],tt=Object(t.useState)(null),pt=Object(m.a)(tt,2),We=pt[0],bt=pt[1],Tt=Object(t.useState)(It),Qt=Object(m.a)(Tt,2),De=Qt[0],br=Qt[1],sr=Object(t.useRef)(null),Rr=Object(t.useRef)(null),Cn=Object(t.useState)([]),nn=Object(m.a)(Cn,2),jr=nn[0],Qr=nn[1],zr=Object(t.useMemo)(function(){return["not_reviewed","under_review","review_finished"].includes(De.filter)},[De.filter]),an=Object(t.useState)(!1),Tn=Object(m.a)(an,2),hn=Tn[0],bn=Tn[1],Mn=Object(t.useState)(!1),on=Object(m.a)(Mn,2),Er=on[0],Jr=on[1],Sn=Object(t.useState)(""),fn=Object(m.a)(Sn,2),qt=fn[0],Lt=fn[1],lr=Object(t.useState)([]),jt=Object(m.a)(lr,2),mr=jt[0],Zt=jt[1],pn=Object(t.useState)(!1),vr=Object(m.a)(pn,2),En=vr[0],sn=vr[1],mn=Object(t.useState)([]),ln=Object(m.a)(mn,2),Ar=ln[0],_n=ln[1],un=function(){var ze=Object(l.a)(n.a.mark(function Se(Le,Je,mt){var yt,er,Tr,xr,Jt;return n.a.wrap(function(cn){for(;;)switch(cn.prev=cn.next){case 0:return Le.persist(),Le!=null&&(yt=Le.target)!==null&&yt!==void 0&&(er=yt.style)!==null&&er!==void 0&&er.pointerEvents&&(Le.target.style.pointerEvents="none"),cn.next=4,Object(z.a)("/api/practices/".concat(Je.identifier,"/start"),{method:"get"});case 4:if(Jt=cn.sent,!((Jt==null?void 0:Jt.status)===0)){cn.next=10;break}if(!mt){cn.next=9;break}return Object(ct.Q)("/problems/".concat(Jt==null?void 0:Jt.identifier,"/oj/").concat(Je==null?void 0:Je.identifier,"?tab=3")),cn.abrupt("return");case 9:Object(ct.Q)("/problems/".concat(Jt==null?void 0:Jt.identifier,"/oj/").concat(Je==null?void 0:Je.identifier));case 10:Le!=null&&(Tr=Le.target)!==null&&Tr!==void 0&&(xr=Tr.style)!==null&&xr!==void 0&&xr.pointerEvents&&(Le.target.style.pointerEvents="auto");case 11:case"end":return cn.stop()}},Se)}));return function(Le,Je,mt){return ze.apply(this,arguments)}}();Object(t.useEffect)(function(){var ze=k()().add(0,"days").unix(),Se=localStorage.getItem("problemsclose");if(!Se){sn(!0);return}ze>parseInt(Se)&&sn(!0)},[]);var Kn=["\u672A\u53D1\u5E03","\u5DF2\u516C\u5F00","\u672A\u5BA1\u6838","\u5BA1\u6838\u4E2D","\u672A\u516C\u5F00","\u672A\u901A\u8FC7"],Hn=[{title:"\u9898\u76EE\u540D\u79F0",dataIndex:"name",ellipsis:!0,render:function(Se,Le){return e.a.createElement("div",{className:Y.a.titleWarp},(De==null?void 0:De.filter)==="mine"?e.a.createElement("span",{className:Y.a.tag},Kn[Le.practice_status]):null,e.a.createElement("span",{title:Se,className:Y.a.hov,onClick:function(mt){return un(mt,Le)}},Se))}},(De==null?void 0:De.filter)==="public"?{title:"\u9898\u89E3",dataIndex:"solution_count",width:100,sorter:!0,render:function(Se,Le){return e.a.createElement("span",{style:{display:"flex"}},e.a.createElement("span",{onClick:function(mt){return un(mt,Le,!0)},className:"current"},Se),(Le==null?void 0:Le.has_video_solution)&&e.a.createElement("img",{className:"ml5",src:be.a}))}}:null,(De==null?void 0:De.filter)==="public"?{title:"\u901A\u8FC7\u7387",dataIndex:"pass_ratio",sorter:!0,width:90}:null,{title:"\u96BE\u5EA6",dataIndex:"difficulty",sorter:!0,align:"center",width:90,render:function(Se){return e.a.createElement(e.a.Fragment,null,Se===1&&e.a.createElement("span",{className:Y.a["btn-style-1"]},"\u7B80\u5355"),Se===2&&e.a.createElement("span",{className:Y.a["btn-style-2"]},"\u9002\u4E2D"),Se===3&&e.a.createElement("span",{className:Y.a["btn-style-3"]},"\u56F0\u96BE"))}},(De==null?void 0:De.filter)==="public"?{title:"\u4EBA\u6570",dataIndex:"user_count",align:"center",sorter:!0,width:80}:null,(De==null?void 0:De.filter)==="public"?{title:"\u72B6\u6001",dataIndex:"status",width:90,render:function(Se,Le){return Object($.p)()?e.a.createElement(e.a.Fragment,null,We===(Le==null?void 0:Le.identifier)?e.a.createElement("span",{className:Y.a.hovBtn,onClick:function(mt){return un(mt,Le)}},"\u5F00\u542F\u5237\u9898"):e.a.createElement(e.a.Fragment,null,Se===0&&e.a.createElement("span",{style:{color:"#666666"}},"\u672A\u5F00\u542F"),Se===1&&e.a.createElement("span",{style:{color:"#666666"}},"\u8FDB\u884C\u4E2D"),Se===2&&e.a.createElement("span",{style:{color:"#666666"}},"\u5DF2\u901A\u8FC7"))):"-"}}:null,(De==null?void 0:De.filter)!=="public"?{title:"\u77E5\u8BC6\u70B9",dataIndex:"tag_disciplines_name",ellipsis:!0,width:200,render:function(Se){return e.a.createElement("span",null,Se==null?void 0:Se.join("\u3001"))}}:null,(De==null?void 0:De.filter)==="all"?{title:"\u521B\u5EFA\u8005",dataIndex:"creator",ellipsis:!0,width:100}:null,(De==null?void 0:De.filter)!=="public"?{title:"\u66F4\u65B0\u65F6\u95F4",dataIndex:"updated_at",sorter:!0,width:180}:null,Object($.v)()?{title:"\u64CD\u4F5C",dataIndex:"action",key:"action",align:"center",width:80,render:function(Se,Le){return e.a.createElement(d.a,{className:"ml10",overlay:Xn(Le==null?void 0:Le.identifier,Le)},e.a.createElement("span",{style:{cursor:"default"},onClick:function(mt){return mt.preventDefault()}},e.a.createElement("span",{className:"c-grey-666"},"\u66F4\u591A"),e.a.createElement("i",{style:{display:"inline-block",transform:"scale(0.6)",fontSize:12},className:"c-grey-c iconfont icon-xiajiantou1"})))}}:Br&&(De==null?void 0:De.filter)!=="public"?{title:"\u64CD\u4F5C",dataIndex:"action",key:"action",align:"center",width:80,render:function(Se,Le){return Le!=null&&Le.is_self&&(Le==null?void 0:Le.practice_status)!==1?e.a.createElement(d.a,{className:"ml10",overlay:Rn(Le==null?void 0:Le.identifier,Le)},e.a.createElement("span",{style:{cursor:"default"},onClick:function(mt){return mt.preventDefault()}},e.a.createElement("span",{className:"c-grey-666"},"\u66F4\u591A"),e.a.createElement("i",{style:{display:"inline-block",transform:"scale(0.6)",fontSize:12},className:"c-grey-c iconfont icon-xiajiantou1"}))):"-"}}:null].filter(function(ze){return!!ze}),wn=[{title:"\u9898\u76EE\u540D\u79F0",dataIndex:"name",ellipsis:!0,render:function(Se,Le){return e.a.createElement("span",{className:Y.a.hov,onClick:function(mt){return un(mt,Le)}},Se)}},{title:"\u96BE\u5EA6",dataIndex:"difficulty",sorter:!0,align:"center",width:90,render:function(Se){return e.a.createElement(e.a.Fragment,null,Se===1&&e.a.createElement("span",{className:Y.a["btn-style-1"]},"\u7B80\u5355"),Se===2&&e.a.createElement("span",{className:Y.a["btn-style-2"]},"\u9002\u4E2D"),Se===3&&e.a.createElement("span",{className:Y.a["btn-style-3"]},"\u56F0\u96BE"))}},(De==null?void 0:De.filter)==="not_reviewed"?{title:"\u521B\u5EFA\u8005",dataIndex:"creator",ellipsis:!0,width:100}:{title:"\u5BA1\u6838\u8005",dataIndex:"reviewer",ellipsis:!0,width:100},(De==null?void 0:De.filter)==="not_reviewed"?{title:"\u53D1\u5E03\u65F6\u95F4",dataIndex:"submit_time",width:180}:null,(De==null?void 0:De.filter)==="under_review"?{title:"\u5F00\u59CB\u5BA1\u6838\u65F6\u95F4",dataIndex:"start_review_time",width:180}:null,(De==null?void 0:De.filter)==="review_finished"?{title:"\u6700\u540E\u5BA1\u6838\u65F6\u95F4",dataIndex:"review_time",width:180}:null,{title:"\u64CD\u4F5C",dataIndex:"action",key:"action",align:"center",width:120,render:function(Se,Le){var Je;switch(De==null?void 0:De.filter){case"under_review":Je=e.a.createElement("div",{style:{display:"flex"}},e.a.createElement(s.a,{type:"link",size:"small",onClick:function(yt){return un(yt,Le)}},"\u5BA1\u6838"),e.a.createElement(s.a,{type:"link",style:{color:"#666"},size:"small",onClick:function(yt){return In({e:yt,record:Le,op:"release"})}},"\u79FB\u51FA"));break;case"review_finished":Je=e.a.createElement(s.a,{type:"link",size:"small",onClick:function(yt){bn(!0),vn(Le)}},"\u5BA1\u6838\u8BB0\u5F55");break;default:Je=e.a.createElement(s.a,{type:"link",block:!0,onClick:function(yt){return In({e:yt,record:Le,op:"claim"})}},"\u5F00\u59CB\u5BA1\u6838");break}return Je}}].filter(function(ze){return!!ze}),vn=function(){var ze=Object(l.a)(n.a.mark(function Se(Le){var Je;return n.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:return Zt([]),yt.next=3,Object(z.a)("/api/practices/".concat(Le.identifier,"/review_list"),{method:"get"});case 3:Je=yt.sent,Zt(Je==null?void 0:Je.reviews_list);case 5:case"end":return yt.stop()}},Se)}));return function(Le){return ze.apply(this,arguments)}}(),kn=[{title:"\u5BA1\u6838\u65F6\u95F4",dataIndex:"review_time",key:"review_time",render:function(Se,Le){return e.a.createElement("span",null,k()(Se).format("YYYY-MM-DD HH:mm:ss"))}},{title:"\u5BA1\u6838\u8005",dataIndex:"reviewer",key:"reviewer"},{title:"\u5BA1\u6838\u7ED3\u679C",dataIndex:"status",width:120,key:"status",render:function(Se,Le){return Se==="5"||Se===5?e.a.createElement("div",{style:{display:"flex",alignItems:"center"}},e.a.createElement("div",{style:{color:"#333333",marginRight:"5px",whiteSpace:"nowrap"}},"\u672A\u901A\u8FC7"),e.a.createElement("div",{style:{color:"#0152d9",whiteSpace:"nowrap",cursor:"pointer"},onClick:function(){Lt(Le.description),Jr(!0)}},"\u67E5\u770B\u539F\u56E0")):e.a.createElement("span",null,"\u5DF2\u901A\u8FC7")}}];Object(t.useEffect)(function(){Nn(),Fr(De)},[]),Object(t.useEffect)(function(){if(pr.length!==0){var ze;(sr==null||((ze=sr.current)===null||ze===void 0)?void 0:ze.clientHeight)>92&>(1)}},[pr]),Object(t.useEffect)(function(){if(Sr.length!==0){var ze;(Rr==null||((ze=Rr.current)===null||ze===void 0)?void 0:ze.clientHeight)>92&&Yt(1)}},[Sr]),Object(t.useEffect)(function(){return Ct({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),Ct({type:"globalSetting/setShowQuestionBackTop",payload:!0}),function(){Ct({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),Ct({type:"globalSetting/setShowQuestionBackTop",payload:!1})}},[]),Object(t.useEffect)(function(){var ze;(document.title==="\u4EBA\u5DE5\u667A\u80FD\u79D1\u7814\u670D\u52A1\u5E73\u53F0"||document.title==="\u9996\u9875"||document.title==="\u5B9E\u8DF5\u6559\u5B66\u5E73\u53F0"||(ze=document.title)!==null&&ze!==void 0&&ze.includes("img"))&&(document.title="\u5728\u7EBF\u5237\u9898")},[dt]),Object(t.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]);var Fr=function(){var ze=Object(l.a)(n.a.mark(function Se(Le){var Je,mt,yt,er;return n.a.wrap(function(xr){for(;;)switch(xr.prev=xr.next){case 0:return yt=Be.a.cloneDeep(Le),yt.tag_discipline_id=(Je=yt.tag_discipline_id)!==null&&Je!==void 0&&Je.includes(-1)?[]:yt.tag_discipline_id,yt.source_discipline_id=(mt=yt.source_discipline_id)!==null&&mt!==void 0&&mt.includes(-1)?[]:yt.source_discipline_id,console.log(yt,"sendData"),Ne(!0),D([]),xr.next=8,Object(z.a)("/api/practices.json",{method:"get",params:yt});case 8:er=xr.sent,Qr([]),Ne(!1),$r(er==null?void 0:er.practices_count),D(er==null?void 0:er.practices_list),_n((er==null?void 0:er.recommend_subjects)||[]);case 14:case"end":return xr.stop()}},Se)}));return function(Le){return ze.apply(this,arguments)}}(),In=function(){var ze=Object(l.a)(n.a.mark(function Se(Le){var Je,mt,yt,er,Tr,xr;return n.a.wrap(function(An){for(;;)switch(An.prev=An.next){case 0:return Je=Le.op,mt=Le.description,yt=Le.record,er=Le.e,Tr={op:Je,description:mt},Ne(!0),An.next=5,Object(z.a)("/api/practices/".concat(yt.identifier,"/review"),{method:"post",body:Tr});case 5:xr=An.sent,Ne(!1),Je==="claim"&&(xr.status===0||xr.status==="0")&&un(er,yt),Fr(De);case 9:case"end":return An.stop()}},Se)}));return function(Le){return ze.apply(this,arguments)}}(),dn=function(){var ze=Object(l.a)(n.a.mark(function Se(Le){var Je;return n.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:return Ne(!0),yt.next=3,Object(z.a)("/api/practices/".concat(Le.identifier,"/publish"),{method:"post"});case 3:Je=yt.sent,Ne(!1),Fr(De);case 6:case"end":return yt.stop()}},Se)}));return function(Le){return ze.apply(this,arguments)}}(),Nn=function(){var ze=Object(l.a)(n.a.mark(function Se(){var Le,Je,mt,yt,er,Tr;return n.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:return Jt.next=2,Object(z.a)("/api/tag_disciplines.json",{method:"get",params:{target:"practice",position:"index"}});case 2:return Je=Jt.sent,Jt.next=5,Object(z.a)("/api/tag_disciplines.json",{method:"get",params:{target:"practice_source",position:"index"}});case 5:return mt=Jt.sent,Jt.next=8,Object(z.a)("/api/mypractices/rank_list",{method:"get",params:{}});case 8:yt=Jt.sent,Je!=null&&Je.tag_disciplines&&(er=[{id:-1,name:"\u5168\u90E8",count:Je==null?void 0:Je.totalCount}].concat(Object(r.a)(Je==null?void 0:Je.tag_disciplines)),Mr(er)),mt!=null&&mt.tag_disciplines&&(Tr=[{id:-1,name:"\u5168\u90E8",count:mt==null?void 0:mt.totalCount}].concat(Object(r.a)(mt==null?void 0:mt.tag_disciplines)),_r(Tr)),Yr(yt||{}),rn(yt==null||((Le=yt.my_record)===null||Le===void 0)?void 0:Le.outsource);case 13:case"end":return Jt.stop()}},Se)}));return function(){return ze.apply(this,arguments)}}(),On=function(Se,Le){var Je;De.page=1;var mt=De["".concat(Le,"_discipline_id")];(Je=De["".concat(Le,"_discipline_id")])!==null&&Je!==void 0&&Je.includes(Se)?mt=mt.filter(function(yt){return yt!==Se}):mt.push(Se),Se===-1?mt=[-1]:(mt=mt.filter(function(yt){return yt!==-1}),mt.length||(mt=[-1])),De["".concat(Le,"_discipline_id")]=mt,br(Object(h.a)({},De)),Fr(De)},gn=function(Se,Le){De.page=1,De[Le]=typeof Se=="number"?Se:null,br(Object(h.a)({},De)),Fr(De)},Vn=function(Se){De.page=1,De.save_search=Se,br(Object(h.a)({},De))},Un=function(Se,Le,Je){De.page=Se==null?void 0:Se.current,De.per_page=Se==null?void 0:Se.pageSize,Je!=null&&Je.order?(De.sort_by=Je==null?void 0:Je.field,De.sort_direction=(Je==null?void 0:Je.order)==="ascend"?"asc":"desc"):(De.sort_by=null,De.sort_direction=null),br(Object(h.a)({},De)),Fr(De)},Bn=function(Se){De.page=1,De.filter=Se,De.status=null,De.practice_status=null,br(Object(h.a)({},De)),Fr(De)},Gr=function(Se,Le){if((Le==null?void 0:Le.length)===0){y.b.warn("\u8BF7\u9009\u62E9\u8BD5\u9898");return}var Je=function(){var mt=Object(l.a)(n.a.mark(function yt(){var er,Tr;return n.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:return Jt.next=2,Object(z.a)("/api/practices/batch_op.json",{method:"post",body:{identifier:Le,op:Se}});case 2:er=Jt.sent,(er==null?void 0:er.status)===0&&(Tr=u.length===1&&De.page!==1?De.page-1:De.page,De.page=Tr,br(Object(h.a)({},De)),Fr(De));case 4:case"end":return Jt.stop()}},yt)}));return function(){return mt.apply(this,arguments)}}();if(Se===-1){C.a.confirm({centered:!0,width:500,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u5220\u9664\u786E\u8BA4",icon:null,className:"custom-modal-divider",content:"\u5220\u9664\u540E\u9898\u76EE\u5C06\u4E0D\u53EF\u518D\u627E\u56DE\u3002",onOk:Je});return}Je()},jn=e.a.createElement(T.a,null,(De==null?void 0:De.filter)==="public"?e.a.createElement(T.a.Item,{onClick:function(){return Gr(0,jr)}},"\u6279\u91CF\u79FB\u51FA\u516C\u5171"):[e.a.createElement(T.a.Item,{key:2,onClick:function(){return Gr(1,jr)}},"\u6279\u91CF\u79FB\u5165\u516C\u5171"),e.a.createElement(T.a.Item,{key:1,onClick:function(){return Gr(0,jr)}},"\u6279\u91CF\u79FB\u51FA\u516C\u5171")],(De==null?void 0:De.filter)!=="public"&&e.a.createElement(T.a.Item,{onClick:function(){return Gr(-1,jr)}},"\u6279\u91CF\u5220\u9664")),Xn=function(Se,Le){return e.a.createElement(T.a,null,(Le==null?void 0:Le.practice_status)===1?e.a.createElement(T.a.Item,{onClick:function(){return Gr(0,[Se])}},"\u79FB\u51FA\u516C\u5171"):e.a.createElement(T.a.Item,{onClick:function(){return Gr(1,[Se])}},"\u79FB\u5165\u516C\u5171"),(De==null?void 0:De.filter)==="mine"?e.a.createElement(T.a.Item,{onClick:function(){return dn(Le)},disabled:![0,4,5].includes(Le.practice_status)},[0,4,5].includes(Le.practice_status)?"\u53D1\u5E03\u5BA1\u6838":"\u5DF2\u53D1\u5E03\u5BA1\u6838"):null,e.a.createElement(T.a.Item,{onClick:function(){return Object(ct.Q)("/problems/".concat(Se,"/ojedit"))}},"\u7F16\u8F91"),(De==null?void 0:De.filter)!=="public"&&e.a.createElement(T.a.Item,{onClick:function(){return Gr(-1,[Se])}},"\u5220\u9664"))},Rn=function(Se,Le){return e.a.createElement(T.a,null,e.a.createElement(T.a.Item,{onClick:function(){return dn(Le)},disabled:![0,4,5].includes(Le.practice_status)},[0,4,5].includes(Le.practice_status)?"\u53D1\u5E03\u5BA1\u6838":"\u5DF2\u53D1\u5E03\u5BA1\u6838"),e.a.createElement(T.a.Item,{onClick:function(){return Object(ct.Q)("/problems/".concat(Se,"/ojedit"))}},"\u7F16\u8F91"),e.a.createElement(T.a.Item,{onClick:function(){return Gr(-1,[Se])}},"\u5220\u9664"))},$n=function(Se){Qr(Se)},Yn={selectedRowKeys:jr,columnWidth:40,onChange:$n};return e.a.createElement("section",{className:Y.a.wrap},e.a.createElement("div",{className:Y.a.bg},e.a.createElement("div",{className:Y.a.btnWrap},e.a.createElement("div",{className:Y.a.text},e.a.createElement("span",null,"\u5728\u7EBF\u5237\u9898"),e.a.createElement("span",null,"\u5FEB\u901F\u63D0\u9AD8\u7F16\u7A0B\u80FD\u529B")),e.a.createElement(d.a,{className:"ml10",overlay:e.a.createElement(T.a,null,e.a.createElement(T.a.Item,{key:1,onClick:function(){g.d.push("/problems/add")}},"\u65B0\u5EFA\u9898\u76EE"),e.a.createElement(T.a.Item,{key:2,onClick:function(){g.d.push("/problems/batchAdd")}},"\u6279\u91CF\u5BFC\u5165\u9898\u76EE"))},e.a.createElement("div",{className:Y.a.btn,style:{visibility:Object($.v)()||Br?"visible":"hidden"}},e.a.createElement("i",{className:"iconfont icon-a-hao font12 mr5"}),e.a.createElement("span",null,"\u65B0\u5EFA\u9898\u76EE"))))),e.a.createElement("div",{className:Y.a.content},e.a.createElement("div",{className:Y.a.left},e.a.createElement("div",{className:Y.a.filterPoint},e.a.createElement("div",{className:Y.a.btnWarp,ref:sr,style:Wt>0?{height:Wt===1?92:"auto"}:{}},pr==null?void 0:pr.map(function(ze){var Se;return e.a.createElement("div",{onClick:function(){return On(ze.id,"tag")},key:ze.id,className:De!=null&&(Se=De.tag_discipline_id)!==null&&Se!==void 0&&Se.includes(ze.id)?Y.a.btnActive:Y.a.btn},e.a.createElement("span",{title:ze.name},ze.name),e.a.createElement("span",{style:{display:ze.count?"block":"none"}},ze.count))}),!!Wt&&e.a.createElement(e.a.Fragment,null,Wt===1?e.a.createElement("div",{onClick:function(){return gt(2)},className:Y.a.action},"\u5C55\u5F00",e.a.createElement("i",{style:{transform:"scale(0.7)"},className:"iconfont icon-xiala"})):e.a.createElement("div",{onClick:function(){return gt(1)},className:Y.a.action},"\u6536\u8D77",e.a.createElement("i",{style:{transform:"rotate(180deg) translateY(1px) scale(0.7)"},className:"iconfont icon-xiala"}))))),!!Sr.length&&e.a.createElement(e.a.Fragment,null,e.a.createElement("div",{className:Y.a.line}),e.a.createElement("div",{className:Y.a.filterOrigin},e.a.createElement("div",{className:Y.a.btnWarp,ref:Rr,style:Ze>0?{height:Ze===1?92:"auto"}:{}},Sr==null?void 0:Sr.map(function(ze){var Se;return e.a.createElement("div",{onClick:function(){return On(ze.id,"source")},key:ze.id,className:De!=null&&(Se=De.source_discipline_id)!==null&&Se!==void 0&&Se.includes(ze.id)?Y.a.btnActive:Y.a.btn},e.a.createElement("span",{title:ze.name},ze.name),e.a.createElement("span",null,ze.count))}),!!Ze&&e.a.createElement(e.a.Fragment,null,Ze===1?e.a.createElement("div",{onClick:function(){return Yt(2)},className:Y.a.action},"\u5C55\u5F00",e.a.createElement("i",{style:{transform:"scale(0.7)"},className:"iconfont icon-xiala"})):e.a.createElement("div",{onClick:function(){return Yt(1)},className:Y.a.action},"\u6536\u8D77",e.a.createElement("i",{style:{transform:"rotate(180deg) translateY(1px) scale(0.7)"},className:"iconfont icon-xiala"})))))),e.a.createElement("div",{className:Y.a.control},e.a.createElement(w.a,{allowClear:!0,placeholder:"\u96BE\u5EA6",value:De==null?void 0:De.difficulty,onChange:function(Se){return gn(Se,"difficulty")}},e.a.createElement(w.a.Option,{value:1},"\u7B80\u5355"),e.a.createElement(w.a.Option,{value:2},"\u9002\u4E2D"),e.a.createElement(w.a.Option,{value:3},"\u56F0\u96BE")),Object($.p)()&&De.filter==="public"&&e.a.createElement(w.a,{allowClear:!0,placeholder:"\u72B6\u6001",value:De==null?void 0:De.status,onChange:function(Se){return gn(Se,"status")}},e.a.createElement(w.a.Option,{value:0},"\u672A\u5F00\u542F"),e.a.createElement(w.a.Option,{value:1},"\u8FDB\u884C\u4E2D"),e.a.createElement(w.a.Option,{value:2},"\u5DF2\u901A\u8FC7")),Object($.p)()&&De.filter==="mine"&&e.a.createElement(w.a,{allowClear:!0,placeholder:"\u72B6\u6001",value:De==null?void 0:De.practice_status,onChange:function(Se){return gn(Se,"practice_status")}},e.a.createElement(w.a.Option,{value:0},"\u672A\u53D1\u5E03"),e.a.createElement(w.a.Option,{value:1},"\u5DF2\u516C\u5F00"),e.a.createElement(w.a.Option,{value:2},"\u672A\u5BA1\u6838"),e.a.createElement(w.a.Option,{value:3},"\u5BA1\u6838\u4E2D"),e.a.createElement(w.a.Option,{value:4},"\u672A\u516C\u5F00"),e.a.createElement(w.a.Option,{value:5},"\u672A\u901A\u8FC7")),Object($.p)()&&De.filter==="all"&&e.a.createElement(w.a,{allowClear:!0,placeholder:"\u72B6\u6001",value:De==null?void 0:De.practice_status,onChange:function(Se){return gn(Se,"practice_status")}},e.a.createElement(w.a.Option,{value:0},"\u672A\u53D1\u5E03"),e.a.createElement(w.a.Option,{value:1},"\u5DF2\u516C\u5F00"),e.a.createElement(w.a.Option,{value:2},"\u672A\u5BA1\u6838"),e.a.createElement(w.a.Option,{value:3},"\u5BA1\u6838\u4E2D"),e.a.createElement(w.a.Option,{value:4},"\u672A\u516C\u5F00"),e.a.createElement(w.a.Option,{value:5},"\u672A\u901A\u8FC7")),e.a.createElement(M.a.Search,{placeholder:Object($.v)()?"\u8BF7\u8F93\u5165\u9898\u76EE\u540D\u79F0\u3001\u521B\u5EFA\u8005\u641C\u7D22":"\u8BF7\u8F93\u5165\u9898\u76EE\u540D\u79F0\u641C\u7D22",value:De==null?void 0:De.save_search,onChange:function(Se){return Vn(Se.target.value)},onSearch:function(){De.page=1,De.search=De.save_search,br(Object(h.a)({},De)),Fr(De)}})),e.a.createElement("div",{className:Y.a.table},e.a.createElement("div",{className:Y.a.tabWarp,style:Object($.v)()||Br?{}:{height:10,border:0}},Object($.v)()?e.a.createElement(x.a,{className:Y.a.tab,activeKey:zr?"not_reviewed":De.filter,onChange:Bn},e.a.createElement(x.a.TabPane,{tab:"\u516C\u5171",key:"public"}),e.a.createElement(x.a.TabPane,{tab:"\u5168\u90E8",key:"all"}),e.a.createElement(x.a.TabPane,{tab:"\u6211\u521B\u5EFA\u7684",key:"mine"}),e.a.createElement(x.a.TabPane,{tab:"\u5BA1\u6838\u5217\u8868",key:"not_reviewed"})):Br?e.a.createElement(x.a,{className:Y.a.tab,activeKey:zr?"not_reviewed":De.filter,onChange:Bn},e.a.createElement(x.a.TabPane,{tab:"\u516C\u5171",key:"public"}),e.a.createElement(x.a.TabPane,{tab:"\u6211\u521B\u5EFA\u7684",key:"mine"}),e.a.createElement(x.a.TabPane,{tab:"\u5BA1\u6838\u5217\u8868",key:"not_reviewed"})):null,Object($.v)()&&!zr&&e.a.createElement(d.a,{overlay:jn},e.a.createElement("span",{className:"ant-dropdown-link font14 current",onClick:function(Se){return Se.preventDefault()}},"\u6279\u91CF\u64CD\u4F5C ",e.a.createElement("i",{style:{display:"inline-block",transform:"scale(0.6)",fontSize:12},className:"iconfont icon-xiajiantou1"})))),zr?e.a.createElement("div",{className:Y.a.tabWarp2,style:Object($.v)()||Br?{}:{height:10,border:0}},e.a.createElement(x.a,{className:Y.a.tab,activeKey:De.filter,onChange:Bn},e.a.createElement(x.a.TabPane,{tab:"\u5F85\u5BA1\u6838",key:"not_reviewed"}),e.a.createElement(x.a.TabPane,{tab:"\u5BA1\u6838\u4E2D",key:"under_review"}),e.a.createElement(x.a.TabPane,{tab:"\u5DF2\u5BA1\u6838",key:"review_finished"}))):null,e.a.createElement(I.a,{rowSelection:Object($.v)()?Yn:void 0,className:Y.a.customTable,dataSource:u,bordered:!1,rowKey:function(Se){return Se.identifier},columns:zr?wn:Hn,rowClassName:Y.a.row,loading:se,onRow:function(Se){return{onMouseEnter:function(Je){bt(Se==null?void 0:Se.identifier)},onMouseLeave:function(Je){bt(null)}}},onChange:Un,pagination:{pageSize:De.per_page,total:rr,current:De.page,showQuickJumper:!0,hideOnSinglePage:!0,showSizeChanger:!1,position:["bottomCenter"],showTotal:function(Se){return e.a.createElement("span",{className:"mr10"},"\u5171",e.a.createElement("span",{className:"c-orange"},Se),"\u6761\u6570\u636E")}}}))),e.a.createElement("div",{className:Y.a.right},e.a.createElement("div",{className:Y.a.title},e.a.createElement("img",{src:Object($.p)()?F.a.IMG_SERVER+"/images/"+(wt==null||((ye=wt.my_record)===null||ye===void 0)?void 0:ye.image_url):Ve.a}),e.a.createElement("span",null,"\u6211\u7684\u5237\u9898\u7EDF\u8BA1")),e.a.createElement("ul",null,e.a.createElement("li",null,e.a.createElement("div",null,e.a.createElement("span",null,"\u901A\u8FC7\u7387"),Object($.p)()?e.a.createElement("span",null,(wt==null||((Re=wt.my_record)===null||Re===void 0)?void 0:Re.passed_ratio)||0,"%"):e.a.createElement("span",null,"-")),e.a.createElement("img",{src:ke.a})),e.a.createElement("li",null,e.a.createElement("div",null,e.a.createElement("span",null,"\u5237\u9898\u6570"),Object($.p)()?e.a.createElement("span",null,(wt==null||((Ie=wt.my_record)===null||Ie===void 0)?void 0:Ie.passed_count)||0):e.a.createElement("span",null,"-")),e.a.createElement("img",{src:xe.a})),e.a.createElement("li",null,e.a.createElement("div",null,e.a.createElement("span",null,"\u65F6\u957F(h)"),Object($.p)()?e.a.createElement("span",null,wt==null||((Ce=wt.my_record)===null||Ce===void 0||((Ae=Ce.time_count)===null||Ae===void 0))?void 0:Ae.toFixed(2)):e.a.createElement("span",null,"-")),e.a.createElement("img",{src:Oe.a}))),!!(wt!=null&&(ae=wt.rank_list)!==null&&ae!==void 0&&ae.length)&&e.a.createElement(e.a.Fragment,null,e.a.createElement("div",{className:Y.a.line}),((ee=qe.userInfo)===null||ee===void 0?void 0:ee.user_id)!=2&&Object($.m)()&&(dt==null||((te=dt.setting)===null||te===void 0)?void 0:te.main_site)&&En&&(Ar==null?void 0:Ar.length)>0&&e.a.createElement("div",{className:Y.a.problemsclose,style:{position:"relative"}},e.a.createElement(N.a,{autoplay:!0,pauseOnDotsHover:!0,style:{width:292,height:170,marginBottom:"10px",overflow:"hidden"}},Ar==null?void 0:Ar.map(function(ze,Se){return e.a.createElement("div",{style:{display:"flex"},key:Se},e.a.createElement("a",{href:"/paths/".concat(ze.identifier)},e.a.createElement("img",{style:{width:"292px",height:"170px",borderRadius:"4px"},src:F.a.IMG_SERVER+"/"+ze.image_url})))})),e.a.createElement("img",{className:Y.a.imgsrc,onClick:function(){localStorage.setItem("problemsclose",k()().add(1,"days").unix()+""),sn(!1)},src:lt.a})),e.a.createElement("div",{className:Y.a.sort},e.a.createElement("div",{className:Y.a.titles},e.a.createElement("img",{src:Z.a}),e.a.createElement("span",null,"\u6392\u884C\u699C")),!!(wt!=null&&(H=wt.my_record)!==null&&H!==void 0&&H.rank)&&e.a.createElement("div",{className:Y.a.li,style:{background:"#D3EAFF"}},e.a.createElement("span",null,e.a.createElement("span",{style:{fontWeight:600,color:"#0152d9"}},(wt==null||((G=wt.my_record)===null||G===void 0)?void 0:G.rank)>999?"999+":wt==null||((V=wt.my_record)===null||V===void 0)?void 0:V.rank)),e.a.createElement("img",{className:"ml10 mr10",style:{borderRadius:"50%"},width:26,height:26,src:F.a.IMG_SERVER+"/images/"+(wt==null||((Q=wt.my_record)===null||Q===void 0)?void 0:Q.image_url)}),e.a.createElement("span",{title:wt==null||((de=wt.my_record)===null||de===void 0)?void 0:de.nickname,style:{color:"#656F87",maxWidth:96,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"}},wt==null||((ge=wt.my_record)===null||ge===void 0)?void 0:ge.nickname),e.a.createElement("img",{className:"ml10",src:at.a}),e.a.createElement("span",{style:{marginLeft:"auto",color:"#0152d9"}},wt==null||((Me=wt.my_record)===null||Me===void 0)?void 0:Me.passed_count,"\u9898")),wt==null||((et=wt.rank_list)===null||et===void 0)?void 0:et.map(function(ze,Se){var Le=Se+1;return Se===0&&(Le=Ke.a),Se===1&&(Le=we.a),Se===2&&(Le=$e.a),e.a.createElement("div",{className:Y.a.li},e.a.createElement("span",null,typeof Le=="number"?e.a.createElement("span",{style:{fontWeight:600}},Le):e.a.createElement("img",{src:Le})),e.a.createElement("img",{className:"ml10 mr10",style:{borderRadius:"50%"},width:26,height:26,src:F.a.IMG_SERVER+"/images/"+(ze==null?void 0:ze.image_url)}),e.a.createElement("span",{title:ze==null?void 0:ze.nickname,style:{color:"#656F87",width:96,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"}},ze==null?void 0:ze.nickname),e.a.createElement("span",{style:{marginLeft:"auto"}},ze.passed_count,"\u9898"))}))))),e.a.createElement(C.a,{title:"\u5BA1\u6838\u8BB0\u5F55",visible:hn,onOk:function(){},onCancel:function(){bn(!1)},footer:null,closable:!0},e.a.createElement(I.a,{dataSource:mr,columns:kn})),e.a.createElement(C.a,{title:"\u672A\u901A\u8FC7\u539F\u56E0",visible:Er,onOk:function(){},onCancel:function(){Jr(!1)},footer:null,closable:!0},e.a.createElement(_.a,{value:qt})))};Ge.default=Object(g.a)(function(ht){var ut=ht.user,fe=ht.globalSetting;return{user:ut,globalSetting:fe}})(nt)},yDOu:function(ft,Ge){ft.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABZlJREFUaEPtmd1rXNUah5/1tfdkkrSNMdWO+C0pp6mKYhURURRFvPFGiwj+A4p44Y30pngj5+ZcHET/AUGkeuONiKIoIqJVRO0UDdpzPAen2hhTm2Qye68vWdlOmYQ2M/2gYaQDw2K+f8/7/t53r/WOYMhvYsj1cxFgszN4MQN/mwzEGM8om0KIeD7gz+hH1//getEvvDBYU9i/nzXizwXmrAB6hXdFN3dV4mcOV2urtRam0ahEN3dV68zhau2FORuQMwI4nfAkurUDsXC0Er00j1hZXAswMk4cm6xET+wgNo4SE8y5ggwM0BXfG/Gu8P8fQibBUxOIzjKi2ILY2l4L8EedmJ8g1kaJcwvEBHTlbsLpQAbNxkAA68V/CHJ6B2JV+CRivIWsaWQxhmgfR47VEbZYC2By4lKbWN9GyJeIHUdYbBBG5iuQ2aPEeyH02moQiIEBegpUNkEmm4xpJAVqSSGlQ3UkMpNIbxG1HOFsBaENsVMQlSGWgVALhKDxY55Ajl9yhGSvmQrgJMR5AeiNfor8FMi5/yLHM6TYhpIlatGitnhUO6BkjvIeoQUy+ApAKqKLBKWIocDXJf6Ewo8bfMjw8Th+sSRMXUOYg5Ay0S3ufhB9M5AAUvRTl5lYQCbb6AKVxPtFdNBo4VFRoaNFC4MSAeUE0oQKwEqijoQo8dHihcEJj4sKLx1OjeMShMvxyU4LE4RU3AninAC60d+7Fzkzg/hsHpVsUxh0V7yJGBcxUaJ1gXnwXhq7ruPqiS1sN4aRVQDLysIJjh0+wk/vfkjL5VgRcFpgrcB2IXKLS3a6YxLfbBIPHKjstBHEhhlYH/3Zo6ipY2iboQuPSeJLR6YzzC3TXPLw3dyxZZTLfED5gOy98ClJUMk6y/z69sd89tUsv7sSm2nKBJErrClxc9tx0zvwg2ZhIIBk4xT9ZB2Xo8uAySMGQS4V2f17uOK+27lHCEasR4VkqYg8iRBSFAlS4Y3Cx8jKB5/z0fsH+Tl4SiJFIbCZxOoCl6yUspAKup+NTgtw0j5vIJP3e6MvOmQdQwbkt+3k0kcf4KEYqTuPDin6EeUdSvz17TGC0ngl8FLitcIJQfvN93jni+/5DShqljLWKNdn4cBjG9toQ4Bu8XIYxR+o5P3lZTJtyYQkN4Havqd5cHSERmkxLqC9Q6c1ZSDGqoiFSMVI0BKnNC6tmcEur9B68WXetZJODBTOUI6OUqZaYCueXfh+xdwXoNc+K2BMXkU+3R++k6vvu537O5bMO4x1mD27eWL+OP9pHuEb/gJAEGeu46bJbVx78BCvGY1VGlszlB98zvtvf8pPKQvpbgvKEbCD2mhgAJ+j6w7T7pAhybVg5LknuWvqEnYWJZkLmNKSTV/Fnssv5ZbWHN8e+oFvUwZ238CNjSlu/OU3vpr9HwczQ6klNs8o537n+3+9yicuskKgqNco2wmwwA1SB30BWi3UbImaqqPbEaMyMueoOcHIP5/iESGZtJYsiU8QzmP+cS23JsGtYzQTQGM7MwnouyN8mSxkFGXKgjGUMTD//Cu8pSMrWtPxJWVdYOfauOkM32jgNyrkMwaIgjwEakZTe/FZHneeuvVktiRLLdV7jA/o3ddzcxK+urU+RvPQj3ytUg2oqnWajDKBaEV737953To6UtIRkeLCATzD4y6eI4Cgve+lCwgwdBbqdqGhLeLz2UYntnLll00OXNA2unrWHdYLWeogezdjK5Fa6J3Vhu6stxJJfHc3OpSbuV6A7mFmKLfTqzYa1gPNqbIwVEfKLkBa09Z6KA/164p5dcgwVGOV9VlIj4dusHUqiNSZhma02J0uDPVwt3dEMrTj9V6IXlt1nx+aPzjWg5wK5lTv6X2u38iw3+e7r/edjQ76RZv1vosAmxX5ixba7Mj/bTLwJ/OqjXyXcOSkAAAAAElFTkSuQmCC"},yR49:function(ft,Ge,W){ft.exports=W.p+"static/b.3edd9583.svg"},zlzj:function(ft,Ge,W){ft.exports=W.p+"static/b3.30079151.svg"},zqRK:function(ft,Ge,W){ft.exports=W.p+"static/v.7a1274ca.svg"}}]);
|