digital-garden/.obsidian/plugins/media-extended/main.js

215 lines
971 KiB
JavaScript
Raw Normal View History

2024-06-13 21:01:37 +03:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository
*/
"use strict";var TB=Object.create;var cd=Object.defineProperty;var SB=Object.getOwnPropertyDescriptor;var EB=Object.getOwnPropertyNames;var PB=Object.getPrototypeOf,CB=Object.prototype.hasOwnProperty;var MB=(t,e,n)=>e in t?cd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var rt=(t,e)=>()=>(t&&(e=t(t=0)),e);var Jt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ot=(t,e)=>{for(var n in e)cd(t,n,{get:e[n],enumerable:!0})},qC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of EB(e))!CB.call(t,i)&&i!==n&&cd(t,i,{get:()=>e[i],enumerable:!(r=SB(e,i))||r.enumerable});return t};var $=(t,e,n)=>(n=t!=null?TB(PB(t)):{},qC(e||!t||!t.__esModule?cd(n,"default",{value:t,enumerable:!0}):n,t)),RB=t=>qC(cd({},"__esModule",{value:!0}),t);var T=(t,e,n)=>(MB(t,typeof e!="symbol"?e+"":e,n),n),t_=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var L=(t,e,n)=>(t_(t,e,"read from private field"),n?n.call(t):e.get(t)),Z=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Ue=(t,e,n,r)=>(t_(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);var V=(t,e,n)=>(t_(t,e,"access private method"),n);var hd=Jt(im=>{"use strict";Object.defineProperty(im,"__esModule",{value:!0});function iM(t,e){if(e)return t;throw new Error("Unhandled discriminated union member: "+JSON.stringify(t))}im.assertNever=iM;im.default=iM});var mR=Jt(Ee=>{"use strict";var kd=Symbol.for("react.element"),Tj=Symbol.for("react.portal"),Sj=Symbol.for("react.fragment"),Ej=Symbol.for("react.strict_mode"),Pj=Symbol.for("react.profiler"),Cj=Symbol.for("react.provider"),Mj=Symbol.for("react.context"),Rj=Symbol.for("react.forward_ref"),$j=Symbol.for("react.suspense"),Ij=Symbol.for("react.memo"),Lj=Symbol.for("react.lazy"),oR=Symbol.iterator;function Aj(t){return t===null||typeof t!="object"?null:(t=oR&&t[oR]||t["@@iterator"],typeof t=="function"?t:null)}var lR={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},cR=Object.assign,uR={};function jl(t,e,n){this.props=t,this.context=e,this.refs=uR,this.updater=n||lR}jl.prototype.isReactComponent={};jl.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};jl.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function dR(){}dR.prototype=jl.prototype;function y_(t,e,n){this.props=t,this.context=e,this.refs=uR,this.updater=n||lR}var v_=y_.prototype=new dR;v_.constructor=y_;cR(v_,jl.prototype);v_.isPureReactComponent=!0;var aR=Array.isArray,pR=Object.prototype.hasOwnProperty,x_={current:null},fR={key:!0,ref:!0,__self:!0,__source:!0};function hR(t,e,n){var r,i={},o=null,a=null;if(e!=null)for(r in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(o=""+e.key),e)pR.call(e,r)&&!fR.hasOwnProperty(r)&&(i[r]=e[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(r in s=t.defaultProps,s)i[r]===void 0&&(i[r]=s[r]);return{$$typeof:kd,type:t,key:o,ref:a,props:i,_owner:x_.current}}function Oj(t,e){return{$$typeof:kd,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function w_(t){return typeof t=="object"&&t!==null&&t.$$typeof===kd}function Fj(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var sR=/\/+/g;function g_(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Fj(""+t.key):e.toString(36)}function Sm(t,e,n,r,i){var o=typeof t;(o==="undefined"||o==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case kd:case Tj:a=!0}}if(a)return a=t,i=i(a),t=r===""?"."+g_(a,0):r,aR(i)?(n="",t!=null&&(n=t.replace(sR,"$&/")+"/"),Sm(i,e,n,"",function(c){return c})):i!=null&&(w_(i)&&(i=Oj(i,n+(!i.key||a&&a
`+R_+t}var $_=!1;function I_(t,e){if(!t||$_)return"";$_=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
`),o=r.stack.split(`
`),a=i.length-1,s=o.length-1;1<=a&&0<=s&&i[a]!==o[s];)s--;for(;1<=a&&0<=s;a--,s--)if(i[a]!==o[s]){if(a!==1||s!==1)do if(a--,s--,0>s||i[a]!==o[s]){var l=`
`+i[a].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=a&&0<=s);break}}}finally{$_=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Od(t):""}function Hj(t){switch(t.tag){case 5:return Od(t.type);case 16:return Od("Lazy");case 13:return Od("Suspense");case 19:return Od("SuspenseList");case 0:case 2:case 15:return t=I_(t.type,!1),t;case 11:return t=I_(t.type.render,!1),t;case 1:return t=I_(t.type,!0),t;default:return""}}function nk(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Kl:return"Fragment";case ql:return"Portal";case J_:return"Profiler";case Kk:return"StrictMode";case ek:return"Suspense";case tk:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case N$:return(t.displayName||"Context")+".Consumer";case D$:return(t._context.displayName||"Context")+".Provider";case Gk:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Yk:return e=t.displayName||null,e!==null?e:nk(t.type)||"Memo";case oa:e=t._payload,t=t._init;try{return nk(t(e))}catch{}}return null}function Wj(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return nk(e);case 8:return e===Kk?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function xa(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function z$(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function qj(t){var e=z$(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Lm(t){t._valueTracker||(t._valueTracker=qj(t))}function U$(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=z$(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function sg(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function rk(t,e){var n=e.checked;return ut({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function IR(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=xa(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function B$(t,e){e=e.checked,e!=null&&qk(t,"checked",e,!1)}function ik(t,e){B$(t,e);var n=xa(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?ok(t,e.type,n):e.hasOwnProperty("defaultValue")&&ok(t,e.type,xa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function LR(t,e,n){if(e.hasOwnProperty("val
`).replace(e7,"")}function Wm(t,e,n){if(e=r$(e),r$(t)!==e&&n)throw Error(U(425))}function mg(){}var xk=null,wk=null;function bk(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var _k=typeof setTimeout=="function"?setTimeout:void 0,t7=typeof clearTimeout=="function"?clearTimeout:void 0,i$=typeof Promise=="function"?Promise:void 0,n7=typeof queueMicrotask=="function"?queueMicrotask:typeof i$<"u"?function(t){return i$.resolve(null).then(t).catch(r7)}:_k;function r7(t){setTimeout(function(){throw t})}function B_(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),Jd(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Jd(e)}function ha(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function o$(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var vc=Math.random().toString(36).slice(2),Li="__reactFiber$"+vc,ip="__reactProps$"+vc,uo="__reactContainer$"+vc,kk="__reactEvents$"+vc,i7="__reactListeners$"+vc,o7="__reactHandles$"+vc;function gs(t){var e=t[Li];if(e)return e;for(var n=t.parentNode;n;){if(e=n[uo]||n[Li]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=o$(t);t!==null;){if(n=t[Li])return n;t=o$(t)}return e}t=n,n=t.parentNode}return null}function fp(t){return t=t[Li]||t[uo],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Xl(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(U(33))}function Og(t){return t[ip]||null}var Tk=[],Zl=-1;function _a(t){return{current:t}}function Xe(t){0>Zl||(t.current=Tk[Zl],Tk[Zl]=null,Zl--)}function je(t,e){Zl++,Tk[Zl]=t.current,t.current=e}var wa={},mn=_a(wa),Bn=_a(!1),bs=wa;function dc(t,e){var n=t.type.contextTypes;if(!n)return wa;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function jn(t){return t=t.childContextTypes,t!=null}function gg(){Xe(Bn),Xe(mn)}function a$(t,e,n){if(mn.current!==wa)throw Error(U(168));je(mn,e),je(Bn,n)}function RI(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(U(108,Wj(t)||"Unknown",i));return ut({},n,r)}function yg(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||wa,bs=mn.current,je(mn,t),je(Bn,Bn.current),!0}function s$(t,e,n){var r=t.stateNode;if(!r)throw Error(U(169));n?(t=RI(t,e,bs),r.__reactInternalMemoizedMergedChildContext=t,Xe(Bn),Xe(mn),je(mn,t)):Xe(Bn),je(Bn,n)}var oo=null,Fg=!1,j_=!1;function $I(t){oo===null?oo=[t]:oo.push(t)}function a7(t){Fg=!0,$I(t)}function ka(){if(!j_&&oo!==null){j_=!0;var t=0,e=Fe;try{var n=oo;for(Fe=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}oo=null,Fg=!1}catch(i){throw oo!==null&&(oo=oo.slice(t+1)),nI(Xk,ka),i}finally{Fe=e,j_=!1}}return null}var Jl=[],ec=0,vg=null,xg=0,Lr=[],Ar=0,_s=null,ao=1,so="";function hs(t,e){Jl[ec++]=xg,Jl[ec++]=vg,vg=t,xg=e}function II(t,e,n){Lr[Ar++]=ao,Lr[Ar++]=so,Lr[Ar++]=_s,_s=t;var r=ao;t=so;var i=32-si(r)-1;r&=~(1<<i),n+=1;var o=32-si(e)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,ao=1<<32-si(e)+i|n<<i|r,so=o+t}else ao=1<<o|n<<i|r,so=t}function a0(t){t.return!==null&&(hs(t,1),II(t,1,0))}function s0(t){for(;t===vg;)vg=Jl[--ec],Jl[ec]=null,xg=Jl[--ec],Jl[ec]=null;for(;t===_s;)_s=Lr[--Ar],Lr[Ar]=null,so=Lr[--Ar],Lr[Ar]=null,ao=Lr[--Ar],Lr[Ar]=null}var ar=null,or=null,it=!1,ai=null;function LI(t,e){var n=Or(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletio
Error generating stack: `+o.message+`
`+o.stack}return{value:t,source:e,stack:i,digest:null}}function G_(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Rk(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var m7=typeof WeakMap=="function"?WeakMap:Map;function sL(t,e,n){n=lo(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Pg||(Pg=!0,zk=r),Rk(t,e)},n}function lL(t,e,n){n=lo(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){Rk(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Rk(t,e),typeof r!="function"&&(ga===null?ga=new Set([this]):ga.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),n}function y$(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new m7;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=M7.bind(null,t,e,n),e.then(t,t))}function v$(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function x$(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=lo(-1,1),e.tag=2,ma(n,e,1))),n.lanes|=1),t)}var g7=ho.ReactCurrentOwner,Un=!1;function Sn(t,e,n,r){e.child=t===null?zI(e,null,n,r):fc(e,t.child,n,r)}function w$(t,e,n,r,i){n=n.render;var o=e.ref;return lc(e,i),r=v0(t,e,n,r,o,i),n=x0(),t!==null&&!Un?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,fo(t,e,i)):(it&&n&&a0(e),e.flags|=1,Sn(t,e,r,i),e.child)}function b$(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!M0(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,cL(t,e,o,r,i)):(t=ag(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:tp,n(a,r)&&t.ref===e.ref)return fo(t,e,i)}return e.flags|=1,t=va(o,r),t.ref=e.ref,t.return=e,e.child=t}function cL(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(tp(o,r)&&t.ref===e.ref)if(Un=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(Un=!0);else return e.lanes=t.lanes,fo(t,e,i)}return $k(t,e,n,r,i)}function uL(t,e,n){var r=e.pendingProps,i=r.children,o=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},je(rc,ir),ir|=n;else{if(!(n&1073741824))return t=o!==null?o.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,je(rc,ir),ir|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,je(rc,ir),ir|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,je(rc,ir),ir|=r;return Sn(t,e,i,n),e.child}function dL(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function $k(t,e,n,r,i){var o=jn(n)?bs:mn.current;return o=dc(e,o),lc(e,i),n=v0(t,e,n,r,o,i),r=x0(),t!==null&&!Un?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,fo(t,e,i)):(it&&r&&a0(e),e.flags|=1,Sn(t,e,n,i),e.child)}function _$(t,e,n,r,i){if(jn(n)){var o=!0;yg(e)}else o=!1;if(lc(e,i),e.stateNode===null)rg(t,e),NI(e,n,r),Mk(e,n,r,i),r=!0;else if(t===null){var a=e.stateNode,s=e.memoizedProps;a.props=s;var l=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=Dr(c):(c=jn(n)?bs:mn.current,c=dc(e,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==r||l!==c)&&f$(e,a,r,c),aa=!1;var p=e.memoizedState;a.state=p,_g(e,r,a,i),l=e.memoizedState,s!==r||p!==l||Bn.current||aa?(typeof u=="function"&&(Ck(e,n,u,r),l=e.memoizedState),(s=aa||p$(e,n,s,r,p,l,c))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.
`:"")+e;else if(e.includes(i9)){let r=this.o(e,n);r&&(this.a=new xo(r[0],r[1],r[2].join(" ")),this.a.id=this.l,this.c=Rc.Cue)}this.l=e}o(e,n){return super.o(e.replace(r9,"."),n)}}});var pT={};Ot(pT,{ParseErrorBuilder:()=>a9});var a9,fT=rt(()=>{"use strict";Cp();a9={p(){return new Kn({code:Ur.BadSignature,reason:"missing WEBVTT file header",line:1})},q(t,e){return new Kn({code:Ur.BadTimestamp,reason:`cue start timestamp \`${t}\` is invalid on line ${e}`,line:e})},r(t,e){return new Kn({code:Ur.BadTimestamp,reason:`cue end timestamp \`${t}\` is invalid on line ${e}`,line:e})},s(t,e,n){return new Kn({code:Ur.BadTimestamp,reason:`cue end timestamp \`${e}\` is greater than start \`${t}\` on line ${n}`,line:n})},w(t,e,n){return new Kn({code:Ur.BadSettingValue,reason:`invalid value for cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},v(t,e,n){return new Kn({code:Ur.UnknownSetting,reason:`unknown cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},u(t,e,n){return new Kn({code:Ur.BadSettingValue,reason:`invalid value for region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},t(t,e,n){return new Kn({code:Ur.UnknownSetting,reason:`unknown region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},T(t,e){return new Kn({code:Ur.BadFormat,reason:`format missing for \`${t}\` block on line ${e}`,line:e})}}});var zA={};Ot(zA,{SSAParser:()=>fy,default:()=>s9});function mT(t){let e=parseInt(t.replace("&H",""),16);if(e>=0){let r=(e>>24&255^255)/255,i=e>>16&255,o=e>>8&255;return"rgba("+[e&255,o,i,r].join(",")+")"}return null}function gT(t,e,n){let r=Math.ceil(2*Math.PI*t),i="";for(let o=0;o<r;o++){let a=2*Math.PI*o/r;i+=t*Math.cos(a)+"px "+e*Math.sin(a)+"px 0 "+n+(o==r-1?"":",")}return i}function s9(){return new fy}var dy,OA,FA,py,DA,NA,VA,hT,fy,UA=rt(()=>{"use strict";Cp();dy=/^Format:[\s\t]*/,OA=/^Style:[\s\t]*/,FA=/^Dialogue:[\s\t]*/,py=/[\s\t]*,[\s\t]*/,DA=/\{[^}]+\}/g,NA=/\\N/g,VA=/^\[(.*)[\s\t]?Styles\]$/,hT=/^\[(.*)[\s\t]?Events\]$/,fy=class{constructor(){T(this,"f");T(this,"O",0);T(this,"a",null);T(this,"j",[]);T(this,"k",[]);T(this,"N",null);T(this,"d");T(this,"P",{})}async init(e){this.f=e,e.errors&&(this.d=(await Promise.resolve().then(()=>(fT(),pT))).ParseErrorBuilder)}parse(e,n){if(this.O)switch(this.O){case 1:if(e==="")this.O=0;else if(OA.test(e))if(this.N){let r=e.replace(OA,"").split(py);this.S(r)}else this.e(this.d?.T("Style",n));else dy.test(e)?this.N=e.replace(dy,"").split(py):hT.test(e)&&(this.N=null,this.O=2);break;case 2:if(e==="")this.Q();else if(FA.test(e))if(this.Q(),this.N){let r=e.replace(FA,"").split(py),i=this.U(r,n);i&&(this.a=i)}else this.e(this.d?.T("Dialogue",n));else this.a?this.a.text+=`
`+e.replace(DA,"").replace(NA,`
`):dy.test(e)?this.N=e.replace(dy,"").split(py):VA.test(e)?(this.N=null,this.O=1):hT.test(e)&&(this.N=null)}else e===""||(VA.test(e)?(this.N=null,this.O=1):hT.test(e)&&(this.N=null,this.O=2))}done(){return{metadata:{},cues:this.j,regions:[],errors:this.k}}Q(){this.a&&(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null)}S(e){let n="Default",r={},i,o="center",a="bottom",s,l=1.2,c,u,d=3,p=[];for(let f=0;f<this.N.length;f++){let h=this.N[f],g=e[f];switch(h){case"Name":n=g;break;case"Fontname":r["font-family"]=g;break;case"Fontsize":r["font-size"]=`calc(${g} / var(--overlay-height))`;break;case"PrimaryColour":let x=mT(g);x&&(r["--cue-color"]=x);break;case"BorderStyle":d=parseInt(g,10);break;case"BackColour":u=mT(g);break;case"OutlineColour":let m=mT(g);m&&(c=m);break;case"Bold":parseInt(g)&&(r["font-weight"]="bold");break;case"Italic":parseInt(g)&&(r["font-style"]="italic");break;case"Underline":parseInt(g)&&(r["text-decoration"]="underline");break;case"StrikeOut":parseInt(g)&&(r["text-decoration"]="line-through");break;case"Spacing":r["letter-spacing"]=g+"px";break;case"AlphaLevel":r.opacity=parseFloat(g);break;case"ScaleX":p.push(`scaleX(${parseFloat(g)/100})`);break;case"ScaleY":p.push(`scaleY(${parseFloat(g)/100})`);break;case"Angle":p.push(`rotate(${g}deg)`);break;case"Shadow":l=parseInt(g,10)*1.2;break;case"MarginL":r["--cue-width"]="auto",r["--cue-left"]=parseFloat(g)+"px";break;case"MarginR":r["--cue-width"]="auto",r["--cue-right"]=parseFloat(g)+"px";break;case"MarginV":s=parseFloat(g);break;case"Outline":i=parseInt(g,10);break;case"Alignment":let y=parseInt(g,10);switch(y>=4&&(a=y>=7?"top":"center"),y%3){case 1:o="start";break;case 2:o="center";break;case 3:o="end";break}}}if(r.R=a,r["--cue-white-space"]="normal",r["--cue-line-height"]="normal",r["--cue-text-align"]=o,a==="center"?(r["--cue-top"]="50%",p.push("translateY(-50%)")):r[`--cue-${a}`]=(s||0)+"px",d===1&&(r["--cue-padding-y"]="0"),(d===1||u)&&(r["--cue-bg-color"]=d===1?"none":u),d===3&&c&&(r["--cue-outline"]=`${i}px solid ${c}`),d===1&&typeof i=="number"){let f=u??"#000";r["--cue-text-shadow"]=[c&&gT(i*1.2,l*1.2,c),c?gT(i*(i/2),l*(i/2),f):gT(i,l,f)].filter(Boolean).join(", ")}p.length&&(r["--cue-transform"]=p.join(" ")),this.P[n]=r}U(e,n){let r=this.V(e),i=this.o(r.Start,r.End,n);if(!i)return;let o=new xo(i[0],i[1],""),a={...this.P[r.Style]||{}},s=r.Name?`<v ${r.Name}>`:"",l=a.R,c=r.MarginL&&parseFloat(r.MarginL),u=r.MarginR&&parseFloat(r.MarginR),d=r.MarginV&&parseFloat(r.MarginV);return c&&(a["--cue-width"]="auto",a["--cue-left"]=c+"px"),u&&(a["--cue-width"]="auto",a["--cue-right"]=u+"px"),d&&l!=="center"&&(a[`--cue-${l}`]=d+"px"),o.text=s+e.slice(this.N.length-1).join(", ").replace(DA,"").replace(NA,`
`),delete a.R,Object.keys(a).length&&(o.style=a),o}V(e){let n={};for(let r=0;r<this.N.length;r++)n[this.N[r]]=e[r];return n}o(e,n,r){let i=wo(e),o=wo(n);if(i!==null&&o!==null&&o>i)return[i,o];i===null&&this.e(this.d?.q(e,r)),o===null&&this.e(this.d?.r(n,r)),i!=null&&o!==null&&o>i&&this.e(this.d?.s(i,o,r))}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}}});async function KA(t,e){let n=new ReadableStream({start(r){let i=t.split(qA);for(let o of i)r.enqueue(o);r.close()}});return yy(n,e)}async function yy(t,e){let n=e?.type??"vtt",r;if(typeof n=="string")switch(n){case"srt":r=(await Promise.resolve().then(()=>(AA(),LA))).default;break;case"ssa":case"ass":r=(await Promise.resolve().then(()=>(UA(),zA))).default;break;default:r=(await Promise.resolve().then(function(){return S9})).default}else r=n;let i,o=t.getReader(),a=r(),s=!!e?.strict||!!e?.errors;await a.init({strict:!1,...e,errors:s,type:n,cancel(){o.cancel(),i=a.done(!0)}});let l=1;for(;;){let{value:c,done:u}=await o.read();if(u){a.parse("",l),i=a.done(!1);break}a.parse(c,l),l++}return i}async function GA(t,e){let n=await t;if(!n.ok||!n.body)return{metadata:{},cues:[],regions:[],errors:[void 0]};let r=n.headers.get("content-type")||"",i=r.match(/text\/(.*?)(?:;|$)/)?.[1],o=r.match(/charset=(.*?)(?:;|$)/)?.[1];return wT(n.body,{type:i,encoding:o,...e})}async function wT(t,{encoding:e="utf-8",...n}={}){let r=t.pipeThrough(new vT(e));return yy(r,n)}function u9(t){let e=parseInt(t,10);return Number.isNaN(e)?null:e}function Rp(t){let e=parseInt(t.replace(c9,""),10);return!Number.isNaN(e)&&e>=0&&e<=100?e:null}function jA(t){if(!t.includes(BA))return null;let[e,n]=t.split(BA).map(Rp);return e!==null&&n!==null?[e,n]:null}function d9(t){let e=parseFloat(t);return Number.isNaN(e)?null:e}function wo(t){let e=t.match(k9);if(!e)return null;let n=e[1]?parseInt(e[1],10):0,r=parseInt(e[2],10),i=parseInt(e[3],10),o=e[4]?parseInt(e[4].padEnd(3,"0"),10):0,a=n*3600+r*60+i+o/1e3;return n<0||r<0||i<0||o<0||r>59||i>59?null:a}function T9(){return new $c}function _T(t){let e="",n=1,r=[],i=[],o;for(let c=0;c<t.text.length;c++){let u=t.text[c];switch(n){case 1:u==="<"?(l(),n=2):e+=u;break;case 2:switch(u){case`
`:case" ":case" ":a(),n=4;break;case".":a(),n=3;break;case"/":n=5;break;case">":a(),n=1;break;default:!e&&E9.test(u)&&(n=6),e+=u;break}break;case 3:switch(u){case" ":case" ":case`
`:s(),o&&o.class?.trim(),n=4;break;case".":s();break;case">":s(),o&&o.class?.trim(),n=1;break;default:e+=u}break;case 4:u===">"?(e=e.replace(P9," "),o?.type==="v"?o.voice=yT(e):o?.type==="lang"&&(o.lang=yT(e)),e="",n=1):e+=u;break;case 5:u===">"&&(e="",o=i.pop(),n=1);break;case 6:if(u===">"){let d=wo(e);d!==null&&d>=t.startTime&&d<=t.endTime&&(e="timestamp",a(),o.time=d),e="",n=1}else e+=u;break}}function a(){if($9.has(e)){let c=o;o=I9(e),c?(i[i.length-1]!==c&&i.push(c),c.children.push(o)):r.push(o)}e="",n=1}function s(){if(o&&e){let c=e.replace("bg_","");R9.has(c)?o[e.startsWith("bg_")?"bgColor":"color"]=c:o.class=o.class?o.class+" "+e:e}e=""}function l(){if(!e)return;let c={type:"text",data:yT(e)};o?o.children.push(c):r.push(c),e=""}return n===1&&l(),r}function I9(t){return{tagName:YA[t],type:t,children:[]}}function yT(t){return t.replace(M9,e=>C9[e]||"'")}function Ln(t,e,n){t.style.setProperty(`--${e}`,n+"")}function Pa(t,e,n=!0){t.setAttribute(`data-${e}`,n===!0?"":n+"")}function hy(t,e){t.setAttribute("data-part",e)}function L9(t){return parseFloat(getComputedStyle(t).lineHeight)||0}function QA(t){if(bT)throw Error("[media-captions] called `createVTTCueTemplate` on the server - use `renderVTTCueString`");let e=document.createElement("template");return e.innerHTML=vy(t),{cue:t,content:e.content}}function vy(t,e=0){return xy(_T(t),e)}function xy(t,e=0){let n,r="";for(let i of t)if(i.type==="text")r+=i.data;else{let o=i.type==="timestamp";n={},n.class=i.class,n.title=i.type==="v"&&i.voice,n.lang=i.type==="lang"&&i.lang,n["data-part"]=i.type==="v"&&"voice",o&&(n["data-part"]="timed",n["data-time"]=i.time,n["data-future"]=i.time>e,n["data-past"]=i.time<e),n.style=`${i.color?`color: ${i.color};`:""}${i.bgColor?`background-color: ${i.bgColor};`:""}`;let a=Object.entries(n).filter(s=>s[1]).map(s=>`${s[0]}="${s[1]===!0?"":s[1]}"`).join(" ");r+=`<${i.tagName}${a?" "+a:""}>${xy(i.children)}</${i.tagName}>`}return r}function kT(t,e){if(!bT)for(let n of t.querySelectorAll('[data-part="timed"]')){let r=Number(n.getAttribute("data-time"));Number.isNaN(r)||(r>e?Pa(n,"future"):n.removeAttribute("data-future"),r<e?Pa(n,"past"):n.removeAttribute("data-past"))}}function A9(t,e){let n=null,r;function i(){o(),t(...r),r=void 0}function o(){clearTimeout(n),n=null}function a(){r=[].slice.call(arguments),o(),n=setTimeout(i,e)}return a}function TT(t){return t.instanceOf(HTMLElement)?{top:t.offsetTop,width:t.clientWidth,height:t.clientHeight,left:t.offsetLeft,right:t.offsetLeft+t.clientWidth,bottom:t.offsetTop+t.clientHeight}:{...t}}function my(t,e,n){switch(e){case"+x":t.left+=n,t.right+=n;break;case"-x":t.left-=n,t.right-=n;break;case"+y":t.top+=n,t.bottom+=n;break;case"-y":t.top-=n,t.bottom-=n;break}}function O9(t,e){return t.left<=e.right&&t.right>=e.left&&t.top<=e.bottom&&t.bottom>=e.top}function F9(t,e){for(let n=0;n<e.length;n++)if(O9(t,e[n]))return e[n];return null}function WA(t,e){return e.top>=0&&e.bottom<=t.height&&e.left>=0&&e.right<=t.width}function D9(t,e,n){switch(n){case"+x":return e.left<0;case"-x":return e.right>t.width;case"+y":return e.top<0;case"-y":return e.bottom>t.height}}function N9(t,e){let n=Math.max(0,Math.min(t.width,e.right)-Math.max(0,e.left)),r=Math.max(0,Math.min(t.height,e.bottom)-Math.max(0,e.top));return n*r/(t.height*t.width)}function ST(t,e){return{top:e.top/t.height,left:e.left/t.width,right:(t.width-e.right)/t.width,bottom:(t.height-e.bottom)/t.height}}function XA(t,e){return e.top=e.top*t.height,e.left=e.left*t.width,e.right=t.width-e.right*t.width,e.bottom=t.height-e.bottom*t.height,e}function JA(t,e,n,r){let i=ST(e,n);for(let o of ZA)Ln(t,`${r}-${o}`,i[o]*100+"%")}function eO(t,e,n,r){let i=1,o,a={...e};for(let s=0;s<r.length;s++){for(;D9(t,e,r[s])||WA(t,e)&&F9(e,n);)my(e,r[s],1);if(WA(t,e))return e;let l=N9(t,e);i>l&&(o={...e},i=l),e={...a}}return o||a}function V9(t,e,n,r){let i=n.firstElementChild,o=B9(e),a,s=[];if(n[Ca]||(n[Ca]=z9(t,n)),a=XA(t,{...n[Ca]}),n[$p])s=[n[$p]==="top"?"+y":"-y","+x","-x"];else if(e.snapToLines){let l;switch(e.vertical){case"":s=["+y","-y"],l="height";break;case"rl":s=["+
`:"")+e}break;case 3:this.n(e.split(Mp),n);break}else if(e.startsWith(m9))this.c=4;else if(e.startsWith(g9))this.c=3,this.b=new Lp,this.n(e.replace(y9,"").split(Mp),n);else if(e.includes(v9)){let r=this.o(e,n);r&&(this.a=new xo(r[0],r[1],""),this.a.id=this.l,this.m(r[2],n)),this.c=2}else n===1&&this.i(e,n);this.l=e}done(){return{metadata:this.g,cues:this.j,regions:Object.values(this.h),errors:this.k}}i(e,n){if(n>1){if(Ic.test(e)){let[r,i]=e.split(Ic);r&&(this.g[r]=(i||"").replace(Mp,""))}}else e.startsWith(p9)?this.c=1:this.e(this.d?.p())}o(e,n){let[r,i=""]=e.split(x9),[o,...a]=i.split(Mp),s=wo(r),l=wo(o);if(s!==null&&l!==null&&l>s)return[s,l,a];s===null&&this.e(this.d?.q(r,n)),l===null&&this.e(this.d?.r(o,n)),s!=null&&l!==null&&l>s&&this.e(this.d?.s(s,l,n))}n(e,n){let r;for(let i=0;i<e.length;i++)if(Ic.test(e[i])){r=!1;let[o,a]=e[i].split(Ic);switch(o){case"id":this.b.id=a;break;case"width":let s=Rp(a);s!==null?this.b.width=s:r=!0;break;case"lines":let l=u9(a);l!==null?this.b.lines=l:r=!0;break;case"regionanchor":let c=jA(a);c!==null?(this.b.regionAnchorX=c[0],this.b.regionAnchorY=c[1]):r=!0;break;case"viewportanchor":let u=jA(a);u!==null?(this.b.viewportAnchorX=u[0],this.b.viewportAnchorY=u[1]):r=!0;break;case"scroll":a==="up"?this.b.scroll="up":r=!0;break;default:this.e(this.d?.t(o,a,n))}r&&this.e(this.d?.u(o,a,n))}}m(e,n){let r;for(let i=0;i<e.length;i++)if(r=!1,Ic.test(e[i])){let[o,a]=e[i].split(Ic);switch(o){case"region":let s=this.h[a];s&&(this.a.region=s);break;case"vertical":a==="lr"||a==="rl"?(this.a.vertical=a,this.a.region=null):r=!0;break;case"line":let[l,c]=a.split(HA);if(l.includes(f9)){let h=Rp(l);h!==null?(this.a.line=h,this.a.snapToLines=!1):r=!0}else{let h=d9(l);h!==null?this.a.line=h:r=!0}b9.test(c)?this.a.lineAlign=c:c&&(r=!0),this.a.line!=="auto"&&(this.a.region=null);break;case"position":let[u,d]=a.split(HA),p=Rp(u);p!==null?this.a.position=p:r=!0,d&&_9.test(d)?this.a.positionAlign=d:d&&(r=!0);break;case"size":let f=Rp(a);f!==null?(this.a.size=f,f<100&&(this.a.region=null)):r=!0;break;case"align":w9.test(a)?this.a.align=a:r=!0;break;default:this.e(this.d?.v(o,a,n))}r&&this.e(this.d?.w(o,a,n))}}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}};S9=Object.freeze({__proto__:null,VTTBlock:Rc,VTTParser:$c,default:T9,parseVTTTimestamp:wo}),E9=/[0-9]/,P9=/[\s\t]+/,YA={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span",timestamp:"span"},C9={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&nbsp;":"\xA0","&lrm;":"\u200E","&rlm;":"\u200F"},M9=/&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g,R9=new Set(["white","lime","cyan","red","yellow","magenta","blue","black"]),$9=new Set(Object.keys(YA));Ca=Symbol(0);ZA=["top","left","right","bottom"];$p=Symbol(0);W9=["-y","+y","-x","+x"];gy=class{constructor(e,n){T(this,"overlay");T(this,"z");T(this,"A",0);T(this,"C","ltr");T(this,"B",[]);T(this,"D",!1);T(this,"E");T(this,"h",new Map);T(this,"j",new Map);T(this,"K",A9(()=>{this.D=!1,this.G();for(let e of this.h.values())e[Ca]=null;for(let e of this.j.values())e&&(e[Ca]=null);this.H(!0)},50));this.overlay=e,this.dir=n?.dir??"ltr",e.setAttribute("translate","yes"),e.setAttribute("aria-live","off"),e.setAttribute("aria-atomic","true"),hy(e,"captions"),this.G(),this.E=new ResizeObserver(this.I.bind(this)),this.E.observe(e)}get dir(){return this.C}set dir(e){this.C=e,Pa(this.overlay,"dir",e)}get currentTime(){return this.A}set currentTime(e){this.A=e,this.update()}changeTrack({regions:e,cues:n}){this.reset(),this.J(e);for(let r of n)this.j.set(r,null);this.update()}addCue(e){this.j.set(e,null),this.update()}removeCue(e){this.j.delete(e),this.update()}update(e=!1){this.H(e)}reset(){this.j.clear(),this.h.clear(),this.B=[],this.overlay.textContent=""}destroy(){this.reset(),this.E.disconnect()}I(){this.D=!0,this.K()}G(){this.z=TT(this.overlay),Ln(this.overlay,"overlay-width",this.z.width+"px"),Ln(this.overlay,"overlay-height",this.z.height+"px")}H(e=!1){if(!this.j.size||this.D)return;let n,r=[...this.j.keys()].filter(o=>this.A>=o.startTime&&this.A<=o.endTime).sort
`)[1].trim():null}function wq(t){let e=t.split(`
`);for(let n of e)if(n.startsWith("#EXT-X-TARGETDURATION")){let r=parseFloat(n.split(":")[1]);if(!isNaN(r))return r}return-1}function DO(t){return(bt(t)?t:[t&&!ee(t)&&"src"in t?t:{src:t||""}]).map(({src:e,type:n,...r})=>({src:e,type:n??(ee(e)?kF.get(e):null)??(!ee(e)||e.startsWith("blob:")?"video/object":e.includes("youtube")?"video/youtube":e.includes("vimeo")&&!e.includes("progressive_redirect")&&!e.includes(".m3u8")?"video/vimeo":"?"),...r})).sort(e=>e.type==="?"?1:-1)}function NO(t,e){return t?.src===e?.src&&t?.type===e?.type}function Cq(t){return t?"true":"false"}function Qn(t){return()=>Cq(t())}function VO(t,e,n){let r=e-t,i=n-t;return r>0?i/r:0}function Mq(t,e,n,r){return FS(t,An(n,wy(r)),e)}function Rq(t,e,n,r){let i=FS(0,n,1),o=e-t,a=o*i,s=a/r,l=r*s;return t+l}function sS(t,e){let n=String(t),r=n.length;if(r<e){let o=e-r;return`${"0".repeat(o)}${t}`}return n}function TF(t){let e=Math.trunc(t/3600),n=Math.trunc(t%3600/60),r=Math.trunc(t%60),i=Number((t-Math.trunc(t)).toPrecision(3));return{hours:e,minutes:n,seconds:r,fraction:i}}function Aa(t,{padHrs:e=null,padMins:n=null,showHrs:r=!1,showMs:i=!1}={}){let{hours:o,minutes:a,seconds:s,fraction:l}=TF(t),c=e?sS(o,2):o,u=n||Di(n)&&t>=3600?sS(a,2):a,d=sS(s,2),p=i&&l>0?`.${String(l).replace(/^0?\./,"")}`:"",f=`${u}:${d}${p}`;return o>0||r?`${c}:${f}`:f}function Qp(t){let e=[],{hours:n,minutes:r,seconds:i}=TF(t);return n>0&&e.push(`${n} hour`),r>0&&e.push(`${r} min`),(i>0||e.length===0)&&e.push(`${i} sec`),e.join(" ")}function DS(t,{clamp:e,offset:n,orientation:r}){let i=getComputedStyle(t),o=parseFloat(i.width),a=parseFloat(i.height),s={top:null,right:null,bottom:null,left:null};if(s[r==="horizontal"?"bottom":"left"]=`calc(100% + var(--media-slider-preview-offset, ${n}px))`,r==="horizontal"){let l=o/2;if(!e)s.left=`calc(var(--slider-pointer) - ${l}px)`;else{let c=`max(0px, calc(var(--slider-pointer) - ${l}px))`,u=`calc(100% - ${o}px)`;s.left=`min(${c}, ${u})`}}else{let l=a/2;if(!e)s.bottom=`calc(var(--slider-pointer) - ${l}px)`;else{let c=`max(${l}px, calc(var(--slider-pointer) - ${l}px))`,u=`calc(100% - ${a}px)`;s.bottom=`min(${c}, ${u})`}}Object.assign(t.style,s)}function uK(t){return Ze.isValidElement(t)&&t.type===cK}function dK(t,e){let n={...e};for(let r in e){let i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...s)=>{o(...s),i(...s)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function CF(t){return t?.$$PROVIDER_TYPE==="REMOTION"}function qe(t,e){let n=Ta(Ws);return Ie((e?.current?.$state||n||fK)[t])}var Ze,lW,cW,uW,dW,pW,fW,hW,mW,gW,yW,vW,ye,wO,jp,fr,bO,_O,kO,Yn,Br,Os,Dy,Ny,Y,xW,Ac,SO,Np,tO,qO,CS,$e,Iy,TW,SW,EW,PW,CW,MW,RW,de,EO,PO,CO,gn,$W,Ws,IW,Af,zc,cS,Dc,Uy,Ly,Ma,DW,zW,BW,ZW,eq,rq,To,jy,Ff,Hy,uS,Wy,LS,qy,Up,Ky,Gy,sq,lq,pr,Yy,pF,LO,cq,AO,dS,uq,Qy,fF,hF,mF,gF,yF,vF,Xy,qp,xF,bF,Zy,Jy,oS,pq,fq,ev,pS,fS,tv,hS,mS,hq,gS,yS,mq,nv,mr,gq,yq,We,De,vq,kF,xS,wS,bq,_q,kq,Bc,rv,iv,ov,Vc,Tq,av,sv,Kp,Kt,Sq,Eq,Pq,Gp,lv,cv,uv,dv,pv,fv,hv,mv,gv,Cv,zO,bS,Yp,Mv,Ui,So,_o,Oy,yv,jc,vv,$q,Iq,Lq,Ds,Aq,Oq,Fq,Hc,Xp,Zp,Wc,Dq,Nq,Rv,Eo,sn,Vq,UO,_S,zq,Uq,Df,Bq,Po,jq,Hq,Wq,Ns,xv,wv,Bp,Jp,kS,Ia,qq,Kq,SF,qc,Gq,Yq,Qq,Kc,Xq,Zq,NS,Vs,Jq,eK,VS,zs,tK,nK,zS,Us,rK,iK,US,EF,Bs,oK,aK,BS,js,bv,TS,_v,ef,tf,sK,lK,SS,Hs,kv,nf,rf,Tv,of,af,sf,lf,cf,uf,df,pf,ff,hf,mf,gf,yf,vf,xf,wf,bf,_f,kf,Tf,Sf,Ef,Pf,Cf,Mf,Rf,$f,If,Sv,Gc,Lf,PF,ES,cK,pK,oe,BO,fK,Gn=rt(()=>{"use strict";"use client";Ze=$(K(),1);In();cW=Symbol(0);lW=cW;uW=Symbol(0),dW=Symbol(0),pW=Symbol(0),fW=Symbol(0),hW=Symbol(0),mW=Symbol(0),gW=Symbol(0),yW=Symbol(0),vW=Symbol(0),ye={_add:uW,_remove:dW,_reset:pW,_select:fW,_readonly:hW,_setReadonly:mW,_onReset:gW,_onRemove:yW,_onUserSelect:vW},jp=class extends Tc{constructor(){super(...arguments),this._items=[],this[wO]=!1}get length(){return this._items.length}get readonly(){return this[ye._readonly]}toArray(){return[...this._items]}[(wO=ye._readonly,Symbol.iterator)](){return this._items.values()}[ye._add](e,n){let r=this._items.length;""+r in this||Object.defineProperty(this,r,{get(){return this._items[r]}}),!this._items.includes(e)&&(t
`],{type:"text/vtt"});n.src=URL.createObjectURL(a),n.addEventListener("load",o),n.addEventListener("error",o)}return n.label=e.label,n.kind=e.kind,n.default=r,e.language&&(n.srclang=e.language),r&&!i&&this._copyCues(e,n.track),n}_copyCues(e,n){if(!(e.src&&e.type==="vtt"||n.cues?.length))for(let r of e.cues)n.addCue(r)}_onChange(e){for(let n of this._tracks){let r=n[de._native]?.track;if(!r)continue;if(!this._display){r.mode="disabled";continue}let i=r.mode==="showing";i&&this._copyCues(n,r),n.setMode(i?"showing":"disabled",e)}}},Wy=class{constructor(e){this._media=e,this._video=null,this._renderers=[],this._nativeDisplay=!1,this._nativeRenderer=null,this._customRenderer=null;let n=e.textTracks;this._textTracks=n,M(this._watchControls.bind(this)),me(this._detach.bind(this)),z(n,"add",this._onAddTrack.bind(this)),z(n,"remove",this._onRemoveTrack.bind(this)),z(n,"mode-change",this._update.bind(this))}_watchControls(){let{$state:e,$iosControls:n}=this._media;this._nativeDisplay=e.controls()||n(),this._update()}add(e){this._renderers.push(e),this._update()}remove(e){e.detach(),this._renderers.splice(this._renderers.indexOf(e),1),this._update()}_attachVideo(e){requestAnimationFrame(()=>{if(this._video=e,e){this._nativeRenderer=new uS,this._nativeRenderer.attach(e);for(let n of this._textTracks)this._addNativeTrack(n)}this._update()})}_addNativeTrack(e){It(e)&&this._nativeRenderer?.addTrack(e)}_removeNativeTrack(e){It(e)&&this._nativeRenderer?.removeTrack(e)}_onAddTrack(e){this._addNativeTrack(e.detail)}_onRemoveTrack(e){this._removeNativeTrack(e.detail)}_update(){let e=this._textTracks.selected;if(this._video&&(this._nativeDisplay||e?.[de._nativeHLS])){this._customRenderer?.changeTrack(null),this._nativeRenderer?.setDisplay(!0),this._nativeRenderer?.changeTrack(e);return}if(this._nativeRenderer?.setDisplay(!1),this._nativeRenderer?.changeTrack(null),!e){this._customRenderer?.changeTrack(null);return}let n=this._renderers.sort((r,i)=>r.priority-i.priority).find(r=>r.canRender(e,this._video));this._customRenderer!==n&&(this._customRenderer?.detach(),n?.attach(this._video),this._customRenderer=n??null),n?.changeTrack(e)}_detach(){this._nativeRenderer?.detach(),this._nativeRenderer=null,this._customRenderer?.detach(),this._customRenderer=null}},LS=aq;qy=class extends jp{constructor(){super(),this._canLoad=!1,this._defaults={},this._storage=null,this._preferredLang=null,this._selectTracks=LS(async()=>{if(!this._canLoad)return;!this._preferredLang&&this._storage&&(this._preferredLang=await this._storage.getLang());let e=await this._storage?.getCaptions(),n=[["captions","subtitles"],"chapters","descriptions","metadata"];for(let r of n){let i=this.getByKind(r);if(i.find(c=>c.mode==="showing"))continue;let o=this._preferredLang?i.find(c=>c.language===this._preferredLang):null,a=bt(r)?this._defaults[r.find(c=>this._defaults[c])||""]:this._defaults[r],s=o??a,l=s&&It(s);s&&(!l||e!==!1)&&(s.mode="showing",l&&this._saveCaptionsTrack(s))}},300),this._onTrackModeChangeBind=this._onTrackModeChange.bind(this)}get selected(){return this._items.find(n=>n.mode==="showing"&&It(n))??null}get preferredLang(){return this._preferredLang}set preferredLang(e){this._preferredLang=e,this._saveLang(e)}add(e,n){let r=e instanceof gn,i=r?e:new gn(e),o=e.kind==="captions"||e.kind==="subtitles"?"captions":e.kind;return this._defaults[o]&&e.default&&delete e.default,i.addEventListener("mode-change",this._onTrackModeChangeBind),this[ye._add](i,n),i[de._crossOrigin]=this[de._crossOrigin],this._canLoad&&i[de._canLoad](),e.default&&(this._defaults[o]=i),this._selectTracks(),this}remove(e,n){if(this._items.includes(e))return e===this._defaults[e.kind]&&delete this._defaults[e.kind],e.mode="disabled",e[de._onModeChange]=null,e.removeEventListener("mode-change",this._onTrackModeChangeBind),this[ye._remove](e,n),this}clear(e){for(let n of[...this._items])this.remove(n,e);return this}getById(e){return this._items.find(n=>n.id===e)??null}getByKind(e){let n=Array.isArray(e)?e:[e];return this._items.filter(r=>n.includes(r.kind))}[de._canLoad](){if(!this._canLoad){for(let e
`:"")+e;else if(e.includes(oae)){let r=this.o(e,n);r&&(this.a=new rs(r[0],r[1],r[2].join(" ")),this.a.id=this.l,this.c=qu.Cue)}this.l=e}o(e,n){return super.o(e.replace(iae,"."),n)}}});var N1={};Ot(N1,{ParseErrorBuilder:()=>sae});var sae,V1=rt(()=>{"use strict";jh();sae={p(){return new br({code:Ti.BadSignature,reason:"missing WEBVTT file header",line:1})},q(t,e){return new br({code:Ti.BadTimestamp,reason:`cue start timestamp \`${t}\` is invalid on line ${e}`,line:e})},r(t,e){return new br({code:Ti.BadTimestamp,reason:`cue end timestamp \`${t}\` is invalid on line ${e}`,line:e})},s(t,e,n){return new br({code:Ti.BadTimestamp,reason:`cue end timestamp \`${e}\` is greater than start \`${t}\` on line ${n}`,line:n})},w(t,e,n){return new br({code:Ti.BadSettingValue,reason:`invalid value for cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},v(t,e,n){return new br({code:Ti.UnknownSetting,reason:`unknown cue setting \`${t}\` on line ${n} (value: ${e})`,line:n})},u(t,e,n){return new br({code:Ti.BadSettingValue,reason:`invalid value for region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},t(t,e,n){return new br({code:Ti.UnknownSetting,reason:`unknown region setting \`${t}\` on line ${n} (value: ${e})`,line:n})},N(t,e){return new br({code:Ti.BadFormat,reason:`format missing for \`${t}\` block on line ${e}`,line:e})}}});var h6={};Ot(h6,{SSAParser:()=>Pb,default:()=>lae});function U1(t){let e=parseInt(t.replace("&H",""),16);if(e>=0){let r=(e>>24&255^255)/255,i=e>>16&255,o=e>>8&255;return"rgba("+[e&255,o,i,r].join(",")+")"}return null}function B1(t,e,n){let r=Math.ceil(2*Math.PI*t),i="";for(let o=0;o<r;o++){let a=2*Math.PI*o/r;i+=t*Math.cos(a)+"px "+e*Math.sin(a)+"px 0 "+n+(o==r-1?"":",")}return i}function lae(){return new Pb}var Sb,c6,u6,Eb,d6,p6,f6,z1,Pb,m6=rt(()=>{"use strict";jh();Sb=/^Format:[\s\t]*/,c6=/^Style:[\s\t]*/,u6=/^Dialogue:[\s\t]*/,Eb=/[\s\t]*,[\s\t]*/,d6=/\{[^}]+\}/g,p6=/\\N/g,f6=/^\[(.*)[\s\t]?Styles\]$/,z1=/^\[(.*)[\s\t]?Events\]$/,Pb=class{constructor(){T(this,"f");T(this,"P",0);T(this,"a",null);T(this,"j",[]);T(this,"k",[]);T(this,"O",null);T(this,"d");T(this,"Q",{})}async init(e){this.f=e,e.errors&&(this.d=(await Promise.resolve().then(()=>(V1(),N1))).ParseErrorBuilder)}parse(e,n){if(this.P)switch(this.P){case 1:if(e==="")this.P=0;else if(c6.test(e))if(this.O){let r=e.replace(c6,"").split(Eb);this.T(r)}else this.e(this.d?.N("Style",n));else Sb.test(e)?this.O=e.replace(Sb,"").split(Eb):z1.test(e)&&(this.O=null,this.P=2);break;case 2:if(e==="")this.R();else if(u6.test(e))if(this.R(),this.O){let r=e.replace(u6,"").split(Eb),i=this.U(r,n);i&&(this.a=i)}else this.e(this.d?.N("Dialogue",n));else this.a?this.a.text+=`
`+e.replace(d6,"").replace(p6,`
`):Sb.test(e)?this.O=e.replace(Sb,"").split(Eb):f6.test(e)?(this.O=null,this.P=1):z1.test(e)&&(this.O=null)}else e===""||(f6.test(e)?(this.O=null,this.P=1):z1.test(e)&&(this.O=null,this.P=2))}done(){return{metadata:{},cues:this.j,regions:[],errors:this.k}}R(){this.a&&(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null)}T(e){let n="Default",r={},i,o="center",a="bottom",s,l=1.2,c,u,d=3,p=[];for(let f=0;f<this.O.length;f++){let h=this.O[f],g=e[f];switch(h){case"Name":n=g;break;case"Fontname":r["font-family"]=g;break;case"Fontsize":r["font-size"]=`calc(${g} / var(--overlay-height))`;break;case"PrimaryColour":let x=U1(g);x&&(r["--cue-color"]=x);break;case"BorderStyle":d=parseInt(g,10);break;case"BackColour":u=U1(g);break;case"OutlineColour":let m=U1(g);m&&(c=m);break;case"Bold":parseInt(g)&&(r["font-weight"]="bold");break;case"Italic":parseInt(g)&&(r["font-style"]="italic");break;case"Underline":parseInt(g)&&(r["text-decoration"]="underline");break;case"StrikeOut":parseInt(g)&&(r["text-decoration"]="line-through");break;case"Spacing":r["letter-spacing"]=g+"px";break;case"AlphaLevel":r.opacity=parseFloat(g);break;case"ScaleX":p.push(`scaleX(${parseFloat(g)/100})`);break;case"ScaleY":p.push(`scaleY(${parseFloat(g)/100})`);break;case"Angle":p.push(`rotate(${g}deg)`);break;case"Shadow":l=parseInt(g,10)*1.2;break;case"MarginL":r["--cue-width"]="auto",r["--cue-left"]=parseFloat(g)+"px";break;case"MarginR":r["--cue-width"]="auto",r["--cue-right"]=parseFloat(g)+"px";break;case"MarginV":s=parseFloat(g);break;case"Outline":i=parseInt(g,10);break;case"Alignment":let y=parseInt(g,10);switch(y>=4&&(a=y>=7?"top":"center"),y%3){case 1:o="start";break;case 2:o="center";break;case 3:o="end";break}}}if(r.S=a,r["--cue-white-space"]="normal",r["--cue-line-height"]="normal",r["--cue-text-align"]=o,a==="center"?(r["--cue-top"]="50%",p.push("translateY(-50%)")):r[`--cue-${a}`]=(s||0)+"px",d===1&&(r["--cue-padding-y"]="0"),(d===1||u)&&(r["--cue-bg-color"]=d===1?"none":u),d===3&&c&&(r["--cue-outline"]=`${i}px solid ${c}`),d===1&&typeof i=="number"){let f=u??"#000";r["--cue-text-shadow"]=[c&&B1(i*1.2,l*1.2,c),c?B1(i*(i/2),l*(i/2),f):B1(i,l,f)].filter(Boolean).join(", ")}p.length&&(r["--cue-transform"]=p.join(" ")),this.Q[n]=r}U(e,n){let r=this.V(e),i=this.o(r.Start,r.End,n);if(!i)return;let o=new rs(i[0],i[1],""),a={...this.Q[r.Style]||{}},s=r.Name?`<v ${r.Name}>`:"",l=a.S,c=r.MarginL&&parseFloat(r.MarginL),u=r.MarginR&&parseFloat(r.MarginR),d=r.MarginV&&parseFloat(r.MarginV);return c&&(a["--cue-width"]="auto",a["--cue-left"]=c+"px"),u&&(a["--cue-width"]="auto",a["--cue-right"]=u+"px"),d&&l!=="center"&&(a[`--cue-${l}`]=d+"px"),o.text=s+e.slice(this.O.length-1).join(", ").replace(d6,"").replace(p6,`
`),delete a.S,Object.keys(a).length&&(o.style=a),o}V(e){let n={};for(let r=0;r<this.O.length;r++)n[this.O[r]]=e[r];return n}o(e,n,r){let i=vl(e),o=vl(n);if(i!==null&&o!==null&&o>i)return[i,o];i===null&&this.e(this.d?.q(e,r)),o===null&&this.e(this.d?.r(n,r)),i!=null&&o!==null&&o>i&&this.e(this.d?.s(i,o,r))}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}}});async function j1(t,e){let n=new ReadableStream({start(r){let i=t.split(cae);for(let o of i)r.enqueue(o);r.close()}});return x6(n,e)}async function x6(t,e){let n=e?.type??"vtt",r;if(typeof n=="string")switch(n){case"srt":r=(await Promise.resolve().then(()=>(l6(),s6))).default;break;case"ssa":case"ass":r=(await Promise.resolve().then(()=>(m6(),h6))).default;break;default:r=(await Promise.resolve().then(function(){return Cae})).default}else r=n;let i,o=t.getReader(),a=r(),s=!!e?.strict||!!e?.errors;await a.init({strict:!1,...e,errors:s,type:n,cancel(){o.cancel(),i=a.done(!0)}});let l=1;for(;;){let{value:c,done:u}=await o.read();if(u){a.parse("",l),i=a.done(!1);break}a.parse(c,l),l++}return i}function fae(t){let e=parseInt(t,10);return Number.isNaN(e)?null:e}function Wh(t){let e=parseInt(t.replace(pae,""),10);return!Number.isNaN(e)&&e>=0&&e<=100?e:null}function y6(t){if(!t.includes(g6))return null;let[e,n]=t.split(g6).map(Wh);return e!==null&&n!==null?[e,n]:null}function hae(t){let e=parseFloat(t);return Number.isNaN(e)?null:e}function vl(t){let e=t.match(Eae);if(!e)return null;let n=e[1]?parseInt(e[1],10):0,r=parseInt(e[2],10),i=parseInt(e[3],10),o=e[4]?parseInt(e[4].padEnd(3,"0"),10):0,a=n*3600+r*60+i+o/1e3;return n<0||r<0||i<0||o<0||r>59||i>59?null:a}function Pae(){return new Ku}var Ti,br,cae,Cb,uae,dae,rs,Mb,g6,pae,mae,v6,gae,Gu,yae,vae,xae,wae,Hh,bae,_ae,kae,Tae,Sae,Eae,qu,Ku,Cae,Mae,QLe,XLe,ZLe,jh=rt(()=>{"use strict";Ti={LoadFail:0,BadSignature:1,BadTimestamp:2,BadSettingValue:3,BadFormat:4,UnknownSetting:5},br=class extends Error{constructor(n){super(n.reason);T(this,"code");T(this,"line");this.code=n.code,this.line=n.line}},cae=/\r?\n|\r/gm;Cb=class extends EventTarget{constructor(n,r,i){super();T(this,"id","");T(this,"startTime");T(this,"endTime");T(this,"text");T(this,"pauseOnExit",!1);this.startTime=n,this.endTime=r,this.text=i}addEventListener(n,r,i){super.addEventListener(n,r,i)}removeEventListener(n,r,i){super.removeEventListener(n,r,i)}},uae=typeof document>"u",dae=uae?Cb:window.VTTCue,rs=class extends dae{constructor(){super(...arguments);T(this,"region",null);T(this,"vertical","");T(this,"snapToLines",!0);T(this,"line","auto");T(this,"lineAlign","start");T(this,"position","auto");T(this,"positionAlign","auto");T(this,"size",100);T(this,"align","center");T(this,"style")}},Mb=class{constructor(){T(this,"id","");T(this,"width",100);T(this,"lines",3);T(this,"regionAnchorX",0);T(this,"regionAnchorY",100);T(this,"viewportAnchorX",0);T(this,"viewportAnchorY",100);T(this,"scroll","")}},g6=",",pae="%";mae="WEBVTT",v6=",",gae="%",Gu=/[:=]/,yae=/^[\s\t]*(region|vertical|line|position|size|align)[:=]/,vae="NOTE",xae="REGION",wae=/^REGION:?[\s\t]+/,Hh=/[\s\t]+/,bae="-->",_ae=/[\s\t]*-->[\s\t]+/,kae=/start|center|end|left|right/,Tae=/start|center|end/,Sae=/line-(?:left|right)|center|auto/,Eae=/^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/,qu=(t=>(t[t.None=0]="None",t[t.Header=1]="Header",t[t.Cue=2]="Cue",t[t.Region=3]="Region",t[t.Note=4]="Note",t))(qu||{}),Ku=class{constructor(){T(this,"f");T(this,"c",0);T(this,"g",{});T(this,"h",{});T(this,"j",[]);T(this,"a",null);T(this,"b",null);T(this,"k",[]);T(this,"d");T(this,"l","")}async init(e){this.f=e,e.strict&&(this.c=1),e.errors&&(this.d=(await Promise.resolve().then(()=>(V1(),N1))).ParseErrorBuilder)}parse(e,n){if(e==="")this.a?(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null):this.b?(this.h[this.b.id]=this.b,this.f.onRegion?.(this.b),this.b=null):this.c===1&&(this.i(e,n),this.f.onHeaderMetadata?.(this.g)),this.c=0;else if(this.c)switch(this.c){case 1:this.i(e,n);break;case 2:if(this.a){let r=this.a.text.length>0;!r&&yae.test(e)?this.m(e.split(Hh),n):this.a.text+=(r?`
`:"")+e}break;case 3:this.n(e.split(Hh),n);break}else if(e.startsWith(vae))this.c=4;else if(e.startsWith(xae))this.c=3,this.b=new Mb,this.n(e.replace(wae,"").split(Hh),n);else if(e.includes(bae)){let r=this.o(e,n);r&&(this.a=new rs(r[0],r[1],""),this.a.id=this.l,this.m(r[2],n)),this.c=2}else n===1&&this.i(e,n);this.l=e}done(){return{metadata:this.g,cues:this.j,regions:Object.values(this.h),errors:this.k}}i(e,n){if(n>1){if(Gu.test(e)){let[r,i]=e.split(Gu);r&&(this.g[r]=(i||"").replace(Hh,""))}}else e.startsWith(mae)?this.c=1:this.e(this.d?.p())}o(e,n){let[r,i=""]=e.split(_ae),[o,...a]=i.split(Hh),s=vl(r),l=vl(o);if(s!==null&&l!==null&&l>s)return[s,l,a];s===null&&this.e(this.d?.q(r,n)),l===null&&this.e(this.d?.r(o,n)),s!=null&&l!==null&&l>s&&this.e(this.d?.s(s,l,n))}n(e,n){let r;for(let i=0;i<e.length;i++)if(Gu.test(e[i])){r=!1;let[o,a]=e[i].split(Gu);switch(o){case"id":this.b.id=a;break;case"width":let s=Wh(a);s!==null?this.b.width=s:r=!0;break;case"lines":let l=fae(a);l!==null?this.b.lines=l:r=!0;break;case"regionanchor":let c=y6(a);c!==null?(this.b.regionAnchorX=c[0],this.b.regionAnchorY=c[1]):r=!0;break;case"viewportanchor":let u=y6(a);u!==null?(this.b.viewportAnchorX=u[0],this.b.viewportAnchorY=u[1]):r=!0;break;case"scroll":a==="up"?this.b.scroll="up":r=!0;break;default:this.e(this.d?.t(o,a,n))}r&&this.e(this.d?.u(o,a,n))}}m(e,n){let r;for(let i=0;i<e.length;i++)if(r=!1,Gu.test(e[i])){let[o,a]=e[i].split(Gu);switch(o){case"region":let s=this.h[a];s&&(this.a.region=s);break;case"vertical":a==="lr"||a==="rl"?(this.a.vertical=a,this.a.region=null):r=!0;break;case"line":let[l,c]=a.split(v6);if(l.includes(gae)){let h=Wh(l);h!==null?(this.a.line=h,this.a.snapToLines=!1):r=!0}else{let h=hae(l);h!==null?this.a.line=h:r=!0}Tae.test(c)?this.a.lineAlign=c:c&&(r=!0),this.a.line!=="auto"&&(this.a.region=null);break;case"position":let[u,d]=a.split(v6),p=Wh(u);p!==null?this.a.position=p:r=!0,d&&Sae.test(d)?this.a.positionAlign=d:d&&(r=!0);break;case"size":let f=Wh(a);f!==null?(this.a.size=f,f<100&&(this.a.region=null)):r=!0;break;case"align":kae.test(a)?this.a.align=a:r=!0;break;default:this.e(this.d?.v(o,a,n))}r&&this.e(this.d?.w(o,a,n))}}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}};Cae=Object.freeze({__proto__:null,VTTBlock:qu,VTTParser:Ku,default:Pae,parseVTTTimestamp:vl}),Mae={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span",timestamp:"span"},QLe=new Set(Object.keys(Mae)),XLe=Symbol(0),ZLe=Symbol(0)});var Yse={};Ot(Yse,{default:()=>Jb});module.exports=RB(Yse);var GC=require("obsidian");function n_(t,e){let n={};for(let r of e)r in t&&(n[r]=t[r]);return n}function em(t,e){let n={...t};for(let r of e)delete n[r];return n}var r_={bilibili:"https://www.bilibili.com",youtube:"https://www.youtube.com",vimeo:"https://www.vimeo.com",coursera:"https://www.coursera.org"},tm={bilibili:"bilibili",youtube:"YouTube",generic:"Website",vimeo:"Vimeo",coursera:"Coursera"},KC=t=>em(t,["generic"]);var $B={bilibili:'<path fill-rule="evenodd" clip-rule="evenodd" d="M 20.736 14.88 C 18.513 12.735 18.513 9.173 20.736 7.028 C 22.849 4.99 26.197 4.99 28.311 7.028 L 40.096 18.397 C 40.43 18.72 40.715 19.075 40.949 19.453 L 58.772 19.453 C 59.006 19.075 59.291 18.72 59.625 18.397 L 71.41 7.028 C 73.523 4.99 76.871 4.99 78.984 7.028 C 81.208 9.173 81.208 12.735 78.984 14.88 L 74.244 19.453 L 77.778 19.453 C 90.051 19.453 100 29.402 100 41.675 L 100 72.262 C 100 84.534 90.051 94.484 77.778 94.484 L 22.222 94.484 C 9.949 94.484 0 84.534 0 72.262 L 0 41.675 C 0 29.402 9.949 19.453 22.222 19.453 L 25.477 19.453 L 20.736 14.88 Z M 22.222 30.172 C 16.086 30.172 11.111 35.146 11.111 41.283 L 11.111 72.654 C 11.111 78.79 16.086 83.765 22.222 83.765 L 77.778 83.765 C 83.914 83.765 88.889 78.79 88.889 72.654 L 88.889 41.283 C 88.889 35.146 83.914 30.172 77.778 30.172 L 22.222 30.172 Z M 27.778 51.805 C 27.778 48.737 30.265 46.25 33.333 46.25 C 36.402 46.25 38.889 48.737 38.889 51.805 L 38.889 56.772 C 38.889 59.84 36.402 62.328 33.333 62.328 C 30.265 62.328 27.778 59.84 27.778 56.772 L 27.778 51.805 Z M
body:not(.mx-show-controls) .vp-player-ui-overlays {
opacity: 0 !important;
}
\`,{waitForSelector:x,MediaPlugin:M}=n(),i=class extends M{findMedia(){return x("#main [data-player] .vp-video video")}getStyle(){return super.getStyle()+\`
\`+y}};
`;var mD=`"use strict";var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var x=(n,t)=>{for(var e in t)u(n,e,{get:t[e],enumerable:!0})},E=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of v(t))!T.call(n,o)&&o!==e&&u(n,o,{get:()=>t[o],enumerable:!(i=f(t,o))||i.enumerable});return n};var k=n=>E(u({},"__esModule",{value:!0}),n);var D={};x(D,{default:()=>c});module.exports=k(D);var p=()=>require("media-extended");var M=\`
body:not(.mx-player-ready) #movie_player,
ytd-watch-flexy[theater] #movie_player {
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100vw !important;
height: 100vh !important;
max-width: none !important;
max-height: none !important;
min-width: 0 !important;
min-height: 0 !important;
margin: 0 !important;
padding: 0 !important;
z-index: 2147483647 !important; /* Ensure it's on top of other elements */
background-color: #000 !important;
transform: none !important;
}
.mx-parent {
overflow: visible !important;
z-index: auto !important;
transform: none !important;
-webkit-transform-style: flat !important;
transition: none !important;
contain: none !important;
}
.mx-absolute {
position: absolute !important;
}
html, body {
overflow: hidden !important;
zoom: 100% !important;
}
.mx-parent video {
object-fit: contain !important;
}
ytd-app .html5-endscreen {
opacity: 0 !important;
}
body:not(.mx-show-controls) ytd-app .ytp-chrome-bottom {
opacity: 0 !important;
}
\`.trim(),P=\`
/* \\u9996\\u9875\\u9876\\u90E8\\u6A2A\\u5E45\\u5E7F\\u544A */
#masthead-ad,
/* \\u9996\\u9875\\u89C6\\u9891\\u6392\\u7248\\u5E7F\\u544A */
ytd-rich-item-renderer.style-scope.ytd-rich-grid-row #content:has(.ytd-display-ad-renderer),
/* \\u64AD\\u653E\\u5668\\u5E95\\u90E8\\u5E7F\\u544A */
.video-ads.ytp-ad-module,
/* \\u64AD\\u653E\\u9875\\u4F1A\\u5458\\u4FC3\\u9500\\u5E7F\\u544A */
tp-yt-paper-dialog:has(yt-mealbar-promo-renderer),
/* \\u64AD\\u653E\\u9875\\u53F3\\u4E0A\\u65B9\\u63A8\\u8350\\u5E7F\\u544A */
ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-ads"],
/* \\u64AD\\u653E\\u9875\\u8BC4\\u8BBA\\u533A\\u53F3\\u4FA7\\u63A8\\u5E7F\\u5E7F\\u544A */
#related #player-ads,
/* \\u64AD\\u653E\\u9875\\u8BC4\\u8BBA\\u533A\\u53F3\\u4FA7\\u89C6\\u9891\\u6392\\u7248\\u5E7F\\u544A */
#related ytd-ad-slot-renderer,
/* \\u641C\\u7D22\\u9875\\u5E7F\\u544A */
ytd-ad-slot-renderer,
/* \\u64AD\\u653E\\u9875\\u4F1A\\u5458\\u63A8\\u8350\\u5E7F\\u544A */
yt-mealbar-promo-renderer,
/* M\\u64AD\\u653E\\u9875\\u7B2C\\u4E09\\u65B9\\u63A8\\u8350\\u5E7F */
ad-slot-renderer,
/* M\\u53EF\\u8DF3\\u8FC7\\u7684\\u89C6\\u9891\\u5E7F\\u544A\\u94FE\\u63A5 */
ytm-companion-ad-renderer {
opacity: 0 !important;
}
\`.trim(),{waitForSelector:l,MediaPlugin:A}=p(),a=class extends A{async findMedia(){let t=await l("ytd-app #movie_player video");if(this.app=t.closest("ytd-app"),this.moviePlayer=t.closest("#movie_player"),!this.app||!this.moviePlayer)throw new Error("Failed to find media");return this.watchIfDetached(),t}captionSrc=new Map;getTracks(){let t=window.ytInitialPlayerResponse?.captions?.playerCaptionsTracklistRenderer?.captionTracks;return Array.isArray(t)?t.map((e,i)=>{let o=e,r=o.vssId||\`tract\${i}\`;return this.captionSrc.set(r,{url:o.baseUrl}),{wid:r,kind:"subtitles",language:o.languageCode,label:o.name?.simpleText||o.trackName}}):[]}#t=new DOMParser;#e(t){return this.#t.parseFromString(t,"text/html").documentElement.textContent??t}async getTrack(t){let e=this.captionSrc.get(t);if(!e)return null;let i=await fetch(e.url);if(!i.ok)return null;let o=await i.text(),s=[...this.#t.parseFromString(o,"text/xml").getElementsByTagName("text")],h={Kind:"subtitles",ID:t};return{cues:s.map((d,y)=>{let m=parseFloat(d.getAttribute("start")),g=parseFloat(d.getAttribute("dur")),b=m+g,w=this.#e(d.textContent);return{id:y.toString(),startTime:m,endTime:b,text:w}}),metadata:h}}watchIfDetached(){let t=this.moviePlayer,e=new MutationObserver(async()=>{if(this.media.isConnected)return;let i=await this.findMedia();i&&this.rehookMediaEl(i)});e.observe(t,{childList:!0,subtree:!0}),this.register(()=>e.disconnect())}getStyle(){return M+\`
\`+P}async onload(){await super.onload();let t=this.getTracks();t.length>0&&this.controller.send("mx-text-tracks",{tracks:t}),this.disableAutoPlay(),l("ytd-consent-bump-v2-lightbox",this.app).then(()=>{this.controller.send("mx-open-browser",{message:"Seems like YouTube is showing a consent popup that block playback. To continue playback, you should handle it in dedicated login browser. ",url:"https://youtube.com"})})}app;moviePlayer;async disableAutoPlay(){let e=await l('button.ytp-button[data-tooltip-target-id="ytp-autonav-toggle-button"]',this.app);if(!e)throw new Error("Autoplay button not found");let i=e.querySelector(".ytp-autonav-toggle-button");if(!i)throw new Error("Autoplay button label not found");let o=()=>i.getAttribute("aria-checked")==="true";o()&&(e.click(),await new Promise(r=>{let s=new MutationObserver(()=>{o()||(s.disconnect(),r())});s.observe(i,{attributes:!0})}))}enterWebFullscreen(){this.assignParentClass(this.moviePlayer),(async()=>{let t=await l("#movie_player .ytp-size-button"),e=0;for(;!this.isCinematicsMode()&&e++<5;)t.click(),await C(500);e>=5,window.dispatchEvent(new Event("resize"))})()}isCinematicsMode(){return this.media.offsetWidth===window.innerWidth}};function C(n){return new Promise(t=>setTimeout(t,n))}var c=class extends a{actualDuration=parseInt(ytInitialPlayerResponse?.videoDetails?.lengthSeconds,10);_runningAd=Number.isNaN(this.actualDuration)?null:!1;#t=null;get runningAd(){return this._runningAd}set runningAd(t){if(this._runningAd=t,t===!1)window.clearInterval(this.#t?.id??-1),this.#t=null;else if(t===!0&&!this.#t){let e={id:window.setTimeout(()=>{e.retry++>=2?(this._runningAd=!1,window.clearInterval(e.id),this.#t=null):this.adContinue()},500),retry:0};this.#t=e}}adContinue(){let t=this.moviePlayer.querySelector(".ytp-play-button")??this.moviePlayer;t.click(),S.call(t)}async onload(){if(await super.onload(),this.runningAd!==null){let t=this.media,e=()=>{if(Math.abs(t.duration-this.actualDuration)<=1){this.runningAd=!1;return}this.runningAd=!0,window.location.href.includes("https://m.youtube.com/")&&(t.muted=!0),t.currentTime=t.duration,this.adContinue()};e(),this.media.addEventListener("durationchange",e)}}};function S(){let n=new Touch({identifier:Date.now(),target:this,clientX:12,clientY:34,radiusX:56,radiusY:78,rotationAngle:0,force:1}),t=new TouchEvent("touchstart",{bubbles:!0,cancelable:!0,view:window,touches:[n],targetTouches:[n],changedTouches:[n]});this.dispatchEvent(t);let e=new TouchEvent("touchend",{bubbles:!0,cancelable:!0,view:window,touches:[],targetTouches:[],changedTouches:[n]});this.dispatchEvent(e)}
`;var gD={bilibili:fD,youtube:mD,vimeo:hD,coursera:void 0,generic:void 0};var yD="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var vD=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=yD[n[t]&63];return e};var Bf=vD(12);function eu(t){return t.replaceAll("process.env.BILI_REQ_STORE",JSON.stringify(Bf))}var xD={generic:t=>t,bilibili:t=>t.replaceAll(/[-_]哔哩哔哩.+$|[-_]bilibili.+$|-(?:番剧|电影|纪录片|国创|电视剧|综艺)-.+/g,""),youtube:t=>t.replace(/^\(\d+\) /,"").replace(/ - YouTube$/,""),vimeo:t=>t.replace(/ on Vimeo$/,""),coursera:t=>t.replace(/ \| Coursera$/,"")};function wD(t){return`webpage::${btoa(t)}`}function bD(t){return atob(t.replace(/^webpage::/,""))}function _D(t){return typeof t=="string"&&t.startsWith("webpage::")}function kD(t){return t.type==="TimeRanges"}var qv=class{constructor(e){this.ranges=e}get length(){return this.ranges.length}start(e){return this.ranges[e][0]}end(e){return this.ranges[e][1]}};function fi(t){return kD(t)?new qv(t.value):t}var{onDispose:tE,peek:GG}=Ea,Kv=class{constructor(e,n){this._provider=e;this._ctx=n;T(this,"_disposal",pD());T(this,"_waiting",!1);T(this,"_attachedLoadStart",!1);T(this,"_attachedCanPlay",!1);T(this,"_handlers");T(this,"_handleDevEvent");this._attachInitialListeners(),tE(this._media.on("timeupdate",this._onTimeUpdate.bind(this))),tE(this._onDispose.bind(this))}get _webview(){return this._provider.webview}get _media(){return this._provider.media}get _notify(){return this._ctx.delegate._notify}_onDispose(){this._attachedLoadStart=!1,this._attachedCanPlay=!1,this._disposal.empty()}_attachInitialListeners(){this._attachEventListener("loadstart",this._onLoadStart),this._attachEventListener("abort",this._onAbort),this._attachEventListener("emptied",this._onEmptied),this._attachEventListener("error",this._onError),this._attachEventListener("volumechange",this._onVolumeChange)}_attachLoadStartListeners(){this._attachedLoadStart||(this._disposal.add(this._attachEventListener("loadeddata",this._onLoadedData),this._attachEventListener("loadedmetadata",this._onLoadedMetadata),this._attachEventListener("canplay",this._onCanPlay),this._attachEventListener("canplaythrough",this._onCanPlayThrough),this._attachEventListener("durationchange",this._onDurationChange),this._attachEventListener("play",this._onPlay),this._attachEventListener("progress",this._onProgress),this._attachEventListener("stalled",this._onStalled),this._attachEventListener("suspend",this._onSuspend)),this._attachedLoadStart=!0)}_attachCanPlayListeners(){this._attachedCanPlay||(this._disposal.add(this._attachEventListener("pause",this._onPause),this._attachEventListener("playing",this._onPlaying),this._attachEventListener("ratechange",this._onRateChange),this._attachEventListener("seeked",this._onSeeked),this._attachEventListener("seeking",this._onSeeking),this._attachEventListener("ended",this._onEnded),this._attachEventListener("waiting",this._onWaiting)),this._attachedCanPlay=!0)}_attachEventListener(e,n){let r=n.bind(this),i=this._media.on(e,r);return tE(i)}_onDevEvent(e){}_updateCurrentTime(e,n,r){let i={currentTime:Math.min(e,this._ctx.$state.seekableEnd()),played:n};this._notify("time-update",i,r&&new Event(r.type))}_onLoadStart(e){if(e.payload.networkState===3){this._onAbort(e);return}this._attachLoadStartListeners(),this._notify("load-start",void 0,new Event(e.type))}_onAbort(e){this._notify("abort",void 0,new Event(e.type))}_onEmptied({type:e}){this._notify("emptied",void 0,new Event(e))}_onLoadedData(e){this._notify("loaded-data",void 0,new Event(e.type))}_onLoadedMetadata(e){this._attachCanPlayListeners(),this._notify("loaded-metadata",void 0,new Event(e.type))}_getCanPlayDetail({duration:e,buffered:n,seekable:r}){return{provider:GG(this._ctx.$provider),duration:e,buffered:n,seekable:r}}_onPlay(e){this._ctx.$state.canPlay()&&this._notify("play",void 0,new Event(e.type))}_onPause({type:e,payload:n}){n.readyState===1&&!this._waiting||(this._waiting=!1,this._notify("pause",void 0,new Event(e)))}_onCanPlay({type:e,payload:n}){let r=fi(n.b
---
`);return await o.processFrontMatter(s,l=>{Object.assign(l,r(s.path))}),s};function*$ne(t){for(let e of Mh(t.vault.getRoot())){if(e.extension!=="md")continue;let n=xP(e,t);n&&(yield{meta:n,file:e})}}function Uw(){let t=Ine(async e=>{let n=await this.plugin.transcript.getTracks(e);this.store.getState().setTextTracks(n)});this.registerEvent(this.plugin.app.metadataCache.on("mx:transcript-changed",async(e,n)=>{let r=this.getMediaInfo();!r||Ct(r)!==n||await t(r)}))}function Ine(t,e){let n=new Set,r=new Set,i=(0,zw.debounce)(o=>{t(...o).then((...a)=>{n.forEach(s=>s(...a)),n.clear()}).catch((...a)=>{r.forEach(s=>s(...a)),r.clear()})},e);return(...o)=>new Promise((a,s)=>{n.add(a),r.add(s),i(o)})}var bP=$(ie()),Bw=class extends jw.EditableFileView{constructor(n,r){super(n);this.plugin=r;T(this,"allowNoFile",!1);T(this,"store");T(this,"scope");T(this,"root",null);this.store=Ba(r),this.scope=new jw.Scope(this.app.scope),this.contentEl.addClasses(["mx","custom"]),Mx(this)}get player(){return this.store.getState().player}onload(){Uw.call(this),Lw(this,()=>this.render())}async onLoadFile(n){await this.store.getState().loadFile(n,{vault:this.app.vault})}onPaneMenu(n,r){super.onPaneMenu(n,r),Rx(this,n,r)}setEphemeralState(n){if("subpath"in n){let{subpath:r}=n;this.store.getState().setHash(r)}super.setEphemeralState(n)}async onOpen(){await super.onOpen(),this.render()}render(){this.root?.unmount(),this.root=n5.default.createRoot(this.contentEl),this.root.render((0,bP.jsx)(cn.Provider,{value:{plugin:this.plugin,store:this.store,reload:()=>this.render(),onPlaylistChange:n=>{this.plugin.leafOpener.openMediaIn(this.leaf,n.media)},embed:!1},children:(0,bP.jsx)(Ya,{})}))}async onClose(){return this.root?.unmount(),this.root=null,super.onClose()}},Cu=class extends Bw{getIcon(){return"file-video"}getMediaInfo(){return this.file?{type:"video",file:this.file,hash:this.getEphemeralState().subpath}:null}getViewType(){return Vn.video}canAcceptExtension(e){return Ft(e)==="video"}},Mu=class extends Bw{getIcon(){return"file-audio"}getViewType(){return Vn.audio}getMediaInfo(){return this.file?{type:"audio",file:this.file,hash:this.getEphemeralState().subpath}:null}canAcceptExtension(e){return Ft(e)==="audio"}};var Hw=require("obsidian"),i5=$(xc());function r5(){let t=this.getDisplayText();this.titleEl.setText(t),this.app.workspace.activeLeaf===this.leaf&&this.app.workspace.requestActiveLeafEvents()&&this.leaf.updateHeader()}var _P=$(ie()),Qa=class extends Hw.ItemView{constructor(n,r){super(n);this.plugin=r;T(this,"store");T(this,"scope");T(this,"root",null);T(this,"navigation",!0);T(this,"updateTitle",r5);this.store=Ba(r),this.scope=new Hw.Scope(this.app.scope),this.contentEl.addClasses(["mx","custom"]),Mx(this)}get player(){return this.store.getState().player}async setSource(n){let r=await this.plugin.transcript.getTracks(n);return{viewType:this.getViewType(),textTracks:r}}getMediaInfo(){let n=this.store.getState().source?.url;return n instanceof xt?n??null:null}get sourceType(){return this.store.getState().player?.state.source.type??""}get playerTitle(){return this.store.getState().player?.state.title??""}onload(){let n=this;super.onload(),Uw.call(this),this.register(yt(this.leaf,{detach:r=>function(...i){return n.root?.unmount(),n.root=null,r.call(this,...i)}})),Lw(this,()=>this.render())}registerRemoteTitleChange(){this.register(tl(this.store,n=>n.subscribe(({title:r})=>{this.updateTitle()})))}onPaneMenu(n,r){super.onPaneMenu(n,r),Rx(this,n,r)}getState(){let n=super.getState(),r=this.store.getState().source?.url;if(Se(r))throw new Error("Remote view don't handle file media");return{...n,source:r?r.jsonState.source:n.source}}async setState(n,r){if(await super.setState(n,r),!("source"in n))return;let i=this.plugin.resolveUrl(n.source);if(!i)console.warn("Invalid URL",n.source);else if(Se(i))console.warn("Open in-vault media in remote view",i);else{let o=this.store.getState().source?.url;Zn(i,o)||(this.store.getState().setSource(i,await this.setSource(i)),this.render())}}setEphemeralState(n){if("subpath"in n){let{subpath:r}=n;this.store.getState().set
`,r=[],i=!1;for(let o of t.list)if(o.media instanceof xt)n+=`#EXTINF:-1,${o.title}
${o.media.href}
`;else if(Se(o.media))if(e.adapter instanceof Nu.FileSystemAdapter){let a=e.adapter.getFullPath(o.media.file.path);try{let s=(0,b5.pathToFileURL)(a).href;n+=`#EXTINF:-1,${o.title}
${s}
`}catch(s){new Nu.Notice(`Failed to convert file path to URL: ${s}`),r.push(o.title||Ct(o.media))}}else i=!0,r.push(o.title||Ct(o.media));r.length>0&&(i?new Nu.Notice(createFragment(o=>{o.createDiv({text:"File URI is not supported in this environment. "}),o.createDiv({text:`Skipped items: ${r.join(", ")}`})})):new Nu.Notice(`Skipped items: ${r.join(", ")}`)),Une(n,t.title)}function Une(t,e){let n=new Blob([t],{type:"application/vnd.apple.mpegurl"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=`${e}.m3u8`,document.body.appendChild(r),r.click(),document.body.removeChild(r)}var t6=require("obsidian");function PP(t,e){let n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}var zt=Za(/[A-Za-z]/),Ut=Za(/[\dA-Za-z]/),_5=Za(/[#-'*+\--9=?A-Z^-~]/);function ul(t){return t!==null&&(t<32||t===127)}var Ah=Za(/\d/),k5=Za(/[\dA-Fa-f]/),T5=Za(/[!-/:-@[-`{-~]/);function q(t){return t!==null&&t<-2}function Te(t){return t!==null&&(t<0||t===32)}function re(t){return t===-2||t===-1||t===32}var dl=Za(/\p{P}|\p{S}/u),Gi=Za(/\s/);function Za(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function CP(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Ja=function(t){if(t==null)return Wne;if(typeof t=="function")return eb(t);if(typeof t=="object")return Array.isArray(t)?Bne(t):jne(t);if(typeof t=="string")return Hne(t);throw new Error("Expected function, string, or object as test")};function Bne(t){let e=[],n=-1;for(;++n<t.length;)e[n]=Ja(t[n]);return eb(r);function r(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function jne(t){let e=t;return eb(n);function n(r){let i=r,o;for(o in t)if(i[o]!==e[o])return!1;return!0}}function Hne(t){return eb(e);function e(n){return n&&n.type===t}}function eb(t){return e;function e(n,r,i){return!!(qne(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Wne(){return!0}function qne(t){return t!==null&&typeof t=="object"&&"type"in t}var S5=[],tb=!0,Yi=!1,nb="skip";function Oh(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;let o=Ja(i),a=r?-1:1;s(t,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=S5,h,g,x;if((!e||o(l,c,u[u.length-1]||void 0))&&(f=Kne(n(l,u)),f[0]===Yi))return f;if("children"in l&&l.children){let m=l;if(m.children&&f[0]!==nb)for(g=(r?m.children.length:-1)+a,x=u.concat(m);g>-1&&g<m.children.length;){let y=m.children[g];if(h=s(y,g,x)(),h[0]===Yi)return h;g=typeof h[1]=="number"?h[1]:g+a}}return f}}}function Kne(t){return Array.isArray(t)?t:typeof t=="number"?[tb,t]:t==null?S5:[t]}function MP(t,e,n){let i=Ja((n||{}).ignore||[]),o=Gne(e),a=-1;for(;++a<o.length;)Oh(t,"text",s);function s(c,u){let d=-1,p;for(;++d<u.length;){let f=u[d],h=p?p.children:void 0;if(i(f,h?h.indexOf(f):void 0,p))return;p=f}if(p)return l(c,u)}function l(c,u){let d=u[u.length-1],p=o[a][0],f=o[a][1],h=0,x=d.children.indexOf(c),m=!1,y=[];p.lastIndex=0;let v=p.exec(c.value);for(;v;){let w=v.index,k={index:v.index,input:v.input,stack:[...u,c]},b=f(...v,k);if(typeof b=="string"&&(b=b.length>0?{type:"text",value:b}:void 0),b===!1?p.lastIndex=w+1:(h!==w&&y.push({type:"text",value:c.value.slice(h,w)}),Array.isArray(b)?y.push(...b):b&&y.push(b),h=w+v[0].length,m=!0),!p.global)break;v=p.exec(c.value)}return m?(h<c.value.length&&y.push({type:"text",value:c.value.slice(h)}),d.children.splice(x,1,...y)):y=[c],x+y.length}}function Gne(t){let e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");let n=!t[0]||Array.isArray(t[0])?t:[t],r=-1;for(;++r<n.length;){let i=n[r];e.push([Yne(i[0]),Qne(i[1])])}return e}function Yne(t){return typeof t=="string"?new RegExp(CP(t),"g
`)}function _re(t){return t==null?"":String(t)}function kre(t){return t.length}function M5(t){let e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function $5(t,e,n,r){let i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);let a=n.indentLines(n.containerFlow(t,o.current()),Tre);return i(),a}function Tre(t,e,n){return">"+(n?"":" ")+t}function L5(t,e){return I5(t,e.inConstruct,!0)&&!I5(t,e.notInConstruct,!1)}function I5(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function VP(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
`&&L5(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function A5(t,e){let n=String(t),r=n.indexOf(e),i=r,o=0,a=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>a&&(a=o):o=1,i=r+e.length,r=n.indexOf(e,i);return a}function O5(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function F5(t){let e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function D5(t,e,n,r){let i=F5(n),o=t.value||"",a=i==="`"?"GraveAccent":"Tilde";if(O5(t,n)){let d=n.enter("codeIndented"),p=n.indentLines(o,Sre);return d(),p}let s=n.createTracker(r),l=i.repeat(Math.max(A5(o,i)+1,3)),c=n.enter("codeFenced"),u=s.move(l);if(t.lang){let d=n.enter(`codeFencedLang${a}`);u+=s.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...s.current()})),d()}if(t.lang&&t.meta){let d=n.enter(`codeFencedMeta${a}`);u+=s.move(" "),u+=s.move(n.safe(t.meta,{before:u,after:`
`,encode:["`"],...s.current()})),d()}return u+=s.move(`
`),o&&(u+=s.move(o+`
`)),u+=s.move(l),c(),u}function Sre(t,e,n){return(n?"":" ")+t}function Vu(t){let e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function N5(t,e,n,r){let i=Vu(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("definition"),s=n.enter("label"),l=n.createTracker(r),c=l.move("[");return c+=l.move(n.safe(n.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),s(),!t.url||/[\0- \u007F]/.test(t.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":`
`,...l.current()}))),s(),t.title&&(s=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),s()),a(),c}function V5(t){let e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}zP.peek=Ere;function zP(t,e,n,r){let i=V5(n),o=n.enter("emphasis"),a=n.createTracker(r),s=a.move(i);return s+=a.move(n.containerPhrasing(t,{before:s,after:i,...a.current()})),s+=a.move(i),o(),s}function Ere(t,e,n){return n.options.emphasis||"*"}function zu(t,e,n,r){let i,o,a;typeof e=="function"&&typeof n!="function"?(o=void 0,a=e,i=n):(o=e,a=n,i=r),Oh(t,o,s,i);function s(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return a(l,d,u)}}var Pre={};function pl(t,e){let n=e||Pre,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return U5(t,r,i)}function U5(t,e,n){if(Cre(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return z5(t.children,e,n)}return Array.isArray(t)?z5(t,e,n):""}function z5(t,e,n){let r=[],i=-1;for(;++i<t.length;)r[i]=U5(t[i],e,n);return r.join("")}function Cre(t){return!!(t&&typeof t=="object")}function B5(t,e){let n=!1;return zu(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Yi}),!!((!t.depth||t.depth<3)&&pl(t)&&(e.options.setext||n))}function j5(t,e,n,r){let i=Math.max(Math.min(6,t.depth||1),1),o=n.createTracker(r);if(B5(t,n)){let u=n.enter("headingSetext"),d=n.enter("phrasing"),p=n.containerPhrasing(t,{...o.current(),before:`
`,after:`
`});return d(),u(),p+`
`+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
`))+1))}let a="#".repeat(i),s=n.enter("headingAtx"),l=n.enter("phrasing");o.move(a+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
`,...o.current()});return/^[\t ]/.test(c)&&(c="&#x"+c.charCodeAt(0).toString(16).toUpperCase()+";"+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),l(),s(),c}UP.peek=Mre;function UP(t){return t.value||""}function Mre(){return"<"}BP.peek=Rre;function BP(t,e,n,r){let i=Vu(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image"),s=n.enter("label"),l=n.createTracker(r),c=l.move("![");return c+=l.move(n.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),s(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),s(),t.title&&(s=n.enter(`title${o}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),s()),c+=l.move(")"),a(),c}function Rre(){return"!"}jP.peek=$re;function jP(t,e,n,r){let i=t.referenceType,o=n.enter("imageReference"),a=n.enter("label"),s=n.createTracker(r),l=s.move("!["),c=n.safe(t.alt,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),a();let u=n.stack;n.stack=[],a=n.enter("reference");let d=n.safe(n.associationId(t),{before:l,after:"]",...s.current()});return a(),n.stack=u,o(),i==="full"||!c||c!==d?l+=s.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function $re(){return"!"}HP.peek=Ire;function HP(t,e,n){let r=t.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){let a=n.unsafe[o],s=n.compilePattern(a),l;if(a.atBreak)for(;l=s.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function Ire(){return"`"}function WP(t,e){let n=pl(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}qP.peek=Lre;function qP(t,e,n,r){let i=Vu(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r),s,l;if(WP(t,n)){let u=n.stack;n.stack=[],s=n.enter("autolink");let d=a.move("<");return d+=a.move(n.containerPhrasing(t,{before:d,after:">",...a.current()})),d+=a.move(">"),s(),n.stack=u,d}s=n.enter("link"),l=n.enter("label");let c=a.move("[");return c+=a.move(n.containerPhrasing(t,{before:c,after:"](",...a.current()})),c+=a.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(t.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(t.url,{before:c,after:t.title?" ":")",...a.current()}))),l(),t.title&&(l=n.enter(`title${o}`),c+=a.move(" "+i),c+=a.move(n.safe(t.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),s(),c}function Lre(t,e,n){return WP(t,n)?"<":"["}KP.peek=Are;function KP(t,e,n,r){let i=t.referenceType,o=n.enter("linkReference"),a=n.enter("label"),s=n.createTracker(r),l=s.move("["),c=n.containerPhrasing(t,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),a();let u=n.stack;n.stack=[],a=n.enter("reference");let d=n.safe(n.associationId(t),{before:l,after:"]",...s.current()});return a(),n.stack=u,o(),i==="full"||!c||c!==d?l+=s.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function Are(){return"["}function Uu(t){let e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function H5(t){let e=Uu(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function W5(t){let e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:a,tableCell:l,tableRow:s}};function a(f,h,g,x){return c(u(f,g,x),f.align)}function s(f,h,g,x){let m=d(f,g,x),y=c([m]);return y.slice(0,y.indexOf(`
`))}function l(f,h,g,x){let m=g.enter("tableCell"),y=g.enter("phrasing"),v=g.containerPhrasing(f,{...x,before:o,after:o});return y(),m(),v}function c(f,h){return R5(f,{align:h,alignDelimiters:r,padding:n,stringLength:i})}function u(f,h,g){let x=f.children,m=-1,y=[],v=h.enter("table");for(;++m<x.length;)y[m]=d(x[m],h,g);return v(),y}function d(f,h,g){let x=f.children,m=-1,y=[],v=h.enter("tableRow");for(;++m<x.length;)y[m]=l(x[m],f,h,g);return v(),y}function p(f,h,g){let x=Fh.inlineCode(f,h,g);return g.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function JP(){return{exit:{taskListCheckValueChecked:i4,taskListCheckValueUnchecked:i4,paragraph:jre}}}function e1(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Hre}}}function i4(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function jre(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let n=this.stack[this.stack.length-1];n.type;let r=n.children[0];if(r&&r.type==="text"){let i=e.children,o=-1,a;for(;++o<i.length;){let s=i[o];if(s.type==="paragraph"){a=s;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Hre(t,e,n,r){let i=t.children[0],o=typeof t.checked=="boolean"&&i&&i.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",s=n.createTracker(r);o&&s.move(a);let l=Fh.listItem(t,e,n,{...r,...s.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+a}}function t1(){return[LP(),OP(),DP(),XP(),JP()]}function n1(t){return{extensions:[AP(),FP(),NP(),ZP(t),e1()]}}function kt(t,e,n,r){let i=t.length,o=0,a;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(e,0),t.splice(...a),o+=1e4,e+=1e4}function Fn(t,e){return t.length>0?(kt(t,t.length,0,e),t):e}var o4={}.hasOwnProperty;function ob(t){let e={},n=-1;for(;++n<t.length;)Wre(e,t[n]);return e}function Wre(t,e){let n;for(n in e){let i=(o4.call(t,n)?t[n]:void 0)||(t[n]={}),o=e[n],a;if(o)for(a in o){o4.call(i,a)||(i[a]=[]);let s=o[a];qre(i[a],Array.isArray(s)?s:s?[s]:[])}}}function qre(t,e){let n=-1,r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);kt(t,0,0,r)}var Kre={tokenize:Zre,partial:!0},a4={tokenize:Jre,partial:!0},s4={tokenize:eie,partial:!0},l4={tokenize:tie,partial:!0},Gre={tokenize:nie,partial:!0},c4={tokenize:Qre,previous:d4},u4={tokenize:Xre,previous:p4},zo={tokenize:Yre,previous:f4},Qi={};function i1(){return{text:Qi}}var fl=48;for(;fl<123;)Qi[fl]=zo,fl++,fl===58?fl=65:fl===91&&(fl=97);Qi[43]=zo;Qi[45]=zo;Qi[46]=zo;Qi[95]=zo;Qi[72]=[zo,u4];Qi[104]=[zo,u4];Qi[87]=[zo,c4];Qi[119]=[zo,c4];function Yre(t,e,n){let r=this,i,o;return a;function a(d){return!r1(d)||!f4.call(r,r.previous)||o1(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),s(d))}function s(d){return r1(d)?(t.consume(d),s):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(Gre,u,c)(d):d===45||d===95||Ut(d)?(o=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),i=!0,l}function u(d){return o&&i&&zt(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function Qre(t,e,n){let r=this;return i;function i(a){return a!==87&&a!==119||!d4.call(r,r.previous)||o1(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Kre,t.attempt(a4,t.attempt(s4,o),n),n)(a))}function o(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function Xre(t,e,n){let r=this,i="",o=!1;return a;function a(d){return(d===72||d===104)&&p4.call(r,r.previous)&&!o1(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),s):n(d)}function s(d){if(zt(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),s;if(d===58){let
`;break}case-3:{a=`\r
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}var b1={};Ot(b1,{attentionMarkers:()=>Ooe,contentInitial:()=>Moe,disable:()=>Foe,document:()=>Coe,flow:()=>$oe,flowInitial:()=>Roe,insideSpan:()=>Aoe,string:()=>Ioe,text:()=>Loe});var Coe={42:bn,43:bn,45:bn,48:bn,49:bn,50:bn,51:bn,52:bn,53:bn,54:bn,55:bn,56:bn,57:bn,62:ab},Moe={91:c1},Roe={[-2]:Nh,[-1]:Nh,32:Nh},$oe={35:d1,42:gl,45:[hb,gl],60:f1,61:hb,95:gl,96:cb,126:cb},Ioe={38:lb,92:sb},Loe={[-5]:Vh,[-4]:Vh,[-3]:Vh,33:m1,38:lb,42:Dh,60:[a1,h1],91:g1,92:[u1,sb],93:ml,95:Dh,96:s1},Aoe={null:[Dh,T4]},Ooe={null:[42,95]},Foe={null:[]};function _1(t){let n=ob([b1,...(t||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i(w4),document:i(_4),flow:i(k4),string:i(S4),text:i(E4)};return r;function i(o){return a;function a(s){return M4(r,o,s)}}}function k1(t){for(;!ub(t););return t}var R4=/[\0\t\n\r]/g;function T1(){let t=1,e="",n=!0,r;return i;function i(o,a,s){let l=[],c,u,d,p,f;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),d=0,e="",n&&(o.charCodeAt(0)===65279&&d++,n=void 0);d<o.length;){if(R4.lastIndex=d,c=R4.exec(o),p=c&&c.index!==void 0?c.index:o.length,f=o.charCodeAt(p),!c){e=o.slice(d);break}if(f===10&&d===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<p&&(l.push(o.slice(d,p)),t+=p-d),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}d=p+1}return s&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}function ts(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?$4(t.position):"start"in t||"end"in t?$4(t):"line"in t||"column"in t?S1(t):""}function S1(t){return I4(t&&t.line)+":"+I4(t&&t.column)}function $4(t){return S1(t&&t.start)+"-"+S1(t&&t.end)}function I4(t){return t&&typeof t=="number"?t:1}var A4={}.hasOwnProperty;function E1(t,e,n){return typeof e!="string"&&(n=e,e=void 0),Doe(n)(k1(_1(n).document().write(T1()(t,e,!0))))}function Doe(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(HC),autolinkProtocol:R,autolinkEmail:R,atxHeading:o(os),blockQuote:o(Wo),characterEscape:R,characterReference:R,codeFenced:o(kr),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(kr,a),codeText:o(qo,a),codeTextData:R,data:R,codeFlowValue:R,definition:o(Ko),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(ad),hardBreakEscape:o(BC),hardBreakTrailing:o(BC),htmlFlow:o(jC,a),htmlFlowData:R,htmlText:o(jC,a),htmlTextData:R,image:o(vB),label:a,link:o(HC),listItem:o(xB),listItemValue:p,listOrdered:o(WC,d),listUnordered:o(WC),paragraph:o(wB),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(os),strong:o(bB),thematicBreak:o(kB)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:st,autolinkProtocol:Tl,blockQuote:l(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:Ji,characterReferenceMarkerNumeric:Ji,characterReferenceValue:od,codeFenced:l(x),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:h,codeFlowValue:_,codeIndented:l(m),codeText:l(j),codeTextData:_,data:_,definition:l(),definitionDestinationString:w,definitionLabelString:y,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(N),htmlFlowData:_,htmlText:l(O),htmlTextData:_,image:l(X),label:se,labelText:xe,lineEnding:D,link:l(Q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:_n,resourceDestinationString:E,resourceTitleString:Ne,resource:Pt,setextHeading:l(C),setextHeadingLineSequence:S,setextHeadingText:b,strong:l(),thematicBreak:l()}};O4(e,(t||{}).mdastExtensions||[]);let n={};return r;function r(F){let W={type:"root",children:[]},fe={stack:[W],tokenStack:[],config:e,enter:s,exit:c,buffer:a,resume:u,data:n},Ce=[],Ve=-1;for(;++Ve<F.length;)if(F[Ve][1].type==="listOrdered"||F[Ve][1].type==="listUnordered")if(F[Ve][0]==="enter")Ce.push(
`)}async function W1(t,e){let n=await j1(t,e);return n.metadata=hE(n.metadata,r=>Lae(r)),n}function T6(t,e){if(e.tracks.local.length===0&&e.tracks.remote.length===0)return;let n=[...e.tracks.local.map(r=>({...r,_type:"local"})),...e.tracks.remote.map(r=>({...r,_type:"remote"}))];t.addItem(r=>{let i=r.setSection("view").setTitle("Open transcript").setIcon("subtitles").setSubmenu();n.sort(yE).forEach((o,a)=>{let s=o.label||pu(o.language)||o.wid||`${Gf(o.kind)} ${a+1}`;i.addItem(l=>l.setTitle(s).onClick(async()=>{if(o._type==="remote"){let c=await Aae(o,e);c&&e.plugin.app.workspace.openLinkText(c.path,"","split")}else o._type==="local"&&(o.src instanceof _r.TFile?e.plugin.app.vault.getFileByPath(o.src.path)&&e.plugin.app.workspace.openLinkText(o.src.path,"","split"):new _r.Notice("Remote track not yet supported"))}))})})}async function Aae({wid:t,language:e,label:n,kind:r},{source:i,plugin:o,player:a}){let s=a.provider;if(!(s instanceof yn)||!(i instanceof xt))return new _r.Notice("Cannot save transcript from this media"),null;try{let l=await s.media.methods.getTrack(t);if(!l)return new _r.Notice(`Failed to save transcript: track ${t} not found`),null;let c=k6(l,{Source:i.jsonState.source,Title:Ao(i,a),Language:e,Label:n}),u=hu([Ao(i).replace(/\s+/gu,"").toLowerCase(),t.replaceAll(".","_"),e,"vtt"].filter(Boolean).join(".")).replaceAll(/_+-+|-+_+/gu,"-").replaceAll(/-{2,}/gu,"-").replaceAll(/_{2,}$/gu,"_"),d=await o.mediaNote.getNote(i,a),p=await Sx(o.settings.getState().subtitleFolderPath,{plugin:o,sourcePath:d.path}),f=(0,_r.normalizePath)(`${p.path}/${u}`),h=o.app.vault.getFileByPath(f);h?await o.app.vault.modify(h,c):h=await o.app.vault.create(f,c),new _r.Notice(`Transcript saved to ${h.path}`);let{fileManager:g}=o.app,x=(n||e||t).trim(),m=g.generateMarkdownLink(h,d.path,`#wid=${encodeURIComponent(t)}`,x).replace(/^!/u,""),y=Xf[r],v=w=>typeof w=="string";return await o.app.fileManager.processFrontMatter(d,w=>{let k=[];if(y.plural in w){let S=w[y.plural];if(!S)k=[];else if(Array.isArray(S)&&S.every(v))k=S;else{new _r.Notice(`Failed to save transcript: field \`${y.plural}\` in note ${d.path} is not an array of strings, you may need to fix it manually.`),console.log("EXISTING",S);return}}else if(y.singular in w){let S=w[y.singular];if(!S)k=[];else if(v(S))k=[S];else{new _r.Notice(`Failed to save transcript: field \`${y.singular}\` in note ${d.path} is not a string, you may need to fix it manually.`);return}}let b=kx([...k.filter(S=>{let C=S.match(/#wid=(?<wid>[^&|)\]]+)/u);return C?C.groups.wid!==t:!0}),m]);b.length===1?(delete w[y.plural],w[y.singular]=m):(delete w[y.singular],w[y.plural]=b)}),h}catch(l){return console.error("Failed to save transcript",l),l instanceof Error?new _r.Notice(`Failed to save transcript: ${l.message}`):new _r.Notice("Failed to save transcript, for details see console."),null}}function S6(t,{setTransform:e,transform:n}){let r=t.setTitle("Transform").setIcon("rotate-3d").setSection("mx-player").setSubmenu();(n?.flipHorizontal||n?.flipVertical||n?.rotate)&&r.addItem(i=>i.setIcon("reset").setTitle("Reset").onClick(()=>e(null))),r.addItem(i=>i.setTitle("Flip horizontally").setIcon("flip-horizontal").setChecked(!!n?.flipHorizontal).onClick(()=>e({flipHorizontal:!n?.flipHorizontal}))).addItem(i=>i.setTitle("Flip vertically").setIcon("flip-vertical").setChecked(!!n?.flipVertical).onClick(()=>e({flipVertical:!n?.flipVertical}))).addSeparator().addItem(i=>i.setChecked(n?.rotate==="180").setIcon("iteration-cw").setTitle("Rotate 180\xB0").onClick(()=>{e({rotate:n?.rotate==="180"?void 0:"180"})}))}var q1=require("obsidian");function E6(t,{source:e,plugin:n,viewType:r,player:i}){if(Se(e))return;if(e.isFileUrl){Jw(e,t);return}let o=e.jsonState.source,a=e.print({start:i.currentTime,end:-1});t.addItem(u=>u.setTitle("Copy URL").setIcon("copy").setSection("action").onClick(()=>{navigator.clipboard.writeText(o),new q1.Notice("URL copied to clipboard")})),a!==o&&t.addItem(u=>u.setTitle("Copy URL with timestamp").setIcon("copy-check").setSection("action").onClick(()=>{navigator.clipboard.writeText(a),new q1.Notice(
- {{TIMESTAMP}} `,screenshotEmbedTemplate:"{{TITLE}}{{DURATION}}|50",screenshotTemplate:`
- !{{SCREENSHOT}} {{TIMESTAMP}} `,insertBefore:!1,timestampOffset:0,biliDefaultQuality:80,screenshotFormat:"image/webp",speedStep:.1};function X6(){return Tt.Platform.isDesktopApp?require("os").hostname()||(Tt.Platform.isMacOS?"Mac":Tt.Platform.isWin?"Windows":Tt.Platform.isLinux?"Linux":"Desktop"):Tt.Platform.isIosApp?Tt.Platform.isPhone?"iPhone":Tt.Platform.isTablet?"iPad":"iOS Device":Tt.Platform.isAndroidApp?Tt.Platform.isPhone?"Android Phone":Tt.Platform.isTablet?"Android Tablet":"Android Device":"Unknown Device"}function Z6(t){return new Map(t.map(e=>[`${e.appId}%${e.protocol}`,e.replace]))}function Qae(t){return Array.from(t.entries()).map(([e,n])=>{let[r,i]=e.split("%");return{appId:r,protocol:i,replace:n}}).filter(e=>e.appId&&e.protocol&&e.replace)}function eU(t){let e=(0,Tt.debounce)(n=>{let r=n_(n,Y6);t.saveData({...r,urlMappingData:n.getUrlMappingData()})},1e3);return wc((n,r)=>({...em(Q6,["urlMappingData"]),setEnableSubtitle(i){n({enableSubtitle:i}),e(r())},setSpeedStep(i){i=Math.abs(i),i!==0&&(n({speedStep:i}),e(r()))},setScreenshotFormat(i){n({screenshotFormat:i}),e(r())},setScreenshotQuality(i){n({screenshotQuality:i??void 0}),e(r())},setDefaultLanguage(i){n({defaultLanguage:i?.format()}),e(r())},getDefaultLang(){let i=r().defaultLanguage,o=Tt.moment.locale();return i&&!Qf(i)?(new Tt.Notice(`Invalid language code detected in preferences: ${i}, reverting to ${o}.`),n({defaultLanguage:void 0}),e(r()),o):i??Tt.moment.locale()},getUrlMappingData(){return Qae(r().urlMapping)},setBiliDefaultQuality(i){n({biliDefaultQuality:i}),e(r())},setInsertPosition(i){n({insertBefore:i==="before"}),e(r())},setLinkHandler(i,o){n(a=>{let s={...a.linkHandler};for(let l of Object.keys(s)){let c=l;s[c]=s[c].filter(u=>typeof u=="string"?u!==i:typeof i=="string"||!Xae(u,i)),c===o&&(s[c]=[...s[c],i])}return{linkHandler:s}}),e(r())},setTimestampOffset(i){n({timestampOffset:i}),e(r())},setDefaultMxLinkBehavior:i=>{let o;i==="split"||i==="split-horizontal"?o="window":i==="window"?o="tab":i==="tab"?o="split":o=null,n({defaultMxLinkClick:{click:i,alt:o}}),e(r())},setTemplate(i,o){switch(i){case"screenshot":n({screenshotTemplate:o});break;case"screenshotEmbed":n({screenshotEmbedTemplate:o});break;case"timestamp":n({timestampTemplate:o});break;default:(0,J6.assertNever)(i)}e(r())},setMxLinkAltBehavior:i=>{n(({defaultMxLinkClick:o})=>({defaultMxLinkClick:{...o,alt:i}})),e(r())},urlMapping:Z6(Q6.urlMappingData),setDefaultVolume:i=>{n({defaultVolume:i}),e(r())},getUrlMapping:i=>r().urlMapping.get(`${t.app.appId}%${i}`),setUrlMapping:(i,o)=>{if(i.includes("%"))throw new Error("Protocol cannot contain %");let a=`${t.app.appId}%${i}`;n(s=>({urlMapping:new Map(s.urlMapping).set(a,o),devices:s.getDeviceName()?s.devices:[...s.devices,{appId:t.app.appId,name:X6()}]})),e(r())},removeUrlMapping:i=>{if(i.includes("%"))throw new Error("Protocol cannot contain %");n(o=>{let a=`${t.app.appId}%${i}`,s=new Map(o.urlMapping);return s.delete(a),{urlMapping:s}}),e(r())},getDeviceName(i=t.app.appId){return r().devices.find(o=>o.appId===i)?.name},getDeviceNameWithDefault(i=t.app.appId){let o=r().devices.find(a=>a.appId===i);return o?o.name:i===t.app.appId?X6():"Unknown Device"},setDeviceName(i,o=t.app.appId){n({devices:[...r().devices.filter(a=>a.appId!==o),{appId:o,name:i}]}),e(r())},setLoadStrategy:i=>{n({loadStrategy:i}),e(r())},setScreenshotFolder(i){i!==null?(i=(0,Tt.normalizePath)(i),i==="."?i="/":i.startsWith("./")&&(i=i.slice(2)),n({screenshotFolderPath:i})):n({screenshotFolderPath:void 0})},setSubtitleFolder(i){i!==null?(i=(0,Tt.normalizePath)(i),i==="."?i="/":i.startsWith("./")&&(i=i.slice(2)),n({subtitleFolderPath:i})):n({subtitleFolderPath:void 0})},load:async()=>{let i=await t.loadData();if(!i)return;let{urlMappingData:o,...a}=n_(i,Y6);n({...a,urlMapping:Z6(o??[])})},save:()=>{e(r())}}))}function Xae(t,e){let n=new Set([...Object.keys(t),...Object.keys(e)]);for(let r of n)if(t[r]!==e[r])return!1;return!0}var nU=require("url"),yC=$(mE()),pe=require("obsidian");var Fb=class extends pe.PluginSettingTab{constructor(n){super(n.app,n);T(this,"plugin");t
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return(l=n?.onChange)==null||l.call(n,i),i}}function Bb(t,e){if(t===void 0)throw new Error(`Unexpected undefined${e?`: ${e}`:""}`);return t}var MU=(t,e)=>Math.abs(t-e)<1;var gse=t=>t,yse=t=>{let e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let i=e;i<=n;i++)r.push(i);return r},RU=(t,e)=>{let n=t.scrollElement;if(!n)return;let r=o=>{let{width:a,height:s}=o;e({width:Math.round(a),height:Math.round(s)})};if(r(n.getBoundingClientRect()),typeof ResizeObserver>"u")return()=>{};let i=new ResizeObserver(o=>{let a=o[0];if(a?.borderBoxSize){let s=a.borderBoxSize[0];if(s){r({width:s.inlineSize,height:s.blockSize});return}}r(n.getBoundingClientRect())});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}};var $U=(t,e)=>{let n=t.scrollElement;if(!n)return;let r=()=>{e(n[t.options.horizontal?"scrollLeft":"scrollTop"])};return r(),n.addEventListener("scroll",r,{passive:!0}),()=>{n.removeEventListener("scroll",r)}};var vse=(t,e,n)=>{if(e?.borderBoxSize){let r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(t.getBoundingClientRect()[n.options.horizontal?"width":"height"])};var IU=(t,{adjustments:e=0,behavior:n},r)=>{var i,o;let a=t+e;(o=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})},jb=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=(()=>{let n=null,r=()=>n||(typeof ResizeObserver<"u"?n=new ResizeObserver(i=>{i.forEach(o=>{this._measureElement(o.target,o)})}):null);return{disconnect:()=>{var i;return(i=r())==null?void 0:i.disconnect()},observe:i=>{var o;return(o=r())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=r())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:gse,rangeExtractor:yse,onChange:()=>{},measureElement:vse,initialRect:{width:0,height:0},scrollMargin:0,gap:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=wl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.scrollElement=null},this._didMount=()=>(this.measureElementCache.forEach(this.observer.observe),()=>{this.observer.disconnect(),this.cleanup()}),this._willUpdate=()=>{let n=this.options.getScrollElement();this.scrollElement!==n&&(this.cleanup(),this.scrollElement=n,this._scrollToOffset(this.scrollOffset,{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,r=>{this.scrollAdjustments=0,this.scrollOffset!==r&&(this.isScrollingTimeoutId!==null&&(clearTimeout(this.isScrollingTimeoutId),this.isScrollingTimeoutId=null),this.isScrolling=!0,this.scrollDirection=this.scrollOffset<r?"forward":"backward",this.scrollOffset=r,this.maybeNotify(),this.isScrollingTimeoutId=setTimeout(()=>{this.isScrollingTimeoutId=null,this.isScrolling=!1,this.scrollDirection=null,this.maybeNotify()},this.options.scrollingDelay))})))},this.getSize=()=>this.scrollRect[this.options.horizontal?"width":"height"],this.memoOptions=wl(
`)?t.split(`
`).forEach((r,i)=>{i===0?e.push(r):e.push((0,Zt.jsx)("br",{},`${n}seg-${i}`),r)}):e.push(t)}var nd=$(ie()),JU=(0,Zi.forwardRef)(function({children:e,className:n,searchResult:r,onPlay:i,onCopy:o,activeCueIDs:a},s){let l=(0,Zi.useRef)(null),c=(0,Zi.useMemo)(()=>new Map(r?.map(p=>[p.id,p.matches])??[]),[r]),u=OU({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>45,overscan:20});(0,Zi.useEffect)(()=>{if(!a)return;let[p]=a;if(!p)return;let f=e.findIndex(h=>h.id===p);f-1<0||u.scrollToIndex(f-1,{behavior:"smooth",align:"start"})},[a,e,u]),(0,Zi.useImperativeHandle)(s,()=>({scrollToIndex:p=>u.scrollToIndex(p,{behavior:"auto",align:"start"})}),[u]);let d=u.getVirtualItems();return(0,nd.jsx)(DC,{className:gt(n,"h-full"),ref:l,children:(0,nd.jsx)("div",{style:{height:`${u.getTotalSize()}px`},className:"w-full relative max-w-[var(--file-line-width)] mx-auto",children:(0,nd.jsx)("div",{className:"absolute w-full top-0 left-0",style:{transform:`translateY(${d[0]?.start??0}px)`},children:d.map(p=>{let f=e[p.index];return(0,nd.jsx)(XU,{active:a?.has(f.id),ref:u.measureElement,"data-index":p.index,time:f.startTime,matches:c?.get(f.id),actions:(0,nd.jsx)(QU,{onPlay:i&&(h=>i(h,f.startTime)),onCopy:o&&(h=>o(h,f.startTime,f.text))}),children:f.text},f.id)})})})})});var bl=$(K());var Ho=$(ie());function eB({onSubmit:t,onExit:e,noResult:n=!1}){let[r,i]=(0,bl.useState)(""),o=(0,bl.useRef)("");function a(l){l.preventDefault(),i(""),o.current="",e?.()}let s=(0,bl.useRef)(null);return(0,bl.useEffect)(()=>{s.current?.focus()},[]),(0,Ho.jsx)("div",{className:"document-search-container",children:(0,Ho.jsxs)("form",{className:gt("document-search"),onSubmit:l=>{l.preventDefault(),t(r,o.current!==r,"next"),o.current=r},children:[(0,Ho.jsx)("input",{type:"text",ref:s,value:r,onChange:l=>i(l.target.value),onKeyDown:l=>{l.key==="Escape"&&a(l)},placeholder:"Search transcript",className:gt("document-search keep-ob",n&&o.current&&o.current===r&&"bg-[rgba(var(--background-modifier-error-rgb),0.2)]")}),(0,Ho.jsxs)("div",{className:"document-search-buttons",children:[(0,Ho.jsx)("button",{type:"button",className:"document-search-button keep-ob",onClick:l=>{l.preventDefault(),t(r,o.current!==r,"prev"),o.current=r},children:"Prev"}),(0,Ho.jsx)("button",{type:"submit",className:"document-search-button keep-ob",children:"Next"})]}),(0,Ho.jsx)("span",{className:"document-search-close-button",tabIndex:0,role:"button",onKeyDown:l=>{l.key==="Enter"&&a(l)},onClick:a})]})})}var Xh=$(ie());function NC(){let t=Uo(p=>p.textTrack?.content.cues||[]),e=Uo(p=>p.activeCueIDs),n=PU(),r=CU(),i=(0,_l.useMemo)(()=>new Map(t.map((p,f)=>[p.id,{cue:p,index:f}])),[t]),[o,a]=EU(),[s,l]=(0,_l.useState)([]),c=(0,_l.useRef)(-1),u=SU(),d=(0,_l.useRef)(null);return(0,Xh.jsxs)("div",{className:"h-full",children:[u&&o&&(0,Xh.jsx)(eB,{noResult:s.length===0,onSubmit:(p,f,h)=>{if(!f){if(c.current<0||s.length===0)return;h==="next"?c.current<s.length-1?c.current+=1:c.current=0:h==="prev"?c.current>0?c.current-=1:c.current=s.length-1:(0,tB.assertNever)(h),d.current?.scrollToIndex(i.get(s[c.current].id)?.index??-1);return}let g=u(p.trim(),{prefix:!0,fuzzy:!0});if(g.length===0){l([]);return}let{top:x,alt:m}=g.reduce((b,S,C,R)=>(S.queryTerms.length>=R[0].queryTerms.length?b.top.push(S):b.alt.push(S),b),{top:[],alt:[]}),[{score:y},v]=x;v&&y-v.score<10&&x.sort((b,S)=>{let C=i.get(b.id)?.index??-1,R=i.get(S.id)?.index??-1;return C-R});let w=x[0].id,{index:k}=i.get(w)??{};typeof k=="number"&&(l([...x,...m]),d.current?.scrollToIndex(k),c.current=0)},onExit:()=>{a(!1),l([])}}),(0,Xh.jsx)(JU,{className:"p-[var(--file-margins)] pt-0",ref:d,onPlay:n,onCopy:r,activeCueIDs:e,searchResult:s,children:t})]})}var Kb={local:"mx-transcript-local",webpage:"mx-transcript-webpage"};var VC=$(ie()),Zh=class t extends Gb.EditableFileView{constructor(n,r){super(n);this.plugin=r;T(this,"store",kU());T(this,"root",null);T(this,"allowNoFile",!1);this.contentEl.addClasses(["mx","custom","mx-transcript-view"])}static register(n){n.registerView(Kb.local,r=>new t(r,n)),n.registerExtensions(_x(),Kb.local)}canAcceptExtensi
`;var id=require("obsidian");var qse=eu(fB),Kse=eu(hB),Gse=eu(pB).replace("__USERSCRIPT__",JSON.stringify(Kse)),mB=Cw(Bf),Zb=class extends id.Component{constructor(n){super();this.plugin=n;T(this,"ready",!1)}get app(){return this.plugin.app}onReady(){this.ready=!0,this.app.metadataCache.trigger("mx:preload-ready")}onError(n){console.error("Failed to load preload",n),this.ready=null,this.app.metadataCache.trigger("mx:preload-error",n)}untilReady(n=5e3){return new Promise((r,i)=>{if(this.ready)return r();if(this.ready===null)return i(new Error("Cannot load"));let o=()=>{this.app.metadataCache.off("mx:preload-ready",o),this.app.metadataCache.off("mx:preload-error",a),r()},a=s=>{this.app.metadataCache.off("mx:preload-ready",o),this.app.metadataCache.off("mx:preload-error",a),i(s)};this.app.metadataCache.on("mx:preload-ready",o),this.app.metadataCache.on("mx:preload-error",a),setTimeout(()=>{a(new Error("Timeout"))},n)})}onload(){if(!id.Platform.isDesktopApp){this.onReady();return}let n=ps(),r=tR(),i=en.join(r,`mx-player-hack.${Date.now()}.js`),o=en.join(r,`mx-preload.${Date.now()}.js`);(async()=>{await Promise.all([n.writeFile(i,qse,"utf-8"),n.writeFile(o,Gse,"utf-8")]),this.register(()=>{n.rm(o,{force:!0,maxRetries:5}).catch(l=>console.warn("Failed to remove preload script",o,l))});try{await eR(i),console.debug("preload patch loaded")}finally{await n.rm(i,{force:!0,maxRetries:5}).catch(l=>console.warn("Failed to remove hack script",i,l))}let{enable:a,disable:s}=uP({ipcRenderer:require("electron").ipcRenderer,channel:mB});await a(o),this.app.workspace.onLayoutReady(()=>{this.app.workspace.floatingSplit.children.forEach(l=>{l instanceof id.WorkspaceWindow&&this.enablePreload(o,l.win)}),this.registerEvent(this.app.workspace.on("window-open",async(l,c)=>{await this.enablePreload(o,c)}))}),this.register(s),console.log("mx-player-hack loaded"),this.onReady()})().catch(a=>this.onError(a))}async enablePreload(n,r){let{ipcRenderer:i}=r.require("electron"),{enable:o}=uP({ipcRenderer:i,channel:mB});await o(n)}};var gB=require("obsidian");async function yB(){if(!gB.Platform.isDesktopApp)return;let t=_d(this.app.appId);t&&(this.settings.subscribe((e,n)=>{e.biliDefaultQuality!==n.biliDefaultQuality&&mC(t,e.biliDefaultQuality)}),await mC(t,this.settings.getState().biliDefaultQuality))}var Jb=class extends e_.Plugin{constructor(){super(...arguments);T(this,"settings",eU(this));T(this,"transcript",this.addChild(new Xb(this)));T(this,"api",{openUrl:async(n,r,i)=>{let o=this.resolveUrl(n);if(!o){new e_.Notice("Protocol not yet supported");return}await this.leafOpener.openMedia(o,r,{direction:i})}});T(this,"urlViewType",this.addChild(new wm(this)));T(this,"mediaNote",this.addChild(new Nw(this)));T(this,"playlist",this.addChild(new _b(this)));T(this,"preload",this.addChild(new Zb(this)));T(this,"leafOpener",this.addChild(new Kw(this)));T(this,"recorderNote",this.addChild(new rm(this)));T(this,"handleMediaNote",m5);T(this,"injectMediaEmbed",lC);T(this,"injectMediaView",hC);T(this,"registerMediaMenu",K1);T(this,"fixLinkLabel",pC);T(this,"patchEditorClick",cC);T(this,"patchPreviewClick",fC);T(this,"patchInlineUrl",uC);T(this,"patchLinktextOpen",dC);T(this,"modifySession",yB);T(this,"initLogin",nR)}resolveUrl(n){let r=W6(n);return r?KM(rr(r),this.settings.getState(),this.app):null}async onload(){this.addSettingTab(new Fb(this)),await this.loadSettings(),this.initLogin(),this.loadPatches(),this.registerMediaMenu(),this.handleMediaNote(),rB(this),await this.modifySession(),dU(this)}async loadSettings(){await this.settings.getState().load()}loadPatches(){this.injectMediaView(Vn.audio,n=>new Mu(n,this),Go("audio")),this.injectMediaView(Vn.video,n=>new Cu(n,this),Go("video")),this.injectMediaEmbed((n,r,i)=>new kb(n,r,i,this)),this.registerView(Rr,n=>new Lu(n,this)),this.registerView(ds,n=>new Ru(n,this)),this.registerView(nr.video,n=>new $u(n,this)),this.registerView(nr.audio,n=>new Iu(n,this)),this.patchEditorClick({onExternalLinkClick:SP}),this.patchPreviewClick({onExternalLinkClick:SP}),this.fixLinkLabel(),this.patchInlineUrl(),this.patchLinktextOpe
/*! Bundled license information:
react/cjs/react.production.min.js:
(**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
scheduler/cjs/scheduler.production.min.js:
(**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-dom/cjs/react-dom.production.min.js:
(**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
(**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js:
(**
* @license React
* use-sync-external-store-shim/with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react/cjs/react-jsx-runtime.production.min.js:
(**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
lodash-es/lodash.js:
(**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
*/