@byomakase/omakase-react-components 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +87 -72
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* https://github.com/MikeMcl/decimal.js
|
|
5
5
|
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
6
6
|
* MIT Licence
|
|
7
|
-
*/var rt=9e15,he=1e9,it="0123456789abcdef",Pe="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Be="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ot={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:rt,crypto:!1},Wt,ae,A=!0,$e="[DecimalError] ",me=$e+"Invalid argument: ",jt=$e+"Precision limit exceeded",Gt=$e+"crypto unavailable",Yt="[object Decimal]",q=Math.floor,U=Math.pow,Bn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Un=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Kn=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,zt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,te=1e7,C=7,Hn=9007199254740991,$n=Pe.length-1,st=Be.length-1,g={toStringTag:Yt};g.absoluteValue=g.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),y(t)};g.ceil=function(){return y(new this.constructor(this),this.e+1,2)};g.clampedTo=g.clamp=function(t,e){var n,r=this,i=r.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(me+e);return n=r.cmp(t),n<0?t:r.cmp(e)>0?e:new i(r)};g.comparedTo=g.cmp=function(t){var e,n,r,i,o=this,s=o.d,u=(t=new o.constructor(t)).d,c=o.s,a=t.s;if(!s||!u)return!c||!a?NaN:c!==a?c:s===u?0:!s^c<0?1:-1;if(!s[0]||!u[0])return s[0]?c:u[0]?-a:0;if(c!==a)return c;if(o.e!==t.e)return o.e>t.e^c<0?1:-1;for(r=s.length,i=u.length,e=0,n=r<i?r:i;e<n;++e)if(s[e]!==u[e])return s[e]>u[e]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1};g.cosine=g.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+C,r.rounding=1,n=Zn(r,nn(r,n)),r.precision=t,r.rounding=e,y(ae==2||ae==3?n.neg():n,t,e,!0)):new r(1):new r(NaN)};g.cubeRoot=g.cbrt=function(){var t,e,n,r,i,o,s,u,c,a,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(A=!1,o=l.s*U(l.s*l,1/3),!o||Math.abs(o)==1/0?(n=$(l.d),t=l.e,(o=(t-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=U(n,1/3),t=q((t+1)/3)-(t%3==(t<0?-1:2)),o==1/0?n="5e"+t:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+t),r=new f(n),r.s=l.s):r=new f(o.toString()),s=(t=f.precision)+3;;)if(u=r,c=u.times(u).times(u),a=c.plus(l),r=D(a.plus(l).times(u),a.plus(c),s+2,1),$(u.d).slice(0,s)===(n=$(r.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!i&&n=="4999"){if(!i&&(y(u,t+1,0),u.times(u).times(u).eq(l))){r=u;break}s+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(y(r,t+1,1),e=!r.times(r).times(r).eq(l));break}return A=!0,y(r,t,f.rounding,e)};g.decimalPlaces=g.dp=function(){var t,e=this.d,n=NaN;if(e){if(t=e.length-1,n=(t-q(this.e/C))*C,t=e[t],t)for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n};g.dividedBy=g.div=function(t){return D(this,new this.constructor(t))};g.dividedToIntegerBy=g.divToInt=function(t){var e=this,n=e.constructor;return y(D(e,new n(t),0,1,1),n.precision,n.rounding)};g.equals=g.eq=function(t){return this.cmp(t)===0};g.floor=function(){return y(new this.constructor(this),this.e+1,3)};g.greaterThan=g.gt=function(t){return this.cmp(t)>0};g.greaterThanOrEqualTo=g.gte=function(t){var e=this.cmp(t);return e==1||e===0};g.hyperbolicCosine=g.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(t=Math.ceil(i/3),e=(1/qe(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),o=Se(s,1,o.times(e),new s(1),!0);for(var c,a=t,l=new s(8);a--;)c=o.times(o),o=u.minus(c.times(l.minus(c.times(l))));return y(o,s.precision=n,s.rounding=r,!0)};g.hyperbolicSine=g.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,r=i.d.length,r<3)i=Se(o,2,i,i,!0);else{t=1.4*Math.sqrt(r),t=t>16?16:t|0,i=i.times(1/qe(5,t)),i=Se(o,2,i,i,!0);for(var s,u=new o(5),c=new o(16),a=new o(20);t--;)s=i.times(i),i=i.times(u.plus(s.times(c.times(s).plus(a))))}return o.precision=e,o.rounding=n,y(i,e,n,!0)};g.hyperbolicTangent=g.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,D(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)};g.inverseCosine=g.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return r!==-1?r===0?e.isNeg()?ee(n,i,o):new n(0):new n(NaN):e.isZero()?ee(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=ee(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))};g.inverseHyperbolicCosine=g.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,A=!1,n=n.times(n).minus(1).sqrt().plus(n),A=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)};g.inverseHyperbolicSine=g.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,A=!1,n=n.times(n).plus(1).sqrt().plus(n),A=!0,r.precision=t,r.rounding=e,n.ln())};g.inverseHyperbolicTangent=g.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?y(new o(i),t,e,!0):(o.precision=n=r-i.e,i=D(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)};g.inverseSine=g.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,e!==-1?e===0?(t=ee(o,n+4,r).times(.5),t.s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))};g.inverseTangent=g.atan=function(){var t,e,n,r,i,o,s,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding;if(a.isFinite()){if(a.isZero())return new l(a);if(a.abs().eq(1)&&f+4<=st)return s=ee(l,f+4,d).times(.25),s.s=a.s,s}else{if(!a.s)return new l(NaN);if(f+4<=st)return s=ee(l,f+4,d).times(.5),s.s=a.s,s}for(l.precision=u=f+10,l.rounding=1,n=Math.min(28,u/C+2|0),t=n;t;--t)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(A=!1,e=Math.ceil(u/C),r=1,c=a.times(a),s=new l(a),i=a;t!==-1;)if(i=i.times(c),o=s.minus(i.div(r+=2)),i=i.times(c),s=o.plus(i.div(r+=2)),s.d[e]!==void 0)for(t=e;s.d[t]===o.d[t]&&t--;);return n&&(s=s.times(2<<n-1)),A=!0,y(s,l.precision=f,l.rounding=d,!0)};g.isFinite=function(){return!!this.d};g.isInteger=g.isInt=function(){return!!this.d&&q(this.e/C)>this.d.length-2};g.isNaN=function(){return!this.s};g.isNegative=g.isNeg=function(){return this.s<0};g.isPositive=g.isPos=function(){return this.s>0};g.isZero=function(){return!!this.d&&this.d[0]===0};g.lessThan=g.lt=function(t){return this.cmp(t)<0};g.lessThanOrEqualTo=g.lte=function(t){return this.cmp(t)<1};g.logarithm=g.log=function(t){var e,n,r,i,o,s,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding,m=5;if(t==null)t=new l(10),e=!0;else{if(t=new l(t),n=t.d,t.s<0||!n||!n[0]||t.eq(1))return new l(NaN);e=t.eq(10)}if(n=a.d,a.s<0||!n||!n[0]||a.eq(1))return new l(n&&!n[0]?-1/0:a.s!=1?NaN:n?0:1/0);if(e)if(n.length>1)o=!0;else{for(i=n[0];i%10===0;)i/=10;o=i!==1}if(A=!1,u=f+m,s=fe(a,u),r=e?Ue(l,u+10):fe(t,u),c=D(s,r,u,1),Me(c.d,i=f,d))do if(u+=10,s=fe(a,u),r=e?Ue(l,u+10):fe(t,u),c=D(s,r,u,1),!o){+$(c.d).slice(i+1,i+15)+1==1e14&&(c=y(c,f+1,0));break}while(Me(c.d,i+=10,d));return A=!0,y(c,f,d)};g.minus=g.sub=function(t){var e,n,r,i,o,s,u,c,a,l,f,d,m=this,h=m.constructor;if(t=new h(t),!m.d||!t.d)return!m.s||!t.s?t=new h(NaN):m.d?t.s=-t.s:t=new h(t.d||m.s!==t.s?m:NaN),t;if(m.s!=t.s)return t.s=-t.s,m.plus(t);if(a=m.d,d=t.d,u=h.precision,c=h.rounding,!a[0]||!d[0]){if(d[0])t.s=-t.s;else if(a[0])t=new h(m);else return new h(c===3?-0:0);return A?y(t,u,c):t}if(n=q(t.e/C),l=q(m.e/C),a=a.slice(),o=l-n,o){for(f=o<0,f?(e=a,o=-o,s=d.length):(e=d,n=l,s=a.length),r=Math.max(Math.ceil(u/C),s)+2,o>r&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for(r=a.length,s=d.length,f=r<s,f&&(s=r),r=0;r<s;r++)if(a[r]!=d[r]){f=a[r]<d[r];break}o=0}for(f&&(e=a,a=d,d=e,t.s=-t.s),s=a.length,r=d.length-s;r>0;--r)a[s++]=0;for(r=d.length;r>o;){if(a[--r]<d[r]){for(i=r;i&&a[--i]===0;)a[i]=te-1;--a[i],a[r]+=te}a[r]-=d[r]}for(;a[--s]===0;)a.pop();for(;a[0]===0;a.shift())--n;return a[0]?(t.d=a,t.e=Ze(a,n),A?y(t,u,c):t):new h(c===3?-0:0)};g.modulo=g.mod=function(t){var e,n=this,r=n.constructor;return t=new r(t),!n.d||!t.s||t.d&&!t.d[0]?new r(NaN):!t.d||n.d&&!n.d[0]?y(new r(n),r.precision,r.rounding):(A=!1,r.modulo==9?(e=D(n,t.abs(),0,3,1),e.s*=t.s):e=D(n,t,0,r.modulo,1),e=e.times(t),A=!0,n.minus(e))};g.naturalExponential=g.exp=function(){return at(this)};g.naturalLogarithm=g.ln=function(){return fe(this)};g.negated=g.neg=function(){var t=new this.constructor(this);return t.s=-t.s,y(t)};g.plus=g.add=function(t){var e,n,r,i,o,s,u,c,a,l,f=this,d=f.constructor;if(t=new d(t),!f.d||!t.d)return!f.s||!t.s?t=new d(NaN):f.d||(t=new d(t.d||f.s===t.s?f:NaN)),t;if(f.s!=t.s)return t.s=-t.s,f.minus(t);if(a=f.d,l=t.d,u=d.precision,c=d.rounding,!a[0]||!l[0])return l[0]||(t=new d(f)),A?y(t,u,c):t;if(o=q(f.e/C),r=q(t.e/C),a=a.slice(),i=o-r,i){for(i<0?(n=a,i=-i,s=l.length):(n=l,r=o,s=a.length),o=Math.ceil(u/C),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=a.length,i=l.length,s-i<0&&(i=s,n=l,l=a,a=n),e=0;i;)e=(a[--i]=a[i]+l[i]+e)/te|0,a[i]%=te;for(e&&(a.unshift(e),++r),s=a.length;a[--s]==0;)a.pop();return t.d=a,t.e=Ze(a,r),A?y(t,u,c):t};g.precision=g.sd=function(t){var e,n=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(me+t);return n.d?(e=Jt(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e};g.round=function(){var t=this,e=t.constructor;return y(new e(t),t.e+1,e.rounding)};g.sine=g.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+C,r.rounding=1,n=Xn(r,nn(r,n)),r.precision=t,r.rounding=e,y(ae>2?n.neg():n,t,e,!0)):new r(NaN)};g.squareRoot=g.sqrt=function(){var t,e,n,r,i,o,s=this,u=s.d,c=s.e,a=s.s,l=s.constructor;if(a!==1||!u||!u[0])return new l(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);for(A=!1,a=Math.sqrt(+s),a==0||a==1/0?(e=$(u),(e.length+c)%2==0&&(e+="0"),a=Math.sqrt(e),c=q((c+1)/2)-(c<0||c%2),a==1/0?e="5e"+c:(e=a.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),r=new l(e)):r=new l(a.toString()),n=(c=l.precision)+3;;)if(o=r,r=o.plus(D(s,o,n+2,1)).times(.5),$(o.d).slice(0,n)===(e=$(r.d)).slice(0,n))if(e=e.slice(n-3,n+1),e=="9999"||!i&&e=="4999"){if(!i&&(y(o,c+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(y(r,c+1,1),t=!r.times(r).eq(s));break}return A=!0,y(r,c,l.rounding,t)};g.tangent=g.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,n=n.sin(),n.s=1,n=D(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,y(ae==2||ae==4?n.neg():n,t,e,!0)):new r(NaN)};g.times=g.mul=function(t){var e,n,r,i,o,s,u,c,a,l=this,f=l.constructor,d=l.d,m=(t=new f(t)).d;if(t.s*=l.s,!d||!d[0]||!m||!m[0])return new f(!t.s||d&&!d[0]&&!m||m&&!m[0]&&!d?NaN:!d||!m?t.s/0:t.s*0);for(n=q(l.e/C)+q(t.e/C),c=d.length,a=m.length,c<a&&(o=d,d=m,m=o,s=c,c=a,a=s),o=[],s=c+a,r=s;r--;)o.push(0);for(r=a;--r>=0;){for(e=0,i=c+r;i>r;)u=o[i]+m[r]*d[i-r-1]+e,o[i--]=u%te|0,e=u/te|0;o[i]=(o[i]+e)%te|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=Ze(o,n),A?y(t,f.precision,f.rounding):t};g.toBinary=function(t,e){return ht(this,2,t,e)};g.toDecimalPlaces=g.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(W(t,0,he),e===void 0?e=r.rounding:W(e,0,8),y(n,t+n.e+1,e))};g.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ie(r,!0):(W(t,0,he),e===void 0?e=i.rounding:W(e,0,8),r=y(new i(r),t+1,e),n=ie(r,!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n};g.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?n=ie(i):(W(t,0,he),e===void 0?e=o.rounding:W(e,0,8),r=y(new o(i),t+i.e+1,e),n=ie(r,!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};g.toFraction=function(t){var e,n,r,i,o,s,u,c,a,l,f,d,m=this,h=m.d,p=m.constructor;if(!h)return new p(m);if(a=n=new p(1),r=c=new p(0),e=new p(r),o=e.e=Jt(h)-m.e-1,s=o%C,e.d[0]=U(10,s<0?C+s:s),t==null)t=o>0?e:a;else{if(u=new p(t),!u.isInt()||u.lt(a))throw Error(me+u);t=u.gt(e)?o>0?e:a:u}for(A=!1,u=new p($(h)),l=p.precision,p.precision=o=h.length*C*2;f=D(u,e,0,1,1),i=n.plus(f.times(r)),i.cmp(t)!=1;)n=r,r=i,i=a,a=c.plus(f.times(i)),c=i,i=e,e=u.minus(f.times(i)),u=i;return i=D(t.minus(n),r,0,1,1),c=c.plus(i.times(a)),n=n.plus(i.times(r)),c.s=a.s=m.s,d=D(a,r,o,1).minus(m).abs().cmp(D(c,n,o,1).minus(m).abs())<1?[a,r]:[c,n],p.precision=l,A=!0,d};g.toHexadecimal=g.toHex=function(t,e){return ht(this,16,t,e)};g.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),t==null){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),e===void 0?e=r.rounding:W(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(A=!1,n=D(n,t,0,e,1).times(t),A=!0,y(n)):(t.s=n.s,n=t),n};g.toNumber=function(){return+this};g.toOctal=function(t,e){return ht(this,8,t,e)};g.toPower=g.pow=function(t){var e,n,r,i,o,s,u=this,c=u.constructor,a=+(t=new c(t));if(!u.d||!t.d||!u.d[0]||!t.d[0])return new c(U(+u,a));if(u=new c(u),u.eq(1))return u;if(r=c.precision,o=c.rounding,t.eq(1))return y(u,r,o);if(e=q(t.e/C),e>=t.d.length-1&&(n=a<0?-a:a)<=Hn)return i=Qt(c,u,n,r),t.s<0?new c(1).div(i):y(i,r,o);if(s=u.s,s<0){if(e<t.d.length-1)return new c(NaN);if((t.d[e]&1)==0&&(s=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=s,u}return n=U(+u,a),e=n==0||!isFinite(n)?q(a*(Math.log("0."+$(u.d))/Math.LN10+u.e+1)):new c(n+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(A=!1,c.rounding=u.s=1,n=Math.min(12,(e+"").length),i=at(t.times(fe(u,r+n)),r),i.d&&(i=y(i,r+5,1),Me(i.d,r,o)&&(e=r+10,i=y(at(t.times(fe(u,e+n)),e),e+5,1),+$(i.d).slice(r+1,r+15)+1==1e14&&(i=y(i,r+1,0)))),i.s=s,A=!0,c.rounding=o,y(i,r,o))};g.toPrecision=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ie(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(W(t,1,he),e===void 0?e=i.rounding:W(e,0,8),r=y(new i(r),t,e),n=ie(r,t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n};g.toSignificantDigits=g.toSD=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(W(t,1,he),e===void 0?e=r.rounding:W(e,0,8)),y(new r(n),t,e)};g.toString=function(){var t=this,e=t.constructor,n=ie(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n};g.truncated=g.trunc=function(){return y(new this.constructor(this),this.e+1,1)};g.valueOf=g.toJSON=function(){var t=this,e=t.constructor,n=ie(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};function $(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;e<i;e++)r=t[e]+"",n=C-r.length,n&&(o+=ce(n)),o+=r;s=t[e],r=s+"",n=C-r.length,n&&(o+=ce(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function W(t,e,n){if(t!==~~t||t<e||t>n)throw Error(me+t)}function Me(t,e,n,r){var i,o,s,u;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=C,i=0):(i=Math.ceil((e+1)/C),e%=C),o=U(10,C-e),u=t[i]%o|0,r==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),s=n<4&&u==99999||n>3&&u==49999||u==5e4||u==0):s=(n<4&&u+1==o||n>3&&u+1==o/2)&&(t[i+1]/o/100|0)==U(10,e-2)-1||(u==o/2||u==0)&&(t[i+1]/o/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),s=(r||n<4)&&u==9999||!r&&n>3&&u==4999):s=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(t[i+1]/o/1e3|0)==U(10,e-3)-1,s}function Fe(t,e,n){for(var r,i=[0],o,s=0,u=t.length;s<u;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=it.indexOf(t.charAt(s++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function Zn(t,e){var n,r,i;if(e.isZero())return e;r=e.d.length,r<32?(n=Math.ceil(r/3),i=(1/qe(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=Se(t,1,e.times(i),new t(1));for(var o=n;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=n,e}var D=function(){function t(r,i,o){var s,u=0,c=r.length;for(r=r.slice();c--;)s=r[c]*i+u,r[c]=s%o|0,u=s/o|0;return u&&r.unshift(u),r}function e(r,i,o,s){var u,c;if(o!=s)c=o>s?1:-1;else for(u=c=0;u<o;u++)if(r[u]!=i[u]){c=r[u]>i[u]?1:-1;break}return c}function n(r,i,o,s){for(var u=0;o--;)r[o]-=u,u=r[o]<i[o]?1:0,r[o]=u*s+r[o]-i[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,o,s,u,c){var a,l,f,d,m,h,p,w,E,I,M,N,k,x,G,ne,Y,ve,H,oe,se=r.constructor,be=r.s==i.s?1:-1,P=r.d,_=i.d;if(!P||!P[0]||!_||!_[0])return new se(!r.s||!i.s||(P?_&&P[0]==_[0]:!_)?NaN:P&&P[0]==0||!_?be*0:be/0);for(c?(m=1,l=r.e-i.e):(c=te,m=C,l=q(r.e/m)-q(i.e/m)),H=_.length,Y=P.length,E=new se(be),I=E.d=[],f=0;_[f]==(P[f]||0);f++);if(_[f]>(P[f]||0)&&l--,o==null?(x=o=se.precision,s=se.rounding):u?x=o+(r.e-i.e)+1:x=o,x<0)I.push(1),h=!0;else{if(x=x/m+2|0,f=0,H==1){for(d=0,_=_[0],x++;(f<Y||d)&&x--;f++)G=d*c+(P[f]||0),I[f]=G/_|0,d=G%_|0;h=d||f<Y}else{for(d=c/(_[0]+1)|0,d>1&&(_=t(_,d,c),P=t(P,d,c),H=_.length,Y=P.length),ne=H,M=P.slice(0,H),N=M.length;N<H;)M[N++]=0;oe=_.slice(),oe.unshift(0),ve=_[0],_[1]>=c/2&&++ve;do d=0,a=e(_,M,H,N),a<0?(k=M[0],H!=N&&(k=k*c+(M[1]||0)),d=k/ve|0,d>1?(d>=c&&(d=c-1),p=t(_,d,c),w=p.length,N=M.length,a=e(p,M,w,N),a==1&&(d--,n(p,H<w?oe:_,w,c))):(d==0&&(a=d=1),p=_.slice()),w=p.length,w<N&&p.unshift(0),n(M,p,N,c),a==-1&&(N=M.length,a=e(_,M,H,N),a<1&&(d++,n(M,H<N?oe:_,N,c))),N=M.length):a===0&&(d++,M=[0]),I[f++]=d,a&&M[0]?M[N++]=P[ne]||0:(M=[P[ne]],N=1);while((ne++<Y||M[0]!==void 0)&&x--);h=M[0]!==void 0}I[0]||I.shift()}if(m==1)E.e=l,Wt=h;else{for(f=1,d=I[0];d>=10;d/=10)f++;E.e=f+l*m-1,y(E,u?o+E.e+1:o,s,h)}return E}}();function y(t,e,n,r){var i,o,s,u,c,a,l,f,d,m=t.constructor;e:if(e!=null){if(f=t.d,!f)return t;for(i=1,u=f[0];u>=10;u/=10)i++;if(o=e-i,o<0)o+=C,s=e,l=f[d=0],c=l/U(10,i-s-1)%10|0;else if(d=Math.ceil((o+1)/C),u=f.length,d>=u)if(r){for(;u++<=d;)f.push(0);l=c=0,i=1,o%=C,s=o-C+1}else break e;else{for(l=u=f[d],i=1;u>=10;u/=10)i++;o%=C,s=o-C+i,c=s<0?0:l/U(10,i-s-1)%10|0}if(r=r||e<0||f[d+1]!==void 0||(s<0?l:l%U(10,i-s-1)),a=n<4?(c||r)&&(n==0||n==(t.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(o>0?s>0?l/U(10,i-s):0:f[d-1])%10&1||n==(t.s<0?8:7)),e<1||!f[0])return f.length=0,a?(e-=t.e+1,f[0]=U(10,(C-e%C)%C),t.e=-e||0):f[0]=t.e=0,t;if(o==0?(f.length=d,u=1,d--):(f.length=d+1,u=U(10,C-o),f[d]=s>0?(l/U(10,i-s)%U(10,s)|0)*u:0),a)for(;;)if(d==0){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(t.e++,f[0]==te&&(f[0]=1));break}else{if(f[d]+=u,f[d]!=te)break;f[d--]=0,u=1}for(o=f.length;f[--o]===0;)f.pop()}return A&&(t.e>m.maxE?(t.d=null,t.e=NaN):t.e<m.minE&&(t.e=0,t.d=[0])),t}function ie(t,e,n){if(!t.isFinite())return tn(t);var r,i=t.e,o=$(t.d),s=o.length;return e?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+ce(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+ce(-i-1)+o,n&&(r=n-s)>0&&(o+=ce(r))):i>=s?(o+=ce(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+ce(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=ce(r))),o}function Ze(t,e){var n=t[0];for(e*=C;n>=10;n/=10)e++;return e}function Ue(t,e,n){if(e>$n)throw A=!0,n&&(t.precision=n),Error(jt);return y(new t(Pe),e,1,!0)}function ee(t,e,n){if(e>st)throw Error(jt);return y(new t(Be),e,n,!0)}function Jt(t){var e=t.length-1,n=e*C+1;if(e=t[e],e){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function ce(t){for(var e="";t--;)e+="0";return e}function Qt(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/C+4);for(A=!1;;){if(n%2&&(o=o.times(e),Ot(o.d,s)&&(i=!0)),n=q(n/2),n===0){n=o.d.length-1,i&&o.d[n]===0&&++o.d[n];break}e=e.times(e),Ot(e.d,s)}return A=!0,o}function It(t){return t.d[t.d.length-1]&1}function en(t,e,n){for(var r,i=new t(e[0]),o=0;++o<e.length;)if(r=new t(e[o]),r.s)i[n](r)&&(i=r);else{i=r;break}return i}function at(t,e){var n,r,i,o,s,u,c,a=0,l=0,f=0,d=t.constructor,m=d.rounding,h=d.precision;if(!t.d||!t.d[0]||t.e>17)return new d(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(A=!1,c=h):c=e,u=new d(.03125);t.e>-2;)t=t.times(u),f+=5;for(r=Math.log(U(2,f))/Math.LN10*2+5|0,c+=r,n=o=s=new d(1),d.precision=c;;){if(o=y(o.times(t),c,1),n=n.times(++l),u=s.plus(D(o,n,c,1)),$(u.d).slice(0,c)===$(s.d).slice(0,c)){for(i=f;i--;)s=y(s.times(s),c,1);if(e==null)if(a<3&&Me(s.d,c-r,m,a))d.precision=c+=10,n=o=u=new d(1),l=0,a++;else return y(s,d.precision=h,m,A=!0);else return d.precision=h,s}s=u}}function fe(t,e){var n,r,i,o,s,u,c,a,l,f,d,m=1,h=10,p=t,w=p.d,E=p.constructor,I=E.rounding,M=E.precision;if(p.s<0||!w||!w[0]||!p.e&&w[0]==1&&w.length==1)return new E(w&&!w[0]?-1/0:p.s!=1?NaN:w?0:p);if(e==null?(A=!1,l=M):l=e,E.precision=l+=h,n=$(w),r=n.charAt(0),Math.abs(o=p.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=$(p.d),r=n.charAt(0),m++;o=p.e,r>1?(p=new E("0."+n),o++):p=new E(r+"."+n.slice(1))}else return a=Ue(E,l+2,M).times(o+""),p=fe(new E(r+"."+n.slice(1)),l-h).plus(a),E.precision=M,e==null?y(p,M,I,A=!0):p;for(f=p,c=s=p=D(p.minus(1),p.plus(1),l,1),d=y(p.times(p),l,1),i=3;;){if(s=y(s.times(d),l,1),a=c.plus(D(s,new E(i),l,1)),$(a.d).slice(0,l)===$(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(Ue(E,l+2,M).times(o+""))),c=D(c,new E(m),l,1),e==null)if(Me(c.d,l-h,I,u))E.precision=l+=h,a=s=p=D(f.minus(1),f.plus(1),l,1),d=y(p.times(p),l,1),i=u=1;else return y(c,E.precision=M,I,A=!0);else return E.precision=M,c;c=a,i+=2}}function tn(t){return String(t.s*t.s/0)}function ut(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;r++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(r,i),e){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%C,n<0&&(r+=C),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=C;r<i;)t.d.push(+e.slice(r,r+=C));e=e.slice(r),r=C-e.length}else r-=i;for(;r--;)e+="0";t.d.push(+e),A&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function qn(t,e){var n,r,i,o,s,u,c,a,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),zt.test(e))return ut(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Un.test(e))n=16,e=e.toLowerCase();else if(Bn.test(e))n=2;else if(Kn.test(e))n=8;else throw Error(me+e);for(o=e.search(/p/i),o>0?(c=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),s=o>=0,r=t.constructor,s&&(e=e.replace(".",""),u=e.length,o=u-o,i=Qt(r,new r(n),o,o*2)),a=Fe(e,n,te),l=a.length-1,o=l;a[o]===0;--o)a.pop();return o<0?new r(t.s*0):(t.e=Ze(a,l),t.d=a,A=!1,s&&(t=D(t,i,u*4)),c&&(t=t.times(Math.abs(c)<54?U(2,c):Le.pow(2,c))),A=!0,t)}function Xn(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:Se(t,2,e,e);n=1.4*Math.sqrt(r),n=n>16?16:n|0,e=e.times(1/qe(5,n)),e=Se(t,2,e,e);for(var i,o=new t(5),s=new t(16),u=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(u))));return e}function Se(t,e,n,r,i){var o,s,u,c,a=t.precision,l=Math.ceil(a/C);for(A=!1,c=n.times(n),u=new t(r);;){if(s=D(u.times(c),new t(e++*e++),a,1),u=i?r.plus(s):r.minus(s),r=D(s.times(c),new t(e++*e++),a,1),s=u.plus(r),s.d[l]!==void 0){for(o=l;s.d[o]===u.d[o]&&o--;);if(o==-1)break}o=u,u=r,r=s,s=o}return A=!0,s.d.length=l+1,s}function qe(t,e){for(var n=t;--e;)n*=t;return n}function nn(t,e){var n,r=e.s<0,i=ee(t,t.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return ae=r?4:1,e;if(n=e.divToInt(i),n.isZero())ae=r?3:2;else{if(e=e.minus(n.times(i)),e.lte(o))return ae=It(n)?r?2:3:r?4:1,e;ae=It(n)?r?1:4:r?3:2}return e.minus(i).abs()}function ht(t,e,n,r){var i,o,s,u,c,a,l,f,d,m=t.constructor,h=n!==void 0;if(h?(W(n,1,he),r===void 0?r=m.rounding:W(r,0,8)):(n=m.precision,r=m.rounding),!t.isFinite())l=tn(t);else{for(l=ie(t),s=l.indexOf("."),h?(i=2,e==16?n=n*4-3:e==8&&(n=n*3-2)):i=e,s>=0&&(l=l.replace(".",""),d=new m(1),d.e=l.length-s,d.d=Fe(ie(d),10,i),d.e=d.d.length),f=Fe(l,10,i),o=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=h?"0p+0":"0";else{if(s<0?o--:(t=new m(t),t.d=f,t.e=o,t=D(t,d,n,r,0,i),f=t.d,o=t.e,a=Wt),s=f[n],u=i/2,a=a||f[n+1]!==void 0,a=r<4?(s!==void 0||a)&&(r===0||r===(t.s<0?3:2)):s>u||s===u&&(r===4||a||r===6&&f[n-1]&1||r===(t.s<0?8:7)),f.length=n,a)for(;++f[--n]>i-1;)f[n]=0,n||(++o,f.unshift(1));for(c=f.length;!f[c-1];--c);for(s=0,l="";s<c;s++)l+=it.charAt(f[s]);if(h){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(f=Fe(l,i,e),c=f.length;!f[c-1];--c);for(s=1,l="1.";s<c;s++)l+=it.charAt(f[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return t.s<0?"-"+l:l}function Ot(t,e){if(t.length>e)return t.length=e,!0}function Wn(t){return new this(t).abs()}function jn(t){return new this(t).acos()}function Gn(t){return new this(t).acosh()}function Yn(t,e){return new this(t).plus(e)}function zn(t){return new this(t).asin()}function Jn(t){return new this(t).asinh()}function Qn(t){return new this(t).atan()}function er(t){return new this(t).atanh()}function tr(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return!t.s||!e.s?n=new this(NaN):!t.d&&!e.d?(n=ee(this,o,1).times(e.s>0?.25:.75),n.s=t.s):!e.d||t.isZero()?(n=e.s<0?ee(this,r,i):new this(0),n.s=t.s):!t.d||e.isZero()?(n=ee(this,o,1).times(.5),n.s=t.s):e.s<0?(this.precision=o,this.rounding=1,n=this.atan(D(t,e,o,1)),e=ee(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(D(t,e,o,1)),n}function nr(t){return new this(t).cbrt()}function rr(t){return y(t=new this(t),t.e+1,2)}function ir(t,e,n){return new this(t).clamp(e,n)}function or(t){if(!t||typeof t!="object")throw Error($e+"Object expected");var e,n,r,i=t.defaults===!0,o=["precision",1,he,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,rt,"maxE",0,rt,"minE",-9e15,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(n=o[e],i&&(this[n]=ot[n]),(r=t[n])!==void 0)if(q(r)===r&&r>=o[e+1]&&r<=o[e+2])this[n]=r;else throw Error(me+n+": "+r);if(n="crypto",i&&(this[n]=ot[n]),(r=t[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(Gt);else this[n]=!1;else throw Error(me+n+": "+r);return this}function sr(t){return new this(t).cos()}function ar(t){return new this(t).cosh()}function rn(t){var e,n,r;function i(o){var s,u,c,a=this;if(!(a instanceof i))return new i(o);if(a.constructor=i,_t(o)){a.s=o.s,A?!o.d||o.e>i.maxE?(a.e=NaN,a.d=null):o.e<i.minE?(a.e=0,a.d=[0]):(a.e=o.e,a.d=o.d.slice()):(a.e=o.e,a.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){a.s=1/o<0?-1:1,a.e=0,a.d=[0];return}if(o<0?(o=-o,a.s=-1):a.s=1,o===~~o&&o<1e7){for(s=0,u=o;u>=10;u/=10)s++;A?s>i.maxE?(a.e=NaN,a.d=null):s<i.minE?(a.e=0,a.d=[0]):(a.e=s,a.d=[o]):(a.e=s,a.d=[o]);return}else if(o*0!==0){o||(a.s=NaN),a.e=NaN,a.d=null;return}return ut(a,o.toString())}else if(c!=="string")throw Error(me+o);return(u=o.charCodeAt(0))===45?(o=o.slice(1),a.s=-1):(u===43&&(o=o.slice(1)),a.s=1),zt.test(o)?ut(a,o):qn(a,o)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=or,i.clone=rn,i.isDecimal=_t,i.abs=Wn,i.acos=jn,i.acosh=Gn,i.add=Yn,i.asin=zn,i.asinh=Jn,i.atan=Qn,i.atanh=er,i.atan2=tr,i.cbrt=nr,i.ceil=rr,i.clamp=ir,i.cos=sr,i.cosh=ar,i.div=ur,i.exp=cr,i.floor=lr,i.hypot=fr,i.ln=dr,i.log=mr,i.log10=pr,i.log2=hr,i.max=gr,i.min=vr,i.mod=br,i.mul=wr,i.pow=Er,i.random=Sr,i.round=Tr,i.sign=yr,i.sin=Cr,i.sinh=Mr,i.sqrt=Lr,i.sub=Ar,i.sum=xr,i.tan=Ir,i.tanh=Or,i.trunc=_r,t===void 0&&(t={}),t&&t.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return i.config(t),i}function ur(t,e){return new this(t).div(e)}function cr(t){return new this(t).exp()}function lr(t){return y(t=new this(t),t.e+1,3)}function fr(){var t,e,n=new this(0);for(A=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)n.d&&(n=n.plus(e.times(e)));else{if(e.s)return A=!0,new this(1/0);n=e}return A=!0,n.sqrt()}function _t(t){return t instanceof Le||t&&t.toStringTag===Yt||!1}function dr(t){return new this(t).ln()}function mr(t,e){return new this(t).log(e)}function hr(t){return new this(t).log(2)}function pr(t){return new this(t).log(10)}function gr(){return en(this,arguments,"lt")}function vr(){return en(this,arguments,"gt")}function br(t,e){return new this(t).mod(e)}function wr(t,e){return new this(t).mul(e)}function Er(t,e){return new this(t).pow(e)}function Sr(t){var e,n,r,i,o=0,s=new this(1),u=[];if(t===void 0?t=this.precision:W(t,1,he),r=Math.ceil(t/C),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));o<r;)i=e[o],i>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);o<r;)i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,o):(u.push(i%1e7),o+=4);o=r/4}else throw Error(Gt);else for(;o<r;)u[o++]=Math.random()*1e7|0;for(r=u[--o],t%=C,r&&t&&(i=U(10,C-t),u[o]=(r/i|0)*i);u[o]===0;o--)u.pop();if(o<0)n=0,u=[0];else{for(n=-1;u[0]===0;n-=C)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<C&&(n-=C-r)}return s.e=n,s.d=u,s}function Tr(t){return y(t=new this(t),t.e+1,this.rounding)}function yr(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function Cr(t){return new this(t).sin()}function Mr(t){return new this(t).sinh()}function Lr(t){return new this(t).sqrt()}function Ar(t,e){return new this(t).sub(e)}function xr(){var t=0,e=arguments,n=new this(e[t]);for(A=!1;n.s&&++t<e.length;)n=n.plus(e[t]);return A=!0,y(n,this.precision,this.rounding)}function Ir(t){return new this(t).tan()}function Or(t){return new this(t).tanh()}function _r(t){return y(t=new this(t),t.e+1,1)}g[Symbol.for("nodejs.util.inspect.custom")]=g.toString;g[Symbol.toStringTag]="Decimal";var Le=g.constructor=rn(ot);Pe=new Le(Pe);Be=new Le(Be);class re{static formatToTimecode(e,n,r=!1){let i=new Le(n),o,s=i.round();o=i.mul(e).floor();let u,c,a,l,f=s.mul(86400),d=o.mod(f),m=s.mul(3600),h=s.mul(60);return l=d.divToInt(m),d=d.minus(l.mul(m)),a=d.divToInt(h),d=d.minus(a.mul(h)),c=d.divToInt(s),u=d.minus(c.mul(s)),re.formatTimecodeText(l.toNumber(),a.toNumber(),c.toNumber(),u.toNumber(),r)}static formatTimecodeText(e,n,r,i,o=!1){let s=o?".":":";return`${re.padZero(e)}:${re.padZero(n)}:${re.padZero(r)}${s}${re.padZero(i)}`}static padZero(e){return e<10?`0${e}`:`${e}`}}class Nr{static resolveFrameRateValueFromFraction(e){return 30}}const Q=class Q{static parseTimeMoment(e){const[n,r]=e.split(":").map(Number);return[n,r]}static parseTimeRange(e){const n=e.match(this.timeRangePattern);if(!n)throw new Error("Not valid timerange: "+e);const r=n[1]==="[",i=n[5]==="]",o=n[2]?this.parseTimeMoment(n[2]):void 0,s=n[4]?this.parseTimeMoment(n[4]):void 0;return{start:o,end:s,isStartInclusive:r,isEndInclusive:i}}static timeMomentToSeconds(e){return Q.timeMomentToMilliseconds(e)/1e3}static timeMomentToMilliseconds(e){return e[0]*1e3+e[1]/1e6}static timeMomentToDate(e){const r=e[0]*1e3+e[1]/1e6;return new Date(r)}static formatTimeMomentToTimecodeText(e,n,r=!1){let i=Nr.resolveFrameRateValueFromFraction(n);return re.formatToTimecode(Q.timeMomentToSeconds(e),i,r)}static formatTimerangeToTimecodeText(e,n,r=!1){let i=Q.parseTimeRange(e),o=i.start?Q.formatTimeMomentToTimecodeText(i.start,n,r):"?",s=i.end?Q.formatTimeMomentToTimecodeText(i.end,n,r):"?";return`${o} - ${s}`}static nanosecondsToSeconds(e){return e/1e9}static nanosecondsToTimeMoment(e){const n=Math.floor(e/1e9),r=Math.ceil(e%1e9);return[n,r]}static secondsToTimeMoment(e){return this.nanosecondsToTimeMoment(e*1e9)}static timerangeExprDuration(e){return this.timeRangeDuration(this.parseTimeRange(e))}static timeRangeDuration(e){const{start:n,end:r}=e;if(n===void 0||r===void 0)return 0;{const i=r[0]-n[0],o=r[1]-n[1],s=i+o/1e9;return parseFloat(s.toFixed(3))}}static formatTimeMomentExpr(e){return`${e[0]}:${e[1]}`}static formatNanosecondsToTimeMomentExpr(e){return this.formatTimeMomentExpr(this.nanosecondsToTimeMoment(e))}static toTimeRange(e,n,r=!0,i=!0){return{start:e,end:n,isStartInclusive:r,isEndInclusive:i}}static formatTimeRangeExpr(e){const n=e.isStartInclusive?"[":"(",r=e.isEndInclusive?"]":")",i=e.start?`${e.start[0]}:${e.start[1]}`:"",o=e.end?`${e.end[0]}:${e.end[1]}`:"";return`${n}${i}_${o}${r}`}static timerangeDuration(e){let n=Q.parseTimeRange(e);if(n.start===void 0||n.end===void 0)return 1/0;{let r=Q.timeMomentToSeconds(n.start);return Q.timeMomentToSeconds(n.end)-r}}static padZero(e){return e<10?`0${e}`:`${e}`}};Q.timeRangePattern=/^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$/;let B=Q;function kr(t){return t.format==="urn:x-nmos:format:data"&&t.container==="text/vtt"}function Rr(t){var e,n,r;return{id:on(t.id),label:((e=t.tags)==null?void 0:e.hls_name)??t.label??"Subtitles",default:((n=t.tags)==null?void 0:n.hls_default)==="YES",language:((r=t.tags)==null?void 0:r.hls_language)??"unknown",embedded:!1}}function on(t){return`subtitles-${t}`}function Dr(t,e){const n=t.filter(f=>e.get(f.id).length>0).map(f=>{const d=e.get(f.id);let m,h=!1;if(f.format==="urn:x-nmos:format:video"){const p=f.essence_parameters.frame_rate;p&&(m=p.numerator/(p.denominator??1),(p.numerator===6e4||p.numerator===3e4)&&p.denominator===1001&&(h=!0))}return{start:B.timeMomentToSeconds(B.parseTimeRange(d.at(0).timerange).start),frameRate:m,dropFrame:h}}).sort((f,d)=>f.start-d.start),r=n.find(f=>f.frameRate!==void 0),i=(r==null?void 0:r.start)??n.at(0).start,o=new Date(i*1e3),s=o.getUTCHours(),u=o.getUTCMinutes(),c=o.getUTCSeconds(),a=o.getUTCMilliseconds(),l=s*3600+u*60+c+a/1e3;return r===void 0?{ffom:re.formatToTimecode(l,100,!1),mediaStartTime:i,frameRate:100,dropFrame:!1}:{ffom:re.formatToTimecode(l,r.frameRate,r.dropFrame),mediaStartTime:r.start,frameRate:r.frameRate,dropFrame:r.dropFrame}}class Fr{constructor(e){T(this,"_lanes",[]);T(this,"_markersLaneMap",new Map);T(this,"_laneNodenMap",new Map);this.omakasePlayer=e}addMarkerLane(e){const n={config:e,type:"marker"};this._lanes.push(n)}addMarkers(e,n){this._markersLaneMap.get(e)===void 0&&this._markersLaneMap.set(e,[]),this._markersLaneMap.get(e).push(...n)}addTimelineNode(e,n){this._laneNodenMap.get(e)||this._laneNodenMap.set(e,[]),this._laneNodenMap.get(e).push(n)}addThumbnailLane(e){const n={config:e,type:"thumbnail"};this._lanes.push(n)}addLabelLane(e){const n={config:e,type:"label"};this._lanes.push(n)}addSubtitlesLane(e){const n={config:e,type:"subtitles"};this._lanes.push(n)}buildAndAttachTimeline(e){this.omakasePlayer.createTimeline(e).subscribe({next:n=>{this.buildAttachedTimeline(n)}})}buildAttachedTimeline(e){this._lanes.forEach(n=>this._createAndAttachLane(e,n))}_createAndAttachLane(e,n){let r;if(n.type==="marker"){r=new F.MarkerLane(n.config),e.addTimelineLane(r);const o=this._markersLaneMap.get(r.id);o==null||o.forEach(s=>r.addMarker(s))}else n.type==="thumbnail"?(r=new F.ThumbnailLane(n.config),e.addTimelineLane(r)):n.type==="label"?(r=new F.LabelLane(n.config),e.addTimelineLane(r)):n.type==="subtitles"&&(r=new F.SubtitlesLane(n.config),e.addTimelineLane(r));const i=this._laneNodenMap.get(r.id);i==null||i.forEach(o=>{r.addTimelineNode(o.config)})}}var ct=function(t,e){return ct=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},ct(t,e)};function Ae(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ct(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function Vr(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(l){try{a(r.next(l))}catch(f){s(f)}}function c(l){try{a(r.throw(l))}catch(f){s(f)}}function a(l){l.done?o(l.value):i(l.value).then(u,c)}a((r=r.apply(t,e||[])).next())})}function sn(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function Te(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ke(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function He(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function Ee(t){return this instanceof Ee?(this.v=t,this):new Ee(t)}function Pr(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(m){return function(h){return Promise.resolve(h).then(m,f)}}function u(m,h){r[m]&&(i[m]=function(p){return new Promise(function(w,E){o.push([m,p,w,E])>1||c(m,p)})},h&&(i[m]=h(i[m])))}function c(m,h){try{a(r[m](h))}catch(p){d(o[0][3],p)}}function a(m){m.value instanceof Ee?Promise.resolve(m.value.v).then(l,f):d(o[0][2],m)}function l(m){c("next",m)}function f(m){c("throw",m)}function d(m,h){m(h),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Br(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Te=="function"?Te(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(s){return new Promise(function(u,c){s=t[o](s),i(u,c,s.done,s.value)})}}function i(o,s,u,c){Promise.resolve(c).then(function(a){o({value:a,done:u})},s)}}function K(t){return typeof t=="function"}function pt(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var ze=pt(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
|
7
|
+
*/var rt=9e15,he=1e9,it="0123456789abcdef",Pe="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Be="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ot={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:rt,crypto:!1},Wt,ae,A=!0,$e="[DecimalError] ",me=$e+"Invalid argument: ",jt=$e+"Precision limit exceeded",Gt=$e+"crypto unavailable",Yt="[object Decimal]",q=Math.floor,U=Math.pow,Bn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Un=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Kn=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,zt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,te=1e7,C=7,Hn=9007199254740991,$n=Pe.length-1,st=Be.length-1,g={toStringTag:Yt};g.absoluteValue=g.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),y(t)};g.ceil=function(){return y(new this.constructor(this),this.e+1,2)};g.clampedTo=g.clamp=function(t,e){var n,r=this,i=r.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(me+e);return n=r.cmp(t),n<0?t:r.cmp(e)>0?e:new i(r)};g.comparedTo=g.cmp=function(t){var e,n,r,i,o=this,s=o.d,u=(t=new o.constructor(t)).d,c=o.s,a=t.s;if(!s||!u)return!c||!a?NaN:c!==a?c:s===u?0:!s^c<0?1:-1;if(!s[0]||!u[0])return s[0]?c:u[0]?-a:0;if(c!==a)return c;if(o.e!==t.e)return o.e>t.e^c<0?1:-1;for(r=s.length,i=u.length,e=0,n=r<i?r:i;e<n;++e)if(s[e]!==u[e])return s[e]>u[e]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1};g.cosine=g.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+C,r.rounding=1,n=Zn(r,nn(r,n)),r.precision=t,r.rounding=e,y(ae==2||ae==3?n.neg():n,t,e,!0)):new r(1):new r(NaN)};g.cubeRoot=g.cbrt=function(){var t,e,n,r,i,o,s,u,c,a,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(A=!1,o=l.s*U(l.s*l,1/3),!o||Math.abs(o)==1/0?(n=$(l.d),t=l.e,(o=(t-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=U(n,1/3),t=q((t+1)/3)-(t%3==(t<0?-1:2)),o==1/0?n="5e"+t:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+t),r=new f(n),r.s=l.s):r=new f(o.toString()),s=(t=f.precision)+3;;)if(u=r,c=u.times(u).times(u),a=c.plus(l),r=D(a.plus(l).times(u),a.plus(c),s+2,1),$(u.d).slice(0,s)===(n=$(r.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!i&&n=="4999"){if(!i&&(y(u,t+1,0),u.times(u).times(u).eq(l))){r=u;break}s+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(y(r,t+1,1),e=!r.times(r).times(r).eq(l));break}return A=!0,y(r,t,f.rounding,e)};g.decimalPlaces=g.dp=function(){var t,e=this.d,n=NaN;if(e){if(t=e.length-1,n=(t-q(this.e/C))*C,t=e[t],t)for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n};g.dividedBy=g.div=function(t){return D(this,new this.constructor(t))};g.dividedToIntegerBy=g.divToInt=function(t){var e=this,n=e.constructor;return y(D(e,new n(t),0,1,1),n.precision,n.rounding)};g.equals=g.eq=function(t){return this.cmp(t)===0};g.floor=function(){return y(new this.constructor(this),this.e+1,3)};g.greaterThan=g.gt=function(t){return this.cmp(t)>0};g.greaterThanOrEqualTo=g.gte=function(t){var e=this.cmp(t);return e==1||e===0};g.hyperbolicCosine=g.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(t=Math.ceil(i/3),e=(1/qe(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),o=Se(s,1,o.times(e),new s(1),!0);for(var c,a=t,l=new s(8);a--;)c=o.times(o),o=u.minus(c.times(l.minus(c.times(l))));return y(o,s.precision=n,s.rounding=r,!0)};g.hyperbolicSine=g.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,r=i.d.length,r<3)i=Se(o,2,i,i,!0);else{t=1.4*Math.sqrt(r),t=t>16?16:t|0,i=i.times(1/qe(5,t)),i=Se(o,2,i,i,!0);for(var s,u=new o(5),c=new o(16),a=new o(20);t--;)s=i.times(i),i=i.times(u.plus(s.times(c.times(s).plus(a))))}return o.precision=e,o.rounding=n,y(i,e,n,!0)};g.hyperbolicTangent=g.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,D(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)};g.inverseCosine=g.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return r!==-1?r===0?e.isNeg()?ee(n,i,o):new n(0):new n(NaN):e.isZero()?ee(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=ee(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))};g.inverseHyperbolicCosine=g.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,A=!1,n=n.times(n).minus(1).sqrt().plus(n),A=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)};g.inverseHyperbolicSine=g.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,A=!1,n=n.times(n).plus(1).sqrt().plus(n),A=!0,r.precision=t,r.rounding=e,n.ln())};g.inverseHyperbolicTangent=g.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?y(new o(i),t,e,!0):(o.precision=n=r-i.e,i=D(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)};g.inverseSine=g.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,e!==-1?e===0?(t=ee(o,n+4,r).times(.5),t.s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))};g.inverseTangent=g.atan=function(){var t,e,n,r,i,o,s,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding;if(a.isFinite()){if(a.isZero())return new l(a);if(a.abs().eq(1)&&f+4<=st)return s=ee(l,f+4,d).times(.25),s.s=a.s,s}else{if(!a.s)return new l(NaN);if(f+4<=st)return s=ee(l,f+4,d).times(.5),s.s=a.s,s}for(l.precision=u=f+10,l.rounding=1,n=Math.min(28,u/C+2|0),t=n;t;--t)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(A=!1,e=Math.ceil(u/C),r=1,c=a.times(a),s=new l(a),i=a;t!==-1;)if(i=i.times(c),o=s.minus(i.div(r+=2)),i=i.times(c),s=o.plus(i.div(r+=2)),s.d[e]!==void 0)for(t=e;s.d[t]===o.d[t]&&t--;);return n&&(s=s.times(2<<n-1)),A=!0,y(s,l.precision=f,l.rounding=d,!0)};g.isFinite=function(){return!!this.d};g.isInteger=g.isInt=function(){return!!this.d&&q(this.e/C)>this.d.length-2};g.isNaN=function(){return!this.s};g.isNegative=g.isNeg=function(){return this.s<0};g.isPositive=g.isPos=function(){return this.s>0};g.isZero=function(){return!!this.d&&this.d[0]===0};g.lessThan=g.lt=function(t){return this.cmp(t)<0};g.lessThanOrEqualTo=g.lte=function(t){return this.cmp(t)<1};g.logarithm=g.log=function(t){var e,n,r,i,o,s,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding,m=5;if(t==null)t=new l(10),e=!0;else{if(t=new l(t),n=t.d,t.s<0||!n||!n[0]||t.eq(1))return new l(NaN);e=t.eq(10)}if(n=a.d,a.s<0||!n||!n[0]||a.eq(1))return new l(n&&!n[0]?-1/0:a.s!=1?NaN:n?0:1/0);if(e)if(n.length>1)o=!0;else{for(i=n[0];i%10===0;)i/=10;o=i!==1}if(A=!1,u=f+m,s=fe(a,u),r=e?Ue(l,u+10):fe(t,u),c=D(s,r,u,1),Me(c.d,i=f,d))do if(u+=10,s=fe(a,u),r=e?Ue(l,u+10):fe(t,u),c=D(s,r,u,1),!o){+$(c.d).slice(i+1,i+15)+1==1e14&&(c=y(c,f+1,0));break}while(Me(c.d,i+=10,d));return A=!0,y(c,f,d)};g.minus=g.sub=function(t){var e,n,r,i,o,s,u,c,a,l,f,d,m=this,h=m.constructor;if(t=new h(t),!m.d||!t.d)return!m.s||!t.s?t=new h(NaN):m.d?t.s=-t.s:t=new h(t.d||m.s!==t.s?m:NaN),t;if(m.s!=t.s)return t.s=-t.s,m.plus(t);if(a=m.d,d=t.d,u=h.precision,c=h.rounding,!a[0]||!d[0]){if(d[0])t.s=-t.s;else if(a[0])t=new h(m);else return new h(c===3?-0:0);return A?y(t,u,c):t}if(n=q(t.e/C),l=q(m.e/C),a=a.slice(),o=l-n,o){for(f=o<0,f?(e=a,o=-o,s=d.length):(e=d,n=l,s=a.length),r=Math.max(Math.ceil(u/C),s)+2,o>r&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for(r=a.length,s=d.length,f=r<s,f&&(s=r),r=0;r<s;r++)if(a[r]!=d[r]){f=a[r]<d[r];break}o=0}for(f&&(e=a,a=d,d=e,t.s=-t.s),s=a.length,r=d.length-s;r>0;--r)a[s++]=0;for(r=d.length;r>o;){if(a[--r]<d[r]){for(i=r;i&&a[--i]===0;)a[i]=te-1;--a[i],a[r]+=te}a[r]-=d[r]}for(;a[--s]===0;)a.pop();for(;a[0]===0;a.shift())--n;return a[0]?(t.d=a,t.e=Ze(a,n),A?y(t,u,c):t):new h(c===3?-0:0)};g.modulo=g.mod=function(t){var e,n=this,r=n.constructor;return t=new r(t),!n.d||!t.s||t.d&&!t.d[0]?new r(NaN):!t.d||n.d&&!n.d[0]?y(new r(n),r.precision,r.rounding):(A=!1,r.modulo==9?(e=D(n,t.abs(),0,3,1),e.s*=t.s):e=D(n,t,0,r.modulo,1),e=e.times(t),A=!0,n.minus(e))};g.naturalExponential=g.exp=function(){return at(this)};g.naturalLogarithm=g.ln=function(){return fe(this)};g.negated=g.neg=function(){var t=new this.constructor(this);return t.s=-t.s,y(t)};g.plus=g.add=function(t){var e,n,r,i,o,s,u,c,a,l,f=this,d=f.constructor;if(t=new d(t),!f.d||!t.d)return!f.s||!t.s?t=new d(NaN):f.d||(t=new d(t.d||f.s===t.s?f:NaN)),t;if(f.s!=t.s)return t.s=-t.s,f.minus(t);if(a=f.d,l=t.d,u=d.precision,c=d.rounding,!a[0]||!l[0])return l[0]||(t=new d(f)),A?y(t,u,c):t;if(o=q(f.e/C),r=q(t.e/C),a=a.slice(),i=o-r,i){for(i<0?(n=a,i=-i,s=l.length):(n=l,r=o,s=a.length),o=Math.ceil(u/C),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=a.length,i=l.length,s-i<0&&(i=s,n=l,l=a,a=n),e=0;i;)e=(a[--i]=a[i]+l[i]+e)/te|0,a[i]%=te;for(e&&(a.unshift(e),++r),s=a.length;a[--s]==0;)a.pop();return t.d=a,t.e=Ze(a,r),A?y(t,u,c):t};g.precision=g.sd=function(t){var e,n=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(me+t);return n.d?(e=Jt(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e};g.round=function(){var t=this,e=t.constructor;return y(new e(t),t.e+1,e.rounding)};g.sine=g.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+C,r.rounding=1,n=Xn(r,nn(r,n)),r.precision=t,r.rounding=e,y(ae>2?n.neg():n,t,e,!0)):new r(NaN)};g.squareRoot=g.sqrt=function(){var t,e,n,r,i,o,s=this,u=s.d,c=s.e,a=s.s,l=s.constructor;if(a!==1||!u||!u[0])return new l(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);for(A=!1,a=Math.sqrt(+s),a==0||a==1/0?(e=$(u),(e.length+c)%2==0&&(e+="0"),a=Math.sqrt(e),c=q((c+1)/2)-(c<0||c%2),a==1/0?e="5e"+c:(e=a.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),r=new l(e)):r=new l(a.toString()),n=(c=l.precision)+3;;)if(o=r,r=o.plus(D(s,o,n+2,1)).times(.5),$(o.d).slice(0,n)===(e=$(r.d)).slice(0,n))if(e=e.slice(n-3,n+1),e=="9999"||!i&&e=="4999"){if(!i&&(y(o,c+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(y(r,c+1,1),t=!r.times(r).eq(s));break}return A=!0,y(r,c,l.rounding,t)};g.tangent=g.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,n=n.sin(),n.s=1,n=D(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,y(ae==2||ae==4?n.neg():n,t,e,!0)):new r(NaN)};g.times=g.mul=function(t){var e,n,r,i,o,s,u,c,a,l=this,f=l.constructor,d=l.d,m=(t=new f(t)).d;if(t.s*=l.s,!d||!d[0]||!m||!m[0])return new f(!t.s||d&&!d[0]&&!m||m&&!m[0]&&!d?NaN:!d||!m?t.s/0:t.s*0);for(n=q(l.e/C)+q(t.e/C),c=d.length,a=m.length,c<a&&(o=d,d=m,m=o,s=c,c=a,a=s),o=[],s=c+a,r=s;r--;)o.push(0);for(r=a;--r>=0;){for(e=0,i=c+r;i>r;)u=o[i]+m[r]*d[i-r-1]+e,o[i--]=u%te|0,e=u/te|0;o[i]=(o[i]+e)%te|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=Ze(o,n),A?y(t,f.precision,f.rounding):t};g.toBinary=function(t,e){return ht(this,2,t,e)};g.toDecimalPlaces=g.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(W(t,0,he),e===void 0?e=r.rounding:W(e,0,8),y(n,t+n.e+1,e))};g.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ie(r,!0):(W(t,0,he),e===void 0?e=i.rounding:W(e,0,8),r=y(new i(r),t+1,e),n=ie(r,!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n};g.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?n=ie(i):(W(t,0,he),e===void 0?e=o.rounding:W(e,0,8),r=y(new o(i),t+i.e+1,e),n=ie(r,!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};g.toFraction=function(t){var e,n,r,i,o,s,u,c,a,l,f,d,m=this,h=m.d,p=m.constructor;if(!h)return new p(m);if(a=n=new p(1),r=c=new p(0),e=new p(r),o=e.e=Jt(h)-m.e-1,s=o%C,e.d[0]=U(10,s<0?C+s:s),t==null)t=o>0?e:a;else{if(u=new p(t),!u.isInt()||u.lt(a))throw Error(me+u);t=u.gt(e)?o>0?e:a:u}for(A=!1,u=new p($(h)),l=p.precision,p.precision=o=h.length*C*2;f=D(u,e,0,1,1),i=n.plus(f.times(r)),i.cmp(t)!=1;)n=r,r=i,i=a,a=c.plus(f.times(i)),c=i,i=e,e=u.minus(f.times(i)),u=i;return i=D(t.minus(n),r,0,1,1),c=c.plus(i.times(a)),n=n.plus(i.times(r)),c.s=a.s=m.s,d=D(a,r,o,1).minus(m).abs().cmp(D(c,n,o,1).minus(m).abs())<1?[a,r]:[c,n],p.precision=l,A=!0,d};g.toHexadecimal=g.toHex=function(t,e){return ht(this,16,t,e)};g.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),t==null){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),e===void 0?e=r.rounding:W(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(A=!1,n=D(n,t,0,e,1).times(t),A=!0,y(n)):(t.s=n.s,n=t),n};g.toNumber=function(){return+this};g.toOctal=function(t,e){return ht(this,8,t,e)};g.toPower=g.pow=function(t){var e,n,r,i,o,s,u=this,c=u.constructor,a=+(t=new c(t));if(!u.d||!t.d||!u.d[0]||!t.d[0])return new c(U(+u,a));if(u=new c(u),u.eq(1))return u;if(r=c.precision,o=c.rounding,t.eq(1))return y(u,r,o);if(e=q(t.e/C),e>=t.d.length-1&&(n=a<0?-a:a)<=Hn)return i=Qt(c,u,n,r),t.s<0?new c(1).div(i):y(i,r,o);if(s=u.s,s<0){if(e<t.d.length-1)return new c(NaN);if((t.d[e]&1)==0&&(s=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=s,u}return n=U(+u,a),e=n==0||!isFinite(n)?q(a*(Math.log("0."+$(u.d))/Math.LN10+u.e+1)):new c(n+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(A=!1,c.rounding=u.s=1,n=Math.min(12,(e+"").length),i=at(t.times(fe(u,r+n)),r),i.d&&(i=y(i,r+5,1),Me(i.d,r,o)&&(e=r+10,i=y(at(t.times(fe(u,e+n)),e),e+5,1),+$(i.d).slice(r+1,r+15)+1==1e14&&(i=y(i,r+1,0)))),i.s=s,A=!0,c.rounding=o,y(i,r,o))};g.toPrecision=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ie(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(W(t,1,he),e===void 0?e=i.rounding:W(e,0,8),r=y(new i(r),t,e),n=ie(r,t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n};g.toSignificantDigits=g.toSD=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(W(t,1,he),e===void 0?e=r.rounding:W(e,0,8)),y(new r(n),t,e)};g.toString=function(){var t=this,e=t.constructor,n=ie(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n};g.truncated=g.trunc=function(){return y(new this.constructor(this),this.e+1,1)};g.valueOf=g.toJSON=function(){var t=this,e=t.constructor,n=ie(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};function $(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;e<i;e++)r=t[e]+"",n=C-r.length,n&&(o+=ce(n)),o+=r;s=t[e],r=s+"",n=C-r.length,n&&(o+=ce(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function W(t,e,n){if(t!==~~t||t<e||t>n)throw Error(me+t)}function Me(t,e,n,r){var i,o,s,u;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=C,i=0):(i=Math.ceil((e+1)/C),e%=C),o=U(10,C-e),u=t[i]%o|0,r==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),s=n<4&&u==99999||n>3&&u==49999||u==5e4||u==0):s=(n<4&&u+1==o||n>3&&u+1==o/2)&&(t[i+1]/o/100|0)==U(10,e-2)-1||(u==o/2||u==0)&&(t[i+1]/o/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),s=(r||n<4)&&u==9999||!r&&n>3&&u==4999):s=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(t[i+1]/o/1e3|0)==U(10,e-3)-1,s}function Fe(t,e,n){for(var r,i=[0],o,s=0,u=t.length;s<u;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=it.indexOf(t.charAt(s++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function Zn(t,e){var n,r,i;if(e.isZero())return e;r=e.d.length,r<32?(n=Math.ceil(r/3),i=(1/qe(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=Se(t,1,e.times(i),new t(1));for(var o=n;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=n,e}var D=function(){function t(r,i,o){var s,u=0,c=r.length;for(r=r.slice();c--;)s=r[c]*i+u,r[c]=s%o|0,u=s/o|0;return u&&r.unshift(u),r}function e(r,i,o,s){var u,c;if(o!=s)c=o>s?1:-1;else for(u=c=0;u<o;u++)if(r[u]!=i[u]){c=r[u]>i[u]?1:-1;break}return c}function n(r,i,o,s){for(var u=0;o--;)r[o]-=u,u=r[o]<i[o]?1:0,r[o]=u*s+r[o]-i[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,o,s,u,c){var a,l,f,d,m,h,p,w,E,I,M,N,k,x,G,ne,Y,ve,H,oe,se=r.constructor,be=r.s==i.s?1:-1,P=r.d,_=i.d;if(!P||!P[0]||!_||!_[0])return new se(!r.s||!i.s||(P?_&&P[0]==_[0]:!_)?NaN:P&&P[0]==0||!_?be*0:be/0);for(c?(m=1,l=r.e-i.e):(c=te,m=C,l=q(r.e/m)-q(i.e/m)),H=_.length,Y=P.length,E=new se(be),I=E.d=[],f=0;_[f]==(P[f]||0);f++);if(_[f]>(P[f]||0)&&l--,o==null?(x=o=se.precision,s=se.rounding):u?x=o+(r.e-i.e)+1:x=o,x<0)I.push(1),h=!0;else{if(x=x/m+2|0,f=0,H==1){for(d=0,_=_[0],x++;(f<Y||d)&&x--;f++)G=d*c+(P[f]||0),I[f]=G/_|0,d=G%_|0;h=d||f<Y}else{for(d=c/(_[0]+1)|0,d>1&&(_=t(_,d,c),P=t(P,d,c),H=_.length,Y=P.length),ne=H,M=P.slice(0,H),N=M.length;N<H;)M[N++]=0;oe=_.slice(),oe.unshift(0),ve=_[0],_[1]>=c/2&&++ve;do d=0,a=e(_,M,H,N),a<0?(k=M[0],H!=N&&(k=k*c+(M[1]||0)),d=k/ve|0,d>1?(d>=c&&(d=c-1),p=t(_,d,c),w=p.length,N=M.length,a=e(p,M,w,N),a==1&&(d--,n(p,H<w?oe:_,w,c))):(d==0&&(a=d=1),p=_.slice()),w=p.length,w<N&&p.unshift(0),n(M,p,N,c),a==-1&&(N=M.length,a=e(_,M,H,N),a<1&&(d++,n(M,H<N?oe:_,N,c))),N=M.length):a===0&&(d++,M=[0]),I[f++]=d,a&&M[0]?M[N++]=P[ne]||0:(M=[P[ne]],N=1);while((ne++<Y||M[0]!==void 0)&&x--);h=M[0]!==void 0}I[0]||I.shift()}if(m==1)E.e=l,Wt=h;else{for(f=1,d=I[0];d>=10;d/=10)f++;E.e=f+l*m-1,y(E,u?o+E.e+1:o,s,h)}return E}}();function y(t,e,n,r){var i,o,s,u,c,a,l,f,d,m=t.constructor;e:if(e!=null){if(f=t.d,!f)return t;for(i=1,u=f[0];u>=10;u/=10)i++;if(o=e-i,o<0)o+=C,s=e,l=f[d=0],c=l/U(10,i-s-1)%10|0;else if(d=Math.ceil((o+1)/C),u=f.length,d>=u)if(r){for(;u++<=d;)f.push(0);l=c=0,i=1,o%=C,s=o-C+1}else break e;else{for(l=u=f[d],i=1;u>=10;u/=10)i++;o%=C,s=o-C+i,c=s<0?0:l/U(10,i-s-1)%10|0}if(r=r||e<0||f[d+1]!==void 0||(s<0?l:l%U(10,i-s-1)),a=n<4?(c||r)&&(n==0||n==(t.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(o>0?s>0?l/U(10,i-s):0:f[d-1])%10&1||n==(t.s<0?8:7)),e<1||!f[0])return f.length=0,a?(e-=t.e+1,f[0]=U(10,(C-e%C)%C),t.e=-e||0):f[0]=t.e=0,t;if(o==0?(f.length=d,u=1,d--):(f.length=d+1,u=U(10,C-o),f[d]=s>0?(l/U(10,i-s)%U(10,s)|0)*u:0),a)for(;;)if(d==0){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(t.e++,f[0]==te&&(f[0]=1));break}else{if(f[d]+=u,f[d]!=te)break;f[d--]=0,u=1}for(o=f.length;f[--o]===0;)f.pop()}return A&&(t.e>m.maxE?(t.d=null,t.e=NaN):t.e<m.minE&&(t.e=0,t.d=[0])),t}function ie(t,e,n){if(!t.isFinite())return tn(t);var r,i=t.e,o=$(t.d),s=o.length;return e?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+ce(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+ce(-i-1)+o,n&&(r=n-s)>0&&(o+=ce(r))):i>=s?(o+=ce(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+ce(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=ce(r))),o}function Ze(t,e){var n=t[0];for(e*=C;n>=10;n/=10)e++;return e}function Ue(t,e,n){if(e>$n)throw A=!0,n&&(t.precision=n),Error(jt);return y(new t(Pe),e,1,!0)}function ee(t,e,n){if(e>st)throw Error(jt);return y(new t(Be),e,n,!0)}function Jt(t){var e=t.length-1,n=e*C+1;if(e=t[e],e){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function ce(t){for(var e="";t--;)e+="0";return e}function Qt(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/C+4);for(A=!1;;){if(n%2&&(o=o.times(e),Ot(o.d,s)&&(i=!0)),n=q(n/2),n===0){n=o.d.length-1,i&&o.d[n]===0&&++o.d[n];break}e=e.times(e),Ot(e.d,s)}return A=!0,o}function It(t){return t.d[t.d.length-1]&1}function en(t,e,n){for(var r,i=new t(e[0]),o=0;++o<e.length;)if(r=new t(e[o]),r.s)i[n](r)&&(i=r);else{i=r;break}return i}function at(t,e){var n,r,i,o,s,u,c,a=0,l=0,f=0,d=t.constructor,m=d.rounding,h=d.precision;if(!t.d||!t.d[0]||t.e>17)return new d(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(A=!1,c=h):c=e,u=new d(.03125);t.e>-2;)t=t.times(u),f+=5;for(r=Math.log(U(2,f))/Math.LN10*2+5|0,c+=r,n=o=s=new d(1),d.precision=c;;){if(o=y(o.times(t),c,1),n=n.times(++l),u=s.plus(D(o,n,c,1)),$(u.d).slice(0,c)===$(s.d).slice(0,c)){for(i=f;i--;)s=y(s.times(s),c,1);if(e==null)if(a<3&&Me(s.d,c-r,m,a))d.precision=c+=10,n=o=u=new d(1),l=0,a++;else return y(s,d.precision=h,m,A=!0);else return d.precision=h,s}s=u}}function fe(t,e){var n,r,i,o,s,u,c,a,l,f,d,m=1,h=10,p=t,w=p.d,E=p.constructor,I=E.rounding,M=E.precision;if(p.s<0||!w||!w[0]||!p.e&&w[0]==1&&w.length==1)return new E(w&&!w[0]?-1/0:p.s!=1?NaN:w?0:p);if(e==null?(A=!1,l=M):l=e,E.precision=l+=h,n=$(w),r=n.charAt(0),Math.abs(o=p.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=$(p.d),r=n.charAt(0),m++;o=p.e,r>1?(p=new E("0."+n),o++):p=new E(r+"."+n.slice(1))}else return a=Ue(E,l+2,M).times(o+""),p=fe(new E(r+"."+n.slice(1)),l-h).plus(a),E.precision=M,e==null?y(p,M,I,A=!0):p;for(f=p,c=s=p=D(p.minus(1),p.plus(1),l,1),d=y(p.times(p),l,1),i=3;;){if(s=y(s.times(d),l,1),a=c.plus(D(s,new E(i),l,1)),$(a.d).slice(0,l)===$(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(Ue(E,l+2,M).times(o+""))),c=D(c,new E(m),l,1),e==null)if(Me(c.d,l-h,I,u))E.precision=l+=h,a=s=p=D(f.minus(1),f.plus(1),l,1),d=y(p.times(p),l,1),i=u=1;else return y(c,E.precision=M,I,A=!0);else return E.precision=M,c;c=a,i+=2}}function tn(t){return String(t.s*t.s/0)}function ut(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;r++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(r,i),e){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%C,n<0&&(r+=C),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=C;r<i;)t.d.push(+e.slice(r,r+=C));e=e.slice(r),r=C-e.length}else r-=i;for(;r--;)e+="0";t.d.push(+e),A&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function qn(t,e){var n,r,i,o,s,u,c,a,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),zt.test(e))return ut(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Un.test(e))n=16,e=e.toLowerCase();else if(Bn.test(e))n=2;else if(Kn.test(e))n=8;else throw Error(me+e);for(o=e.search(/p/i),o>0?(c=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),s=o>=0,r=t.constructor,s&&(e=e.replace(".",""),u=e.length,o=u-o,i=Qt(r,new r(n),o,o*2)),a=Fe(e,n,te),l=a.length-1,o=l;a[o]===0;--o)a.pop();return o<0?new r(t.s*0):(t.e=Ze(a,l),t.d=a,A=!1,s&&(t=D(t,i,u*4)),c&&(t=t.times(Math.abs(c)<54?U(2,c):Le.pow(2,c))),A=!0,t)}function Xn(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:Se(t,2,e,e);n=1.4*Math.sqrt(r),n=n>16?16:n|0,e=e.times(1/qe(5,n)),e=Se(t,2,e,e);for(var i,o=new t(5),s=new t(16),u=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(u))));return e}function Se(t,e,n,r,i){var o,s,u,c,a=t.precision,l=Math.ceil(a/C);for(A=!1,c=n.times(n),u=new t(r);;){if(s=D(u.times(c),new t(e++*e++),a,1),u=i?r.plus(s):r.minus(s),r=D(s.times(c),new t(e++*e++),a,1),s=u.plus(r),s.d[l]!==void 0){for(o=l;s.d[o]===u.d[o]&&o--;);if(o==-1)break}o=u,u=r,r=s,s=o}return A=!0,s.d.length=l+1,s}function qe(t,e){for(var n=t;--e;)n*=t;return n}function nn(t,e){var n,r=e.s<0,i=ee(t,t.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return ae=r?4:1,e;if(n=e.divToInt(i),n.isZero())ae=r?3:2;else{if(e=e.minus(n.times(i)),e.lte(o))return ae=It(n)?r?2:3:r?4:1,e;ae=It(n)?r?1:4:r?3:2}return e.minus(i).abs()}function ht(t,e,n,r){var i,o,s,u,c,a,l,f,d,m=t.constructor,h=n!==void 0;if(h?(W(n,1,he),r===void 0?r=m.rounding:W(r,0,8)):(n=m.precision,r=m.rounding),!t.isFinite())l=tn(t);else{for(l=ie(t),s=l.indexOf("."),h?(i=2,e==16?n=n*4-3:e==8&&(n=n*3-2)):i=e,s>=0&&(l=l.replace(".",""),d=new m(1),d.e=l.length-s,d.d=Fe(ie(d),10,i),d.e=d.d.length),f=Fe(l,10,i),o=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=h?"0p+0":"0";else{if(s<0?o--:(t=new m(t),t.d=f,t.e=o,t=D(t,d,n,r,0,i),f=t.d,o=t.e,a=Wt),s=f[n],u=i/2,a=a||f[n+1]!==void 0,a=r<4?(s!==void 0||a)&&(r===0||r===(t.s<0?3:2)):s>u||s===u&&(r===4||a||r===6&&f[n-1]&1||r===(t.s<0?8:7)),f.length=n,a)for(;++f[--n]>i-1;)f[n]=0,n||(++o,f.unshift(1));for(c=f.length;!f[c-1];--c);for(s=0,l="";s<c;s++)l+=it.charAt(f[s]);if(h){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(f=Fe(l,i,e),c=f.length;!f[c-1];--c);for(s=1,l="1.";s<c;s++)l+=it.charAt(f[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return t.s<0?"-"+l:l}function Ot(t,e){if(t.length>e)return t.length=e,!0}function Wn(t){return new this(t).abs()}function jn(t){return new this(t).acos()}function Gn(t){return new this(t).acosh()}function Yn(t,e){return new this(t).plus(e)}function zn(t){return new this(t).asin()}function Jn(t){return new this(t).asinh()}function Qn(t){return new this(t).atan()}function er(t){return new this(t).atanh()}function tr(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return!t.s||!e.s?n=new this(NaN):!t.d&&!e.d?(n=ee(this,o,1).times(e.s>0?.25:.75),n.s=t.s):!e.d||t.isZero()?(n=e.s<0?ee(this,r,i):new this(0),n.s=t.s):!t.d||e.isZero()?(n=ee(this,o,1).times(.5),n.s=t.s):e.s<0?(this.precision=o,this.rounding=1,n=this.atan(D(t,e,o,1)),e=ee(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(D(t,e,o,1)),n}function nr(t){return new this(t).cbrt()}function rr(t){return y(t=new this(t),t.e+1,2)}function ir(t,e,n){return new this(t).clamp(e,n)}function or(t){if(!t||typeof t!="object")throw Error($e+"Object expected");var e,n,r,i=t.defaults===!0,o=["precision",1,he,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,rt,"maxE",0,rt,"minE",-9e15,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(n=o[e],i&&(this[n]=ot[n]),(r=t[n])!==void 0)if(q(r)===r&&r>=o[e+1]&&r<=o[e+2])this[n]=r;else throw Error(me+n+": "+r);if(n="crypto",i&&(this[n]=ot[n]),(r=t[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(Gt);else this[n]=!1;else throw Error(me+n+": "+r);return this}function sr(t){return new this(t).cos()}function ar(t){return new this(t).cosh()}function rn(t){var e,n,r;function i(o){var s,u,c,a=this;if(!(a instanceof i))return new i(o);if(a.constructor=i,_t(o)){a.s=o.s,A?!o.d||o.e>i.maxE?(a.e=NaN,a.d=null):o.e<i.minE?(a.e=0,a.d=[0]):(a.e=o.e,a.d=o.d.slice()):(a.e=o.e,a.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){a.s=1/o<0?-1:1,a.e=0,a.d=[0];return}if(o<0?(o=-o,a.s=-1):a.s=1,o===~~o&&o<1e7){for(s=0,u=o;u>=10;u/=10)s++;A?s>i.maxE?(a.e=NaN,a.d=null):s<i.minE?(a.e=0,a.d=[0]):(a.e=s,a.d=[o]):(a.e=s,a.d=[o]);return}else if(o*0!==0){o||(a.s=NaN),a.e=NaN,a.d=null;return}return ut(a,o.toString())}else if(c!=="string")throw Error(me+o);return(u=o.charCodeAt(0))===45?(o=o.slice(1),a.s=-1):(u===43&&(o=o.slice(1)),a.s=1),zt.test(o)?ut(a,o):qn(a,o)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=or,i.clone=rn,i.isDecimal=_t,i.abs=Wn,i.acos=jn,i.acosh=Gn,i.add=Yn,i.asin=zn,i.asinh=Jn,i.atan=Qn,i.atanh=er,i.atan2=tr,i.cbrt=nr,i.ceil=rr,i.clamp=ir,i.cos=sr,i.cosh=ar,i.div=ur,i.exp=cr,i.floor=lr,i.hypot=fr,i.ln=dr,i.log=mr,i.log10=pr,i.log2=hr,i.max=gr,i.min=vr,i.mod=br,i.mul=wr,i.pow=Er,i.random=Sr,i.round=Tr,i.sign=yr,i.sin=Cr,i.sinh=Mr,i.sqrt=Lr,i.sub=Ar,i.sum=xr,i.tan=Ir,i.tanh=Or,i.trunc=_r,t===void 0&&(t={}),t&&t.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return i.config(t),i}function ur(t,e){return new this(t).div(e)}function cr(t){return new this(t).exp()}function lr(t){return y(t=new this(t),t.e+1,3)}function fr(){var t,e,n=new this(0);for(A=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)n.d&&(n=n.plus(e.times(e)));else{if(e.s)return A=!0,new this(1/0);n=e}return A=!0,n.sqrt()}function _t(t){return t instanceof Le||t&&t.toStringTag===Yt||!1}function dr(t){return new this(t).ln()}function mr(t,e){return new this(t).log(e)}function hr(t){return new this(t).log(2)}function pr(t){return new this(t).log(10)}function gr(){return en(this,arguments,"lt")}function vr(){return en(this,arguments,"gt")}function br(t,e){return new this(t).mod(e)}function wr(t,e){return new this(t).mul(e)}function Er(t,e){return new this(t).pow(e)}function Sr(t){var e,n,r,i,o=0,s=new this(1),u=[];if(t===void 0?t=this.precision:W(t,1,he),r=Math.ceil(t/C),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));o<r;)i=e[o],i>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);o<r;)i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,o):(u.push(i%1e7),o+=4);o=r/4}else throw Error(Gt);else for(;o<r;)u[o++]=Math.random()*1e7|0;for(r=u[--o],t%=C,r&&t&&(i=U(10,C-t),u[o]=(r/i|0)*i);u[o]===0;o--)u.pop();if(o<0)n=0,u=[0];else{for(n=-1;u[0]===0;n-=C)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<C&&(n-=C-r)}return s.e=n,s.d=u,s}function Tr(t){return y(t=new this(t),t.e+1,this.rounding)}function yr(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function Cr(t){return new this(t).sin()}function Mr(t){return new this(t).sinh()}function Lr(t){return new this(t).sqrt()}function Ar(t,e){return new this(t).sub(e)}function xr(){var t=0,e=arguments,n=new this(e[t]);for(A=!1;n.s&&++t<e.length;)n=n.plus(e[t]);return A=!0,y(n,this.precision,this.rounding)}function Ir(t){return new this(t).tan()}function Or(t){return new this(t).tanh()}function _r(t){return y(t=new this(t),t.e+1,1)}g[Symbol.for("nodejs.util.inspect.custom")]=g.toString;g[Symbol.toStringTag]="Decimal";var Le=g.constructor=rn(ot);Pe=new Le(Pe);Be=new Le(Be);class re{static formatToTimecode(e,n,r=!1,i=!1){let o=new Le(n),s,u=o.round();s=o.mul(e).floor();let c,a,l,f,d=u.mul(86400),m=s.mod(d),h=u.mul(3600),p=u.mul(60);return f=m.divToInt(h),m=m.minus(f.mul(h)),l=m.divToInt(p),m=m.minus(l.mul(p)),a=m.divToInt(u),c=m.minus(a.mul(u)),re.formatTimecodeText(f.toNumber(),l.toNumber(),a.toNumber(),c.toNumber(),r,i)}static formatTimecodeText(e,n,r,i,o=!1,s=!1){let u=s?".":o?";":":";return`${re.padZero(e)}:${re.padZero(n)}:${re.padZero(r)}${u}${re.padZero(i)}`}static padZero(e){return e<10?`0${e}`:`${e}`}}class Nr{static resolveFrameRateValueFromFraction(e){return 30}}const Q=class Q{static parseTimeMoment(e){const[n,r]=e.split(":").map(Number);return[n,r]}static parseTimeRange(e){const n=e.match(this.timeRangePattern);if(!n)throw new Error("Not valid timerange: "+e);const r=n[1]==="[",i=n[5]==="]",o=n[2]?this.parseTimeMoment(n[2]):void 0,s=n[4]?this.parseTimeMoment(n[4]):void 0;return{start:o,end:s,isStartInclusive:r,isEndInclusive:i}}static timeMomentToSeconds(e){return Q.timeMomentToMilliseconds(e)/1e3}static timeMomentToMilliseconds(e){return e[0]*1e3+e[1]/1e6}static timeMomentToDate(e){const r=e[0]*1e3+e[1]/1e6;return new Date(r)}static formatTimeMomentToTimecodeText(e,n,r=!1){let i=Nr.resolveFrameRateValueFromFraction(n);return re.formatToTimecode(Q.timeMomentToSeconds(e),i,r)}static formatTimerangeToTimecodeText(e,n,r=!1){let i=Q.parseTimeRange(e),o=i.start?Q.formatTimeMomentToTimecodeText(i.start,n,r):"?",s=i.end?Q.formatTimeMomentToTimecodeText(i.end,n,r):"?";return`${o} - ${s}`}static nanosecondsToSeconds(e){return e/1e9}static nanosecondsToTimeMoment(e){const n=Math.floor(e/1e9),r=Math.ceil(e%1e9);return[n,r]}static secondsToTimeMoment(e){return this.nanosecondsToTimeMoment(e*1e9)}static timerangeExprDuration(e){return this.timeRangeDuration(this.parseTimeRange(e))}static timeRangeDuration(e){const{start:n,end:r}=e;if(n===void 0||r===void 0)return 0;{const i=r[0]-n[0],o=r[1]-n[1],s=i+o/1e9;return parseFloat(s.toFixed(3))}}static formatTimeMomentExpr(e){return`${e[0]}:${e[1]}`}static formatNanosecondsToTimeMomentExpr(e){return this.formatTimeMomentExpr(this.nanosecondsToTimeMoment(e))}static toTimeRange(e,n,r=!0,i=!0){return{start:e,end:n,isStartInclusive:r,isEndInclusive:i}}static formatTimeRangeExpr(e){const n=e.isStartInclusive?"[":"(",r=e.isEndInclusive?"]":")",i=e.start?`${e.start[0]}:${e.start[1]}`:"",o=e.end?`${e.end[0]}:${e.end[1]}`:"";return`${n}${i}_${o}${r}`}static timerangeDuration(e){let n=Q.parseTimeRange(e);if(n.start===void 0||n.end===void 0)return 1/0;{let r=Q.timeMomentToSeconds(n.start);return Q.timeMomentToSeconds(n.end)-r}}static padZero(e){return e<10?`0${e}`:`${e}`}};Q.timeRangePattern=/^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$/;let B=Q;function kr(t){return t.format==="urn:x-nmos:format:data"&&t.container==="text/vtt"}function Rr(t){var e,n,r;return{id:on(t.id),label:((e=t.tags)==null?void 0:e.hls_name)??t.label??"Subtitles",default:((n=t.tags)==null?void 0:n.hls_default)==="YES",language:((r=t.tags)==null?void 0:r.hls_language)??"unknown",embedded:!1}}function on(t){return`subtitles-${t}`}function Dr(t,e){const n=t.filter(f=>e.get(f.id).length>0).map(f=>{const d=e.get(f.id);let m,h=!1;if(f.format==="urn:x-nmos:format:video"){const p=f.essence_parameters.frame_rate;p&&(m=p.numerator/(p.denominator??1),(p.numerator===6e4||p.numerator===3e4)&&p.denominator===1001&&(h=!0))}return{start:B.timeMomentToSeconds(B.parseTimeRange(d.at(0).timerange).start),frameRate:m,dropFrame:h}}).sort((f,d)=>f.start-d.start),r=n.find(f=>f.frameRate!==void 0),i=(r==null?void 0:r.start)??n.at(0).start,o=new Date(i*1e3),s=o.getUTCHours(),u=o.getUTCMinutes(),c=o.getUTCSeconds(),a=o.getUTCMilliseconds(),l=s*3600+u*60+c+a/1e3;return r===void 0?{ffom:re.formatToTimecode(l,100,!1,!0),mediaStartTime:i,frameRate:100,dropFrame:!1}:{ffom:re.formatToTimecode(l,r.frameRate,r.dropFrame),mediaStartTime:r.start,frameRate:r.frameRate,dropFrame:r.dropFrame}}class Fr{constructor(e){T(this,"_lanes",[]);T(this,"_markersLaneMap",new Map);T(this,"_laneNodenMap",new Map);this.omakasePlayer=e}addMarkerLane(e){const n={config:e,type:"marker"};this._lanes.push(n)}addMarkers(e,n){this._markersLaneMap.get(e)===void 0&&this._markersLaneMap.set(e,[]),this._markersLaneMap.get(e).push(...n)}addTimelineNode(e,n){this._laneNodenMap.get(e)||this._laneNodenMap.set(e,[]),this._laneNodenMap.get(e).push(n)}addThumbnailLane(e){const n={config:e,type:"thumbnail"};this._lanes.push(n)}addLabelLane(e){const n={config:e,type:"label"};this._lanes.push(n)}addSubtitlesLane(e){const n={config:e,type:"subtitles"};this._lanes.push(n)}buildAndAttachTimeline(e){this.omakasePlayer.createTimeline(e).subscribe({next:n=>{this.buildAttachedTimeline(n)}})}buildAttachedTimeline(e){this._lanes.forEach(n=>this._createAndAttachLane(e,n))}_createAndAttachLane(e,n){let r;if(n.type==="marker"){r=new F.MarkerLane(n.config),e.addTimelineLane(r);const o=this._markersLaneMap.get(r.id);o==null||o.forEach(s=>r.addMarker(s))}else n.type==="thumbnail"?(r=new F.ThumbnailLane(n.config),e.addTimelineLane(r)):n.type==="label"?(r=new F.LabelLane(n.config),e.addTimelineLane(r)):n.type==="subtitles"&&(r=new F.SubtitlesLane(n.config),e.addTimelineLane(r));const i=this._laneNodenMap.get(r.id);i==null||i.forEach(o=>{r.addTimelineNode(o.config)})}}var ct=function(t,e){return ct=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},ct(t,e)};function Ae(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ct(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function Vr(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(l){try{a(r.next(l))}catch(f){s(f)}}function c(l){try{a(r.throw(l))}catch(f){s(f)}}function a(l){l.done?o(l.value):i(l.value).then(u,c)}a((r=r.apply(t,e||[])).next())})}function sn(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function Te(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ke(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function He(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function Ee(t){return this instanceof Ee?(this.v=t,this):new Ee(t)}function Pr(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(m){return function(h){return Promise.resolve(h).then(m,f)}}function u(m,h){r[m]&&(i[m]=function(p){return new Promise(function(w,E){o.push([m,p,w,E])>1||c(m,p)})},h&&(i[m]=h(i[m])))}function c(m,h){try{a(r[m](h))}catch(p){d(o[0][3],p)}}function a(m){m.value instanceof Ee?Promise.resolve(m.value.v).then(l,f):d(o[0][2],m)}function l(m){c("next",m)}function f(m){c("throw",m)}function d(m,h){m(h),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Br(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Te=="function"?Te(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(s){return new Promise(function(u,c){s=t[o](s),i(u,c,s.done,s.value)})}}function i(o,s,u,c){Promise.resolve(c).then(function(a){o({value:a,done:u})},s)}}function K(t){return typeof t=="function"}function pt(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var ze=pt(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
|
8
8
|
`+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
|
|
9
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}});function lt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Xe=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=Te(s),c=u.next();!c.done;c=u.next()){var a=c.value;a.remove(this)}}catch(p){e={error:p}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(K(l))try{l()}catch(p){o=p instanceof ze?p.errors:[p]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=Te(f),m=d.next();!m.done;m=d.next()){var h=m.value;try{Nt(h)}catch(p){o=o??[],p instanceof ze?o=He(He([],Ke(o)),Ke(p.errors)):o.push(p)}}}catch(p){r={error:p}}finally{try{m&&!m.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}if(o)throw new ze(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Nt(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&<(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&<(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),an=Xe.EMPTY;function un(t){return t instanceof Xe||t&&"closed"in t&&K(t.remove)&&K(t.add)&&K(t.unsubscribe)}function Nt(t){K(t)?t():t.unsubscribe()}var Ur={Promise:void 0},Kr={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,He([t,e],Ke(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function cn(t){Kr.setTimeout(function(){throw t})}function ft(){}function Ve(t){t()}var gt=function(t){Ae(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,un(n)&&n.add(r)):r.destination=Zr,r}return e.create=function(n,r,i){return new dt(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Xe),Hr=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){Oe(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Oe(r)}else Oe(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Oe(n)}},t}(),dt=function(t){Ae(e,t);function e(n,r,i){var o=t.call(this)||this,s;return K(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new Hr(s),o}return e}(gt);function Oe(t){cn(t)}function $r(t){throw t}var Zr={closed:!0,next:ft,error:$r,complete:ft},vt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function We(t){return t}function qr(t){return t.length===0?We:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var j=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,o=Wr(e)?e:new dt(e,n,r);return Ve(function(){var s=i,u=s.operator,c=s.source;o.add(u?u.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=kt(n),new n(function(i,o){var s=new dt({next:function(u){try{e(u)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});r.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[vt]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return qr(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=kt(e),new e(function(r,i){var o;n.subscribe(function(s){return o=s},function(s){return i(s)},function(){return r(o)})})},t.create=function(e){return new t(e)},t}();function kt(t){var e;return(e=t??Ur.Promise)!==null&&e!==void 0?e:Promise}function Xr(t){return t&&K(t.next)&&K(t.error)&&K(t.complete)}function Wr(t){return t&&t instanceof gt||Xr(t)&&un(t)}function jr(t){return K(t==null?void 0:t.lift)}function pe(t){return function(e){if(jr(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function ue(t,e,n,r,i){return new Gr(t,e,n,r,i)}var Gr=function(t){Ae(e,t);function e(n,r,i,o,s,u){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=u,c._next=r?function(a){try{r(a)}catch(l){n.error(l)}}:t.prototype._next,c._error=o?function(a){try{o(a)}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(a){n.error(a)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(gt),Yr=pt(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),le=function(t){Ae(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new Rt(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Yr},e.prototype.next=function(n){var r=this;Ve(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=Te(r.currentObservers),u=s.next();!u.done;u=s.next()){var c=u.value;c.next(n)}}catch(a){i={error:a}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;Ve(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;Ve(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?an:(this.currentObservers=null,u.push(n),new Xe(function(){r.currentObservers=null,lt(u,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,s=r.isStopped;i?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new j;return n.source=this,n},e.create=function(n,r){return new Rt(n,r)},e}(j),Rt=function(t){Ae(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:an},e}(le),zr=new j(function(t){return t.complete()});function Jr(t){return t&&K(t.schedule)}function ln(t){return t[t.length-1]}function fn(t){return K(ln(t))?t.pop():void 0}function Qr(t){return Jr(ln(t))?t.pop():void 0}var dn=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function mn(t){return K(t==null?void 0:t.then)}function hn(t){return K(t[vt])}function pn(t){return Symbol.asyncIterator&&K(t==null?void 0:t[Symbol.asyncIterator])}function gn(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ei(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var vn=ei();function bn(t){return K(t==null?void 0:t[vn])}function wn(t){return Pr(this,arguments,function(){var n,r,i,o;return sn(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ee(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,Ee(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ee(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function En(t){return K(t==null?void 0:t.getReader)}function xe(t){if(t instanceof j)return t;if(t!=null){if(hn(t))return ti(t);if(dn(t))return ni(t);if(mn(t))return ri(t);if(pn(t))return Sn(t);if(bn(t))return ii(t);if(En(t))return oi(t)}throw gn(t)}function ti(t){return new j(function(e){var n=t[vt]();if(K(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ni(t){return new j(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function ri(t){return new j(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,cn)})}function ii(t){return new j(function(e){var n,r;try{for(var i=Te(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function Sn(t){return new j(function(e){si(t,e).catch(function(n){return e.error(n)})})}function oi(t){return Sn(wn(t))}function si(t,e){var n,r,i,o;return Vr(this,void 0,void 0,function(){var s,u;return sn(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Br(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function de(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function Tn(t,e){return e===void 0&&(e=0),pe(function(n,r){n.subscribe(ue(r,function(i){return de(r,t,function(){return r.next(i)},e)},function(){return de(r,t,function(){return r.complete()},e)},function(i){return de(r,t,function(){return r.error(i)},e)}))})}function yn(t,e){return e===void 0&&(e=0),pe(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function ai(t,e){return xe(t).pipe(yn(e),Tn(e))}function ui(t,e){return xe(t).pipe(yn(e),Tn(e))}function ci(t,e){return new j(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function li(t,e){return new j(function(n){var r;return de(n,e,function(){r=t[vn](),de(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(u){n.error(u);return}s?n.complete():n.next(o)},0,!0)}),function(){return K(r==null?void 0:r.return)&&r.return()}})}function Cn(t,e){if(!t)throw new Error("Iterable cannot be null");return new j(function(n){de(n,e,function(){var r=t[Symbol.asyncIterator]();de(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function fi(t,e){return Cn(wn(t),e)}function di(t,e){if(t!=null){if(hn(t))return ai(t,e);if(dn(t))return ci(t,e);if(mn(t))return ui(t,e);if(pn(t))return Cn(t,e);if(bn(t))return li(t,e);if(En(t))return fi(t,e)}throw gn(t)}function Mn(t,e){return e?di(t,e):xe(t)}var Ln=pt(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function mi(t,e){return pe(function(n,r){var i=0;n.subscribe(ue(r,function(o){r.next(t.call(e,o,i++))}))})}var hi=Array.isArray;function pi(t,e){return hi(e)?t.apply(void 0,He([],Ke(e))):t(e)}function An(t){return mi(function(e){return pi(t,e)})}var gi=Array.isArray,vi=Object.getPrototypeOf,bi=Object.prototype,wi=Object.keys;function xn(t){if(t.length===1){var e=t[0];if(gi(e))return{args:e,keys:null};if(Ei(e)){var n=wi(e);return{args:n.map(function(r){return e[r]}),keys:n}}}return{args:t,keys:null}}function Ei(t){return t&&typeof t=="object"&&vi(t)===bi}function In(t,e){return t.reduce(function(n,r,i){return n[r]=e[i],n},{})}function Si(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Qr(t),r=fn(t),i=xn(t),o=i.args,s=i.keys;if(o.length===0)return Mn([],n);var u=new j(Ti(o,n,s?function(c){return In(s,c)}:We));return r?u.pipe(An(r)):u}function Ti(t,e,n){return n===void 0&&(n=We),function(r){Dt(e,function(){for(var i=t.length,o=new Array(i),s=i,u=i,c=function(l){Dt(e,function(){var f=Mn(t[l],e),d=!1;f.subscribe(ue(r,function(m){o[l]=m,d||(d=!0,u--),u||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},a=0;a<i;a++)c(a)},r)}}function Dt(t,e,n){t?de(n,t,e):e()}function yi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=fn(t),r=xn(t),i=r.args,o=r.keys,s=new j(function(u){var c=i.length;if(!c){u.complete();return}for(var a=new Array(c),l=c,f=c,d=function(h){var p=!1;xe(i[h]).subscribe(ue(u,function(w){p||(p=!0,f--),a[h]=w},function(){return l--},void 0,function(){(!l||!p)&&(f||u.next(o?In(o,a):a),u.complete())}))},m=0;m<c;m++)d(m)});return n?s.pipe(An(n)):s}function Ci(t,e){return pe(function(n,r){var i=0;n.subscribe(ue(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function Mi(t){return pe(function(e,n){var r=!1;e.subscribe(ue(n,function(i){r=!0,n.next(i)},function(){r||n.next(t),n.complete()}))})}function Li(t){return t<=0?function(){return zr}:pe(function(e,n){var r=0;e.subscribe(ue(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function Ai(t){return t===void 0&&(t=xi),pe(function(e,n){var r=!1;e.subscribe(ue(n,function(i){r=!0,n.next(i)},function(){return r?n.complete():n.error(t())}))})}function xi(){return new Ln}function we(t,e){var n=arguments.length>=2;return function(r){return r.pipe(We,Li(1),n?Mi(e):Ai(function(){return new Ln}))}}function Z(t){return pe(function(e,n){xe(t).subscribe(ue(n,function(){return n.complete()},ft)),!n.closed&&e.subscribe(n)})}class Ii{constructor(){T(this,"actionZoomIn");T(this,"actionZoomOut");T(this,"actionResetZoom");T(this,"actionToggleNextAudioTrack");T(this,"actionTogglePreviousAudioTrack");T(this,"actionToggleCti")}getKeyboardShortcutsHelpMenuGroup(){let e=(...i)=>i.join(" + "),n="shift".toUpperCase();return{name:"Timeline function shortcuts",items:[{description:"Timeline Zoom In",name:e("=")},{description:"Timeline Zoom Out",name:e("-")},{description:"Timeline Zoom level 100%",name:e("0")},{description:"Toggle Next Audio Track",name:e(n,"e")},{description:"Toggle Previous Audio Track",name:e("e")},{description:"Toggle CTI into / out-of Interactive Mode",name:e("'")}]}}handleKeyboardEvent(e){const n=e.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(n.tagName.toUpperCase())?!1:e.code==="Equal"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionZoomIn&&this.actionZoomIn(),!0):e.code==="Minus"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionZoomOut&&this.actionZoomOut(),!0):e.code==="Digit0"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionResetZoom&&this.actionResetZoom(),!0):e.code==="KeyE"&&!e.ctrlKey&&!e.metaKey?(e.shiftKey?this.actionToggleNextAudioTrack&&this.actionToggleNextAudioTrack():this.actionTogglePreviousAudioTrack&&this.actionTogglePreviousAudioTrack(),!0):e.code==="Quote"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionToggleCti&&this.actionToggleCti(),!0):!1}}const Oi=v.memo(({omakasePlayer:t,onTimelineCreatedCallback:e,timelineConfig:n,enableHotKeys:r})=>(v.useEffect(()=>{if(n.timelineHTMLElementId===void 0&&(n.timelineHTMLElementId="omakase-timeline"),t.createTimeline(n).subscribe({next:i=>{Si([t.timeline.onReady$,t.video.onVideoLoaded$.pipe(Ci(o=>!!o))]).subscribe({next:()=>e(i)})}}),r===void 0||r){const i=new Ii;i.actionToggleCti=()=>{var u;return(u=t.timeline)==null?void 0:u.toggleTimecodeEdit()},i.actionResetZoom=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomToEased(100)},i.actionZoomIn=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomInEased()},i.actionZoomOut=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomOutEased()};const o=u=>{const c=t.audio.getAudioTracks(),a=t.audio.getActiveAudioTrack(),f=c.findIndex(d=>d.id===(a==null?void 0:a.id))+(u?-1:1);f>=0&&f<c.length&&t.audio.setActiveAudioTrack(c.at(f).id)};i.actionTogglePreviousAudioTrack=()=>o(!0),i.actionToggleNextAudioTrack=()=>o(!1);const s=u=>{i.handleKeyboardEvent(u)&&(u.preventDefault(),u.stopPropagation())};return window.addEventListener("keydown",s),t.video.appendHelpMenuGroup(i.getKeyboardShortcutsHelpMenuGroup()),()=>{window.removeEventListener("keydown",s)}}},[t]),v.createElement("div",{id:n.timelineHTMLElementId})));class On{static get window(){return window}static get navigator(){return window.navigator}static get userAgent(){var n;const e=((n=this.navigator)==null?void 0:n.userAgent)||"";return/Android/i.test(e)?"android":/Firefox/i.test(e)?"firefox":/Edg/i.test(e)?"edge":(/Chrome/i.test(e)||/CriOS/i.test(e))&&!/Edg/i.test(e)?"chrome":/Chrome/i.test(e)||/CriOS/i.test(e)?"chromium":/Safari/i.test(e)?"safari":"unknown"}static get platform(){var n,r,i;const e=((r=(n=this.navigator)==null?void 0:n.userAgentData)==null?void 0:r.platform)||((i=this.navigator)==null?void 0:i.platform);return e!=null&&e.toUpperCase().includes("MAC")?"macos":e!=null&&e.toUpperCase().includes("WIN")?"windows":e!=null&&e.toUpperCase().includes("LINUX")?"linux":"unknown"}static isUserAgent(e){return this.userAgent===e}static isPlatform(e){return this.platform===e}static open(e,n="_blank"){this.window.open(e,n)}}const Ce=[.25,.5,.75,1,2,4,8];class Ft{static getKeyboardShortcutsHelpMenuGroup(){let e=(...o)=>o.join(" + "),n="shift".toUpperCase(),r="ctrl".toUpperCase();return{name:"Playback function shortcuts",items:[{description:"Play / Pause",name:e("Space")},{description:"Toggle Sound",name:e("s")},{description:"Toggle Text On / Off",name:e("d")},{description:"Toggle Full Screen",name:e("f")},{description:"Increase Volume",name:e(n,"\\")},{description:"Reduce Volume",name:e("\\")},{description:"One Frame Forward",name:e("Right Arrow")},{description:"One Frame Backward",name:e("Left Arrow")},{description:"10 Frames Forward",name:e(n,"Right Arrow")},{description:"10 Frames Backwards",name:e(n,"Left Arrow")},{description:"Stop shuttle and pause",name:e("k")},{description:"Decrease Shuttle Forwards",name:e("l")},{description:"Increase Shuttle Forwards",name:e(n,"l")},{description:"Set playhead to Start of Media and Stop",name:e("1 / Home")},{description:"Set playhead to End of Media and Stop",name:e(r,"1")+" / End"}]}}static handleKeyboardEvent(e,n){const r=e.target,i=["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"],o=On.userAgent;if(i.includes(r.tagName.toUpperCase()))return!1;if(n&&n.video){if(e.code==="Space"&&(o!=="safari"||!n.video.isFullscreen()))return n.video.togglePlayPause(),!0;if(e.code==="KeyS"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey)return n.video.toggleMuteUnmute(),!0;if(e.code==="Backslash"){let s=10,u=e.shiftKey?1:-1,c=n.video.getVolume()*100+s*u;c>=100?c=100:c<=0&&(c=0),n.video.setVolume(c/100)}if(e.code==="KeyD"&&!(e.ctrlKey&&e.shiftKey&&e.metaKey))return n.subtitles.toggleShowHideActiveTrack(),!0;if(e.code==="KeyK"&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey&&(n.video.setPlaybackRate(1),n.video.pause()),e.code==="KeyL"&&!e.ctrlKey&&!e.metaKey){let s=e.shiftKey?1:-1;const u=Ce.indexOf(n.video.getPlaybackRate())+s;let c;return u<0?c=Ce.at(0):u>=Ce.length?c=Ce.at(-1):c=Ce.at(u),n.video.setPlaybackRate(c),n.video.isPaused()&&n.video.play(),!0}if(n.video.isVideoLoaded()){if(["ArrowLeft","ArrowRight"].includes(e.key)&&!e.metaKey&&!e.altKey){let s=e.key==="ArrowRight"?1:-1,u=e.shiftKey?10:1;return n.video.isPlaying()&&n.video.pause(),n.video.seekFromCurrentFrame(u*s),!0}if(e.code==="Digit1"&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey||e.code==="Home")return n.video.pause().subscribe(()=>n.video.seekToFrame(0)),!0;if(e.code==="Digit1"&&e.ctrlKey||e.code==="End")return n.video.isPlaying()?n.video.pause().subscribe(()=>n.video.seekToEnd()):n.video.seekToEnd(),!0}if(e.code==="KeyF"&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey)return n.video.toggleFullscreen(),!0}return!1}}const _n=v.memo(function({videoUrl:e,config:n,videoLoadOptions:r,onVideoLoadedCallback:i,enableHotkeys:o}){return n&&(n==null?void 0:n.playerHTMLElementId)===void 0&&(n.playerHTMLElementId="omakase-player"),v.useEffect(()=>{var c,a;let s=new F.OmakasePlayer(n);const u=l=>{Ft.handleKeyboardEvent(l,s)&&(l.stopPropagation(),l.preventDefault())};return(o===void 0||o)&&((c=document.querySelector("media-controller"))==null||c.setAttribute("nohotkeys",""),(a=document.querySelector("media-controller"))==null||a.setAttribute("tabindex","-1"),window.addEventListener("keydown",u),s.video.appendHelpMenuGroup(Ft.getKeyboardShortcutsHelpMenuGroup())),s.loadVideo(e,r).subscribe({next:l=>{i&&i(s,l)}}),()=>{(o===void 0||o)&&window.removeEventListener("keydown",u)}},[e]),v.createElement("div",{id:n.playerHTMLElementId})}),_i=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M10.5675 21C10.2375 21 9.9675 20.73 9.9675 20.4V16.7925L5.6325 12.3675L9.9675 8.235V3.6C9.9675 3.27 10.2375 3 10.5675 3C10.8975 3 11.1675 3.27 11.1675 3.6V8.7525L7.3425 12.3975L11.1675 16.305V20.4C11.1675 20.73 10.8975 21 10.5675 21Z",fill:"#CACFEA"}),v.createElement("path",{d:"M17.7675 17.145C17.61 17.145 17.46 17.085 17.34 16.965L12.8325 12.3675L17.355 8.0625C17.595 7.8375 17.9775 7.845 18.2025 8.085C18.4275 8.325 18.42 8.7075 18.18 8.9325L14.5425 12.3975L18.195 16.125C18.4275 16.365 18.42 16.74 18.1875 16.9725C18.075 17.085 17.9175 17.145 17.7675 17.145Z",fill:"#CACFEA"})),Ni=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M13.4325 21C13.7625 21 14.0325 20.73 14.0325 20.4V16.7925L18.3675 12.3675L14.0325 8.235V3.6C14.0325 3.27 13.7625 3 13.4325 3C13.1025 3 12.8325 3.27 12.8325 3.6V8.7525L16.6575 12.3975L12.8325 16.305V20.4C12.8325 20.73 13.1025 21 13.4325 21Z",fill:"#CACFEA"}),v.createElement("path",{d:"M6.2325 17.145C6.39 17.145 6.54 17.085 6.66 16.965L11.1675 12.3675L6.645 8.0625C6.405 7.8375 6.0225 7.845 5.7975 8.085C5.5725 8.325 5.58 8.7075 5.82 8.9325L9.4575 12.3975L5.805 16.125C5.5725 16.365 5.58 16.74 5.8125 16.9725C5.925 17.085 6.0825 17.145 6.2325 17.145Z",fill:"#CACFEA"})),ki=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M14.1675 21C13.8375 21 13.5675 20.73 13.5675 20.4V16.7925L9.2325 12.3675L13.5675 8.235V3.6C13.5675 3.27 13.8375 3 14.1675 3C14.4975 3 14.7675 3.27 14.7675 3.6V8.7525L10.9425 12.3975L14.7675 16.305V20.4C14.7675 20.73 14.4975 21 14.1675 21Z",fill:"#CACFEA"})),Ri=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M9.8325 21C10.1625 21 10.4325 20.73 10.4325 20.4V16.7925L14.7675 12.3675L10.4325 8.235V3.6C10.4325 3.27 10.1625 3 9.8325 3C9.5025 3 9.2325 3.27 9.2325 3.6V8.7525L13.0575 12.3975L9.2325 16.305V20.4C9.2325 20.73 9.5025 21 9.8325 21Z",fill:"#CACFEA"})),Di=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M11.3475 3H5.775V21L11.3475 17.0475V3Z",fill:"#CACFEA"}),v.createElement("path",{d:"M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",fill:"#CACFEA"})),Fi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",fill:"#CACFEA"}),v.createElement("path",{d:"M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",fill:"#CACFEA"})),Vi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M6.39001 3V21L12 17.0175L17.61 21V3H6.38251H6.39001ZM16.44 3.84L7.23001 18.7125V3.84H16.44ZM12 15.9975L8.25751 18.6525L16.77 4.89V19.3725L12 15.9825V15.9975Z",fill:"#CACFEA"})),Pi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M12.3075 8.0175L14.4525 5.8725C14.6175 5.7075 14.6175 5.43 14.4525 5.265L12.3 3.12C12.135 2.955 11.8575 2.955 11.6925 3.12C11.5275 3.285 11.5275 3.5625 11.6925 3.7275L13.1025 5.1375H6.64499C5.22749 5.1375 4.07249 6.2925 4.07249 7.71V16.2825C4.07249 17.7 5.22749 18.855 6.64499 18.855C6.87749 18.855 7.07249 18.66 7.07249 18.4275C7.07249 18.195 6.87749 18 6.64499 18C5.69249 18 4.93499 17.2275 4.93499 16.29V7.7175C4.93499 6.765 5.70749 6.0075 6.64499 6.0075H13.11L11.7 7.4175C11.535 7.5825 11.535 7.86 11.7 8.025C11.865 8.19 12.1425 8.19 12.3075 8.025V8.0175Z",fill:"#CACFEA"}),v.createElement("path",{d:"M17.355 18.8625C18.7725 18.8625 19.9275 17.7075 19.9275 16.29V7.7175C19.9275 6.3 18.7725 5.145 17.355 5.145C17.1225 5.145 16.9275 5.34 16.9275 5.5725C16.9275 5.805 17.1225 6 17.355 6C18.3075 6 19.065 6.7725 19.065 7.71V16.2825C19.065 17.235 18.2925 17.9925 17.355 17.9925H10.89L12.3075 16.5825C12.3825 16.5075 12.435 16.395 12.435 16.2825C12.435 16.17 12.3975 16.0575 12.3075 15.9825C12.15 15.8175 11.8575 15.825 11.7 15.9825L9.52501 18.1575V18.18C9.45751 18.255 9.42751 18.345 9.42751 18.435C9.42751 18.555 9.46501 18.66 9.55501 18.735L11.7 20.88C11.8575 21.045 12.15 21.045 12.3075 20.88C12.4725 20.715 12.4725 20.4375 12.3075 20.2725L10.89 18.8625H17.355Z",fill:"#CACFEA"})),Bi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("g",{clipPath:"url(#clip0_3377_237)"},v.createElement("path",{d:"M13.02 19.95C17.42 19.95 21 16.37 21 11.97C21 7.57 17.42 4 13.02 4C8.88 4 5.39 7.24 5.08 11.37L5.02 12.14L3.56 10.68C3.49 10.61 3.41 10.58 3.33 10.58C3.25 10.58 3.17 10.61 3.1 10.68C3.03 10.75 3 10.83 3 10.92C3 11 3.03 11.08 3.1 11.15L5.22 13.27C5.35 13.4 5.55 13.43 5.65 13.3L7.8 11.15C7.87 11.08 7.9 11 7.9 10.92C7.9 10.84 7.86 10.76 7.8 10.69C7.73 10.62 7.65 10.59 7.57 10.59C7.49 10.59 7.41 10.62 7.34 10.69L5.9 12.13L6.03 11.11C6.45 7.57 9.46 4.91 13.02 4.91C16.91 4.91 20.08 8.08 20.08 11.97C20.08 15.86 16.91 19.03 13.02 19.03C12.77 19.03 12.56 19.24 12.56 19.49C12.56 19.74 12.77 19.95 13.02 19.95Z",fill:"#CACFEA"}),v.createElement("path",{d:"M14.95 13.19C14.95 13.72 14.75 14.14 14.36 14.45C13.97 14.76 13.43 14.91 12.75 14.91C12.16 14.91 11.69 14.81 11.32 14.62V13.53C11.7 13.81 12.14 13.95 12.65 13.95C12.98 13.95 13.23 13.88 13.41 13.74C13.59 13.6 13.67 13.41 13.67 13.17C13.67 12.93 13.56 12.72 13.34 12.58C13.12 12.44 12.82 12.37 12.43 12.37H11.92V11.41H12.39C13.13 11.41 13.5 11.16 13.5 10.67C13.5 10.21 13.22 9.98 12.65 9.98C12.26 9.98 11.89 10.1 11.54 10.35V9.33C11.93 9.13 12.4 9.03 12.94 9.03C13.48 9.03 13.94 9.16 14.28 9.41C14.62 9.66 14.79 10.01 14.79 10.44C14.79 11.19 14.41 11.65 13.66 11.84V11.86C14.06 11.91 14.37 12.05 14.61 12.29C14.85 12.53 14.96 12.83 14.96 13.19H14.95Z",fill:"#CACFEA"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_3377_237"},v.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),Ui=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("g",{clipPath:"url(#clip0_3377_260)"},v.createElement("path",{d:"M10.98 19.95C6.58 19.95 3 16.37 3 11.98C3 7.58 6.58 4 10.98 4C15.12 4 18.61 7.24 18.93 11.37L18.99 12.14L20.45 10.68C20.52 10.61 20.6 10.58 20.68 10.58C20.76 10.58 20.84 10.61 20.91 10.68C20.98 10.75 21.01 10.83 21.01 10.91C21.01 10.99 20.98 11.07 20.91 11.14L18.79 13.26C18.66 13.39 18.46 13.42 18.36 13.29L16.21 11.14C16.14 11.07 16.11 10.99 16.11 10.91C16.11 10.83 16.15 10.75 16.21 10.68C16.28 10.61 16.36 10.58 16.44 10.58C16.52 10.58 16.6 10.61 16.67 10.68L18.11 12.12L17.98 11.1C17.55 7.57 14.54 4.91 10.98 4.91C7.09 4.91 3.92 8.08 3.92 11.97C3.92 15.86 7.09 19.03 10.98 19.03C11.23 19.03 11.44 19.24 11.44 19.49C11.44 19.74 11.23 19.95 10.98 19.95Z",fill:"#CACFEA"}),v.createElement("path",{d:"M12.91 13.19C12.91 13.72 12.71 14.14 12.32 14.45C11.93 14.76 11.39 14.91 10.71 14.91C10.12 14.91 9.65 14.81 9.28 14.62V13.53C9.66 13.81 10.1 13.95 10.61 13.95C10.94 13.95 11.19 13.88 11.37 13.74C11.55 13.6 11.63 13.41 11.63 13.17C11.63 12.93 11.52 12.72 11.3 12.58C11.08 12.44 10.78 12.37 10.39 12.37H9.88V11.41H10.35C11.09 11.41 11.46 11.16 11.46 10.67C11.46 10.21 11.18 9.98 10.61 9.98C10.22 9.98 9.85 10.1 9.5 10.35V9.33C9.89 9.13 10.36 9.03 10.9 9.03C11.44 9.03 11.9 9.16 12.24 9.41C12.58 9.66 12.75 10.01 12.75 10.44C12.75 11.19 12.37 11.65 11.62 11.84V11.86C12.02 11.91 12.33 12.05 12.57 12.29C12.81 12.53 12.92 12.83 12.92 13.19H12.91Z",fill:"#CACFEA"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_3377_260"},v.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),z=({Icon:t,onClick:e,width:n,height:r,text:i,disabled:o})=>v.createElement("button",{disabled:o,onClick:e},v.createElement(t,{width:n,height:r})," ",i),Ki=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z",fill:"#CACFEA"}),v.createElement("path",{d:"M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",fill:"#CACFEA"})),Hi=({width:t,height:e})=>v.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("rect",{x:"0.5",y:"0.5",width:"13",height:"13",rx:"2.5",stroke:"#CACFEA"}),v.createElement("path",{d:"M7.16667 6.33333V6.83333H7.66667H10.3333C10.4257 6.83333 10.5 6.90769 10.5 7C10.5 7.09231 10.4257 7.16667 10.3333 7.16667H7.66667H7.16667V7.66667V10.3333C7.16667 10.4257 7.09231 10.5 7 10.5C6.90769 10.5 6.83333 10.4257 6.83333 10.3333V7.66667V7.16667H6.33333H3.66667C3.57468 7.16667 3.5 7.09199 3.5 7C3.5 6.90801 3.57468 6.83333 3.66667 6.83333H6.33333H6.83333V6.33333V3.66667C6.83333 3.57468 6.90801 3.5 7 3.5C7.09199 3.5 7.16667 3.57468 7.16667 3.66667V6.33333Z",fill:"#CACFEA",stroke:"#CACFEA"}));function J(t){t.next(),t.complete()}class $i{constructor(){T(this,"actionMarkerInOut");T(this,"actionMarkerSplit");T(this,"actionMarkerDelete");T(this,"actionPreviousMarkerToggle");T(this,"actionNextMarkerToggle");T(this,"actionSetMarkerStartToPlayhead");T(this,"actionSetMarkerEndToPlayhead");T(this,"actionSetPlayheadToMarkerStart");T(this,"actionSetPlayheadToMarkerEnd");T(this,"actionRewind3SecondsAndPlayToCurrent");T(this,"actionPlay3SecondsAndRewindToCurrent");T(this,"actionLoopActiveMarker")}getKeyboardShortcutsHelpMenuGroup(){let e=(...s)=>s.join(" + "),n="shift".toUpperCase();const r=On.platform;let i=r==="windows"?"win":r==="linux"?"super":"cmd";return{name:"Segmentation function shortcuts",items:[{description:"Mark In / Out",name:e("m")},{description:"Split Active Marker",name:e(".")},{description:"Delete Active Marker",name:e("n")},{description:"Toggle Previous Marker",name:e("/")},{description:"Toggle Next Marker",name:e(n,"/")},{description:"Set Start of Active Marker to Playhead Position",name:e("i")},{description:"Set End of Active Marker to Playhead Position",name:e("o")},{description:"Set Playhead to Start of Active Marker",name:e("[")},{description:"Set Playhead to End of Active Marker",name:e("]")},{description:"Rewind 3 Seconds and Play to Current Playhead",name:e(i,"Arrow Left")},{description:"Play 3 Seconds and Rewind to Current Playhead",name:e(i,"Arrow Right")},{description:"Loop on Active Marker",name:e("p")}]}}handleKeyboardEvent(e,n){const r=e.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(r.tagName.toUpperCase())?!1:e.code==="KeyM"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerInOut&&this.actionMarkerInOut(),!0):e.code==="Period"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerSplit&&this.actionMarkerSplit(),!0):e.code==="KeyN"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerDelete&&this.actionMarkerDelete(),!0):e.code==="Slash"&&!e.ctrlKey&&!e.metaKey?(e.shiftKey?this.actionNextMarkerToggle&&this.actionNextMarkerToggle():this.actionPreviousMarkerToggle&&this.actionPreviousMarkerToggle(),!0):e.code==="KeyI"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetMarkerStartToPlayhead&&this.actionSetMarkerStartToPlayhead(),!0):e.code==="KeyO"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetMarkerEndToPlayhead&&this.actionSetMarkerEndToPlayhead(),!0):e.code==="BracketLeft"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetPlayheadToMarkerStart&&this.actionSetPlayheadToMarkerStart(),!0):e.code==="BracketRight"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetPlayheadToMarkerEnd&&this.actionSetPlayheadToMarkerEnd(),!0):e.code==="ArrowLeft"&&!e.shiftKey&&!e.ctrlKey&&e.metaKey?(this.actionRewind3SecondsAndPlayToCurrent&&this.actionRewind3SecondsAndPlayToCurrent(),!0):e.code==="ArrowRight"&&!e.shiftKey&&!e.ctrlKey&&e.metaKey?(this.actionPlay3SecondsAndRewindToCurrent&&this.actionPlay3SecondsAndRewindToCurrent(),!0):e.code==="KeyP"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionLoopActiveMarker&&this.actionLoopActiveMarker(),!0):!1}}const _e=(t,e,n)=>t.getMarkers().reduce((r,i)=>{if(e.id===i.id)return r;if(i instanceof F.PeriodMarker&&i.timeObservation.start!=null&&i.timeObservation.end!=null){const o=e.timeObservation,s=i.timeObservation.start,u=i.timeObservation.end,c=o.start,a=n??o.end;if(c!=null&&a!=null)return r||c<=u&&a>=s}return r},!1);function Ne(t,e,n){if(!t||!(t instanceof F.PeriodMarker))return!0;const r=t.timeObservation.start,i=t.timeObservation.end;if(r==null||i==null)return!0;const o=n.video.calculateTimeToFrame(i),s=n.video.calculateTimeToFrame(r),u=n.video.getCurrentFrame();return e<r||o-u<2||u-s<1}function ke(t){return!(t.timeObservation.start==null||t.timeObservation.end==null)}const Zi=({selectedMarker:t,omakasePlayer:e,markerListApi:n,enableHotKeys:r,segmentationLanes:i,setSegmentationLanes:o,setSelectedMarker:s,onMarkerClickCallback:u,setSource:c,source:a,constants:l})=>{const f=v.useRef(void 0),d=v.useRef(void 0),m=new le,h=v.useRef(!1),p=(b,S,L)=>{const R=S??e.video.getCurrentTime();return b.getMarkers().reduce((O,X)=>X instanceof F.PeriodMarker&&X.timeObservation.start!==void 0&&X.timeObservation.end!==void 0&&X.id!==(L==null?void 0:L.id)?O||R>=X.timeObservation.start&&R<=X.timeObservation.end:O,!1)},w=b=>{if(x===void 0)return!0;const S=x.timeObservation.start,L=b??e.video.getCurrentTime();return!!(S==null||S>=L||_e(a,x,L))},E=b=>x!==void 0||a===void 0?!0:p(a,b,x),[I,M]=v.useState(void 0),[N,k]=v.useState(Ne(t,e.video.getCurrentTime(),e)),[x,G]=v.useState(void 0),[ne,Y]=v.useState(w()),[ve,H]=v.useState(E()),oe=b=>{if(b===void 0||a===void 0||!(b instanceof F.PeriodMarker))return!0;const S=_e(a,b,e.video.getCurrentTime());if(S)return S;if(b instanceof F.PeriodMarker){const L=b.timeObservation.end;if(L!=null&&e.video.getCurrentTime()>=L)return!0}return!1},se=b=>{if(b===void 0||a===void 0||!(b instanceof F.PeriodMarker))return!0;const S=_e(a,b,e.video.getCurrentTime());if(S)return S;if(b instanceof F.PeriodMarker){if(b.timeObservation.end==null)return!0;const L=b.timeObservation.start;if(L!=null&&e.video.getCurrentTime()<=L)return!0}return!1},[be,P]=v.useState(oe(t)),[_,je]=v.useState(se(t));v.useEffect(()=>{if(Y(()=>w()),H(()=>E()),x&&x!==t){const b=i.find(S=>S.getMarker(x.id));b==null||b.removeMarker(x.id),G(void 0)}},[t,x,i,G]),v.useEffect(()=>()=>J(m),[]),v.useEffect(()=>{if(P(oe(t)),je(se(t)),t){const b=Ne(t,e.video.getCurrentTime(),e);k(b);const S=e.video.onVideoTimeChange$.pipe(Z(m)).subscribe({next:L=>{k(R=>Ne(t,L.currentTime,e)),P(()=>oe(t)),je(()=>se(t))}});return()=>S.unsubscribe()}},[t]),v.useEffect(()=>{e.video.onSeeking$.pipe(Z(m)).subscribe({next:S=>{Y(()=>w(S.toTime)),H(()=>E(S.toTime))}});const b=e.video.onVideoTimeChange$.pipe(Z(m)).subscribe({next:S=>{Y(()=>w()),H(()=>E())}});return()=>b.unsubscribe()},[x,a]),v.useEffect(()=>{const b=i.map(S=>S.onMarkerUpdate$.pipe(Z(m)).subscribe({next:L=>{(t==null?void 0:t.id)===L.marker.id&&(k(R=>Ne(t,e.video.getCurrentTime(),e)),P(()=>oe(t)),je(()=>se(t)))}}));return()=>b.forEach(S=>S.unsubscribe())},[i,t]),v.useEffect(()=>{I&&(I.marker.style={...I.marker.style,color:I.color},I.marker.timeObservation={...I.marker.timeObservation},M(void 0))},[t]),v.useEffect(()=>{if(a){Y(()=>w()),H(()=>E());const b=a.onMarkerDelete$.pipe(Z(m)).subscribe({next:L=>{const R=L.marker;M(O=>{if((O==null?void 0:O.marker.id)!==R.id)return O}),s(O=>{if((O==null?void 0:O.id)!==R.id)return O}),G(O=>{if((O==null?void 0:O.id)!==R.id)return O}),Y(()=>w()),H(()=>E())}}),S=a.onMarkerUpdate$.pipe(Z(m)).subscribe({next:()=>{Y(()=>w()),H(()=>E())}});return()=>{b.unsubscribe(),S.unsubscribe()}}},[a]);const bt=(b,S)=>{if(S===void 0)return;const L=S.timeObservation;b.video.seekToTime(L.start)},wt=(b,S)=>{if(S===void 0)return;const L=S.timeObservation;b.video.seekToTime(L.end)},Et=(b,S)=>{S instanceof F.PeriodMarker&&S.timeObservation.start!==void 0&&(S.timeObservation={...S.timeObservation,start:b.video.getCurrentTime()})},St=(b,S)=>{S instanceof F.PeriodMarker&&S.timeObservation.end!==void 0&&(S.timeObservation={...S.timeObservation,end:b.video.getCurrentTime()})},Tt=(b,S)=>{f.current&&J(f.current),f.current=new le,b.video.pause();const L=b.video.getCurrentFrame(),R=b.video.getFrameRate(),O=L-S*R,X=O>=0?O:0;b.video.seekToFrame(X).pipe(we()).subscribe(()=>{}),b.video.play(),b.video.onVideoTimeChange$.pipe(Z(f.current),Z(m)).subscribe(Ie=>{Ie.frame>=L-1&&(b.video.pause().subscribe(()=>{b.video.seekToFrame(L).pipe(we()).subscribe(()=>{})}),J(f.current))})},yt=(b,S)=>{f.current&&J(f.current),f.current=new le,d.current&&J(d.current),d.current=new le;const L=b.video.getCurrentFrame(),R=b.video.getFrameRate(),O=L+S*R;b.video.play(),b.video.onVideoTimeChange$.pipe(Z(f.current),Z(m)).subscribe(X=>{X.frame>=O-1&&(b.video.pause().subscribe(()=>{b.video.seekToFrame(L).pipe(we()).subscribe(()=>{})}),J(f.current))}),b.video.onEnded$.pipe(Z(d.current),Z(m)).subscribe(X=>{setTimeout(()=>{b.video.seekToFrame(L).pipe(we()).subscribe(()=>{})},1),J(d.current)})},Ge=b=>{a.removeMarker(b.id),(x==null?void 0:x.id)===b.id&&G(void 0)},Ct=(b,S)=>{if(!(S instanceof F.PeriodMarker))return;const L=S.timeObservation.start,R=S.timeObservation.end,O=b.video.getCurrentTime();if(L==null||R==null)return;const X=L,Ie=O,Dn=Ie+1/b.video.getFrameRate(),Fn=R;Ge(S);const Ye=new F.PeriodMarker({style:l.PERIOD_MARKER_STYLE,timeObservation:{start:X,end:Ie},editable:!0});Ye.onClick$.subscribe({next:()=>u(Ye)});const ye=new F.PeriodMarker({style:l.HIGHLIGHTED_PERIOD_MARKER_STYLE,timeObservation:{start:Dn,end:Fn},editable:!0});ye.onClick$.subscribe({next:()=>u(ye)}),a.addMarker(Ye),a.addMarker(ye),u(ye),setTimeout(()=>{M({marker:ye,color:l.PERIOD_MARKER_STYLE.color})},0)},Mt=()=>{const b=e.video.getCurrentTime(),S=new F.PeriodMarker({timeObservation:{start:b},style:l.PERIOD_MARKER_STYLE,editable:!0});S.onClick$.subscribe({next:()=>u(S)}),a.addMarker(S),G(S),Y(w()),u(S)},Lt=()=>{const b=e.video.getCurrentTime();x.timeObservation={...x.timeObservation,end:b},G(void 0)},At=b=>{f.current&&J(f.current),f.current=new le,d.current&&J(d.current),d.current=new le;const S=e.video.calculateTimeToFrame(b.timeObservation.start),L=e.video.calculateTimeToFrame(b.timeObservation.end);e.video.pause(),e.video.seekToFrame(S),e.video.play(),e.video.onVideoTimeChange$.pipe(Z(f.current),Z(m)).subscribe(R=>{R.frame>=L-1&&(e.video.pause().subscribe(()=>{e.video.seekToFrame(S).pipe(we()).subscribe(()=>{})}),J(f.current))}),e.video.onEnded$.pipe(Z(d.current),Z(m)).subscribe(R=>{setTimeout(()=>{e.video.seekToFrame(S).pipe(we()).subscribe(()=>{})},1),J(d.current)})},Rn=()=>{const b=i.length,S=`Segmentation ${i.length+1}`,L=new F.MarkerLane({style:l.TIMELINE_LANE_STYLE,description:S});L.onMarkerUpdate$.subscribe({next:R=>{_e(L,R.marker)&&(R.marker.timeObservation=R.oldValue.timeObservation)}}),e.timeline.addTimelineLaneAtIndex(L,b+1),o([...i,L]),u(void 0),c(L)},xt=b=>{if(!a)return;const S=a.getMarkers().filter(O=>O instanceof F.PeriodMarker).sort((O,X)=>O.timeObservation.start??0-(X.timeObservation.start??0));if(t===void 0){u(S.at(0));return}const R=S.findIndex(O=>O.id===t.id)+(b?-1:1);R>=0&&R<S.length&&u(S.at(R))};return v.useEffect(()=>{if(!r)return;const b=new $i;b.actionLoopActiveMarker=()=>t instanceof F.PeriodMarker&&ke(t)&&At(t),b.actionSetPlayheadToMarkerStart=()=>t&&bt(e,t),b.actionSetPlayheadToMarkerEnd=()=>t&&t instanceof F.PeriodMarker&&ke(t)&&wt(e,t),b.actionSetMarkerStartToPlayhead=()=>!be&&Et(e,t),b.actionSetMarkerEndToPlayhead=()=>!_&&St(e,t),b.actionMarkerSplit=()=>!N&&Ct(e,t),b.actionMarkerDelete=()=>t&&Ge(t),b.actionMarkerInOut=()=>{x===void 0?!ve&&Mt():!ne&&Lt()},b.actionPlay3SecondsAndRewindToCurrent=()=>yt(e,3),b.actionRewind3SecondsAndPlayToCurrent=()=>Tt(e,3),b.actionNextMarkerToggle=()=>xt(!1),b.actionPreviousMarkerToggle=()=>xt(!0);const S=L=>{b.handleKeyboardEvent(L,e)&&(L.stopPropagation(),L.preventDefault())};return window.addEventListener("keydown",S),h.current||(e.video.appendHelpMenuGroup(b.getKeyboardShortcutsHelpMenuGroup()),h.current=!0),()=>window.removeEventListener("keydown",S)}),v.createElement("div",{className:"control-panel-wrapper"},v.createElement("div",{className:"control-panel"},v.createElement(z,{Icon:_i,onClick:()=>bt(e,t),disabled:t===void 0}),v.createElement(z,{Icon:Ni,onClick:()=>wt(e,t),disabled:t===void 0||t instanceof F.PeriodMarker&&!ke(t)}),v.createElement(z,{Icon:ki,onClick:()=>Et(e,t),disabled:be}),v.createElement(z,{Icon:Ri,onClick:()=>St(e,t),disabled:_}),x===void 0?v.createElement(z,{Icon:Di,onClick:Mt,disabled:ve}):v.createElement(z,{Icon:Ki,onClick:Lt,disabled:ne}),v.createElement(z,{Icon:Vi,onClick:()=>Ge(t),disabled:t===void 0}),v.createElement(z,{Icon:Fi,onClick:()=>Ct(e,t),disabled:N||t===void 0}),v.createElement(z,{Icon:Pi,onClick:()=>At(t),disabled:!(t instanceof F.PeriodMarker&&ke(t))}),v.createElement(z,{Icon:Bi,onClick:()=>Tt(e,3)}),v.createElement(z,{Icon:Ui,onClick:()=>yt(e,3)})),v.createElement("div",{className:"control-panel"},v.createElement("div",{className:"segmentation-button-wrapper"},v.createElement(z,{Icon:Hi,text:"NEW SEGMENTATION",onClick:()=>Rn(),disabled:i.length>=3}))))};class ge{static isNullUndefinedOrWhitespace(e){return typeof e===void 0||e==null?!0:`${e}`.replace(/\s/g,"").length<1}static isNonEmpty(e){return!ge.isNullUndefinedOrWhitespace(e)}static endsWith(e,n){return!ge.isNullUndefinedOrWhitespace(e)&&!ge.isNullUndefinedOrWhitespace(n)?e.indexOf(n,e.length-n.length)!==-1:!1}static toMixedCase(e){let n={NBCU:"NBCU",REDBEE:"Red Bee",CMORE:"C More",TV2:"TV2",BBC:"BBC"};return e.replace(/_/g," ").split(" ").map(r=>r in n?n[r]:`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()}`).join(" ")}static replaceWhitespace(e,n){return e&&e.trim().replace(/([\n ]*,[\n ]*|[\n ]+)/g,n).replace(new RegExp(`${n}$`),"")}static whitespacesToCommas(e){return ge.replaceWhitespace(e,",")}static tokenizeWhitespaceSeparated(e){return e?ge.replaceWhitespace(e," ").split(" "):void 0}}class qi{constructor(e=3,n=!1){this.targetDuration=null,this.mediaSequence=null,this.programDateTime=null,this.playlistType=null,this.streams=[],this.media=[],this.segments=[],this.endList=!1,this.version=e,this.independentSegments=n}}class mt{constructor(e,n,r,i,o){this.bandwidth=e,this.averageBandwidth=n,this.resolution=r,this.frameRate=i,this.uri=o}}class Xi{constructor(e,n,r,i,o,s,u){this.type=e,this.groupId=n,this.name=r,this.isDefault=i,this.autoSelect=o,this.channels=s,this.uri=u}}class Wi{constructor(e,n){this.duration=e,this.uri=n}}class Vt{constructor(){this.playlist=new qi}setVersion(e){return this.playlist.version=e,this}setIndependentSegments(e){return this.playlist.independentSegments=e,this}setTargetDuration(e){return this.playlist.targetDuration=e,this}setMediaSequence(e){return this.playlist.mediaSequence=e,this}setProgramDateTime(e){return this.playlist.programDateTime=e,this}setPlaylistType(e){return this.playlist.playlistType=e,this}addStreamInfo(e){return this.playlist.streams.push(e),this}addMedia(e){return this.playlist.media.push(e),this}addSegment(e,n=!1){const r={...e,gap:n};return this.playlist.segments.push(r),this}setEndList(){return this.playlist.endList=!0,this}setStartOffset(e){return this.playlist.startOffset=e,this}build(){return this.playlist}}class Pt{static write(e){let n=`#EXTM3U
|
|
9
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function lt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Xe=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=Te(s),c=u.next();!c.done;c=u.next()){var a=c.value;a.remove(this)}}catch(p){e={error:p}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(K(l))try{l()}catch(p){o=p instanceof ze?p.errors:[p]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=Te(f),m=d.next();!m.done;m=d.next()){var h=m.value;try{Nt(h)}catch(p){o=o??[],p instanceof ze?o=He(He([],Ke(o)),Ke(p.errors)):o.push(p)}}}catch(p){r={error:p}}finally{try{m&&!m.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}if(o)throw new ze(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Nt(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&<(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&<(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),an=Xe.EMPTY;function un(t){return t instanceof Xe||t&&"closed"in t&&K(t.remove)&&K(t.add)&&K(t.unsubscribe)}function Nt(t){K(t)?t():t.unsubscribe()}var Ur={Promise:void 0},Kr={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,He([t,e],Ke(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function cn(t){Kr.setTimeout(function(){throw t})}function ft(){}function Ve(t){t()}var gt=function(t){Ae(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,un(n)&&n.add(r)):r.destination=Zr,r}return e.create=function(n,r,i){return new dt(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Xe),Hr=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){Oe(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Oe(r)}else Oe(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Oe(n)}},t}(),dt=function(t){Ae(e,t);function e(n,r,i){var o=t.call(this)||this,s;return K(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new Hr(s),o}return e}(gt);function Oe(t){cn(t)}function $r(t){throw t}var Zr={closed:!0,next:ft,error:$r,complete:ft},vt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function We(t){return t}function qr(t){return t.length===0?We:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var j=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,o=Wr(e)?e:new dt(e,n,r);return Ve(function(){var s=i,u=s.operator,c=s.source;o.add(u?u.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=kt(n),new n(function(i,o){var s=new dt({next:function(u){try{e(u)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});r.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[vt]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return qr(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=kt(e),new e(function(r,i){var o;n.subscribe(function(s){return o=s},function(s){return i(s)},function(){return r(o)})})},t.create=function(e){return new t(e)},t}();function kt(t){var e;return(e=t??Ur.Promise)!==null&&e!==void 0?e:Promise}function Xr(t){return t&&K(t.next)&&K(t.error)&&K(t.complete)}function Wr(t){return t&&t instanceof gt||Xr(t)&&un(t)}function jr(t){return K(t==null?void 0:t.lift)}function pe(t){return function(e){if(jr(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function ue(t,e,n,r,i){return new Gr(t,e,n,r,i)}var Gr=function(t){Ae(e,t);function e(n,r,i,o,s,u){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=u,c._next=r?function(a){try{r(a)}catch(l){n.error(l)}}:t.prototype._next,c._error=o?function(a){try{o(a)}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(a){n.error(a)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(gt),Yr=pt(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),le=function(t){Ae(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new Rt(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Yr},e.prototype.next=function(n){var r=this;Ve(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=Te(r.currentObservers),u=s.next();!u.done;u=s.next()){var c=u.value;c.next(n)}}catch(a){i={error:a}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;Ve(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;Ve(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?an:(this.currentObservers=null,u.push(n),new Xe(function(){r.currentObservers=null,lt(u,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,s=r.isStopped;i?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new j;return n.source=this,n},e.create=function(n,r){return new Rt(n,r)},e}(j),Rt=function(t){Ae(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:an},e}(le),zr=new j(function(t){return t.complete()});function Jr(t){return t&&K(t.schedule)}function ln(t){return t[t.length-1]}function fn(t){return K(ln(t))?t.pop():void 0}function Qr(t){return Jr(ln(t))?t.pop():void 0}var dn=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function mn(t){return K(t==null?void 0:t.then)}function hn(t){return K(t[vt])}function pn(t){return Symbol.asyncIterator&&K(t==null?void 0:t[Symbol.asyncIterator])}function gn(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ei(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var vn=ei();function bn(t){return K(t==null?void 0:t[vn])}function wn(t){return Pr(this,arguments,function(){var n,r,i,o;return sn(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ee(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,Ee(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ee(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function En(t){return K(t==null?void 0:t.getReader)}function xe(t){if(t instanceof j)return t;if(t!=null){if(hn(t))return ti(t);if(dn(t))return ni(t);if(mn(t))return ri(t);if(pn(t))return Sn(t);if(bn(t))return ii(t);if(En(t))return oi(t)}throw gn(t)}function ti(t){return new j(function(e){var n=t[vt]();if(K(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ni(t){return new j(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function ri(t){return new j(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,cn)})}function ii(t){return new j(function(e){var n,r;try{for(var i=Te(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function Sn(t){return new j(function(e){si(t,e).catch(function(n){return e.error(n)})})}function oi(t){return Sn(wn(t))}function si(t,e){var n,r,i,o;return Vr(this,void 0,void 0,function(){var s,u;return sn(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Br(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function de(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function Tn(t,e){return e===void 0&&(e=0),pe(function(n,r){n.subscribe(ue(r,function(i){return de(r,t,function(){return r.next(i)},e)},function(){return de(r,t,function(){return r.complete()},e)},function(i){return de(r,t,function(){return r.error(i)},e)}))})}function yn(t,e){return e===void 0&&(e=0),pe(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function ai(t,e){return xe(t).pipe(yn(e),Tn(e))}function ui(t,e){return xe(t).pipe(yn(e),Tn(e))}function ci(t,e){return new j(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function li(t,e){return new j(function(n){var r;return de(n,e,function(){r=t[vn](),de(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(u){n.error(u);return}s?n.complete():n.next(o)},0,!0)}),function(){return K(r==null?void 0:r.return)&&r.return()}})}function Cn(t,e){if(!t)throw new Error("Iterable cannot be null");return new j(function(n){de(n,e,function(){var r=t[Symbol.asyncIterator]();de(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function fi(t,e){return Cn(wn(t),e)}function di(t,e){if(t!=null){if(hn(t))return ai(t,e);if(dn(t))return ci(t,e);if(mn(t))return ui(t,e);if(pn(t))return Cn(t,e);if(bn(t))return li(t,e);if(En(t))return fi(t,e)}throw gn(t)}function Mn(t,e){return e?di(t,e):xe(t)}var Ln=pt(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function mi(t,e){return pe(function(n,r){var i=0;n.subscribe(ue(r,function(o){r.next(t.call(e,o,i++))}))})}var hi=Array.isArray;function pi(t,e){return hi(e)?t.apply(void 0,He([],Ke(e))):t(e)}function An(t){return mi(function(e){return pi(t,e)})}var gi=Array.isArray,vi=Object.getPrototypeOf,bi=Object.prototype,wi=Object.keys;function xn(t){if(t.length===1){var e=t[0];if(gi(e))return{args:e,keys:null};if(Ei(e)){var n=wi(e);return{args:n.map(function(r){return e[r]}),keys:n}}}return{args:t,keys:null}}function Ei(t){return t&&typeof t=="object"&&vi(t)===bi}function In(t,e){return t.reduce(function(n,r,i){return n[r]=e[i],n},{})}function Si(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Qr(t),r=fn(t),i=xn(t),o=i.args,s=i.keys;if(o.length===0)return Mn([],n);var u=new j(Ti(o,n,s?function(c){return In(s,c)}:We));return r?u.pipe(An(r)):u}function Ti(t,e,n){return n===void 0&&(n=We),function(r){Dt(e,function(){for(var i=t.length,o=new Array(i),s=i,u=i,c=function(l){Dt(e,function(){var f=Mn(t[l],e),d=!1;f.subscribe(ue(r,function(m){o[l]=m,d||(d=!0,u--),u||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},a=0;a<i;a++)c(a)},r)}}function Dt(t,e,n){t?de(n,t,e):e()}function yi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=fn(t),r=xn(t),i=r.args,o=r.keys,s=new j(function(u){var c=i.length;if(!c){u.complete();return}for(var a=new Array(c),l=c,f=c,d=function(h){var p=!1;xe(i[h]).subscribe(ue(u,function(w){p||(p=!0,f--),a[h]=w},function(){return l--},void 0,function(){(!l||!p)&&(f||u.next(o?In(o,a):a),u.complete())}))},m=0;m<c;m++)d(m)});return n?s.pipe(An(n)):s}function Ci(t,e){return pe(function(n,r){var i=0;n.subscribe(ue(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function Mi(t){return pe(function(e,n){var r=!1;e.subscribe(ue(n,function(i){r=!0,n.next(i)},function(){r||n.next(t),n.complete()}))})}function Li(t){return t<=0?function(){return zr}:pe(function(e,n){var r=0;e.subscribe(ue(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function Ai(t){return t===void 0&&(t=xi),pe(function(e,n){var r=!1;e.subscribe(ue(n,function(i){r=!0,n.next(i)},function(){return r?n.complete():n.error(t())}))})}function xi(){return new Ln}function we(t,e){var n=arguments.length>=2;return function(r){return r.pipe(We,Li(1),n?Mi(e):Ai(function(){return new Ln}))}}function Z(t){return pe(function(e,n){xe(t).subscribe(ue(n,function(){return n.complete()},ft)),!n.closed&&e.subscribe(n)})}class Ii{constructor(){T(this,"actionZoomIn");T(this,"actionZoomOut");T(this,"actionResetZoom");T(this,"actionToggleNextAudioTrack");T(this,"actionTogglePreviousAudioTrack");T(this,"actionToggleCti")}getKeyboardShortcutsHelpMenuGroup(){let e=(...i)=>i.join(" + "),n="shift".toUpperCase();return{name:"Timeline function shortcuts",items:[{description:"Timeline Zoom In",name:e("=")},{description:"Timeline Zoom Out",name:e("-")},{description:"Timeline Zoom level 100%",name:e("0")},{description:"Toggle Next Audio Track",name:e(n,"e")},{description:"Toggle Previous Audio Track",name:e("e")},{description:"Toggle CTI into / out-of Interactive Mode",name:e("'")}]}}handleKeyboardEvent(e){const n=e.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(n.tagName.toUpperCase())?!1:e.code==="Equal"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionZoomIn&&this.actionZoomIn(),!0):e.code==="Minus"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionZoomOut&&this.actionZoomOut(),!0):e.code==="Digit0"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionResetZoom&&this.actionResetZoom(),!0):e.code==="KeyE"&&!e.ctrlKey&&!e.metaKey?(e.shiftKey?this.actionToggleNextAudioTrack&&this.actionToggleNextAudioTrack():this.actionTogglePreviousAudioTrack&&this.actionTogglePreviousAudioTrack(),!0):e.code==="Quote"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionToggleCti&&this.actionToggleCti(),!0):!1}}const Oi=v.memo(({omakasePlayer:t,onTimelineCreatedCallback:e,timelineConfig:n,enableHotKeys:r})=>(v.useEffect(()=>{if(n.timelineHTMLElementId===void 0&&(n.timelineHTMLElementId="omakase-timeline"),t.createTimeline(n).subscribe({next:i=>{Si([t.timeline.onReady$,t.video.onVideoLoaded$.pipe(Ci(o=>!!o))]).subscribe({next:()=>e(i)})}}),r===void 0||r){const i=new Ii;i.actionToggleCti=()=>{var u;return(u=t.timeline)==null?void 0:u.toggleTimecodeEdit()},i.actionResetZoom=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomToEased(100)},i.actionZoomIn=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomInEased()},i.actionZoomOut=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomOutEased()};const o=u=>{const c=t.audio.getAudioTracks(),a=t.audio.getActiveAudioTrack(),f=c.findIndex(d=>d.id===(a==null?void 0:a.id))+(u?-1:1);f>=0&&f<c.length&&t.audio.setActiveAudioTrack(c.at(f).id)};i.actionTogglePreviousAudioTrack=()=>o(!0),i.actionToggleNextAudioTrack=()=>o(!1);const s=u=>{i.handleKeyboardEvent(u)&&(u.preventDefault(),u.stopPropagation())};return window.addEventListener("keydown",s),t.chroming.appendHelpMenuGroup(i.getKeyboardShortcutsHelpMenuGroup()),()=>{window.removeEventListener("keydown",s)}}},[t]),v.createElement("div",{id:n.timelineHTMLElementId})));class On{static get window(){return window}static get navigator(){return window.navigator}static get userAgent(){var n;const e=((n=this.navigator)==null?void 0:n.userAgent)||"";return/Android/i.test(e)?"android":/Firefox/i.test(e)?"firefox":/Edg/i.test(e)?"edge":(/Chrome/i.test(e)||/CriOS/i.test(e))&&!/Edg/i.test(e)?"chrome":/Chrome/i.test(e)||/CriOS/i.test(e)?"chromium":/Safari/i.test(e)?"safari":"unknown"}static get platform(){var n,r,i;const e=((r=(n=this.navigator)==null?void 0:n.userAgentData)==null?void 0:r.platform)||((i=this.navigator)==null?void 0:i.platform);return e!=null&&e.toUpperCase().includes("MAC")?"macos":e!=null&&e.toUpperCase().includes("WIN")?"windows":e!=null&&e.toUpperCase().includes("LINUX")?"linux":"unknown"}static isUserAgent(e){return this.userAgent===e}static isPlatform(e){return this.platform===e}static open(e,n="_blank"){this.window.open(e,n)}}const Ce=[.25,.5,.75,1,2,4,8];class Ft{static getKeyboardShortcutsHelpMenuGroup(){let e=(...o)=>o.join(" + "),n="shift".toUpperCase(),r="ctrl".toUpperCase();return{name:"Playback function shortcuts",items:[{description:"Play / Pause",name:e("Space")},{description:"Toggle Sound",name:e("s")},{description:"Toggle Text On / Off",name:e("d")},{description:"Toggle Full Screen",name:e("f")},{description:"Increase Volume",name:e(n,"\\")},{description:"Reduce Volume",name:e("\\")},{description:"One Frame Forward",name:e("Right Arrow")},{description:"One Frame Backward",name:e("Left Arrow")},{description:"10 Frames Forward",name:e(n,"Right Arrow")},{description:"10 Frames Backwards",name:e(n,"Left Arrow")},{description:"Stop shuttle and pause",name:e("k")},{description:"Decrease Shuttle Forwards",name:e("l")},{description:"Increase Shuttle Forwards",name:e(n,"l")},{description:"Set playhead to Start of Media and Stop",name:e("1 / Home")},{description:"Set playhead to End of Media and Stop",name:e(r,"1")+" / End"}]}}static handleKeyboardEvent(e,n){const r=e.target,i=["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"],o=On.userAgent;if(i.includes(r.tagName.toUpperCase()))return!1;if(n&&n.video){if(e.code==="Space"&&(o!=="safari"||!n.video.isFullscreen()))return n.video.togglePlayPause(),!0;if(e.code==="KeyS"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey)return n.video.toggleMuteUnmute(),!0;if(e.code==="Backslash"){let s=10,u=e.shiftKey?1:-1,c=n.video.getVolume()*100+s*u;c>=100?c=100:c<=0&&(c=0),n.video.setVolume(c/100)}if(e.code==="KeyD"&&!(e.ctrlKey&&e.shiftKey&&e.metaKey))return n.subtitles.toggleShowHideActiveTrack(),!0;if(e.code==="KeyK"&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey&&(n.video.setPlaybackRate(1),n.video.pause()),e.code==="KeyL"&&!e.ctrlKey&&!e.metaKey){let s=e.shiftKey?1:-1;const u=Ce.indexOf(n.video.getPlaybackRate())+s;let c;return u<0?c=Ce.at(0):u>=Ce.length?c=Ce.at(-1):c=Ce.at(u),n.video.setPlaybackRate(c),n.video.isPaused()&&n.video.play(),!0}if(n.video.isVideoLoaded()){if(["ArrowLeft","ArrowRight"].includes(e.key)&&!e.metaKey&&!e.altKey){let s=e.key==="ArrowRight"?1:-1,u=e.shiftKey?10:1;return n.video.isPlaying()&&n.video.pause(),n.video.seekFromCurrentFrame(u*s),!0}if(e.code==="Digit1"&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey||e.code==="Home")return n.video.pause().subscribe(()=>n.video.seekToFrame(0)),!0;if(e.code==="Digit1"&&e.ctrlKey||e.code==="End")return n.video.isPlaying()?n.video.pause().subscribe(()=>n.video.seekToEnd()):n.video.seekToEnd(),!0}if(e.code==="KeyF"&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey)return n.video.toggleFullscreen(),!0}return!1}}const _n=v.memo(function({videoUrl:e,config:n,videoLoadOptions:r,onVideoLoadedCallback:i,enableHotkeys:o}){return n&&(n==null?void 0:n.playerHTMLElementId)===void 0&&(n.playerHTMLElementId="omakase-player"),v.useEffect(()=>{var c,a;let s=new F.OmakasePlayer(n);const u=l=>{Ft.handleKeyboardEvent(l,s)&&(l.stopPropagation(),l.preventDefault())};return(o===void 0||o)&&((c=document.querySelector("media-controller"))==null||c.setAttribute("nohotkeys",""),(a=document.querySelector("media-controller"))==null||a.setAttribute("tabindex","-1"),window.addEventListener("keydown",u),s.chroming.appendHelpMenuGroup(Ft.getKeyboardShortcutsHelpMenuGroup())),s.loadVideo(e,r).subscribe({next:l=>{i&&i(s,l)}}),()=>{(o===void 0||o)&&window.removeEventListener("keydown",u)}},[e]),v.createElement("div",{id:n.playerHTMLElementId})}),_i=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M10.5675 21C10.2375 21 9.9675 20.73 9.9675 20.4V16.7925L5.6325 12.3675L9.9675 8.235V3.6C9.9675 3.27 10.2375 3 10.5675 3C10.8975 3 11.1675 3.27 11.1675 3.6V8.7525L7.3425 12.3975L11.1675 16.305V20.4C11.1675 20.73 10.8975 21 10.5675 21Z",fill:"#CACFEA"}),v.createElement("path",{d:"M17.7675 17.145C17.61 17.145 17.46 17.085 17.34 16.965L12.8325 12.3675L17.355 8.0625C17.595 7.8375 17.9775 7.845 18.2025 8.085C18.4275 8.325 18.42 8.7075 18.18 8.9325L14.5425 12.3975L18.195 16.125C18.4275 16.365 18.42 16.74 18.1875 16.9725C18.075 17.085 17.9175 17.145 17.7675 17.145Z",fill:"#CACFEA"})),Ni=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M13.4325 21C13.7625 21 14.0325 20.73 14.0325 20.4V16.7925L18.3675 12.3675L14.0325 8.235V3.6C14.0325 3.27 13.7625 3 13.4325 3C13.1025 3 12.8325 3.27 12.8325 3.6V8.7525L16.6575 12.3975L12.8325 16.305V20.4C12.8325 20.73 13.1025 21 13.4325 21Z",fill:"#CACFEA"}),v.createElement("path",{d:"M6.2325 17.145C6.39 17.145 6.54 17.085 6.66 16.965L11.1675 12.3675L6.645 8.0625C6.405 7.8375 6.0225 7.845 5.7975 8.085C5.5725 8.325 5.58 8.7075 5.82 8.9325L9.4575 12.3975L5.805 16.125C5.5725 16.365 5.58 16.74 5.8125 16.9725C5.925 17.085 6.0825 17.145 6.2325 17.145Z",fill:"#CACFEA"})),ki=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M14.1675 21C13.8375 21 13.5675 20.73 13.5675 20.4V16.7925L9.2325 12.3675L13.5675 8.235V3.6C13.5675 3.27 13.8375 3 14.1675 3C14.4975 3 14.7675 3.27 14.7675 3.6V8.7525L10.9425 12.3975L14.7675 16.305V20.4C14.7675 20.73 14.4975 21 14.1675 21Z",fill:"#CACFEA"})),Ri=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M9.8325 21C10.1625 21 10.4325 20.73 10.4325 20.4V16.7925L14.7675 12.3675L10.4325 8.235V3.6C10.4325 3.27 10.1625 3 9.8325 3C9.5025 3 9.2325 3.27 9.2325 3.6V8.7525L13.0575 12.3975L9.2325 16.305V20.4C9.2325 20.73 9.5025 21 9.8325 21Z",fill:"#CACFEA"})),Di=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M11.3475 3H5.775V21L11.3475 17.0475V3Z",fill:"#CACFEA"}),v.createElement("path",{d:"M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",fill:"#CACFEA"})),Fi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",fill:"#CACFEA"}),v.createElement("path",{d:"M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",fill:"#CACFEA"})),Vi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M6.39001 3V21L12 17.0175L17.61 21V3H6.38251H6.39001ZM16.44 3.84L7.23001 18.7125V3.84H16.44ZM12 15.9975L8.25751 18.6525L16.77 4.89V19.3725L12 15.9825V15.9975Z",fill:"#CACFEA"})),Pi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M12.3075 8.0175L14.4525 5.8725C14.6175 5.7075 14.6175 5.43 14.4525 5.265L12.3 3.12C12.135 2.955 11.8575 2.955 11.6925 3.12C11.5275 3.285 11.5275 3.5625 11.6925 3.7275L13.1025 5.1375H6.64499C5.22749 5.1375 4.07249 6.2925 4.07249 7.71V16.2825C4.07249 17.7 5.22749 18.855 6.64499 18.855C6.87749 18.855 7.07249 18.66 7.07249 18.4275C7.07249 18.195 6.87749 18 6.64499 18C5.69249 18 4.93499 17.2275 4.93499 16.29V7.7175C4.93499 6.765 5.70749 6.0075 6.64499 6.0075H13.11L11.7 7.4175C11.535 7.5825 11.535 7.86 11.7 8.025C11.865 8.19 12.1425 8.19 12.3075 8.025V8.0175Z",fill:"#CACFEA"}),v.createElement("path",{d:"M17.355 18.8625C18.7725 18.8625 19.9275 17.7075 19.9275 16.29V7.7175C19.9275 6.3 18.7725 5.145 17.355 5.145C17.1225 5.145 16.9275 5.34 16.9275 5.5725C16.9275 5.805 17.1225 6 17.355 6C18.3075 6 19.065 6.7725 19.065 7.71V16.2825C19.065 17.235 18.2925 17.9925 17.355 17.9925H10.89L12.3075 16.5825C12.3825 16.5075 12.435 16.395 12.435 16.2825C12.435 16.17 12.3975 16.0575 12.3075 15.9825C12.15 15.8175 11.8575 15.825 11.7 15.9825L9.52501 18.1575V18.18C9.45751 18.255 9.42751 18.345 9.42751 18.435C9.42751 18.555 9.46501 18.66 9.55501 18.735L11.7 20.88C11.8575 21.045 12.15 21.045 12.3075 20.88C12.4725 20.715 12.4725 20.4375 12.3075 20.2725L10.89 18.8625H17.355Z",fill:"#CACFEA"})),Bi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("g",{clipPath:"url(#clip0_3377_237)"},v.createElement("path",{d:"M13.02 19.95C17.42 19.95 21 16.37 21 11.97C21 7.57 17.42 4 13.02 4C8.88 4 5.39 7.24 5.08 11.37L5.02 12.14L3.56 10.68C3.49 10.61 3.41 10.58 3.33 10.58C3.25 10.58 3.17 10.61 3.1 10.68C3.03 10.75 3 10.83 3 10.92C3 11 3.03 11.08 3.1 11.15L5.22 13.27C5.35 13.4 5.55 13.43 5.65 13.3L7.8 11.15C7.87 11.08 7.9 11 7.9 10.92C7.9 10.84 7.86 10.76 7.8 10.69C7.73 10.62 7.65 10.59 7.57 10.59C7.49 10.59 7.41 10.62 7.34 10.69L5.9 12.13L6.03 11.11C6.45 7.57 9.46 4.91 13.02 4.91C16.91 4.91 20.08 8.08 20.08 11.97C20.08 15.86 16.91 19.03 13.02 19.03C12.77 19.03 12.56 19.24 12.56 19.49C12.56 19.74 12.77 19.95 13.02 19.95Z",fill:"#CACFEA"}),v.createElement("path",{d:"M14.95 13.19C14.95 13.72 14.75 14.14 14.36 14.45C13.97 14.76 13.43 14.91 12.75 14.91C12.16 14.91 11.69 14.81 11.32 14.62V13.53C11.7 13.81 12.14 13.95 12.65 13.95C12.98 13.95 13.23 13.88 13.41 13.74C13.59 13.6 13.67 13.41 13.67 13.17C13.67 12.93 13.56 12.72 13.34 12.58C13.12 12.44 12.82 12.37 12.43 12.37H11.92V11.41H12.39C13.13 11.41 13.5 11.16 13.5 10.67C13.5 10.21 13.22 9.98 12.65 9.98C12.26 9.98 11.89 10.1 11.54 10.35V9.33C11.93 9.13 12.4 9.03 12.94 9.03C13.48 9.03 13.94 9.16 14.28 9.41C14.62 9.66 14.79 10.01 14.79 10.44C14.79 11.19 14.41 11.65 13.66 11.84V11.86C14.06 11.91 14.37 12.05 14.61 12.29C14.85 12.53 14.96 12.83 14.96 13.19H14.95Z",fill:"#CACFEA"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_3377_237"},v.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),Ui=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("g",{clipPath:"url(#clip0_3377_260)"},v.createElement("path",{d:"M10.98 19.95C6.58 19.95 3 16.37 3 11.98C3 7.58 6.58 4 10.98 4C15.12 4 18.61 7.24 18.93 11.37L18.99 12.14L20.45 10.68C20.52 10.61 20.6 10.58 20.68 10.58C20.76 10.58 20.84 10.61 20.91 10.68C20.98 10.75 21.01 10.83 21.01 10.91C21.01 10.99 20.98 11.07 20.91 11.14L18.79 13.26C18.66 13.39 18.46 13.42 18.36 13.29L16.21 11.14C16.14 11.07 16.11 10.99 16.11 10.91C16.11 10.83 16.15 10.75 16.21 10.68C16.28 10.61 16.36 10.58 16.44 10.58C16.52 10.58 16.6 10.61 16.67 10.68L18.11 12.12L17.98 11.1C17.55 7.57 14.54 4.91 10.98 4.91C7.09 4.91 3.92 8.08 3.92 11.97C3.92 15.86 7.09 19.03 10.98 19.03C11.23 19.03 11.44 19.24 11.44 19.49C11.44 19.74 11.23 19.95 10.98 19.95Z",fill:"#CACFEA"}),v.createElement("path",{d:"M12.91 13.19C12.91 13.72 12.71 14.14 12.32 14.45C11.93 14.76 11.39 14.91 10.71 14.91C10.12 14.91 9.65 14.81 9.28 14.62V13.53C9.66 13.81 10.1 13.95 10.61 13.95C10.94 13.95 11.19 13.88 11.37 13.74C11.55 13.6 11.63 13.41 11.63 13.17C11.63 12.93 11.52 12.72 11.3 12.58C11.08 12.44 10.78 12.37 10.39 12.37H9.88V11.41H10.35C11.09 11.41 11.46 11.16 11.46 10.67C11.46 10.21 11.18 9.98 10.61 9.98C10.22 9.98 9.85 10.1 9.5 10.35V9.33C9.89 9.13 10.36 9.03 10.9 9.03C11.44 9.03 11.9 9.16 12.24 9.41C12.58 9.66 12.75 10.01 12.75 10.44C12.75 11.19 12.37 11.65 11.62 11.84V11.86C12.02 11.91 12.33 12.05 12.57 12.29C12.81 12.53 12.92 12.83 12.92 13.19H12.91Z",fill:"#CACFEA"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_3377_260"},v.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),z=({Icon:t,onClick:e,width:n,height:r,text:i,disabled:o})=>v.createElement("button",{disabled:o,onClick:e},v.createElement(t,{width:n,height:r})," ",i),Ki=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z",fill:"#CACFEA"}),v.createElement("path",{d:"M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",fill:"#CACFEA"})),Hi=({width:t,height:e})=>v.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("rect",{x:"0.5",y:"0.5",width:"13",height:"13",rx:"2.5",stroke:"#CACFEA"}),v.createElement("path",{d:"M7.16667 6.33333V6.83333H7.66667H10.3333C10.4257 6.83333 10.5 6.90769 10.5 7C10.5 7.09231 10.4257 7.16667 10.3333 7.16667H7.66667H7.16667V7.66667V10.3333C7.16667 10.4257 7.09231 10.5 7 10.5C6.90769 10.5 6.83333 10.4257 6.83333 10.3333V7.66667V7.16667H6.33333H3.66667C3.57468 7.16667 3.5 7.09199 3.5 7C3.5 6.90801 3.57468 6.83333 3.66667 6.83333H6.33333H6.83333V6.33333V3.66667C6.83333 3.57468 6.90801 3.5 7 3.5C7.09199 3.5 7.16667 3.57468 7.16667 3.66667V6.33333Z",fill:"#CACFEA",stroke:"#CACFEA"}));function J(t){t.next(),t.complete()}class $i{constructor(){T(this,"actionMarkerInOut");T(this,"actionMarkerSplit");T(this,"actionMarkerDelete");T(this,"actionPreviousMarkerToggle");T(this,"actionNextMarkerToggle");T(this,"actionSetMarkerStartToPlayhead");T(this,"actionSetMarkerEndToPlayhead");T(this,"actionSetPlayheadToMarkerStart");T(this,"actionSetPlayheadToMarkerEnd");T(this,"actionRewind3SecondsAndPlayToCurrent");T(this,"actionPlay3SecondsAndRewindToCurrent");T(this,"actionLoopActiveMarker")}getKeyboardShortcutsHelpMenuGroup(){let e=(...s)=>s.join(" + "),n="shift".toUpperCase();const r=On.platform;let i=r==="windows"?"win":r==="linux"?"super":"cmd";return{name:"Segmentation function shortcuts",items:[{description:"Mark In / Out",name:e("m")},{description:"Split Active Marker",name:e(".")},{description:"Delete Active Marker",name:e("n")},{description:"Toggle Previous Marker",name:e("/")},{description:"Toggle Next Marker",name:e(n,"/")},{description:"Set Start of Active Marker to Playhead Position",name:e("i")},{description:"Set End of Active Marker to Playhead Position",name:e("o")},{description:"Set Playhead to Start of Active Marker",name:e("[")},{description:"Set Playhead to End of Active Marker",name:e("]")},{description:"Rewind 3 Seconds and Play to Current Playhead",name:e(i,"Arrow Left")},{description:"Play 3 Seconds and Rewind to Current Playhead",name:e(i,"Arrow Right")},{description:"Loop on Active Marker",name:e("p")}]}}handleKeyboardEvent(e,n){const r=e.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(r.tagName.toUpperCase())?!1:e.code==="KeyM"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerInOut&&this.actionMarkerInOut(),!0):e.code==="Period"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerSplit&&this.actionMarkerSplit(),!0):e.code==="KeyN"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerDelete&&this.actionMarkerDelete(),!0):e.code==="Slash"&&!e.ctrlKey&&!e.metaKey?(e.shiftKey?this.actionNextMarkerToggle&&this.actionNextMarkerToggle():this.actionPreviousMarkerToggle&&this.actionPreviousMarkerToggle(),!0):e.code==="KeyI"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetMarkerStartToPlayhead&&this.actionSetMarkerStartToPlayhead(),!0):e.code==="KeyO"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetMarkerEndToPlayhead&&this.actionSetMarkerEndToPlayhead(),!0):e.code==="BracketLeft"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetPlayheadToMarkerStart&&this.actionSetPlayheadToMarkerStart(),!0):e.code==="BracketRight"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetPlayheadToMarkerEnd&&this.actionSetPlayheadToMarkerEnd(),!0):e.code==="ArrowLeft"&&!e.shiftKey&&!e.ctrlKey&&e.metaKey?(this.actionRewind3SecondsAndPlayToCurrent&&this.actionRewind3SecondsAndPlayToCurrent(),!0):e.code==="ArrowRight"&&!e.shiftKey&&!e.ctrlKey&&e.metaKey?(this.actionPlay3SecondsAndRewindToCurrent&&this.actionPlay3SecondsAndRewindToCurrent(),!0):e.code==="KeyP"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionLoopActiveMarker&&this.actionLoopActiveMarker(),!0):!1}}const _e=(t,e,n)=>t.getMarkers().reduce((r,i)=>{if(e.id===i.id)return r;if(i instanceof F.PeriodMarker&&i.timeObservation.start!=null&&i.timeObservation.end!=null){const o=e.timeObservation,s=i.timeObservation.start,u=i.timeObservation.end,c=o.start,a=n??o.end;if(c!=null&&a!=null)return r||c<=u&&a>=s}return r},!1);function Ne(t,e,n){if(!t||!(t instanceof F.PeriodMarker))return!0;const r=t.timeObservation.start,i=t.timeObservation.end;if(r==null||i==null)return!0;const o=n.video.calculateTimeToFrame(i),s=n.video.calculateTimeToFrame(r),u=n.video.getCurrentFrame();return e<r||o-u<2||u-s<1}function ke(t){return!(t.timeObservation.start==null||t.timeObservation.end==null)}const Zi=({selectedMarker:t,omakasePlayer:e,markerListApi:n,enableHotKeys:r,segmentationLanes:i,setSegmentationLanes:o,setSelectedMarker:s,onMarkerClickCallback:u,setSource:c,source:a,constants:l})=>{const f=v.useRef(void 0),d=v.useRef(void 0),m=new le,h=v.useRef(!1),p=(b,S,L)=>{const R=S??e.video.getCurrentTime();return b.getMarkers().reduce((O,X)=>X instanceof F.PeriodMarker&&X.timeObservation.start!==void 0&&X.timeObservation.end!==void 0&&X.id!==(L==null?void 0:L.id)?O||R>=X.timeObservation.start&&R<=X.timeObservation.end:O,!1)},w=b=>{if(x===void 0)return!0;const S=x.timeObservation.start,L=b??e.video.getCurrentTime();return!!(S==null||S>=L||_e(a,x,L))},E=b=>x!==void 0||a===void 0?!0:p(a,b,x),[I,M]=v.useState(void 0),[N,k]=v.useState(Ne(t,e.video.getCurrentTime(),e)),[x,G]=v.useState(void 0),[ne,Y]=v.useState(w()),[ve,H]=v.useState(E()),oe=b=>{if(b===void 0||a===void 0||!(b instanceof F.PeriodMarker))return!0;const S=_e(a,b,e.video.getCurrentTime());if(S)return S;if(b instanceof F.PeriodMarker){const L=b.timeObservation.end;if(L!=null&&e.video.getCurrentTime()>=L)return!0}return!1},se=b=>{if(b===void 0||a===void 0||!(b instanceof F.PeriodMarker))return!0;const S=_e(a,b,e.video.getCurrentTime());if(S)return S;if(b instanceof F.PeriodMarker){if(b.timeObservation.end==null)return!0;const L=b.timeObservation.start;if(L!=null&&e.video.getCurrentTime()<=L)return!0}return!1},[be,P]=v.useState(oe(t)),[_,je]=v.useState(se(t));v.useEffect(()=>{if(Y(()=>w()),H(()=>E()),x&&x!==t){const b=i.find(S=>S.getMarker(x.id));b==null||b.removeMarker(x.id),G(void 0)}},[t,x,i,G]),v.useEffect(()=>()=>J(m),[]),v.useEffect(()=>{if(P(oe(t)),je(se(t)),t){const b=Ne(t,e.video.getCurrentTime(),e);k(b);const S=e.video.onVideoTimeChange$.pipe(Z(m)).subscribe({next:L=>{k(R=>Ne(t,L.currentTime,e)),P(()=>oe(t)),je(()=>se(t))}});return()=>S.unsubscribe()}},[t]),v.useEffect(()=>{e.video.onSeeking$.pipe(Z(m)).subscribe({next:S=>{Y(()=>w(S.toTime)),H(()=>E(S.toTime))}});const b=e.video.onVideoTimeChange$.pipe(Z(m)).subscribe({next:S=>{Y(()=>w()),H(()=>E())}});return()=>b.unsubscribe()},[x,a]),v.useEffect(()=>{const b=i.map(S=>S.onMarkerUpdate$.pipe(Z(m)).subscribe({next:L=>{(t==null?void 0:t.id)===L.marker.id&&(k(R=>Ne(t,e.video.getCurrentTime(),e)),P(()=>oe(t)),je(()=>se(t)))}}));return()=>b.forEach(S=>S.unsubscribe())},[i,t]),v.useEffect(()=>{I&&(I.marker.style={...I.marker.style,color:I.color},I.marker.timeObservation={...I.marker.timeObservation},M(void 0))},[t]),v.useEffect(()=>{if(a){Y(()=>w()),H(()=>E());const b=a.onMarkerDelete$.pipe(Z(m)).subscribe({next:L=>{const R=L.marker;M(O=>{if((O==null?void 0:O.marker.id)!==R.id)return O}),s(O=>{if((O==null?void 0:O.id)!==R.id)return O}),G(O=>{if((O==null?void 0:O.id)!==R.id)return O}),Y(()=>w()),H(()=>E())}}),S=a.onMarkerUpdate$.pipe(Z(m)).subscribe({next:()=>{Y(()=>w()),H(()=>E())}});return()=>{b.unsubscribe(),S.unsubscribe()}}},[a]);const bt=(b,S)=>{if(S===void 0)return;const L=S.timeObservation;b.video.seekToTime(L.start)},wt=(b,S)=>{if(S===void 0)return;const L=S.timeObservation;b.video.seekToTime(L.end)},Et=(b,S)=>{S instanceof F.PeriodMarker&&S.timeObservation.start!==void 0&&(S.timeObservation={...S.timeObservation,start:b.video.getCurrentTime()})},St=(b,S)=>{S instanceof F.PeriodMarker&&S.timeObservation.end!==void 0&&(S.timeObservation={...S.timeObservation,end:b.video.getCurrentTime()})},Tt=(b,S)=>{f.current&&J(f.current),f.current=new le,b.video.pause();const L=b.video.getCurrentFrame(),R=b.video.getFrameRate(),O=L-S*R,X=O>=0?O:0;b.video.seekToFrame(X).pipe(we()).subscribe(()=>{}),b.video.play(),b.video.onVideoTimeChange$.pipe(Z(f.current),Z(m)).subscribe(Ie=>{Ie.frame>=L-1&&(b.video.pause().subscribe(()=>{b.video.seekToFrame(L).pipe(we()).subscribe(()=>{})}),J(f.current))})},yt=(b,S)=>{f.current&&J(f.current),f.current=new le,d.current&&J(d.current),d.current=new le;const L=b.video.getCurrentFrame(),R=b.video.getFrameRate(),O=L+S*R;b.video.play(),b.video.onVideoTimeChange$.pipe(Z(f.current),Z(m)).subscribe(X=>{X.frame>=O-1&&(b.video.pause().subscribe(()=>{b.video.seekToFrame(L).pipe(we()).subscribe(()=>{})}),J(f.current))}),b.video.onEnded$.pipe(Z(d.current),Z(m)).subscribe(X=>{setTimeout(()=>{b.video.seekToFrame(L).pipe(we()).subscribe(()=>{})},1),J(d.current)})},Ge=b=>{a.removeMarker(b.id),(x==null?void 0:x.id)===b.id&&G(void 0)},Ct=(b,S)=>{if(!(S instanceof F.PeriodMarker))return;const L=S.timeObservation.start,R=S.timeObservation.end,O=b.video.getCurrentTime();if(L==null||R==null)return;const X=L,Ie=O,Dn=Ie+1/b.video.getFrameRate(),Fn=R;Ge(S);const Ye=new F.PeriodMarker({style:l.PERIOD_MARKER_STYLE,timeObservation:{start:X,end:Ie},editable:!0});Ye.onClick$.subscribe({next:()=>u(Ye)});const ye=new F.PeriodMarker({style:l.HIGHLIGHTED_PERIOD_MARKER_STYLE,timeObservation:{start:Dn,end:Fn},editable:!0});ye.onClick$.subscribe({next:()=>u(ye)}),a.addMarker(Ye),a.addMarker(ye),u(ye),setTimeout(()=>{M({marker:ye,color:l.PERIOD_MARKER_STYLE.color})},0)},Mt=()=>{const b=e.video.getCurrentTime(),S=new F.PeriodMarker({timeObservation:{start:b},style:l.PERIOD_MARKER_STYLE,editable:!0});S.onClick$.subscribe({next:()=>u(S)}),a.addMarker(S),G(S),Y(w()),u(S)},Lt=()=>{const b=e.video.getCurrentTime();x.timeObservation={...x.timeObservation,end:b},G(void 0)},At=b=>{f.current&&J(f.current),f.current=new le,d.current&&J(d.current),d.current=new le;const S=e.video.calculateTimeToFrame(b.timeObservation.start),L=e.video.calculateTimeToFrame(b.timeObservation.end);e.video.pause(),e.video.seekToFrame(S),e.video.play(),e.video.onVideoTimeChange$.pipe(Z(f.current),Z(m)).subscribe(R=>{R.frame>=L-1&&(e.video.pause().subscribe(()=>{e.video.seekToFrame(S).pipe(we()).subscribe(()=>{})}),J(f.current))}),e.video.onEnded$.pipe(Z(d.current),Z(m)).subscribe(R=>{setTimeout(()=>{e.video.seekToFrame(S).pipe(we()).subscribe(()=>{})},1),J(d.current)})},Rn=()=>{const b=i.length,S=`Segmentation ${i.length+1}`,L=new F.MarkerLane({style:l.TIMELINE_LANE_STYLE,description:S});L.onMarkerUpdate$.subscribe({next:R=>{_e(L,R.marker)&&(R.marker.timeObservation=R.oldValue.timeObservation)}}),e.timeline.addTimelineLaneAtIndex(L,b+1),o([...i,L]),u(void 0),c(L)},xt=b=>{if(!a)return;const S=a.getMarkers().filter(O=>O instanceof F.PeriodMarker).sort((O,X)=>O.timeObservation.start??0-(X.timeObservation.start??0));if(t===void 0){u(S.at(0));return}const R=S.findIndex(O=>O.id===t.id)+(b?-1:1);R>=0&&R<S.length&&u(S.at(R))};return v.useEffect(()=>{if(!r)return;const b=new $i;b.actionLoopActiveMarker=()=>t instanceof F.PeriodMarker&&ke(t)&&At(t),b.actionSetPlayheadToMarkerStart=()=>t&&bt(e,t),b.actionSetPlayheadToMarkerEnd=()=>t&&t instanceof F.PeriodMarker&&ke(t)&&wt(e,t),b.actionSetMarkerStartToPlayhead=()=>!be&&Et(e,t),b.actionSetMarkerEndToPlayhead=()=>!_&&St(e,t),b.actionMarkerSplit=()=>!N&&Ct(e,t),b.actionMarkerDelete=()=>t&&Ge(t),b.actionMarkerInOut=()=>{x===void 0?!ve&&Mt():!ne&&Lt()},b.actionPlay3SecondsAndRewindToCurrent=()=>yt(e,3),b.actionRewind3SecondsAndPlayToCurrent=()=>Tt(e,3),b.actionNextMarkerToggle=()=>xt(!1),b.actionPreviousMarkerToggle=()=>xt(!0);const S=L=>{b.handleKeyboardEvent(L,e)&&(L.stopPropagation(),L.preventDefault())};return window.addEventListener("keydown",S),h.current||(e.chroming.appendHelpMenuGroup(b.getKeyboardShortcutsHelpMenuGroup()),h.current=!0),()=>window.removeEventListener("keydown",S)}),v.createElement("div",{className:"control-panel-wrapper"},v.createElement("div",{className:"control-panel"},v.createElement(z,{Icon:_i,onClick:()=>bt(e,t),disabled:t===void 0}),v.createElement(z,{Icon:Ni,onClick:()=>wt(e,t),disabled:t===void 0||t instanceof F.PeriodMarker&&!ke(t)}),v.createElement(z,{Icon:ki,onClick:()=>Et(e,t),disabled:be}),v.createElement(z,{Icon:Ri,onClick:()=>St(e,t),disabled:_}),x===void 0?v.createElement(z,{Icon:Di,onClick:Mt,disabled:ve}):v.createElement(z,{Icon:Ki,onClick:Lt,disabled:ne}),v.createElement(z,{Icon:Vi,onClick:()=>Ge(t),disabled:t===void 0}),v.createElement(z,{Icon:Fi,onClick:()=>Ct(e,t),disabled:N||t===void 0}),v.createElement(z,{Icon:Pi,onClick:()=>At(t),disabled:!(t instanceof F.PeriodMarker&&ke(t))}),v.createElement(z,{Icon:Bi,onClick:()=>Tt(e,3)}),v.createElement(z,{Icon:Ui,onClick:()=>yt(e,3)})),v.createElement("div",{className:"control-panel"},v.createElement("div",{className:"segmentation-button-wrapper"},v.createElement(z,{Icon:Hi,text:"NEW SEGMENTATION",onClick:()=>Rn(),disabled:i.length>=3}))))};class ge{static isNullUndefinedOrWhitespace(e){return typeof e===void 0||e==null?!0:`${e}`.replace(/\s/g,"").length<1}static isNonEmpty(e){return!ge.isNullUndefinedOrWhitespace(e)}static endsWith(e,n){return!ge.isNullUndefinedOrWhitespace(e)&&!ge.isNullUndefinedOrWhitespace(n)?e.indexOf(n,e.length-n.length)!==-1:!1}static toMixedCase(e){let n={NBCU:"NBCU",REDBEE:"Red Bee",CMORE:"C More",TV2:"TV2",BBC:"BBC"};return e.replace(/_/g," ").split(" ").map(r=>r in n?n[r]:`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()}`).join(" ")}static replaceWhitespace(e,n){return e&&e.trim().replace(/([\n ]*,[\n ]*|[\n ]+)/g,n).replace(new RegExp(`${n}$`),"")}static whitespacesToCommas(e){return ge.replaceWhitespace(e,",")}static tokenizeWhitespaceSeparated(e){return e?ge.replaceWhitespace(e," ").split(" "):void 0}}class qi{constructor(e=3,n=!1){this.targetDuration=null,this.mediaSequence=null,this.programDateTime=null,this.playlistType=null,this.streams=[],this.media=[],this.segments=[],this.endList=!1,this.version=e,this.independentSegments=n}}class mt{constructor(e,n,r,i,o){this.bandwidth=e,this.averageBandwidth=n,this.resolution=r,this.frameRate=i,this.uri=o}}class Xi{constructor(e,n,r,i,o,s,u){this.type=e,this.groupId=n,this.name=r,this.isDefault=i,this.autoSelect=o,this.channels=s,this.uri=u}}class Wi{constructor(e,n){this.duration=e,this.uri=n}}class Vt{constructor(){this.playlist=new qi}setVersion(e){return this.playlist.version=e,this}setIndependentSegments(e){return this.playlist.independentSegments=e,this}setTargetDuration(e){return this.playlist.targetDuration=e,this}setMediaSequence(e){return this.playlist.mediaSequence=e,this}setProgramDateTime(e){return this.playlist.programDateTime=e,this}setPlaylistType(e){return this.playlist.playlistType=e,this}addStreamInfo(e){return this.playlist.streams.push(e),this}addMedia(e){return this.playlist.media.push(e),this}addSegment(e,n=!1){const r={...e,gap:n};return this.playlist.segments.push(r),this}setEndList(){return this.playlist.endList=!0,this}setStartOffset(e){return this.playlist.startOffset=e,this}build(){return this.playlist}}class Pt{static write(e){let n=`#EXTM3U
|
|
10
10
|
`;return n+=`#EXT-X-VERSION:${e.version}
|
|
11
11
|
`,e.independentSegments&&(n+=`#EXT-X-INDEPENDENT-SEGMENTS
|
|
12
12
|
`),e.targetDuration!==null&&(n+=`#EXT-X-TARGETDURATION:${e.targetDuration}
|
|
@@ -58,7 +58,7 @@ ${i(m)}`)}),f.join(`
|
|
|
58
58
|
`)}function c(l){const f=[];l.identifier&&f.push(l.identifier);const d=a(l.start),m=a(l.end),h=l.styles?`${l.styles}`:"";return f.push(`${d} --> ${m} ${h}`),f.push(l.text),f.join(`
|
|
59
59
|
`)}function a(l){const f=(l%1).toFixed(3);l=Math.round(l-f);const d=Math.floor(l/3600),m=Math.floor((l-d*3600)/60),h=l-d*3600-m*60;return`${`${r(d,2)}:`}${r(m,2)}:${r(h,2)}.${r(f*1e3,3)}`}return tt={hlsSegment:e,hlsSegmentPlaylist:n},tt}var nt,$t;function Qi(){if($t)return nt;$t=1;const t=Nn().parse,e=zi().compile,n=kn().segment,r=Ji();return nt={parse:t,compile:e,segment:n,hls:r},nt}var eo=Qi();async function to(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch: ${t}`);const n=await e.arrayBuffer();return new TextDecoder("utf-8").decode(n)}function Zt(t){t<0&&(t=0);const e=Math.floor(t/3600).toString().padStart(2,"0"),n=Math.floor(t%3600/60).toString().padStart(2,"0"),r=(t%60).toFixed(3).padStart(6,"0");return`${e}:${n}:${r}`}async function no(t,e,n){if(!t.length)throw new Error("No URLs provided");function r(f,d,m){return Math.min(f-d,m)}function i(f,d,m){return f>=d&&f<=m+d}const o=await Promise.all(t.map(to)),s=[];let u;for(const f of o){const d=eo.parse(f,{strict:!1,meta:!0});u||(u=d.meta);let m=d.cues;e!==void 0&&n!==void 0&&(m=d.cues.filter(h=>i(h.end,e,n)));for(const h of m){let p=h.start,w=h.end;e!==void 0&&n!==void 0&&(p=r(h.start,e,n),w=r(h.end,e,n)),s.push({...h,start:p,end:w})}}const c=[];c.push("WEBVTT"),u&&u["X-TIMESTAMP-MAP=LOCAL"]&&c.push(`X-TIMESTAMP-MAP=LOCAL${u["X-TIMESTAMP-MAP=LOCAL"]}`),c.push("");for(const f of s)c.push(`${Zt(f.start)} --> ${Zt(f.end)}`),c.push(f.text),c.push("");const a=c.join(`
|
|
60
60
|
`).trim()+`
|
|
61
|
-
`,l=new Blob([a],{type:"text/vtt"});return URL.createObjectURL(l)}const ro=v.memo(function({flow:e,childFlows:n,flowsSegments:r,onVideoLoadedCallback:i,config:o,timerange:s,videoLoadOptions:u,enableHotkey:c}){const a=v.useMemo(()=>Yi(e,n,r),[e,r,n,s]),l=Dr([e,...n],r),f={protocol:"hls",ffom:l.ffom,frameRate:l.frameRate,dropFrame:l.dropFrame};let d;if(u){if(u.protocol)throw new Error("Tams player can't change media protocol.");d={...f,...u}}else d=f;const m=(h,p)=>{const w=n.filter(kr),E=w.map(()=>new le);w.forEach(async(I,M)=>{const N=await no(r.get(I.id).map(x=>x.get_urls.at(-1).url),l.mediaStartTime,h.video.getDuration()),k=Rr(I);h.subtitles.createVttTrack({src:N,label:k.label,language:k.language,default:k.default,embedded:k.embedded,id:k.id}).subscribe(()=>{k.default?h.subtitles.showTrack(k.id).subscribe(()=>{E.at(M).next(),E.at(M).complete()}):(E.at(M).next(),E.at(M).complete())})}),i&&yi(E).subscribe(()=>{i(h,p,l)})};return v.createElement(_n,{videoUrl:a,videoLoadOptions:d,onVideoLoadedCallback:m,config:o,enableHotkeys:c})});function Re(t){const e=new Date(t*1e3),n=e.getUTCHours();let r=e.getUTCMinutes();return e.getUTCSeconds()>=30&&r++,`${n}h ${r}min`}const io=`
|
|
61
|
+
`,l=new Blob([a],{type:"text/vtt"});return URL.createObjectURL(l)}const ro=v.memo(function({flow:e,childFlows:n,flowsSegments:r,onVideoLoadedCallback:i,config:o,timerange:s,videoLoadOptions:u,enableHotkey:c}){const a=v.useMemo(()=>Yi(e,n,r),[e,r,n,s]),l=Dr([e,...n],r),f={protocol:"hls",ffom:l.ffom,frameRate:l.frameRate,dropFrame:l.dropFrame};let d;if(u){if(u.protocol)throw new Error("Tams player can't change media protocol.");d={...f,...u}}else d=f;const m=(h,p)=>{const w=n.filter(kr),E=w.map(()=>new le);w.forEach(async(I,M)=>{const N=await no(r.get(I.id).map(x=>x.get_urls.at(-1).url),l.mediaStartTime,h.video.getDuration()),k=Rr(I);h.subtitles.createVttTrack({src:N,label:k.label,language:k.language,default:k.default,embedded:k.embedded,id:k.id}).subscribe(()=>{k.default?h.subtitles.showTrack(k.id).subscribe(()=>{E.at(M).next(),E.at(M).complete()}):(E.at(M).next(),E.at(M).complete())})}),i&&(E.length?yi(E).subscribe(()=>{i(h,p,l)}):i(h,p,l))};return v.createElement(_n,{videoUrl:a,videoLoadOptions:d,onVideoLoadedCallback:m,config:o,enableHotkeys:c})});function Re(t){const e=new Date(t*1e3),n=e.getUTCHours();let r=e.getUTCMinutes();return e.getUTCSeconds()>=30&&r++,`${n}h ${r}min`}const io=`
|
|
62
62
|
.omakase-time-range-selector-segments {
|
|
63
63
|
display: flex;
|
|
64
64
|
width: 700px;
|