@byomakase/omakase-react-components 1.0.3 → 1.0.4

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 CHANGED
@@ -1,12 +1,12 @@
1
- "use strict";var bn=Object.defineProperty;var Sn=(t,e,n)=>e in t?bn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var S=(t,e,n)=>Sn(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("@byomakase/omakase-player"),p=require("react");class En{constructor(e){S(this,"_lanes",[]);S(this,"_markersLaneMap",new Map);S(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)}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 D.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 D.ThumbnailLane(n.config),e.addTimelineLane(r));const i=this._laneNodenMap.get(r.id);i==null||i.forEach(o=>{r.addTimelineNode(o.config)})}}var et=function(t,e){return et=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])},et(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");et(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function Tn(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 a(l){try{u(r.next(l))}catch(d){s(d)}}function c(l){try{u(r.throw(l))}catch(d){s(d)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((r=r.apply(t,e||[])).next())})}function Ft(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=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(l){u=[6,l],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[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 Pe(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(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function Ke(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 yn(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),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(h){return function(w){return Promise.resolve(w).then(h,d)}}function a(h,w){r[h]&&(i[h]=function(v){return new Promise(function(L,M){o.push([h,v,L,M])>1||c(h,v)})},w&&(i[h]=w(i[h])))}function c(h,w){try{u(r[h](w))}catch(v){f(o[0][3],v)}}function u(h){h.value instanceof Ee?Promise.resolve(h.value.v).then(l,d):f(o[0][2],h)}function l(h){c("next",h)}function d(h){c("throw",h)}function f(h,w){h(w),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Cn(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(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(u){o({value:u,done:a})},s)}}function P(t){return typeof t=="function"}function ct(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 Je=ct(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
1
+ "use strict";var wn=Object.defineProperty;var Sn=(t,e,n)=>e in t?wn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var S=(t,e,n)=>Sn(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("@byomakase/omakase-player"),p=require("react");class En{constructor(e){S(this,"_lanes",[]);S(this,"_markersLaneMap",new Map);S(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)}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));const i=this._laneNodenMap.get(r.id);i==null||i.forEach(o=>{r.addTimelineNode(o.config)})}}var et=function(t,e){return et=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])},et(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");et(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function Tn(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 a(l){try{c(r.next(l))}catch(d){s(d)}}function u(l){try{c(r.throw(l))}catch(d){s(d)}}function c(l){l.done?o(l.value):i(l.value).then(a,u)}c((r=r.apply(t,e||[])).next())})}function Ft(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=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(l){return u([c,l])}}function u(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(l){c=[6,l],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[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 Pe(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(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function Ke(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 yn(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),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(m){return function(b){return Promise.resolve(b).then(m,d)}}function a(m,b){r[m]&&(i[m]=function(v){return new Promise(function(y,C){o.push([m,v,y,C])>1||u(m,v)})},b&&(i[m]=b(i[m])))}function u(m,b){try{c(r[m](b))}catch(v){f(o[0][3],v)}}function c(m){m.value instanceof Ee?Promise.resolve(m.value.v).then(l,d):f(o[0][2],m)}function l(m){u("next",m)}function d(m){u("throw",m)}function f(m,b){m(b),o.shift(),o.length&&u(o[0][0],o[0][1])}}function Cn(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(a,u){s=t[o](s),i(a,u,s.done,s.value)})}}function i(o,s,a,u){Promise.resolve(u).then(function(c){o({value:c,done:a})},s)}}function P(t){return typeof t=="function"}function ct(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 Je=ct(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
2
2
  `+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=n}});function tt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var qe=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 a=Te(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(v){e={error:v}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(P(l))try{l()}catch(v){o=v instanceof Je?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=Te(d),h=f.next();!h.done;h=f.next()){var w=h.value;try{Ct(w)}catch(v){o=o??[],v instanceof Je?o=Ke(Ke([],Pe(o)),Pe(v.errors)):o.push(v)}}}catch(v){r={error:v}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}if(o)throw new Je(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Ct(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)&&tt(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&tt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Vt=qe.EMPTY;function Bt(t){return t instanceof qe||t&&"closed"in t&&P(t.remove)&&P(t.add)&&P(t.unsubscribe)}function Ct(t){P(t)?t():t.unsubscribe()}var Ln={Promise:void 0},Mn={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Ke([t,e],Pe(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Pt(t){Mn.setTimeout(function(){throw t})}function nt(){}function Fe(t){t()}var lt=function(t){Ae(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Bt(n)&&n.add(r)):r.destination=In,r}return e.create=function(n,r,i){return new rt(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}(qe),An=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}(),rt=function(t){Ae(e,t);function e(n,r,i){var o=t.call(this)||this,s;return P(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new An(s),o}return e}(lt);function Oe(t){Pt(t)}function xn(t){throw t}var In={closed:!0,next:nt,error:xn,complete:nt},dt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function We(t){return t}function On(t){return t.length===0?We:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var $=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=kn(e)?e:new rt(e,n,r);return Fe(function(){var s=i,a=s.operator,c=s.source;o.add(a?a.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=Lt(n),new n(function(i,o){var s=new rt({next:function(a){try{e(a)}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[dt]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return On(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Lt(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 Lt(t){var e;return(e=t??Ln.Promise)!==null&&e!==void 0?e:Promise}function _n(t){return t&&P(t.next)&&P(t.error)&&P(t.complete)}function kn(t){return t&&t instanceof lt||_n(t)&&Bt(t)}function Nn(t){return P(t==null?void 0:t.lift)}function de(t){return function(e){if(Nn(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 fe(t,e,n,r,i){return new Rn(t,e,n,r,i)}var Rn=function(t){Ae(e,t);function e(n,r,i,o,s,a){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=r?function(u){try{r(u)}catch(l){n.error(l)}}:t.prototype._next,c._error=o?function(u){try{o(u)}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(u){n.error(u)}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}(lt),Dn=ct(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),pe=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 Mt(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Dn},e.prototype.next=function(n){var r=this;Fe(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=Te(r.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(n)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;Fe(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;Fe(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,a=i.observers;return o||s?Vt:(this.currentObservers=null,a.push(n),new qe(function(){r.currentObservers=null,tt(a,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 $;return n.source=this,n},e.create=function(n,r){return new Mt(n,r)},e}($),Mt=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:Vt},e}(pe),Fn=new $(function(t){return t.complete()});function Vn(t){return t&&P(t.schedule)}function Kt(t){return t[t.length-1]}function Bn(t){return P(Kt(t))?t.pop():void 0}function Pn(t){return Vn(Kt(t))?t.pop():void 0}var Ut=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Ht(t){return P(t==null?void 0:t.then)}function Zt(t){return P(t[dt])}function qt(t){return Symbol.asyncIterator&&P(t==null?void 0:t[Symbol.asyncIterator])}function Wt(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 Kn(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Xt=Kn();function Gt(t){return P(t==null?void 0:t[Xt])}function jt(t){return yn(this,arguments,function(){var n,r,i,o;return Ft(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 $t(t){return P(t==null?void 0:t.getReader)}function Xe(t){if(t instanceof $)return t;if(t!=null){if(Zt(t))return Un(t);if(Ut(t))return Hn(t);if(Ht(t))return Zn(t);if(qt(t))return zt(t);if(Gt(t))return qn(t);if($t(t))return Wn(t)}throw Wt(t)}function Un(t){return new $(function(e){var n=t[dt]();if(P(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Hn(t){return new $(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Zn(t){return new $(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,Pt)})}function qn(t){return new $(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(a){n={error:a}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function zt(t){return new $(function(e){Xn(t,e).catch(function(n){return e.error(n)})})}function Wn(t){return zt(jt(t))}function Xn(t,e){var n,r,i,o;return Tn(this,void 0,void 0,function(){var s,a;return Ft(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Cn(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 a=c.sent(),i={error:a},[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 ce(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 Yt(t,e){return e===void 0&&(e=0),de(function(n,r){n.subscribe(fe(r,function(i){return ce(r,t,function(){return r.next(i)},e)},function(){return ce(r,t,function(){return r.complete()},e)},function(i){return ce(r,t,function(){return r.error(i)},e)}))})}function Qt(t,e){return e===void 0&&(e=0),de(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function Gn(t,e){return Xe(t).pipe(Qt(e),Yt(e))}function jn(t,e){return Xe(t).pipe(Qt(e),Yt(e))}function $n(t,e){return new $(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function zn(t,e){return new $(function(n){var r;return ce(n,e,function(){r=t[Xt](),ce(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(a){n.error(a);return}s?n.complete():n.next(o)},0,!0)}),function(){return P(r==null?void 0:r.return)&&r.return()}})}function Jt(t,e){if(!t)throw new Error("Iterable cannot be null");return new $(function(n){ce(n,e,function(){var r=t[Symbol.asyncIterator]();ce(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function Yn(t,e){return Jt(jt(t),e)}function Qn(t,e){if(t!=null){if(Zt(t))return Gn(t,e);if(Ut(t))return $n(t,e);if(Ht(t))return jn(t,e);if(qt(t))return Jt(t,e);if(Gt(t))return zn(t,e);if($t(t))return Yn(t,e)}throw Wt(t)}function en(t,e){return e?Qn(t,e):Xe(t)}var tn=ct(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function Jn(t,e){return de(function(n,r){var i=0;n.subscribe(fe(r,function(o){r.next(t.call(e,o,i++))}))})}var er=Array.isArray;function tr(t,e){return er(e)?t.apply(void 0,Ke([],Pe(e))):t(e)}function nr(t){return Jn(function(e){return tr(t,e)})}var rr=Array.isArray,ir=Object.getPrototypeOf,or=Object.prototype,sr=Object.keys;function ar(t){if(t.length===1){var e=t[0];if(rr(e))return{args:e,keys:null};if(ur(e)){var n=sr(e);return{args:n.map(function(r){return e[r]}),keys:n}}}return{args:t,keys:null}}function ur(t){return t&&typeof t=="object"&&ir(t)===or}function cr(t,e){return t.reduce(function(n,r,i){return n[r]=e[i],n},{})}function lr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Pn(t),r=Bn(t),i=ar(t),o=i.args,s=i.keys;if(o.length===0)return en([],n);var a=new $(dr(o,n,s?function(c){return cr(s,c)}:We));return r?a.pipe(nr(r)):a}function dr(t,e,n){return n===void 0&&(n=We),function(r){At(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,c=function(l){At(e,function(){var d=en(t[l],e),f=!1;d.subscribe(fe(r,function(h){o[l]=h,f||(f=!0,a--),a||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},u=0;u<i;u++)c(u)},r)}}function At(t,e,n){t?ce(n,t,e):e()}function fr(t,e){return de(function(n,r){var i=0;n.subscribe(fe(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function hr(t){return de(function(e,n){var r=!1;e.subscribe(fe(n,function(i){r=!0,n.next(i)},function(){r||n.next(t),n.complete()}))})}function mr(t){return t<=0?function(){return Fn}:de(function(e,n){var r=0;e.subscribe(fe(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function pr(t){return t===void 0&&(t=gr),de(function(e,n){var r=!1;e.subscribe(fe(n,function(i){r=!0,n.next(i)},function(){return r?n.complete():n.error(t())}))})}function gr(){return new tn}function be(t,e){var n=arguments.length>=2;return function(r){return r.pipe(We,mr(1),n?hr(e):pr(function(){return new tn}))}}function q(t){return de(function(e,n){Xe(t).subscribe(fe(n,function(){return n.complete()},nt)),!n.closed&&e.subscribe(n)})}class vr{constructor(){S(this,"actionZoomIn");S(this,"actionZoomOut");S(this,"actionResetZoom");S(this,"actionToggleNextAudioTrack");S(this,"actionTogglePreviousAudioTrack");S(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 wr=p.memo(({omakasePlayer:t,onTimelineCreatedCallback:e,timelineConfig:n,enableHotKeys:r})=>(p.useEffect(()=>{if(n.timelineHTMLElementId===void 0&&(n.timelineHTMLElementId="omakase-timeline"),t.createTimeline(n).subscribe({next:i=>{lr([t.timeline.onReady$,t.video.onVideoLoaded$.pipe(fr(o=>!!o))]).subscribe({next:()=>e(i)})}}),r===void 0||r){const i=new vr;i.actionToggleCti=()=>{var a;return(a=t.timeline)==null?void 0:a.toggleTimecodeEdit()},i.actionResetZoom=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomToEased(100)},i.actionZoomIn=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomInEased()},i.actionZoomOut=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomOutEased()};const o=a=>{const c=t.audio.getAudioTracks(),u=t.audio.getActiveAudioTrack(),d=c.findIndex(f=>f.id===(u==null?void 0:u.id))+(a?-1:1);d>=0&&d<c.length&&t.audio.setActiveAudioTrack(c.at(d).id)};i.actionTogglePreviousAudioTrack=()=>o(!0),i.actionToggleNextAudioTrack=()=>o(!1);const s=a=>{i.handleKeyboardEvent(a)&&(a.preventDefault(),a.stopPropagation())};return window.addEventListener("keydown",s),t.video.appendHelpMenuGroup(i.getKeyboardShortcutsHelpMenuGroup()),()=>{window.removeEventListener("keydown",s)}}},[t]),p.createElement("div",{id:n.timelineHTMLElementId})));class nn{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 Le=[.25,.5,.75,1,2,4,8];class xt{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=nn.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,a=e.shiftKey?1:-1,c=n.video.getVolume()*100+s*a;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 a=Le.indexOf(n.video.getPlaybackRate())+s;let c;return a<0?c=Le.at(0):a>=Le.length?c=Le.at(-1):c=Le.at(a),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,a=e.shiftKey?10:1;return n.video.isPlaying()&&n.video.pause(),n.video.seekFromCurrentFrame(a*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 rn=p.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"),p.useEffect(()=>{var c,u;let s=new D.OmakasePlayer(n);const a=l=>{xt.handleKeyboardEvent(l,s)&&(l.stopPropagation(),l.preventDefault())};return(o===void 0||o)&&((c=document.querySelector("media-controller"))==null||c.setAttribute("nohotkeys",""),(u=document.querySelector("media-controller"))==null||u.setAttribute("tabindex","-1"),window.addEventListener("keydown",a),s.video.appendHelpMenuGroup(xt.getKeyboardShortcutsHelpMenuGroup())),s.loadVideo(e,r).subscribe({next:l=>{i&&i(s,l)}}),()=>{(o===void 0||o)&&window.removeEventListener("keydown",a)}},[e]),p.createElement("div",{id:n.playerHTMLElementId})}),br=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),Sr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),Er=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),Tr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),yr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M11.3475 3H5.775V21L11.3475 17.0475V3Z",fill:"#CACFEA"}),p.createElement("path",{d:"M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",fill:"#CACFEA"})),Cr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",fill:"#CACFEA"}),p.createElement("path",{d:"M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",fill:"#CACFEA"})),Lr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),Mr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),Ar=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("g",{clipPath:"url(#clip0_3377_237)"},p.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"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_3377_237"},p.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),xr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("g",{clipPath:"url(#clip0_3377_260)"},p.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"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_3377_260"},p.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})=>p.createElement("button",{disabled:o,onClick:e},p.createElement(t,{width:n,height:r})," ",i),Ir=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z",fill:"#CACFEA"}),p.createElement("path",{d:"M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",fill:"#CACFEA"})),Or=({width:t,height:e})=>p.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("rect",{x:"0.5",y:"0.5",width:"13",height:"13",rx:"2.5",stroke:"#CACFEA"}),p.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 Y(t){t.next(),t.complete()}class _r{constructor(){S(this,"actionMarkerInOut");S(this,"actionMarkerSplit");S(this,"actionMarkerDelete");S(this,"actionPreviousMarkerToggle");S(this,"actionNextMarkerToggle");S(this,"actionSetMarkerStartToPlayhead");S(this,"actionSetMarkerEndToPlayhead");S(this,"actionSetPlayheadToMarkerStart");S(this,"actionSetPlayheadToMarkerEnd");S(this,"actionRewind3SecondsAndPlayToCurrent");S(this,"actionPlay3SecondsAndRewindToCurrent");S(this,"actionLoopActiveMarker")}getKeyboardShortcutsHelpMenuGroup(){let e=(...s)=>s.join(" + "),n="shift".toUpperCase();const r=nn.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 D.PeriodMarker&&i.timeObservation.start!=null&&i.timeObservation.end!=null){const o=e.timeObservation,s=i.timeObservation.start,a=i.timeObservation.end,c=o.start,u=n??o.end;if(c!=null&&u!=null)return r||c<=a&&u>=s}return r},!1);function ke(t,e,n){if(!t||!(t instanceof D.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),a=n.video.getCurrentFrame();return e<r||o-a<2||a-s<1}function Ne(t){return!(t.timeObservation.start==null||t.timeObservation.end==null)}const kr=({selectedMarker:t,omakasePlayer:e,markerListApi:n,enableHotKeys:r,segmentationLanes:i,setSegmentationLanes:o,setSelectedMarker:s,onMarkerClickCallback:a,setSource:c,source:u,constants:l})=>{const d=p.useRef(void 0),f=p.useRef(void 0),h=new pe,w=p.useRef(!1),v=(g,b,y)=>{const _=b??e.video.getCurrentTime();return g.getMarkers().reduce((I,X)=>X instanceof D.PeriodMarker&&X.timeObservation.start!==void 0&&X.timeObservation.end!==void 0&&X.id!==(y==null?void 0:y.id)?I||_>=X.timeObservation.start&&_<=X.timeObservation.end:I,!1)},L=g=>{if(x===void 0)return!0;const b=x.timeObservation.start,y=g??e.video.getCurrentTime();return!!(b==null||b>=y||_e(u,x,y))},M=g=>x!==void 0||u===void 0?!0:v(u,g,x),[F,A]=p.useState(void 0),[N,H]=p.useState(ke(t,e.video.getCurrentTime(),e)),[x,ee]=p.useState(void 0),[me,j]=p.useState(L()),[ve,K]=p.useState(M()),re=g=>{if(g===void 0||u===void 0||!(g instanceof D.PeriodMarker))return!0;const b=_e(u,g,e.video.getCurrentTime());if(b)return b;if(g instanceof D.PeriodMarker){const y=g.timeObservation.end;if(y!=null&&e.video.getCurrentTime()>=y)return!0}return!1},ie=g=>{if(g===void 0||u===void 0||!(g instanceof D.PeriodMarker))return!0;const b=_e(u,g,e.video.getCurrentTime());if(b)return b;if(g instanceof D.PeriodMarker){if(g.timeObservation.end==null)return!0;const y=g.timeObservation.start;if(y!=null&&e.video.getCurrentTime()<=y)return!0}return!1},[we,V]=p.useState(re(t)),[O,ze]=p.useState(ie(t));p.useEffect(()=>{if(j(()=>L()),K(()=>M()),x&&x!==t){const g=i.find(b=>b.getMarker(x.id));g==null||g.removeMarker(x.id),ee(void 0)}},[t,x,i,ee]),p.useEffect(()=>()=>Y(h),[]),p.useEffect(()=>{if(V(re(t)),ze(ie(t)),t){const g=ke(t,e.video.getCurrentTime(),e);H(g);const b=e.video.onVideoTimeChange$.pipe(q(h)).subscribe({next:y=>{H(_=>ke(t,y.currentTime,e)),V(()=>re(t)),ze(()=>ie(t))}});return()=>b.unsubscribe()}},[t]),p.useEffect(()=>{e.video.onSeeking$.pipe(q(h)).subscribe({next:b=>{j(()=>L(b.toTime)),K(()=>M(b.toTime))}});const g=e.video.onVideoTimeChange$.pipe(q(h)).subscribe({next:b=>{j(()=>L()),K(()=>M())}});return()=>g.unsubscribe()},[x,u]),p.useEffect(()=>{const g=i.map(b=>b.onMarkerUpdate$.pipe(q(h)).subscribe({next:y=>{(t==null?void 0:t.id)===y.marker.id&&(H(_=>ke(t,e.video.getCurrentTime(),e)),V(()=>re(t)),ze(()=>ie(t)))}}));return()=>g.forEach(b=>b.unsubscribe())},[i,t]),p.useEffect(()=>{F&&(F.marker.style={...F.marker.style,color:F.color},F.marker.timeObservation={...F.marker.timeObservation},A(void 0))},[t]),p.useEffect(()=>{if(u){j(()=>L()),K(()=>M());const g=u.onMarkerDelete$.pipe(q(h)).subscribe({next:y=>{const _=y.marker;A(I=>{if((I==null?void 0:I.marker.id)!==_.id)return I}),s(I=>{if((I==null?void 0:I.id)!==_.id)return I}),ee(I=>{if((I==null?void 0:I.id)!==_.id)return I}),j(()=>L()),K(()=>M())}}),b=u.onMarkerUpdate$.pipe(q(h)).subscribe({next:()=>{j(()=>L()),K(()=>M())}});return()=>{g.unsubscribe(),b.unsubscribe()}}},[u]);const ht=(g,b)=>{if(b===void 0)return;const y=b.timeObservation;g.video.seekToTime(y.start)},mt=(g,b)=>{if(b===void 0)return;const y=b.timeObservation;g.video.seekToTime(y.end)},pt=(g,b)=>{b instanceof D.PeriodMarker&&b.timeObservation.start!==void 0&&(b.timeObservation={...b.timeObservation,start:g.video.getCurrentTime()})},gt=(g,b)=>{b instanceof D.PeriodMarker&&b.timeObservation.end!==void 0&&(b.timeObservation={...b.timeObservation,end:g.video.getCurrentTime()})},vt=(g,b)=>{d.current&&Y(d.current),d.current=new pe,g.video.pause();const y=g.video.getCurrentFrame(),_=g.video.getFrameRate(),I=y-b*_,X=I>=0?I:0;g.video.seekToFrame(X).pipe(be()).subscribe(()=>{}),g.video.play(),g.video.onVideoTimeChange$.pipe(q(d.current),q(h)).subscribe(Ie=>{Ie.frame>=y-1&&(g.video.pause().subscribe(()=>{g.video.seekToFrame(y).pipe(be()).subscribe(()=>{})}),Y(d.current))})},wt=(g,b)=>{d.current&&Y(d.current),d.current=new pe,f.current&&Y(f.current),f.current=new pe;const y=g.video.getCurrentFrame(),_=g.video.getFrameRate(),I=y+b*_;g.video.play(),g.video.onVideoTimeChange$.pipe(q(d.current),q(h)).subscribe(X=>{X.frame>=I-1&&(g.video.pause().subscribe(()=>{g.video.seekToFrame(y).pipe(be()).subscribe(()=>{})}),Y(d.current))}),g.video.onEnded$.pipe(q(f.current),q(h)).subscribe(X=>{setTimeout(()=>{g.video.seekToFrame(y).pipe(be()).subscribe(()=>{})},1),Y(f.current)})},Ye=g=>{u.removeMarker(g.id),(x==null?void 0:x.id)===g.id&&ee(void 0)},bt=(g,b)=>{if(!(b instanceof D.PeriodMarker))return;const y=b.timeObservation.start,_=b.timeObservation.end,I=g.video.getCurrentTime();if(y==null||_==null)return;const X=y,Ie=I,vn=Ie+1/g.video.getFrameRate(),wn=_;Ye(b);const Qe=new D.PeriodMarker({style:l.PERIOD_MARKER_STYLE,timeObservation:{start:X,end:Ie},editable:!0});Qe.onClick$.subscribe({next:()=>a(Qe)});const Ce=new D.PeriodMarker({style:l.HIGHLIGHTED_PERIOD_MARKER_STYLE,timeObservation:{start:vn,end:wn},editable:!0});Ce.onClick$.subscribe({next:()=>a(Ce)}),u.addMarker(Qe),u.addMarker(Ce),a(Ce),setTimeout(()=>{A({marker:Ce,color:l.PERIOD_MARKER_STYLE.color})},0)},St=()=>{const g=e.video.getCurrentTime(),b=new D.PeriodMarker({timeObservation:{start:g},style:l.PERIOD_MARKER_STYLE,editable:!0});b.onClick$.subscribe({next:()=>a(b)}),u.addMarker(b),ee(b),j(L()),a(b)},Et=()=>{const g=e.video.getCurrentTime();x.timeObservation={...x.timeObservation,end:g},ee(void 0)},Tt=g=>{d.current&&Y(d.current),d.current=new pe,f.current&&Y(f.current),f.current=new pe;const b=e.video.calculateTimeToFrame(g.timeObservation.start),y=e.video.calculateTimeToFrame(g.timeObservation.end);e.video.pause(),e.video.seekToFrame(b),e.video.play(),e.video.onVideoTimeChange$.pipe(q(d.current),q(h)).subscribe(_=>{_.frame>=y-1&&(e.video.pause().subscribe(()=>{e.video.seekToFrame(b).pipe(be()).subscribe(()=>{})}),Y(d.current))}),e.video.onEnded$.pipe(q(f.current),q(h)).subscribe(_=>{setTimeout(()=>{e.video.seekToFrame(b).pipe(be()).subscribe(()=>{})},1),Y(f.current)})},gn=()=>{const g=i.length,b=`Segmentation ${i.length+1}`,y=new D.MarkerLane({style:l.TIMELINE_LANE_STYLE,description:b});y.onMarkerUpdate$.subscribe({next:_=>{_e(y,_.marker)&&(_.marker.timeObservation=_.oldValue.timeObservation)}}),e.timeline.addTimelineLaneAtIndex(y,g+1),o([...i,y]),a(void 0),c(y)},yt=g=>{if(!u)return;const b=u.getMarkers().filter(I=>I instanceof D.PeriodMarker).sort((I,X)=>I.timeObservation.start??0-(X.timeObservation.start??0));if(t===void 0){a(b.at(0));return}const _=b.findIndex(I=>I.id===t.id)+(g?-1:1);_>=0&&_<b.length&&a(b.at(_))};return p.useEffect(()=>{if(!r)return;const g=new _r;g.actionLoopActiveMarker=()=>t instanceof D.PeriodMarker&&Ne(t)&&Tt(t),g.actionSetPlayheadToMarkerStart=()=>t&&ht(e,t),g.actionSetPlayheadToMarkerEnd=()=>t&&t instanceof D.PeriodMarker&&Ne(t)&&mt(e,t),g.actionSetMarkerStartToPlayhead=()=>!we&&pt(e,t),g.actionSetMarkerEndToPlayhead=()=>!O&&gt(e,t),g.actionMarkerSplit=()=>!N&&bt(e,t),g.actionMarkerDelete=()=>t&&Ye(t),g.actionMarkerInOut=()=>{x===void 0?!ve&&St():!me&&Et()},g.actionPlay3SecondsAndRewindToCurrent=()=>wt(e,3),g.actionRewind3SecondsAndPlayToCurrent=()=>vt(e,3),g.actionNextMarkerToggle=()=>yt(!1),g.actionPreviousMarkerToggle=()=>yt(!0);const b=y=>{g.handleKeyboardEvent(y,e)&&(y.stopPropagation(),y.preventDefault())};return window.addEventListener("keydown",b),w.current||(e.video.appendHelpMenuGroup(g.getKeyboardShortcutsHelpMenuGroup()),w.current=!0),()=>window.removeEventListener("keydown",b)}),p.createElement("div",{className:"control-panel-wrapper"},p.createElement("div",{className:"control-panel"},p.createElement(z,{Icon:br,onClick:()=>ht(e,t),disabled:t===void 0}),p.createElement(z,{Icon:Sr,onClick:()=>mt(e,t),disabled:t===void 0||t instanceof D.PeriodMarker&&!Ne(t)}),p.createElement(z,{Icon:Er,onClick:()=>pt(e,t),disabled:we}),p.createElement(z,{Icon:Tr,onClick:()=>gt(e,t),disabled:O}),x===void 0?p.createElement(z,{Icon:yr,onClick:St,disabled:ve}):p.createElement(z,{Icon:Ir,onClick:Et,disabled:me}),p.createElement(z,{Icon:Lr,onClick:()=>Ye(t),disabled:t===void 0}),p.createElement(z,{Icon:Cr,onClick:()=>bt(e,t),disabled:N||t===void 0}),p.createElement(z,{Icon:Mr,onClick:()=>Tt(t),disabled:!(t instanceof D.PeriodMarker&&Ne(t))}),p.createElement(z,{Icon:Ar,onClick:()=>vt(e,3)}),p.createElement(z,{Icon:xr,onClick:()=>wt(e,3)})),p.createElement("div",{className:"control-panel"},p.createElement("div",{className:"segmentation-button-wrapper"},p.createElement(z,{Icon:Or,text:"NEW SEGMENTATION",onClick:()=>gn(),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}}/*!
3
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function tt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var qe=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 a=Te(s),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this)}}catch(v){e={error:v}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(P(l))try{l()}catch(v){o=v instanceof Je?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=Te(d),m=f.next();!m.done;m=f.next()){var b=m.value;try{Ct(b)}catch(v){o=o??[],v instanceof Je?o=Ke(Ke([],Pe(o)),Pe(v.errors)):o.push(v)}}}catch(v){r={error:v}}finally{try{m&&!m.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}if(o)throw new Je(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Ct(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)&&tt(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&tt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Vt=qe.EMPTY;function Bt(t){return t instanceof qe||t&&"closed"in t&&P(t.remove)&&P(t.add)&&P(t.unsubscribe)}function Ct(t){P(t)?t():t.unsubscribe()}var Ln={Promise:void 0},Mn={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Ke([t,e],Pe(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Pt(t){Mn.setTimeout(function(){throw t})}function nt(){}function Fe(t){t()}var lt=function(t){Ae(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Bt(n)&&n.add(r)):r.destination=In,r}return e.create=function(n,r,i){return new rt(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}(qe),An=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}(),rt=function(t){Ae(e,t);function e(n,r,i){var o=t.call(this)||this,s;return P(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new An(s),o}return e}(lt);function Oe(t){Pt(t)}function xn(t){throw t}var In={closed:!0,next:nt,error:xn,complete:nt},dt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function We(t){return t}function On(t){return t.length===0?We:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var $=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=kn(e)?e:new rt(e,n,r);return Fe(function(){var s=i,a=s.operator,u=s.source;o.add(a?a.call(o,u):u?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=Lt(n),new n(function(i,o){var s=new rt({next:function(a){try{e(a)}catch(u){o(u),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[dt]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return On(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Lt(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 Lt(t){var e;return(e=t??Ln.Promise)!==null&&e!==void 0?e:Promise}function _n(t){return t&&P(t.next)&&P(t.error)&&P(t.complete)}function kn(t){return t&&t instanceof lt||_n(t)&&Bt(t)}function Nn(t){return P(t==null?void 0:t.lift)}function de(t){return function(e){if(Nn(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 fe(t,e,n,r,i){return new Rn(t,e,n,r,i)}var Rn=function(t){Ae(e,t);function e(n,r,i,o,s,a){var u=t.call(this,n)||this;return u.onFinalize=s,u.shouldUnsubscribe=a,u._next=r?function(c){try{r(c)}catch(l){n.error(l)}}:t.prototype._next,u._error=o?function(c){try{o(c)}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._error,u._complete=i?function(){try{i()}catch(c){n.error(c)}finally{this.unsubscribe()}}:t.prototype._complete,u}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}(lt),Dn=ct(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),pe=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 Mt(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Dn},e.prototype.next=function(n){var r=this;Fe(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=Te(r.currentObservers),a=s.next();!a.done;a=s.next()){var u=a.value;u.next(n)}}catch(c){i={error:c}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;Fe(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;Fe(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,a=i.observers;return o||s?Vt:(this.currentObservers=null,a.push(n),new qe(function(){r.currentObservers=null,tt(a,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 $;return n.source=this,n},e.create=function(n,r){return new Mt(n,r)},e}($),Mt=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:Vt},e}(pe),Fn=new $(function(t){return t.complete()});function Vn(t){return t&&P(t.schedule)}function Kt(t){return t[t.length-1]}function Bn(t){return P(Kt(t))?t.pop():void 0}function Pn(t){return Vn(Kt(t))?t.pop():void 0}var Ut=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Ht(t){return P(t==null?void 0:t.then)}function Zt(t){return P(t[dt])}function qt(t){return Symbol.asyncIterator&&P(t==null?void 0:t[Symbol.asyncIterator])}function Wt(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 Kn(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Xt=Kn();function Gt(t){return P(t==null?void 0:t[Xt])}function jt(t){return yn(this,arguments,function(){var n,r,i,o;return Ft(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 $t(t){return P(t==null?void 0:t.getReader)}function Xe(t){if(t instanceof $)return t;if(t!=null){if(Zt(t))return Un(t);if(Ut(t))return Hn(t);if(Ht(t))return Zn(t);if(qt(t))return zt(t);if(Gt(t))return qn(t);if($t(t))return Wn(t)}throw Wt(t)}function Un(t){return new $(function(e){var n=t[dt]();if(P(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Hn(t){return new $(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Zn(t){return new $(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,Pt)})}function qn(t){return new $(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(a){n={error:a}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function zt(t){return new $(function(e){Xn(t,e).catch(function(n){return e.error(n)})})}function Wn(t){return zt(jt(t))}function Xn(t,e){var n,r,i,o;return Tn(this,void 0,void 0,function(){var s,a;return Ft(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=Cn(t),u.label=1;case 1:return[4,n.next()];case 2:if(r=u.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),i={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.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 ce(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 Yt(t,e){return e===void 0&&(e=0),de(function(n,r){n.subscribe(fe(r,function(i){return ce(r,t,function(){return r.next(i)},e)},function(){return ce(r,t,function(){return r.complete()},e)},function(i){return ce(r,t,function(){return r.error(i)},e)}))})}function Qt(t,e){return e===void 0&&(e=0),de(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function Gn(t,e){return Xe(t).pipe(Qt(e),Yt(e))}function jn(t,e){return Xe(t).pipe(Qt(e),Yt(e))}function $n(t,e){return new $(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function zn(t,e){return new $(function(n){var r;return ce(n,e,function(){r=t[Xt](),ce(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(a){n.error(a);return}s?n.complete():n.next(o)},0,!0)}),function(){return P(r==null?void 0:r.return)&&r.return()}})}function Jt(t,e){if(!t)throw new Error("Iterable cannot be null");return new $(function(n){ce(n,e,function(){var r=t[Symbol.asyncIterator]();ce(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function Yn(t,e){return Jt(jt(t),e)}function Qn(t,e){if(t!=null){if(Zt(t))return Gn(t,e);if(Ut(t))return $n(t,e);if(Ht(t))return jn(t,e);if(qt(t))return Jt(t,e);if(Gt(t))return zn(t,e);if($t(t))return Yn(t,e)}throw Wt(t)}function en(t,e){return e?Qn(t,e):Xe(t)}var tn=ct(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function Jn(t,e){return de(function(n,r){var i=0;n.subscribe(fe(r,function(o){r.next(t.call(e,o,i++))}))})}var er=Array.isArray;function tr(t,e){return er(e)?t.apply(void 0,Ke([],Pe(e))):t(e)}function nr(t){return Jn(function(e){return tr(t,e)})}var rr=Array.isArray,ir=Object.getPrototypeOf,or=Object.prototype,sr=Object.keys;function ar(t){if(t.length===1){var e=t[0];if(rr(e))return{args:e,keys:null};if(ur(e)){var n=sr(e);return{args:n.map(function(r){return e[r]}),keys:n}}}return{args:t,keys:null}}function ur(t){return t&&typeof t=="object"&&ir(t)===or}function cr(t,e){return t.reduce(function(n,r,i){return n[r]=e[i],n},{})}function lr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Pn(t),r=Bn(t),i=ar(t),o=i.args,s=i.keys;if(o.length===0)return en([],n);var a=new $(dr(o,n,s?function(u){return cr(s,u)}:We));return r?a.pipe(nr(r)):a}function dr(t,e,n){return n===void 0&&(n=We),function(r){At(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,u=function(l){At(e,function(){var d=en(t[l],e),f=!1;d.subscribe(fe(r,function(m){o[l]=m,f||(f=!0,a--),a||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},c=0;c<i;c++)u(c)},r)}}function At(t,e,n){t?ce(n,t,e):e()}function fr(t,e){return de(function(n,r){var i=0;n.subscribe(fe(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function mr(t){return de(function(e,n){var r=!1;e.subscribe(fe(n,function(i){r=!0,n.next(i)},function(){r||n.next(t),n.complete()}))})}function hr(t){return t<=0?function(){return Fn}:de(function(e,n){var r=0;e.subscribe(fe(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function pr(t){return t===void 0&&(t=gr),de(function(e,n){var r=!1;e.subscribe(fe(n,function(i){r=!0,n.next(i)},function(){return r?n.complete():n.error(t())}))})}function gr(){return new tn}function we(t,e){var n=arguments.length>=2;return function(r){return r.pipe(We,hr(1),n?mr(e):pr(function(){return new tn}))}}function q(t){return de(function(e,n){Xe(t).subscribe(fe(n,function(){return n.complete()},nt)),!n.closed&&e.subscribe(n)})}class vr{constructor(){S(this,"actionZoomIn");S(this,"actionZoomOut");S(this,"actionResetZoom");S(this,"actionToggleNextAudioTrack");S(this,"actionTogglePreviousAudioTrack");S(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 br=p.memo(({omakasePlayer:t,onTimelineCreatedCallback:e,timelineConfig:n,enableHotKeys:r})=>(p.useEffect(()=>{if(n.timelineHTMLElementId===void 0&&(n.timelineHTMLElementId="omakase-timeline"),t.createTimeline(n).subscribe({next:i=>{lr([t.timeline.onReady$,t.video.onVideoLoaded$.pipe(fr(o=>!!o))]).subscribe({next:()=>e(i)})}}),r===void 0||r){const i=new vr;i.actionToggleCti=()=>{var a;return(a=t.timeline)==null?void 0:a.toggleTimecodeEdit()},i.actionResetZoom=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomToEased(100)},i.actionZoomIn=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomInEased()},i.actionZoomOut=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomOutEased()};const o=a=>{const u=t.audio.getAudioTracks(),c=t.audio.getActiveAudioTrack(),d=u.findIndex(f=>f.id===(c==null?void 0:c.id))+(a?-1:1);d>=0&&d<u.length&&t.audio.setActiveAudioTrack(u.at(d).id)};i.actionTogglePreviousAudioTrack=()=>o(!0),i.actionToggleNextAudioTrack=()=>o(!1);const s=a=>{i.handleKeyboardEvent(a)&&(a.preventDefault(),a.stopPropagation())};return window.addEventListener("keydown",s),t.video.appendHelpMenuGroup(i.getKeyboardShortcutsHelpMenuGroup()),()=>{window.removeEventListener("keydown",s)}}},[t]),p.createElement("div",{id:n.timelineHTMLElementId})));class nn{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 Le=[.25,.5,.75,1,2,4,8];class xt{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=nn.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,a=e.shiftKey?1:-1,u=n.video.getVolume()*100+s*a;u>=100?u=100:u<=0&&(u=0),n.video.setVolume(u/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 a=Le.indexOf(n.video.getPlaybackRate())+s;let u;return a<0?u=Le.at(0):a>=Le.length?u=Le.at(-1):u=Le.at(a),n.video.setPlaybackRate(u),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,a=e.shiftKey?10:1;return n.video.isPlaying()&&n.video.pause(),n.video.seekFromCurrentFrame(a*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 rn=p.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"),p.useEffect(()=>{var u,c;let s=new F.OmakasePlayer(n);const a=l=>{xt.handleKeyboardEvent(l,s)&&(l.stopPropagation(),l.preventDefault())};return(o===void 0||o)&&((u=document.querySelector("media-controller"))==null||u.setAttribute("nohotkeys",""),(c=document.querySelector("media-controller"))==null||c.setAttribute("tabindex","-1"),window.addEventListener("keydown",a),s.video.appendHelpMenuGroup(xt.getKeyboardShortcutsHelpMenuGroup())),s.loadVideo(e,r).subscribe({next:l=>{i&&i(s,l)}}),()=>{(o===void 0||o)&&window.removeEventListener("keydown",a)}},[e]),p.createElement("div",{id:n.playerHTMLElementId})}),wr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),Sr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),Er=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),Tr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),yr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M11.3475 3H5.775V21L11.3475 17.0475V3Z",fill:"#CACFEA"}),p.createElement("path",{d:"M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",fill:"#CACFEA"})),Cr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",fill:"#CACFEA"}),p.createElement("path",{d:"M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",fill:"#CACFEA"})),Lr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),Mr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),Ar=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("g",{clipPath:"url(#clip0_3377_237)"},p.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"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_3377_237"},p.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),xr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("g",{clipPath:"url(#clip0_3377_260)"},p.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"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_3377_260"},p.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})=>p.createElement("button",{disabled:o,onClick:e},p.createElement(t,{width:n,height:r})," ",i),Ir=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z",fill:"#CACFEA"}),p.createElement("path",{d:"M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",fill:"#CACFEA"})),Or=({width:t,height:e})=>p.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("rect",{x:"0.5",y:"0.5",width:"13",height:"13",rx:"2.5",stroke:"#CACFEA"}),p.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 Y(t){t.next(),t.complete()}class _r{constructor(){S(this,"actionMarkerInOut");S(this,"actionMarkerSplit");S(this,"actionMarkerDelete");S(this,"actionPreviousMarkerToggle");S(this,"actionNextMarkerToggle");S(this,"actionSetMarkerStartToPlayhead");S(this,"actionSetMarkerEndToPlayhead");S(this,"actionSetPlayheadToMarkerStart");S(this,"actionSetPlayheadToMarkerEnd");S(this,"actionRewind3SecondsAndPlayToCurrent");S(this,"actionPlay3SecondsAndRewindToCurrent");S(this,"actionLoopActiveMarker")}getKeyboardShortcutsHelpMenuGroup(){let e=(...s)=>s.join(" + "),n="shift".toUpperCase();const r=nn.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,a=i.timeObservation.end,u=o.start,c=n??o.end;if(u!=null&&c!=null)return r||u<=a&&c>=s}return r},!1);function ke(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),a=n.video.getCurrentFrame();return e<r||o-a<2||a-s<1}function Ne(t){return!(t.timeObservation.start==null||t.timeObservation.end==null)}const kr=({selectedMarker:t,omakasePlayer:e,markerListApi:n,enableHotKeys:r,segmentationLanes:i,setSegmentationLanes:o,setSelectedMarker:s,onMarkerClickCallback:a,setSource:u,source:c,constants:l})=>{const d=p.useRef(void 0),f=p.useRef(void 0),m=new pe,b=p.useRef(!1),v=(g,w,L)=>{const _=w??e.video.getCurrentTime();return g.getMarkers().reduce((I,X)=>X instanceof F.PeriodMarker&&X.timeObservation.start!==void 0&&X.timeObservation.end!==void 0&&X.id!==(L==null?void 0:L.id)?I||_>=X.timeObservation.start&&_<=X.timeObservation.end:I,!1)},y=g=>{if(x===void 0)return!0;const w=x.timeObservation.start,L=g??e.video.getCurrentTime();return!!(w==null||w>=L||_e(c,x,L))},C=g=>x!==void 0||c===void 0?!0:v(c,g,x),[D,A]=p.useState(void 0),[N,H]=p.useState(ke(t,e.video.getCurrentTime(),e)),[x,ee]=p.useState(void 0),[he,j]=p.useState(y()),[ve,K]=p.useState(C()),re=g=>{if(g===void 0||c===void 0||!(g instanceof F.PeriodMarker))return!0;const w=_e(c,g,e.video.getCurrentTime());if(w)return w;if(g instanceof F.PeriodMarker){const L=g.timeObservation.end;if(L!=null&&e.video.getCurrentTime()>=L)return!0}return!1},ie=g=>{if(g===void 0||c===void 0||!(g instanceof F.PeriodMarker))return!0;const w=_e(c,g,e.video.getCurrentTime());if(w)return w;if(g instanceof F.PeriodMarker){if(g.timeObservation.end==null)return!0;const L=g.timeObservation.start;if(L!=null&&e.video.getCurrentTime()<=L)return!0}return!1},[be,V]=p.useState(re(t)),[O,ze]=p.useState(ie(t));p.useEffect(()=>{if(j(()=>y()),K(()=>C()),x&&x!==t){const g=i.find(w=>w.getMarker(x.id));g==null||g.removeMarker(x.id),ee(void 0)}},[t,x,i,ee]),p.useEffect(()=>()=>Y(m),[]),p.useEffect(()=>{if(V(re(t)),ze(ie(t)),t){const g=ke(t,e.video.getCurrentTime(),e);H(g);const w=e.video.onVideoTimeChange$.pipe(q(m)).subscribe({next:L=>{H(_=>ke(t,L.currentTime,e)),V(()=>re(t)),ze(()=>ie(t))}});return()=>w.unsubscribe()}},[t]),p.useEffect(()=>{e.video.onSeeking$.pipe(q(m)).subscribe({next:w=>{j(()=>y(w.toTime)),K(()=>C(w.toTime))}});const g=e.video.onVideoTimeChange$.pipe(q(m)).subscribe({next:w=>{j(()=>y()),K(()=>C())}});return()=>g.unsubscribe()},[x,c]),p.useEffect(()=>{const g=i.map(w=>w.onMarkerUpdate$.pipe(q(m)).subscribe({next:L=>{(t==null?void 0:t.id)===L.marker.id&&(H(_=>ke(t,e.video.getCurrentTime(),e)),V(()=>re(t)),ze(()=>ie(t)))}}));return()=>g.forEach(w=>w.unsubscribe())},[i,t]),p.useEffect(()=>{D&&(D.marker.style={...D.marker.style,color:D.color},D.marker.timeObservation={...D.marker.timeObservation},A(void 0))},[t]),p.useEffect(()=>{if(c){j(()=>y()),K(()=>C());const g=c.onMarkerDelete$.pipe(q(m)).subscribe({next:L=>{const _=L.marker;A(I=>{if((I==null?void 0:I.marker.id)!==_.id)return I}),s(I=>{if((I==null?void 0:I.id)!==_.id)return I}),ee(I=>{if((I==null?void 0:I.id)!==_.id)return I}),j(()=>y()),K(()=>C())}}),w=c.onMarkerUpdate$.pipe(q(m)).subscribe({next:()=>{j(()=>y()),K(()=>C())}});return()=>{g.unsubscribe(),w.unsubscribe()}}},[c]);const mt=(g,w)=>{if(w===void 0)return;const L=w.timeObservation;g.video.seekToTime(L.start)},ht=(g,w)=>{if(w===void 0)return;const L=w.timeObservation;g.video.seekToTime(L.end)},pt=(g,w)=>{w instanceof F.PeriodMarker&&w.timeObservation.start!==void 0&&(w.timeObservation={...w.timeObservation,start:g.video.getCurrentTime()})},gt=(g,w)=>{w instanceof F.PeriodMarker&&w.timeObservation.end!==void 0&&(w.timeObservation={...w.timeObservation,end:g.video.getCurrentTime()})},vt=(g,w)=>{d.current&&Y(d.current),d.current=new pe,g.video.pause();const L=g.video.getCurrentFrame(),_=g.video.getFrameRate(),I=L-w*_,X=I>=0?I:0;g.video.seekToFrame(X).pipe(we()).subscribe(()=>{}),g.video.play(),g.video.onVideoTimeChange$.pipe(q(d.current),q(m)).subscribe(Ie=>{Ie.frame>=L-1&&(g.video.pause().subscribe(()=>{g.video.seekToFrame(L).pipe(we()).subscribe(()=>{})}),Y(d.current))})},bt=(g,w)=>{d.current&&Y(d.current),d.current=new pe,f.current&&Y(f.current),f.current=new pe;const L=g.video.getCurrentFrame(),_=g.video.getFrameRate(),I=L+w*_;g.video.play(),g.video.onVideoTimeChange$.pipe(q(d.current),q(m)).subscribe(X=>{X.frame>=I-1&&(g.video.pause().subscribe(()=>{g.video.seekToFrame(L).pipe(we()).subscribe(()=>{})}),Y(d.current))}),g.video.onEnded$.pipe(q(f.current),q(m)).subscribe(X=>{setTimeout(()=>{g.video.seekToFrame(L).pipe(we()).subscribe(()=>{})},1),Y(f.current)})},Ye=g=>{c.removeMarker(g.id),(x==null?void 0:x.id)===g.id&&ee(void 0)},wt=(g,w)=>{if(!(w instanceof F.PeriodMarker))return;const L=w.timeObservation.start,_=w.timeObservation.end,I=g.video.getCurrentTime();if(L==null||_==null)return;const X=L,Ie=I,vn=Ie+1/g.video.getFrameRate(),bn=_;Ye(w);const Qe=new F.PeriodMarker({style:l.PERIOD_MARKER_STYLE,timeObservation:{start:X,end:Ie},editable:!0});Qe.onClick$.subscribe({next:()=>a(Qe)});const Ce=new F.PeriodMarker({style:l.HIGHLIGHTED_PERIOD_MARKER_STYLE,timeObservation:{start:vn,end:bn},editable:!0});Ce.onClick$.subscribe({next:()=>a(Ce)}),c.addMarker(Qe),c.addMarker(Ce),a(Ce),setTimeout(()=>{A({marker:Ce,color:l.PERIOD_MARKER_STYLE.color})},0)},St=()=>{const g=e.video.getCurrentTime(),w=new F.PeriodMarker({timeObservation:{start:g},style:l.PERIOD_MARKER_STYLE,editable:!0});w.onClick$.subscribe({next:()=>a(w)}),c.addMarker(w),ee(w),j(y()),a(w)},Et=()=>{const g=e.video.getCurrentTime();x.timeObservation={...x.timeObservation,end:g},ee(void 0)},Tt=g=>{d.current&&Y(d.current),d.current=new pe,f.current&&Y(f.current),f.current=new pe;const w=e.video.calculateTimeToFrame(g.timeObservation.start),L=e.video.calculateTimeToFrame(g.timeObservation.end);e.video.pause(),e.video.seekToFrame(w),e.video.play(),e.video.onVideoTimeChange$.pipe(q(d.current),q(m)).subscribe(_=>{_.frame>=L-1&&(e.video.pause().subscribe(()=>{e.video.seekToFrame(w).pipe(we()).subscribe(()=>{})}),Y(d.current))}),e.video.onEnded$.pipe(q(f.current),q(m)).subscribe(_=>{setTimeout(()=>{e.video.seekToFrame(w).pipe(we()).subscribe(()=>{})},1),Y(f.current)})},gn=()=>{const g=i.length,w=`Segmentation ${i.length+1}`,L=new F.MarkerLane({style:l.TIMELINE_LANE_STYLE,description:w});L.onMarkerUpdate$.subscribe({next:_=>{_e(L,_.marker)&&(_.marker.timeObservation=_.oldValue.timeObservation)}}),e.timeline.addTimelineLaneAtIndex(L,g+1),o([...i,L]),a(void 0),u(L)},yt=g=>{if(!c)return;const w=c.getMarkers().filter(I=>I instanceof F.PeriodMarker).sort((I,X)=>I.timeObservation.start??0-(X.timeObservation.start??0));if(t===void 0){a(w.at(0));return}const _=w.findIndex(I=>I.id===t.id)+(g?-1:1);_>=0&&_<w.length&&a(w.at(_))};return p.useEffect(()=>{if(!r)return;const g=new _r;g.actionLoopActiveMarker=()=>t instanceof F.PeriodMarker&&Ne(t)&&Tt(t),g.actionSetPlayheadToMarkerStart=()=>t&&mt(e,t),g.actionSetPlayheadToMarkerEnd=()=>t&&t instanceof F.PeriodMarker&&Ne(t)&&ht(e,t),g.actionSetMarkerStartToPlayhead=()=>!be&&pt(e,t),g.actionSetMarkerEndToPlayhead=()=>!O&&gt(e,t),g.actionMarkerSplit=()=>!N&&wt(e,t),g.actionMarkerDelete=()=>t&&Ye(t),g.actionMarkerInOut=()=>{x===void 0?!ve&&St():!he&&Et()},g.actionPlay3SecondsAndRewindToCurrent=()=>bt(e,3),g.actionRewind3SecondsAndPlayToCurrent=()=>vt(e,3),g.actionNextMarkerToggle=()=>yt(!1),g.actionPreviousMarkerToggle=()=>yt(!0);const w=L=>{g.handleKeyboardEvent(L,e)&&(L.stopPropagation(),L.preventDefault())};return window.addEventListener("keydown",w),b.current||(e.video.appendHelpMenuGroup(g.getKeyboardShortcutsHelpMenuGroup()),b.current=!0),()=>window.removeEventListener("keydown",w)}),p.createElement("div",{className:"control-panel-wrapper"},p.createElement("div",{className:"control-panel"},p.createElement(z,{Icon:wr,onClick:()=>mt(e,t),disabled:t===void 0}),p.createElement(z,{Icon:Sr,onClick:()=>ht(e,t),disabled:t===void 0||t instanceof F.PeriodMarker&&!Ne(t)}),p.createElement(z,{Icon:Er,onClick:()=>pt(e,t),disabled:be}),p.createElement(z,{Icon:Tr,onClick:()=>gt(e,t),disabled:O}),x===void 0?p.createElement(z,{Icon:yr,onClick:St,disabled:ve}):p.createElement(z,{Icon:Ir,onClick:Et,disabled:he}),p.createElement(z,{Icon:Lr,onClick:()=>Ye(t),disabled:t===void 0}),p.createElement(z,{Icon:Cr,onClick:()=>wt(e,t),disabled:N||t===void 0}),p.createElement(z,{Icon:Mr,onClick:()=>Tt(t),disabled:!(t instanceof F.PeriodMarker&&Ne(t))}),p.createElement(z,{Icon:Ar,onClick:()=>vt(e,3)}),p.createElement(z,{Icon:xr,onClick:()=>bt(e,3)})),p.createElement("div",{className:"control-panel"},p.createElement("div",{className:"segmentation-button-wrapper"},p.createElement(z,{Icon:Or,text:"NEW SEGMENTATION",onClick:()=>gn(),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}}/*!
4
4
  * decimal.js v10.5.0
5
5
  * An arbitrary-precision Decimal type for JavaScript.
6
6
  * https://github.com/MikeMcl/decimal.js
7
7
  * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
8
8
  * MIT Licence
9
- */var Se=9e15,he=1e9,it="0123456789abcdef",Ue="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",He="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ot={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Se,maxE:Se,crypto:!1},on,oe,C=!0,Ge="[DecimalError] ",le=Ge+"Invalid argument: ",sn=Ge+"Precision limit exceeded",an=Ge+"crypto unavailable",un="[object Decimal]",W=Math.floor,B=Math.pow,Nr=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Rr=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Dr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,cn=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,J=1e7,T=7,Fr=9007199254740991,Vr=Ue.length-1,st=He.length-1,m={toStringTag:un};m.absoluteValue=m.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),E(t)};m.ceil=function(){return E(new this.constructor(this),this.e+1,2)};m.clampedTo=m.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(le+e);return n=r.cmp(t),n<0?t:r.cmp(e)>0?e:new i(r)};m.comparedTo=m.cmp=function(t){var e,n,r,i,o=this,s=o.d,a=(t=new o.constructor(t)).d,c=o.s,u=t.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(o.e!==t.e)return o.e>t.e^c<0?1:-1;for(r=s.length,i=a.length,e=0,n=r<i?r:i;e<n;++e)if(s[e]!==a[e])return s[e]>a[e]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1};m.cosine=m.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())+T,r.rounding=1,n=Br(r,mn(r,n)),r.precision=t,r.rounding=e,E(oe==2||oe==3?n.neg():n,t,e,!0)):new r(1):new r(NaN)};m.cubeRoot=m.cbrt=function(){var t,e,n,r,i,o,s,a,c,u,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(C=!1,o=l.s*B(l.s*l,1/3),!o||Math.abs(o)==1/0?(n=Z(l.d),t=l.e,(o=(t-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=B(n,1/3),t=W((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 d(n),r.s=l.s):r=new d(o.toString()),s=(t=d.precision)+3;;)if(a=r,c=a.times(a).times(a),u=c.plus(l),r=k(u.plus(l).times(a),u.plus(c),s+2,1),Z(a.d).slice(0,s)===(n=Z(r.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!i&&n=="4999"){if(!i&&(E(a,t+1,0),a.times(a).times(a).eq(l))){r=a;break}s+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(E(r,t+1,1),e=!r.times(r).times(r).eq(l));break}return C=!0,E(r,t,d.rounding,e)};m.decimalPlaces=m.dp=function(){var t,e=this.d,n=NaN;if(e){if(t=e.length-1,n=(t-W(this.e/T))*T,t=e[t],t)for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n};m.dividedBy=m.div=function(t){return k(this,new this.constructor(t))};m.dividedToIntegerBy=m.divToInt=function(t){var e=this,n=e.constructor;return E(k(e,new n(t),0,1,1),n.precision,n.rounding)};m.equals=m.eq=function(t){return this.cmp(t)===0};m.floor=function(){return E(new this.constructor(this),this.e+1,3)};m.greaterThan=m.gt=function(t){return this.cmp(t)>0};m.greaterThanOrEqualTo=m.gte=function(t){var e=this.cmp(t);return e==1||e===0};m.hyperbolicCosine=m.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;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/$e(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),o=ye(s,1,o.times(e),new s(1),!0);for(var c,u=t,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return E(o,s.precision=n,s.rounding=r,!0)};m.hyperbolicSine=m.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=ye(o,2,i,i,!0);else{t=1.4*Math.sqrt(r),t=t>16?16:t|0,i=i.times(1/$e(5,t)),i=ye(o,2,i,i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=e,o.rounding=n,E(i,e,n,!0)};m.hyperbolicTangent=m.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,k(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)};m.inverseCosine=m.acos=function(){var t=this,e=t.constructor,n=t.abs().cmp(1),r=e.precision,i=e.rounding;return n!==-1?n===0?t.isNeg()?te(e,r,i):new e(0):new e(NaN):t.isZero()?te(e,r+4,i).times(.5):(e.precision=r+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=r,e.rounding=i,t.times(2))};m.inverseHyperbolicCosine=m.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,C=!1,n=n.times(n).minus(1).sqrt().plus(n),C=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)};m.inverseHyperbolicSine=m.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,C=!1,n=n.times(n).plus(1).sqrt().plus(n),C=!0,r.precision=t,r.rounding=e,n.ln())};m.inverseHyperbolicTangent=m.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?E(new o(i),t,e,!0):(o.precision=n=r-i.e,i=k(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)};m.inverseSine=m.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=te(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)))};m.inverseTangent=m.atan=function(){var t,e,n,r,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,f=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&d+4<=st)return s=te(l,d+4,f).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=st)return s=te(l,d+4,f).times(.5),s.s=u.s,s}for(l.precision=a=d+10,l.rounding=1,n=Math.min(28,a/T+2|0),t=n;t;--t)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(C=!1,e=Math.ceil(a/T),r=1,c=u.times(u),s=new l(u),i=u;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)),C=!0,E(s,l.precision=d,l.rounding=f,!0)};m.isFinite=function(){return!!this.d};m.isInteger=m.isInt=function(){return!!this.d&&W(this.e/T)>this.d.length-2};m.isNaN=function(){return!this.s};m.isNegative=m.isNeg=function(){return this.s<0};m.isPositive=m.isPos=function(){return this.s>0};m.isZero=function(){return!!this.d&&this.d[0]===0};m.lessThan=m.lt=function(t){return this.cmp(t)<0};m.lessThanOrEqualTo=m.lte=function(t){return this.cmp(t)<1};m.logarithm=m.log=function(t){var e,n,r,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,f=l.rounding,h=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=u.d,u.s<0||!n||!n[0]||u.eq(1))return new l(n&&!n[0]?-1/0:u.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(C=!1,a=d+h,s=ue(u,a),r=e?Ze(l,a+10):ue(t,a),c=k(s,r,a,1),Me(c.d,i=d,f))do if(a+=10,s=ue(u,a),r=e?Ze(l,a+10):ue(t,a),c=k(s,r,a,1),!o){+Z(c.d).slice(i+1,i+15)+1==1e14&&(c=E(c,d+1,0));break}while(Me(c.d,i+=10,f));return C=!0,E(c,d,f)};m.minus=m.sub=function(t){var e,n,r,i,o,s,a,c,u,l,d,f,h=this,w=h.constructor;if(t=new w(t),!h.d||!t.d)return!h.s||!t.s?t=new w(NaN):h.d?t.s=-t.s:t=new w(t.d||h.s!==t.s?h:NaN),t;if(h.s!=t.s)return t.s=-t.s,h.plus(t);if(u=h.d,f=t.d,a=w.precision,c=w.rounding,!u[0]||!f[0]){if(f[0])t.s=-t.s;else if(u[0])t=new w(h);else return new w(c===3?-0:0);return C?E(t,a,c):t}if(n=W(t.e/T),l=W(h.e/T),u=u.slice(),o=l-n,o){for(d=o<0,d?(e=u,o=-o,s=f.length):(e=f,n=l,s=u.length),r=Math.max(Math.ceil(a/T),s)+2,o>r&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for(r=u.length,s=f.length,d=r<s,d&&(s=r),r=0;r<s;r++)if(u[r]!=f[r]){d=u[r]<f[r];break}o=0}for(d&&(e=u,u=f,f=e,t.s=-t.s),s=u.length,r=f.length-s;r>0;--r)u[s++]=0;for(r=f.length;r>o;){if(u[--r]<f[r]){for(i=r;i&&u[--i]===0;)u[i]=J-1;--u[i],u[r]+=J}u[r]-=f[r]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(t.d=u,t.e=je(u,n),C?E(t,a,c):t):new w(c===3?-0:0)};m.modulo=m.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]?E(new r(n),r.precision,r.rounding):(C=!1,r.modulo==9?(e=k(n,t.abs(),0,3,1),e.s*=t.s):e=k(n,t,0,r.modulo,1),e=e.times(t),C=!0,n.minus(e))};m.naturalExponential=m.exp=function(){return at(this)};m.naturalLogarithm=m.ln=function(){return ue(this)};m.negated=m.neg=function(){var t=new this.constructor(this);return t.s=-t.s,E(t)};m.plus=m.add=function(t){var e,n,r,i,o,s,a,c,u,l,d=this,f=d.constructor;if(t=new f(t),!d.d||!t.d)return!d.s||!t.s?t=new f(NaN):d.d||(t=new f(t.d||d.s===t.s?d:NaN)),t;if(d.s!=t.s)return t.s=-t.s,d.minus(t);if(u=d.d,l=t.d,a=f.precision,c=f.rounding,!u[0]||!l[0])return l[0]||(t=new f(d)),C?E(t,a,c):t;if(o=W(d.e/T),r=W(t.e/T),u=u.slice(),i=o-r,i){for(i<0?(n=u,i=-i,s=l.length):(n=l,r=o,s=u.length),o=Math.ceil(a/T),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,n=l,l=u,u=n),e=0;i;)e=(u[--i]=u[i]+l[i]+e)/J|0,u[i]%=J;for(e&&(u.unshift(e),++r),s=u.length;u[--s]==0;)u.pop();return t.d=u,t.e=je(u,r),C?E(t,a,c):t};m.precision=m.sd=function(t){var e,n=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(le+t);return n.d?(e=ln(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e};m.round=function(){var t=this,e=t.constructor;return E(new e(t),t.e+1,e.rounding)};m.sine=m.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())+T,r.rounding=1,n=Kr(r,mn(r,n)),r.precision=t,r.rounding=e,E(oe>2?n.neg():n,t,e,!0)):new r(NaN)};m.squareRoot=m.sqrt=function(){var t,e,n,r,i,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(C=!1,u=Math.sqrt(+s),u==0||u==1/0?(e=Z(a),(e.length+c)%2==0&&(e+="0"),u=Math.sqrt(e),c=W((c+1)/2)-(c<0||c%2),u==1/0?e="5e"+c:(e=u.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),r=new l(e)):r=new l(u.toString()),n=(c=l.precision)+3;;)if(o=r,r=o.plus(k(s,o,n+2,1)).times(.5),Z(o.d).slice(0,n)===(e=Z(r.d)).slice(0,n))if(e=e.slice(n-3,n+1),e=="9999"||!i&&e=="4999"){if(!i&&(E(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")&&(E(r,c+1,1),t=!r.times(r).eq(s));break}return C=!0,E(r,c,l.rounding,t)};m.tangent=m.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=k(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,E(oe==2||oe==4?n.neg():n,t,e,!0)):new r(NaN)};m.times=m.mul=function(t){var e,n,r,i,o,s,a,c,u,l=this,d=l.constructor,f=l.d,h=(t=new d(t)).d;if(t.s*=l.s,!f||!f[0]||!h||!h[0])return new d(!t.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?t.s/0:t.s*0);for(n=W(l.e/T)+W(t.e/T),c=f.length,u=h.length,c<u&&(o=f,f=h,h=o,s=c,c=u,u=s),o=[],s=c+u,r=s;r--;)o.push(0);for(r=u;--r>=0;){for(e=0,i=c+r;i>r;)a=o[i]+h[r]*f[i-r-1]+e,o[i--]=a%J|0,e=a/J|0;o[i]=(o[i]+e)%J|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=je(o,n),C?E(t,d.precision,d.rounding):t};m.toBinary=function(t,e){return ft(this,2,t,e)};m.toDecimalPlaces=m.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(G(t,0,he),e===void 0?e=r.rounding:G(e,0,8),E(n,t+n.e+1,e))};m.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ne(r,!0):(G(t,0,he),e===void 0?e=i.rounding:G(e,0,8),r=E(new i(r),t+1,e),n=ne(r,!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n};m.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?n=ne(i):(G(t,0,he),e===void 0?e=o.rounding:G(e,0,8),r=E(new o(i),t+i.e+1,e),n=ne(r,!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};m.toFraction=function(t){var e,n,r,i,o,s,a,c,u,l,d,f,h=this,w=h.d,v=h.constructor;if(!w)return new v(h);if(u=n=new v(1),r=c=new v(0),e=new v(r),o=e.e=ln(w)-h.e-1,s=o%T,e.d[0]=B(10,s<0?T+s:s),t==null)t=o>0?e:u;else{if(a=new v(t),!a.isInt()||a.lt(u))throw Error(le+a);t=a.gt(e)?o>0?e:u:a}for(C=!1,a=new v(Z(w)),l=v.precision,v.precision=o=w.length*T*2;d=k(a,e,0,1,1),i=n.plus(d.times(r)),i.cmp(t)!=1;)n=r,r=i,i=u,u=c.plus(d.times(i)),c=i,i=e,e=a.minus(d.times(i)),a=i;return i=k(t.minus(n),r,0,1,1),c=c.plus(i.times(u)),n=n.plus(i.times(r)),c.s=u.s=h.s,f=k(u,r,o,1).minus(h).abs().cmp(k(c,n,o,1).minus(h).abs())<1?[u,r]:[c,n],v.precision=l,C=!0,f};m.toHexadecimal=m.toHex=function(t,e){return ft(this,16,t,e)};m.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:G(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]?(C=!1,n=k(n,t,0,e,1).times(t),C=!0,E(n)):(t.s=n.s,n=t),n};m.toNumber=function(){return+this};m.toOctal=function(t,e){return ft(this,8,t,e)};m.toPower=m.pow=function(t){var e,n,r,i,o,s,a=this,c=a.constructor,u=+(t=new c(t));if(!a.d||!t.d||!a.d[0]||!t.d[0])return new c(B(+a,u));if(a=new c(a),a.eq(1))return a;if(r=c.precision,o=c.rounding,t.eq(1))return E(a,r,o);if(e=W(t.e/T),e>=t.d.length-1&&(n=u<0?-u:u)<=Fr)return i=dn(c,a,n,r),t.s<0?new c(1).div(i):E(i,r,o);if(s=a.s,s<0){if(e<t.d.length-1)return new c(NaN);if((t.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return n=B(+a,u),e=n==0||!isFinite(n)?W(u*(Math.log("0."+Z(a.d))/Math.LN10+a.e+1)):new c(n+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(C=!1,c.rounding=a.s=1,n=Math.min(12,(e+"").length),i=at(t.times(ue(a,r+n)),r),i.d&&(i=E(i,r+5,1),Me(i.d,r,o)&&(e=r+10,i=E(at(t.times(ue(a,e+n)),e),e+5,1),+Z(i.d).slice(r+1,r+15)+1==1e14&&(i=E(i,r+1,0)))),i.s=s,C=!0,c.rounding=o,E(i,r,o))};m.toPrecision=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ne(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(G(t,1,he),e===void 0?e=i.rounding:G(e,0,8),r=E(new i(r),t,e),n=ne(r,t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n};m.toSignificantDigits=m.toSD=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(G(t,1,he),e===void 0?e=r.rounding:G(e,0,8)),E(new r(n),t,e)};m.toString=function(){var t=this,e=t.constructor,n=ne(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n};m.truncated=m.trunc=function(){return E(new this.constructor(this),this.e+1,1)};m.valueOf=m.toJSON=function(){var t=this,e=t.constructor,n=ne(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};function Z(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=T-r.length,n&&(o+=se(n)),o+=r;s=t[e],r=s+"",n=T-r.length,n&&(o+=se(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function G(t,e,n){if(t!==~~t||t<e||t>n)throw Error(le+t)}function Me(t,e,n,r){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=T,i=0):(i=Math.ceil((e+1)/T),e%=T),o=B(10,T-e),a=t[i]%o|0,r==null?e<3?(e==0?a=a/100|0:e==1&&(a=a/10|0),s=n<4&&a==99999||n>3&&a==49999||a==5e4||a==0):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(t[i+1]/o/100|0)==B(10,e-2)-1||(a==o/2||a==0)&&(t[i+1]/o/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),s=(r||n<4)&&a==9999||!r&&n>3&&a==4999):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==B(10,e-3)-1,s}function Ve(t,e,n){for(var r,i=[0],o,s=0,a=t.length;s<a;){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 Br(t,e){var n,r,i;if(e.isZero())return e;r=e.d.length,r<32?(n=Math.ceil(r/3),i=(1/$e(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=ye(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 k=function(){function t(r,i,o){var s,a=0,c=r.length;for(r=r.slice();c--;)s=r[c]*i+a,r[c]=s%o|0,a=s/o|0;return a&&r.unshift(a),r}function e(r,i,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(r[a]!=i[a]){c=r[a]>i[a]?1:-1;break}return c}function n(r,i,o,s){for(var a=0;o--;)r[o]-=a,a=r[o]<i[o]?1:0,r[o]=a*s+r[o]-i[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,o,s,a,c){var u,l,d,f,h,w,v,L,M,F,A,N,H,x,ee,me,j,ve,K,re,ie=r.constructor,we=r.s==i.s?1:-1,V=r.d,O=i.d;if(!V||!V[0]||!O||!O[0])return new ie(!r.s||!i.s||(V?O&&V[0]==O[0]:!O)?NaN:V&&V[0]==0||!O?we*0:we/0);for(c?(h=1,l=r.e-i.e):(c=J,h=T,l=W(r.e/h)-W(i.e/h)),K=O.length,j=V.length,M=new ie(we),F=M.d=[],d=0;O[d]==(V[d]||0);d++);if(O[d]>(V[d]||0)&&l--,o==null?(x=o=ie.precision,s=ie.rounding):a?x=o+(r.e-i.e)+1:x=o,x<0)F.push(1),w=!0;else{if(x=x/h+2|0,d=0,K==1){for(f=0,O=O[0],x++;(d<j||f)&&x--;d++)ee=f*c+(V[d]||0),F[d]=ee/O|0,f=ee%O|0;w=f||d<j}else{for(f=c/(O[0]+1)|0,f>1&&(O=t(O,f,c),V=t(V,f,c),K=O.length,j=V.length),me=K,A=V.slice(0,K),N=A.length;N<K;)A[N++]=0;re=O.slice(),re.unshift(0),ve=O[0],O[1]>=c/2&&++ve;do f=0,u=e(O,A,K,N),u<0?(H=A[0],K!=N&&(H=H*c+(A[1]||0)),f=H/ve|0,f>1?(f>=c&&(f=c-1),v=t(O,f,c),L=v.length,N=A.length,u=e(v,A,L,N),u==1&&(f--,n(v,K<L?re:O,L,c))):(f==0&&(u=f=1),v=O.slice()),L=v.length,L<N&&v.unshift(0),n(A,v,N,c),u==-1&&(N=A.length,u=e(O,A,K,N),u<1&&(f++,n(A,K<N?re:O,N,c))),N=A.length):u===0&&(f++,A=[0]),F[d++]=f,u&&A[0]?A[N++]=V[me]||0:(A=[V[me]],N=1);while((me++<j||A[0]!==void 0)&&x--);w=A[0]!==void 0}F[0]||F.shift()}if(h==1)M.e=l,on=w;else{for(d=1,f=F[0];f>=10;f/=10)d++;M.e=d+l*h-1,E(M,a?o+M.e+1:o,s,w)}return M}}();function E(t,e,n,r){var i,o,s,a,c,u,l,d,f,h=t.constructor;e:if(e!=null){if(d=t.d,!d)return t;for(i=1,a=d[0];a>=10;a/=10)i++;if(o=e-i,o<0)o+=T,s=e,l=d[f=0],c=l/B(10,i-s-1)%10|0;else if(f=Math.ceil((o+1)/T),a=d.length,f>=a)if(r){for(;a++<=f;)d.push(0);l=c=0,i=1,o%=T,s=o-T+1}else break e;else{for(l=a=d[f],i=1;a>=10;a/=10)i++;o%=T,s=o-T+i,c=s<0?0:l/B(10,i-s-1)%10|0}if(r=r||e<0||d[f+1]!==void 0||(s<0?l:l%B(10,i-s-1)),u=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/B(10,i-s):0:d[f-1])%10&1||n==(t.s<0?8:7)),e<1||!d[0])return d.length=0,u?(e-=t.e+1,d[0]=B(10,(T-e%T)%T),t.e=-e||0):d[0]=t.e=0,t;if(o==0?(d.length=f,a=1,f--):(d.length=f+1,a=B(10,T-o),d[f]=s>0?(l/B(10,i-s)%B(10,s)|0)*a:0),u)for(;;)if(f==0){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,d[0]==J&&(d[0]=1));break}else{if(d[f]+=a,d[f]!=J)break;d[f--]=0,a=1}for(o=d.length;d[--o]===0;)d.pop()}return C&&(t.e>h.maxE?(t.d=null,t.e=NaN):t.e<h.minE&&(t.e=0,t.d=[0])),t}function ne(t,e,n){if(!t.isFinite())return hn(t);var r,i=t.e,o=Z(t.d),s=o.length;return e?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+se(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+se(-i-1)+o,n&&(r=n-s)>0&&(o+=se(r))):i>=s?(o+=se(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+se(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=se(r))),o}function je(t,e){var n=t[0];for(e*=T;n>=10;n/=10)e++;return e}function Ze(t,e,n){if(e>Vr)throw C=!0,n&&(t.precision=n),Error(sn);return E(new t(Ue),e,1,!0)}function te(t,e,n){if(e>st)throw Error(sn);return E(new t(He),e,n,!0)}function ln(t){var e=t.length-1,n=e*T+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 se(t){for(var e="";t--;)e+="0";return e}function dn(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/T+4);for(C=!1;;){if(n%2&&(o=o.times(e),Ot(o.d,s)&&(i=!0)),n=W(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 C=!0,o}function It(t){return t.d[t.d.length-1]&1}function fn(t,e,n){for(var r,i,o=new t(e[0]),s=0;++s<e.length;){if(i=new t(e[s]),!i.s){o=i;break}r=o.cmp(i),(r===n||r===0&&o.s===n)&&(o=i)}return o}function at(t,e){var n,r,i,o,s,a,c,u=0,l=0,d=0,f=t.constructor,h=f.rounding,w=f.precision;if(!t.d||!t.d[0]||t.e>17)return new f(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(C=!1,c=w):c=e,a=new f(.03125);t.e>-2;)t=t.times(a),d+=5;for(r=Math.log(B(2,d))/Math.LN10*2+5|0,c+=r,n=o=s=new f(1),f.precision=c;;){if(o=E(o.times(t),c,1),n=n.times(++l),a=s.plus(k(o,n,c,1)),Z(a.d).slice(0,c)===Z(s.d).slice(0,c)){for(i=d;i--;)s=E(s.times(s),c,1);if(e==null)if(u<3&&Me(s.d,c-r,h,u))f.precision=c+=10,n=o=a=new f(1),l=0,u++;else return E(s,f.precision=w,h,C=!0);else return f.precision=w,s}s=a}}function ue(t,e){var n,r,i,o,s,a,c,u,l,d,f,h=1,w=10,v=t,L=v.d,M=v.constructor,F=M.rounding,A=M.precision;if(v.s<0||!L||!L[0]||!v.e&&L[0]==1&&L.length==1)return new M(L&&!L[0]?-1/0:v.s!=1?NaN:L?0:v);if(e==null?(C=!1,l=A):l=e,M.precision=l+=w,n=Z(L),r=n.charAt(0),Math.abs(o=v.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)v=v.times(t),n=Z(v.d),r=n.charAt(0),h++;o=v.e,r>1?(v=new M("0."+n),o++):v=new M(r+"."+n.slice(1))}else return u=Ze(M,l+2,A).times(o+""),v=ue(new M(r+"."+n.slice(1)),l-w).plus(u),M.precision=A,e==null?E(v,A,F,C=!0):v;for(d=v,c=s=v=k(v.minus(1),v.plus(1),l,1),f=E(v.times(v),l,1),i=3;;){if(s=E(s.times(f),l,1),u=c.plus(k(s,new M(i),l,1)),Z(u.d).slice(0,l)===Z(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(Ze(M,l+2,A).times(o+""))),c=k(c,new M(h),l,1),e==null)if(Me(c.d,l-w,F,a))M.precision=l+=w,u=s=v=k(d.minus(1),d.plus(1),l,1),f=E(v.times(v),l,1),i=a=1;else return E(c,M.precision=A,F,C=!0);else return M.precision=A,c;c=u,i+=2}}function hn(t){return String(t.s*t.s/0)}function Be(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)%T,n<0&&(r+=T),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=T;r<i;)t.d.push(+e.slice(r,r+=T));e=e.slice(r),r=T-e.length}else r-=i;for(;r--;)e+="0";t.d.push(+e),C&&(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 Pr(t,e){var n,r,i,o,s,a,c,u,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),cn.test(e))return Be(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Rr.test(e))n=16,e=e.toLowerCase();else if(Nr.test(e))n=2;else if(Dr.test(e))n=8;else throw Error(le+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(".",""),a=e.length,o=a-o,i=dn(r,new r(n),o,o*2)),u=Ve(e,n,J),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new r(t.s*0):(t.e=je(u,l),t.d=u,C=!1,s&&(t=k(t,i,a*4)),c&&(t=t.times(Math.abs(c)<54?B(2,c):xe.pow(2,c))),C=!0,t)}function Kr(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:ye(t,2,e,e);n=1.4*Math.sqrt(r),n=n>16?16:n|0,e=e.times(1/$e(5,n)),e=ye(t,2,e,e);for(var i,o=new t(5),s=new t(16),a=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}function ye(t,e,n,r,i){var o,s,a,c,u=t.precision,l=Math.ceil(u/T);for(C=!1,c=n.times(n),a=new t(r);;){if(s=k(a.times(c),new t(e++*e++),u,1),a=i?r.plus(s):r.minus(s),r=k(s.times(c),new t(e++*e++),u,1),s=a.plus(r),s.d[l]!==void 0){for(o=l;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=r,r=s,s=o}return C=!0,s.d.length=l+1,s}function $e(t,e){for(var n=t;--e;)n*=t;return n}function mn(t,e){var n,r=e.s<0,i=te(t,t.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return oe=r?4:1,e;if(n=e.divToInt(i),n.isZero())oe=r?3:2;else{if(e=e.minus(n.times(i)),e.lte(o))return oe=It(n)?r?2:3:r?4:1,e;oe=It(n)?r?1:4:r?3:2}return e.minus(i).abs()}function ft(t,e,n,r){var i,o,s,a,c,u,l,d,f,h=t.constructor,w=n!==void 0;if(w?(G(n,1,he),r===void 0?r=h.rounding:G(r,0,8)):(n=h.precision,r=h.rounding),!t.isFinite())l=hn(t);else{for(l=ne(t),s=l.indexOf("."),w?(i=2,e==16?n=n*4-3:e==8&&(n=n*3-2)):i=e,s>=0&&(l=l.replace(".",""),f=new h(1),f.e=l.length-s,f.d=Ve(ne(f),10,i),f.e=f.d.length),d=Ve(l,10,i),o=c=d.length;d[--c]==0;)d.pop();if(!d[0])l=w?"0p+0":"0";else{if(s<0?o--:(t=new h(t),t.d=d,t.e=o,t=k(t,f,n,r,0,i),d=t.d,o=t.e,u=on),s=d[n],a=i/2,u=u||d[n+1]!==void 0,u=r<4?(s!==void 0||u)&&(r===0||r===(t.s<0?3:2)):s>a||s===a&&(r===4||u||r===6&&d[n-1]&1||r===(t.s<0?8:7)),d.length=n,u)for(;++d[--n]>i-1;)d[n]=0,n||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,l="";s<c;s++)l+=it.charAt(d[s]);if(w){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(d=Ve(l,i,e),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=it.charAt(d[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 Ur(t){return new this(t).abs()}function Hr(t){return new this(t).acos()}function Zr(t){return new this(t).acosh()}function qr(t,e){return new this(t).plus(e)}function Wr(t){return new this(t).asin()}function Xr(t){return new this(t).asinh()}function Gr(t){return new this(t).atan()}function jr(t){return new this(t).atanh()}function $r(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=te(this,o,1).times(e.s>0?.25:.75),n.s=t.s):!e.d||t.isZero()?(n=e.s<0?te(this,r,i):new this(0),n.s=t.s):!t.d||e.isZero()?(n=te(this,o,1).times(.5),n.s=t.s):e.s<0?(this.precision=o,this.rounding=1,n=this.atan(k(t,e,o,1)),e=te(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(k(t,e,o,1)),n}function zr(t){return new this(t).cbrt()}function Yr(t){return E(t=new this(t),t.e+1,2)}function Qr(t,e,n){return new this(t).clamp(e,n)}function Jr(t){if(!t||typeof t!="object")throw Error(Ge+"Object expected");var e,n,r,i=t.defaults===!0,o=["precision",1,he,"rounding",0,8,"toExpNeg",-Se,0,"toExpPos",0,Se,"maxE",0,Se,"minE",-Se,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(W(r)===r&&r>=o[e+1]&&r<=o[e+2])this[n]=r;else throw Error(le+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(an);else this[n]=!1;else throw Error(le+n+": "+r);return this}function ei(t){return new this(t).cos()}function ti(t){return new this(t).cosh()}function pn(t){var e,n,r;function i(o){var s,a,c,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,_t(o)){u.s=o.s,C?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;C?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return Be(u,o.toString())}if(c==="string")return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),cn.test(o)?Be(u,o):Pr(u,o);if(c==="bigint")return o<0?(o=-o,u.s=-1):u.s=1,Be(u,o.toString());throw Error(le+o)}if(i.prototype=m,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=Jr,i.clone=pn,i.isDecimal=_t,i.abs=Ur,i.acos=Hr,i.acosh=Zr,i.add=qr,i.asin=Wr,i.asinh=Xr,i.atan=Gr,i.atanh=jr,i.atan2=$r,i.cbrt=zr,i.ceil=Yr,i.clamp=Qr,i.cos=ei,i.cosh=ti,i.div=ni,i.exp=ri,i.floor=ii,i.hypot=oi,i.ln=si,i.log=ai,i.log10=ci,i.log2=ui,i.max=li,i.min=di,i.mod=fi,i.mul=hi,i.pow=mi,i.random=pi,i.round=gi,i.sign=vi,i.sin=wi,i.sinh=bi,i.sqrt=Si,i.sub=Ei,i.sum=Ti,i.tan=yi,i.tanh=Ci,i.trunc=Li,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 ni(t,e){return new this(t).div(e)}function ri(t){return new this(t).exp()}function ii(t){return E(t=new this(t),t.e+1,3)}function oi(){var t,e,n=new this(0);for(C=!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 C=!0,new this(1/0);n=e}return C=!0,n.sqrt()}function _t(t){return t instanceof xe||t&&t.toStringTag===un||!1}function si(t){return new this(t).ln()}function ai(t,e){return new this(t).log(e)}function ui(t){return new this(t).log(2)}function ci(t){return new this(t).log(10)}function li(){return fn(this,arguments,-1)}function di(){return fn(this,arguments,1)}function fi(t,e){return new this(t).mod(e)}function hi(t,e){return new this(t).mul(e)}function mi(t,e){return new this(t).pow(e)}function pi(t){var e,n,r,i,o=0,s=new this(1),a=[];if(t===void 0?t=this.precision:G(t,1,he),r=Math.ceil(t/T),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]:a[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):(a.push(i%1e7),o+=4);o=r/4}else throw Error(an);else for(;o<r;)a[o++]=Math.random()*1e7|0;for(r=a[--o],t%=T,r&&t&&(i=B(10,T-t),a[o]=(r/i|0)*i);a[o]===0;o--)a.pop();if(o<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=T)a.shift();for(r=1,i=a[0];i>=10;i/=10)r++;r<T&&(n-=T-r)}return s.e=n,s.d=a,s}function gi(t){return E(t=new this(t),t.e+1,this.rounding)}function vi(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function wi(t){return new this(t).sin()}function bi(t){return new this(t).sinh()}function Si(t){return new this(t).sqrt()}function Ei(t,e){return new this(t).sub(e)}function Ti(){var t=0,e=arguments,n=new this(e[t]);for(C=!1;n.s&&++t<e.length;)n=n.plus(e[t]);return C=!0,E(n,this.precision,this.rounding)}function yi(t){return new this(t).tan()}function Ci(t){return new this(t).tanh()}function Li(t){return E(t=new this(t),t.e+1,1)}m[Symbol.for("nodejs.util.inspect.custom")]=m.toString;m[Symbol.toStringTag]="Decimal";var xe=m.constructor=pn(ot);Ue=new xe(Ue);He=new xe(He);class ae{static formatToTimecode(e,n,r=!1){let i=new xe(n),o,s=i.round();o=i.mul(e).floor();let a,c,u,l,d=s.mul(86400),f=o.mod(d),h=s.mul(3600),w=s.mul(60);return l=f.divToInt(h),f=f.minus(l.mul(h)),u=f.divToInt(w),f=f.minus(u.mul(w)),c=f.divToInt(s),a=f.minus(c.mul(s)),ae.formatTimecodeText(l.toNumber(),u.toNumber(),c.toNumber(),a.toNumber(),r)}static formatTimecodeText(e,n,r,i,o=!1){let s=o?".":":";return`${ae.padZero(e)}:${ae.padZero(n)}:${ae.padZero(r)}${s}${ae.padZero(i)}`}static padZero(e){return e<10?`0${e}`:`${e}`}}class Mi{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=Mi.resolveFrameRateValueFromFraction(n);return ae.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}`}};S(Q,"timeRangePattern",/^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$/);let U=Q;class Ai{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 ut{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,a){this.type=e,this.groupId=n,this.name=r,this.isDefault=i,this.autoSelect=o,this.channels=s,this.uri=a}}class Ii{constructor(e,n){this.duration=e,this.uri=n}}class kt{constructor(){this.playlist=new Ai}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 Nt{static write(e){let n=`#EXTM3U
9
+ */var Se=9e15,me=1e9,it="0123456789abcdef",Ue="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",He="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ot={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Se,maxE:Se,crypto:!1},on,oe,M=!0,Ge="[DecimalError] ",le=Ge+"Invalid argument: ",sn=Ge+"Precision limit exceeded",an=Ge+"crypto unavailable",un="[object Decimal]",W=Math.floor,B=Math.pow,Nr=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Rr=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Dr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,cn=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,J=1e7,T=7,Fr=9007199254740991,Vr=Ue.length-1,st=He.length-1,h={toStringTag:un};h.absoluteValue=h.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),E(t)};h.ceil=function(){return E(new this.constructor(this),this.e+1,2)};h.clampedTo=h.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(le+e);return n=r.cmp(t),n<0?t:r.cmp(e)>0?e:new i(r)};h.comparedTo=h.cmp=function(t){var e,n,r,i,o=this,s=o.d,a=(t=new o.constructor(t)).d,u=o.s,c=t.s;if(!s||!a)return!u||!c?NaN:u!==c?u:s===a?0:!s^u<0?1:-1;if(!s[0]||!a[0])return s[0]?u:a[0]?-c:0;if(u!==c)return u;if(o.e!==t.e)return o.e>t.e^u<0?1:-1;for(r=s.length,i=a.length,e=0,n=r<i?r:i;e<n;++e)if(s[e]!==a[e])return s[e]>a[e]^u<0?1:-1;return r===i?0:r>i^u<0?1:-1};h.cosine=h.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())+T,r.rounding=1,n=Br(r,hn(r,n)),r.precision=t,r.rounding=e,E(oe==2||oe==3?n.neg():n,t,e,!0)):new r(1):new r(NaN)};h.cubeRoot=h.cbrt=function(){var t,e,n,r,i,o,s,a,u,c,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(M=!1,o=l.s*B(l.s*l,1/3),!o||Math.abs(o)==1/0?(n=Z(l.d),t=l.e,(o=(t-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=B(n,1/3),t=W((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 d(n),r.s=l.s):r=new d(o.toString()),s=(t=d.precision)+3;;)if(a=r,u=a.times(a).times(a),c=u.plus(l),r=k(c.plus(l).times(a),c.plus(u),s+2,1),Z(a.d).slice(0,s)===(n=Z(r.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!i&&n=="4999"){if(!i&&(E(a,t+1,0),a.times(a).times(a).eq(l))){r=a;break}s+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(E(r,t+1,1),e=!r.times(r).times(r).eq(l));break}return M=!0,E(r,t,d.rounding,e)};h.decimalPlaces=h.dp=function(){var t,e=this.d,n=NaN;if(e){if(t=e.length-1,n=(t-W(this.e/T))*T,t=e[t],t)for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n};h.dividedBy=h.div=function(t){return k(this,new this.constructor(t))};h.dividedToIntegerBy=h.divToInt=function(t){var e=this,n=e.constructor;return E(k(e,new n(t),0,1,1),n.precision,n.rounding)};h.equals=h.eq=function(t){return this.cmp(t)===0};h.floor=function(){return E(new this.constructor(this),this.e+1,3)};h.greaterThan=h.gt=function(t){return this.cmp(t)>0};h.greaterThanOrEqualTo=h.gte=function(t){var e=this.cmp(t);return e==1||e===0};h.hyperbolicCosine=h.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;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/$e(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),o=ye(s,1,o.times(e),new s(1),!0);for(var u,c=t,l=new s(8);c--;)u=o.times(o),o=a.minus(u.times(l.minus(u.times(l))));return E(o,s.precision=n,s.rounding=r,!0)};h.hyperbolicSine=h.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=ye(o,2,i,i,!0);else{t=1.4*Math.sqrt(r),t=t>16?16:t|0,i=i.times(1/$e(5,t)),i=ye(o,2,i,i,!0);for(var s,a=new o(5),u=new o(16),c=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(u.times(s).plus(c))))}return o.precision=e,o.rounding=n,E(i,e,n,!0)};h.hyperbolicTangent=h.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,k(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)};h.inverseCosine=h.acos=function(){var t=this,e=t.constructor,n=t.abs().cmp(1),r=e.precision,i=e.rounding;return n!==-1?n===0?t.isNeg()?te(e,r,i):new e(0):new e(NaN):t.isZero()?te(e,r+4,i).times(.5):(e.precision=r+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=r,e.rounding=i,t.times(2))};h.inverseHyperbolicCosine=h.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,M=!1,n=n.times(n).minus(1).sqrt().plus(n),M=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)};h.inverseHyperbolicSine=h.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,M=!1,n=n.times(n).plus(1).sqrt().plus(n),M=!0,r.precision=t,r.rounding=e,n.ln())};h.inverseHyperbolicTangent=h.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?E(new o(i),t,e,!0):(o.precision=n=r-i.e,i=k(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)};h.inverseSine=h.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=te(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)))};h.inverseTangent=h.atan=function(){var t,e,n,r,i,o,s,a,u,c=this,l=c.constructor,d=l.precision,f=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&d+4<=st)return s=te(l,d+4,f).times(.25),s.s=c.s,s}else{if(!c.s)return new l(NaN);if(d+4<=st)return s=te(l,d+4,f).times(.5),s.s=c.s,s}for(l.precision=a=d+10,l.rounding=1,n=Math.min(28,a/T+2|0),t=n;t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(M=!1,e=Math.ceil(a/T),r=1,u=c.times(c),s=new l(c),i=c;t!==-1;)if(i=i.times(u),o=s.minus(i.div(r+=2)),i=i.times(u),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)),M=!0,E(s,l.precision=d,l.rounding=f,!0)};h.isFinite=function(){return!!this.d};h.isInteger=h.isInt=function(){return!!this.d&&W(this.e/T)>this.d.length-2};h.isNaN=function(){return!this.s};h.isNegative=h.isNeg=function(){return this.s<0};h.isPositive=h.isPos=function(){return this.s>0};h.isZero=function(){return!!this.d&&this.d[0]===0};h.lessThan=h.lt=function(t){return this.cmp(t)<0};h.lessThanOrEqualTo=h.lte=function(t){return this.cmp(t)<1};h.logarithm=h.log=function(t){var e,n,r,i,o,s,a,u,c=this,l=c.constructor,d=l.precision,f=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=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:c.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(M=!1,a=d+m,s=ue(c,a),r=e?Ze(l,a+10):ue(t,a),u=k(s,r,a,1),Me(u.d,i=d,f))do if(a+=10,s=ue(c,a),r=e?Ze(l,a+10):ue(t,a),u=k(s,r,a,1),!o){+Z(u.d).slice(i+1,i+15)+1==1e14&&(u=E(u,d+1,0));break}while(Me(u.d,i+=10,f));return M=!0,E(u,d,f)};h.minus=h.sub=function(t){var e,n,r,i,o,s,a,u,c,l,d,f,m=this,b=m.constructor;if(t=new b(t),!m.d||!t.d)return!m.s||!t.s?t=new b(NaN):m.d?t.s=-t.s:t=new b(t.d||m.s!==t.s?m:NaN),t;if(m.s!=t.s)return t.s=-t.s,m.plus(t);if(c=m.d,f=t.d,a=b.precision,u=b.rounding,!c[0]||!f[0]){if(f[0])t.s=-t.s;else if(c[0])t=new b(m);else return new b(u===3?-0:0);return M?E(t,a,u):t}if(n=W(t.e/T),l=W(m.e/T),c=c.slice(),o=l-n,o){for(d=o<0,d?(e=c,o=-o,s=f.length):(e=f,n=l,s=c.length),r=Math.max(Math.ceil(a/T),s)+2,o>r&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for(r=c.length,s=f.length,d=r<s,d&&(s=r),r=0;r<s;r++)if(c[r]!=f[r]){d=c[r]<f[r];break}o=0}for(d&&(e=c,c=f,f=e,t.s=-t.s),s=c.length,r=f.length-s;r>0;--r)c[s++]=0;for(r=f.length;r>o;){if(c[--r]<f[r]){for(i=r;i&&c[--i]===0;)c[i]=J-1;--c[i],c[r]+=J}c[r]-=f[r]}for(;c[--s]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(t.d=c,t.e=je(c,n),M?E(t,a,u):t):new b(u===3?-0:0)};h.modulo=h.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]?E(new r(n),r.precision,r.rounding):(M=!1,r.modulo==9?(e=k(n,t.abs(),0,3,1),e.s*=t.s):e=k(n,t,0,r.modulo,1),e=e.times(t),M=!0,n.minus(e))};h.naturalExponential=h.exp=function(){return at(this)};h.naturalLogarithm=h.ln=function(){return ue(this)};h.negated=h.neg=function(){var t=new this.constructor(this);return t.s=-t.s,E(t)};h.plus=h.add=function(t){var e,n,r,i,o,s,a,u,c,l,d=this,f=d.constructor;if(t=new f(t),!d.d||!t.d)return!d.s||!t.s?t=new f(NaN):d.d||(t=new f(t.d||d.s===t.s?d:NaN)),t;if(d.s!=t.s)return t.s=-t.s,d.minus(t);if(c=d.d,l=t.d,a=f.precision,u=f.rounding,!c[0]||!l[0])return l[0]||(t=new f(d)),M?E(t,a,u):t;if(o=W(d.e/T),r=W(t.e/T),c=c.slice(),i=o-r,i){for(i<0?(n=c,i=-i,s=l.length):(n=l,r=o,s=c.length),o=Math.ceil(a/T),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=c.length,i=l.length,s-i<0&&(i=s,n=l,l=c,c=n),e=0;i;)e=(c[--i]=c[i]+l[i]+e)/J|0,c[i]%=J;for(e&&(c.unshift(e),++r),s=c.length;c[--s]==0;)c.pop();return t.d=c,t.e=je(c,r),M?E(t,a,u):t};h.precision=h.sd=function(t){var e,n=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(le+t);return n.d?(e=ln(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e};h.round=function(){var t=this,e=t.constructor;return E(new e(t),t.e+1,e.rounding)};h.sine=h.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())+T,r.rounding=1,n=Kr(r,hn(r,n)),r.precision=t,r.rounding=e,E(oe>2?n.neg():n,t,e,!0)):new r(NaN)};h.squareRoot=h.sqrt=function(){var t,e,n,r,i,o,s=this,a=s.d,u=s.e,c=s.s,l=s.constructor;if(c!==1||!a||!a[0])return new l(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);for(M=!1,c=Math.sqrt(+s),c==0||c==1/0?(e=Z(a),(e.length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=W((u+1)/2)-(u<0||u%2),c==1/0?e="5e"+u:(e=c.toExponential(),e=e.slice(0,e.indexOf("e")+1)+u),r=new l(e)):r=new l(c.toString()),n=(u=l.precision)+3;;)if(o=r,r=o.plus(k(s,o,n+2,1)).times(.5),Z(o.d).slice(0,n)===(e=Z(r.d)).slice(0,n))if(e=e.slice(n-3,n+1),e=="9999"||!i&&e=="4999"){if(!i&&(E(o,u+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(E(r,u+1,1),t=!r.times(r).eq(s));break}return M=!0,E(r,u,l.rounding,t)};h.tangent=h.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=k(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,E(oe==2||oe==4?n.neg():n,t,e,!0)):new r(NaN)};h.times=h.mul=function(t){var e,n,r,i,o,s,a,u,c,l=this,d=l.constructor,f=l.d,m=(t=new d(t)).d;if(t.s*=l.s,!f||!f[0]||!m||!m[0])return new d(!t.s||f&&!f[0]&&!m||m&&!m[0]&&!f?NaN:!f||!m?t.s/0:t.s*0);for(n=W(l.e/T)+W(t.e/T),u=f.length,c=m.length,u<c&&(o=f,f=m,m=o,s=u,u=c,c=s),o=[],s=u+c,r=s;r--;)o.push(0);for(r=c;--r>=0;){for(e=0,i=u+r;i>r;)a=o[i]+m[r]*f[i-r-1]+e,o[i--]=a%J|0,e=a/J|0;o[i]=(o[i]+e)%J|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=je(o,n),M?E(t,d.precision,d.rounding):t};h.toBinary=function(t,e){return ft(this,2,t,e)};h.toDecimalPlaces=h.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(G(t,0,me),e===void 0?e=r.rounding:G(e,0,8),E(n,t+n.e+1,e))};h.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ne(r,!0):(G(t,0,me),e===void 0?e=i.rounding:G(e,0,8),r=E(new i(r),t+1,e),n=ne(r,!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n};h.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?n=ne(i):(G(t,0,me),e===void 0?e=o.rounding:G(e,0,8),r=E(new o(i),t+i.e+1,e),n=ne(r,!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n};h.toFraction=function(t){var e,n,r,i,o,s,a,u,c,l,d,f,m=this,b=m.d,v=m.constructor;if(!b)return new v(m);if(c=n=new v(1),r=u=new v(0),e=new v(r),o=e.e=ln(b)-m.e-1,s=o%T,e.d[0]=B(10,s<0?T+s:s),t==null)t=o>0?e:c;else{if(a=new v(t),!a.isInt()||a.lt(c))throw Error(le+a);t=a.gt(e)?o>0?e:c:a}for(M=!1,a=new v(Z(b)),l=v.precision,v.precision=o=b.length*T*2;d=k(a,e,0,1,1),i=n.plus(d.times(r)),i.cmp(t)!=1;)n=r,r=i,i=c,c=u.plus(d.times(i)),u=i,i=e,e=a.minus(d.times(i)),a=i;return i=k(t.minus(n),r,0,1,1),u=u.plus(i.times(c)),n=n.plus(i.times(r)),u.s=c.s=m.s,f=k(c,r,o,1).minus(m).abs().cmp(k(u,n,o,1).minus(m).abs())<1?[c,r]:[u,n],v.precision=l,M=!0,f};h.toHexadecimal=h.toHex=function(t,e){return ft(this,16,t,e)};h.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:G(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]?(M=!1,n=k(n,t,0,e,1).times(t),M=!0,E(n)):(t.s=n.s,n=t),n};h.toNumber=function(){return+this};h.toOctal=function(t,e){return ft(this,8,t,e)};h.toPower=h.pow=function(t){var e,n,r,i,o,s,a=this,u=a.constructor,c=+(t=new u(t));if(!a.d||!t.d||!a.d[0]||!t.d[0])return new u(B(+a,c));if(a=new u(a),a.eq(1))return a;if(r=u.precision,o=u.rounding,t.eq(1))return E(a,r,o);if(e=W(t.e/T),e>=t.d.length-1&&(n=c<0?-c:c)<=Fr)return i=dn(u,a,n,r),t.s<0?new u(1).div(i):E(i,r,o);if(s=a.s,s<0){if(e<t.d.length-1)return new u(NaN);if((t.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return n=B(+a,c),e=n==0||!isFinite(n)?W(c*(Math.log("0."+Z(a.d))/Math.LN10+a.e+1)):new u(n+"").e,e>u.maxE+1||e<u.minE-1?new u(e>0?s/0:0):(M=!1,u.rounding=a.s=1,n=Math.min(12,(e+"").length),i=at(t.times(ue(a,r+n)),r),i.d&&(i=E(i,r+5,1),Me(i.d,r,o)&&(e=r+10,i=E(at(t.times(ue(a,e+n)),e),e+5,1),+Z(i.d).slice(r+1,r+15)+1==1e14&&(i=E(i,r+1,0)))),i.s=s,M=!0,u.rounding=o,E(i,r,o))};h.toPrecision=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ne(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(G(t,1,me),e===void 0?e=i.rounding:G(e,0,8),r=E(new i(r),t,e),n=ne(r,t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n};h.toSignificantDigits=h.toSD=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(G(t,1,me),e===void 0?e=r.rounding:G(e,0,8)),E(new r(n),t,e)};h.toString=function(){var t=this,e=t.constructor,n=ne(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n};h.truncated=h.trunc=function(){return E(new this.constructor(this),this.e+1,1)};h.valueOf=h.toJSON=function(){var t=this,e=t.constructor,n=ne(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};function Z(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=T-r.length,n&&(o+=se(n)),o+=r;s=t[e],r=s+"",n=T-r.length,n&&(o+=se(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function G(t,e,n){if(t!==~~t||t<e||t>n)throw Error(le+t)}function Me(t,e,n,r){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=T,i=0):(i=Math.ceil((e+1)/T),e%=T),o=B(10,T-e),a=t[i]%o|0,r==null?e<3?(e==0?a=a/100|0:e==1&&(a=a/10|0),s=n<4&&a==99999||n>3&&a==49999||a==5e4||a==0):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(t[i+1]/o/100|0)==B(10,e-2)-1||(a==o/2||a==0)&&(t[i+1]/o/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),s=(r||n<4)&&a==9999||!r&&n>3&&a==4999):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==B(10,e-3)-1,s}function Ve(t,e,n){for(var r,i=[0],o,s=0,a=t.length;s<a;){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 Br(t,e){var n,r,i;if(e.isZero())return e;r=e.d.length,r<32?(n=Math.ceil(r/3),i=(1/$e(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=ye(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 k=function(){function t(r,i,o){var s,a=0,u=r.length;for(r=r.slice();u--;)s=r[u]*i+a,r[u]=s%o|0,a=s/o|0;return a&&r.unshift(a),r}function e(r,i,o,s){var a,u;if(o!=s)u=o>s?1:-1;else for(a=u=0;a<o;a++)if(r[a]!=i[a]){u=r[a]>i[a]?1:-1;break}return u}function n(r,i,o,s){for(var a=0;o--;)r[o]-=a,a=r[o]<i[o]?1:0,r[o]=a*s+r[o]-i[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,o,s,a,u){var c,l,d,f,m,b,v,y,C,D,A,N,H,x,ee,he,j,ve,K,re,ie=r.constructor,be=r.s==i.s?1:-1,V=r.d,O=i.d;if(!V||!V[0]||!O||!O[0])return new ie(!r.s||!i.s||(V?O&&V[0]==O[0]:!O)?NaN:V&&V[0]==0||!O?be*0:be/0);for(u?(m=1,l=r.e-i.e):(u=J,m=T,l=W(r.e/m)-W(i.e/m)),K=O.length,j=V.length,C=new ie(be),D=C.d=[],d=0;O[d]==(V[d]||0);d++);if(O[d]>(V[d]||0)&&l--,o==null?(x=o=ie.precision,s=ie.rounding):a?x=o+(r.e-i.e)+1:x=o,x<0)D.push(1),b=!0;else{if(x=x/m+2|0,d=0,K==1){for(f=0,O=O[0],x++;(d<j||f)&&x--;d++)ee=f*u+(V[d]||0),D[d]=ee/O|0,f=ee%O|0;b=f||d<j}else{for(f=u/(O[0]+1)|0,f>1&&(O=t(O,f,u),V=t(V,f,u),K=O.length,j=V.length),he=K,A=V.slice(0,K),N=A.length;N<K;)A[N++]=0;re=O.slice(),re.unshift(0),ve=O[0],O[1]>=u/2&&++ve;do f=0,c=e(O,A,K,N),c<0?(H=A[0],K!=N&&(H=H*u+(A[1]||0)),f=H/ve|0,f>1?(f>=u&&(f=u-1),v=t(O,f,u),y=v.length,N=A.length,c=e(v,A,y,N),c==1&&(f--,n(v,K<y?re:O,y,u))):(f==0&&(c=f=1),v=O.slice()),y=v.length,y<N&&v.unshift(0),n(A,v,N,u),c==-1&&(N=A.length,c=e(O,A,K,N),c<1&&(f++,n(A,K<N?re:O,N,u))),N=A.length):c===0&&(f++,A=[0]),D[d++]=f,c&&A[0]?A[N++]=V[he]||0:(A=[V[he]],N=1);while((he++<j||A[0]!==void 0)&&x--);b=A[0]!==void 0}D[0]||D.shift()}if(m==1)C.e=l,on=b;else{for(d=1,f=D[0];f>=10;f/=10)d++;C.e=d+l*m-1,E(C,a?o+C.e+1:o,s,b)}return C}}();function E(t,e,n,r){var i,o,s,a,u,c,l,d,f,m=t.constructor;e:if(e!=null){if(d=t.d,!d)return t;for(i=1,a=d[0];a>=10;a/=10)i++;if(o=e-i,o<0)o+=T,s=e,l=d[f=0],u=l/B(10,i-s-1)%10|0;else if(f=Math.ceil((o+1)/T),a=d.length,f>=a)if(r){for(;a++<=f;)d.push(0);l=u=0,i=1,o%=T,s=o-T+1}else break e;else{for(l=a=d[f],i=1;a>=10;a/=10)i++;o%=T,s=o-T+i,u=s<0?0:l/B(10,i-s-1)%10|0}if(r=r||e<0||d[f+1]!==void 0||(s<0?l:l%B(10,i-s-1)),c=n<4?(u||r)&&(n==0||n==(t.s<0?3:2)):u>5||u==5&&(n==4||r||n==6&&(o>0?s>0?l/B(10,i-s):0:d[f-1])%10&1||n==(t.s<0?8:7)),e<1||!d[0])return d.length=0,c?(e-=t.e+1,d[0]=B(10,(T-e%T)%T),t.e=-e||0):d[0]=t.e=0,t;if(o==0?(d.length=f,a=1,f--):(d.length=f+1,a=B(10,T-o),d[f]=s>0?(l/B(10,i-s)%B(10,s)|0)*a:0),c)for(;;)if(f==0){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,d[0]==J&&(d[0]=1));break}else{if(d[f]+=a,d[f]!=J)break;d[f--]=0,a=1}for(o=d.length;d[--o]===0;)d.pop()}return M&&(t.e>m.maxE?(t.d=null,t.e=NaN):t.e<m.minE&&(t.e=0,t.d=[0])),t}function ne(t,e,n){if(!t.isFinite())return mn(t);var r,i=t.e,o=Z(t.d),s=o.length;return e?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+se(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+se(-i-1)+o,n&&(r=n-s)>0&&(o+=se(r))):i>=s?(o+=se(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+se(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=se(r))),o}function je(t,e){var n=t[0];for(e*=T;n>=10;n/=10)e++;return e}function Ze(t,e,n){if(e>Vr)throw M=!0,n&&(t.precision=n),Error(sn);return E(new t(Ue),e,1,!0)}function te(t,e,n){if(e>st)throw Error(sn);return E(new t(He),e,n,!0)}function ln(t){var e=t.length-1,n=e*T+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 se(t){for(var e="";t--;)e+="0";return e}function dn(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/T+4);for(M=!1;;){if(n%2&&(o=o.times(e),Ot(o.d,s)&&(i=!0)),n=W(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 M=!0,o}function It(t){return t.d[t.d.length-1]&1}function fn(t,e,n){for(var r,i,o=new t(e[0]),s=0;++s<e.length;){if(i=new t(e[s]),!i.s){o=i;break}r=o.cmp(i),(r===n||r===0&&o.s===n)&&(o=i)}return o}function at(t,e){var n,r,i,o,s,a,u,c=0,l=0,d=0,f=t.constructor,m=f.rounding,b=f.precision;if(!t.d||!t.d[0]||t.e>17)return new f(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(M=!1,u=b):u=e,a=new f(.03125);t.e>-2;)t=t.times(a),d+=5;for(r=Math.log(B(2,d))/Math.LN10*2+5|0,u+=r,n=o=s=new f(1),f.precision=u;;){if(o=E(o.times(t),u,1),n=n.times(++l),a=s.plus(k(o,n,u,1)),Z(a.d).slice(0,u)===Z(s.d).slice(0,u)){for(i=d;i--;)s=E(s.times(s),u,1);if(e==null)if(c<3&&Me(s.d,u-r,m,c))f.precision=u+=10,n=o=a=new f(1),l=0,c++;else return E(s,f.precision=b,m,M=!0);else return f.precision=b,s}s=a}}function ue(t,e){var n,r,i,o,s,a,u,c,l,d,f,m=1,b=10,v=t,y=v.d,C=v.constructor,D=C.rounding,A=C.precision;if(v.s<0||!y||!y[0]||!v.e&&y[0]==1&&y.length==1)return new C(y&&!y[0]?-1/0:v.s!=1?NaN:y?0:v);if(e==null?(M=!1,l=A):l=e,C.precision=l+=b,n=Z(y),r=n.charAt(0),Math.abs(o=v.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)v=v.times(t),n=Z(v.d),r=n.charAt(0),m++;o=v.e,r>1?(v=new C("0."+n),o++):v=new C(r+"."+n.slice(1))}else return c=Ze(C,l+2,A).times(o+""),v=ue(new C(r+"."+n.slice(1)),l-b).plus(c),C.precision=A,e==null?E(v,A,D,M=!0):v;for(d=v,u=s=v=k(v.minus(1),v.plus(1),l,1),f=E(v.times(v),l,1),i=3;;){if(s=E(s.times(f),l,1),c=u.plus(k(s,new C(i),l,1)),Z(c.d).slice(0,l)===Z(u.d).slice(0,l))if(u=u.times(2),o!==0&&(u=u.plus(Ze(C,l+2,A).times(o+""))),u=k(u,new C(m),l,1),e==null)if(Me(u.d,l-b,D,a))C.precision=l+=b,c=s=v=k(d.minus(1),d.plus(1),l,1),f=E(v.times(v),l,1),i=a=1;else return E(u,C.precision=A,D,M=!0);else return C.precision=A,u;u=c,i+=2}}function mn(t){return String(t.s*t.s/0)}function Be(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)%T,n<0&&(r+=T),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=T;r<i;)t.d.push(+e.slice(r,r+=T));e=e.slice(r),r=T-e.length}else r-=i;for(;r--;)e+="0";t.d.push(+e),M&&(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 Pr(t,e){var n,r,i,o,s,a,u,c,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),cn.test(e))return Be(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Rr.test(e))n=16,e=e.toLowerCase();else if(Nr.test(e))n=2;else if(Dr.test(e))n=8;else throw Error(le+e);for(o=e.search(/p/i),o>0?(u=+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(".",""),a=e.length,o=a-o,i=dn(r,new r(n),o,o*2)),c=Ve(e,n,J),l=c.length-1,o=l;c[o]===0;--o)c.pop();return o<0?new r(t.s*0):(t.e=je(c,l),t.d=c,M=!1,s&&(t=k(t,i,a*4)),u&&(t=t.times(Math.abs(u)<54?B(2,u):xe.pow(2,u))),M=!0,t)}function Kr(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:ye(t,2,e,e);n=1.4*Math.sqrt(r),n=n>16?16:n|0,e=e.times(1/$e(5,n)),e=ye(t,2,e,e);for(var i,o=new t(5),s=new t(16),a=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}function ye(t,e,n,r,i){var o,s,a,u,c=t.precision,l=Math.ceil(c/T);for(M=!1,u=n.times(n),a=new t(r);;){if(s=k(a.times(u),new t(e++*e++),c,1),a=i?r.plus(s):r.minus(s),r=k(s.times(u),new t(e++*e++),c,1),s=a.plus(r),s.d[l]!==void 0){for(o=l;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=r,r=s,s=o}return M=!0,s.d.length=l+1,s}function $e(t,e){for(var n=t;--e;)n*=t;return n}function hn(t,e){var n,r=e.s<0,i=te(t,t.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return oe=r?4:1,e;if(n=e.divToInt(i),n.isZero())oe=r?3:2;else{if(e=e.minus(n.times(i)),e.lte(o))return oe=It(n)?r?2:3:r?4:1,e;oe=It(n)?r?1:4:r?3:2}return e.minus(i).abs()}function ft(t,e,n,r){var i,o,s,a,u,c,l,d,f,m=t.constructor,b=n!==void 0;if(b?(G(n,1,me),r===void 0?r=m.rounding:G(r,0,8)):(n=m.precision,r=m.rounding),!t.isFinite())l=mn(t);else{for(l=ne(t),s=l.indexOf("."),b?(i=2,e==16?n=n*4-3:e==8&&(n=n*3-2)):i=e,s>=0&&(l=l.replace(".",""),f=new m(1),f.e=l.length-s,f.d=Ve(ne(f),10,i),f.e=f.d.length),d=Ve(l,10,i),o=u=d.length;d[--u]==0;)d.pop();if(!d[0])l=b?"0p+0":"0";else{if(s<0?o--:(t=new m(t),t.d=d,t.e=o,t=k(t,f,n,r,0,i),d=t.d,o=t.e,c=on),s=d[n],a=i/2,c=c||d[n+1]!==void 0,c=r<4?(s!==void 0||c)&&(r===0||r===(t.s<0?3:2)):s>a||s===a&&(r===4||c||r===6&&d[n-1]&1||r===(t.s<0?8:7)),d.length=n,c)for(;++d[--n]>i-1;)d[n]=0,n||(++o,d.unshift(1));for(u=d.length;!d[u-1];--u);for(s=0,l="";s<u;s++)l+=it.charAt(d[s]);if(b){if(u>1)if(e==16||e==8){for(s=e==16?4:3,--u;u%s;u++)l+="0";for(d=Ve(l,i,e),u=d.length;!d[u-1];--u);for(s=1,l="1.";s<u;s++)l+=it.charAt(d[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>u)for(o-=u;o--;)l+="0";else o<u&&(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 Ur(t){return new this(t).abs()}function Hr(t){return new this(t).acos()}function Zr(t){return new this(t).acosh()}function qr(t,e){return new this(t).plus(e)}function Wr(t){return new this(t).asin()}function Xr(t){return new this(t).asinh()}function Gr(t){return new this(t).atan()}function jr(t){return new this(t).atanh()}function $r(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=te(this,o,1).times(e.s>0?.25:.75),n.s=t.s):!e.d||t.isZero()?(n=e.s<0?te(this,r,i):new this(0),n.s=t.s):!t.d||e.isZero()?(n=te(this,o,1).times(.5),n.s=t.s):e.s<0?(this.precision=o,this.rounding=1,n=this.atan(k(t,e,o,1)),e=te(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(k(t,e,o,1)),n}function zr(t){return new this(t).cbrt()}function Yr(t){return E(t=new this(t),t.e+1,2)}function Qr(t,e,n){return new this(t).clamp(e,n)}function Jr(t){if(!t||typeof t!="object")throw Error(Ge+"Object expected");var e,n,r,i=t.defaults===!0,o=["precision",1,me,"rounding",0,8,"toExpNeg",-Se,0,"toExpPos",0,Se,"maxE",0,Se,"minE",-Se,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(W(r)===r&&r>=o[e+1]&&r<=o[e+2])this[n]=r;else throw Error(le+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(an);else this[n]=!1;else throw Error(le+n+": "+r);return this}function ei(t){return new this(t).cos()}function ti(t){return new this(t).cosh()}function pn(t){var e,n,r;function i(o){var s,a,u,c=this;if(!(c instanceof i))return new i(o);if(c.constructor=i,_t(o)){c.s=o.s,M?!o.d||o.e>i.maxE?(c.e=NaN,c.d=null):o.e<i.minE?(c.e=0,c.d=[0]):(c.e=o.e,c.d=o.d.slice()):(c.e=o.e,c.d=o.d?o.d.slice():o.d);return}if(u=typeof o,u==="number"){if(o===0){c.s=1/o<0?-1:1,c.e=0,c.d=[0];return}if(o<0?(o=-o,c.s=-1):c.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;M?s>i.maxE?(c.e=NaN,c.d=null):s<i.minE?(c.e=0,c.d=[0]):(c.e=s,c.d=[o]):(c.e=s,c.d=[o]);return}if(o*0!==0){o||(c.s=NaN),c.e=NaN,c.d=null;return}return Be(c,o.toString())}if(u==="string")return(a=o.charCodeAt(0))===45?(o=o.slice(1),c.s=-1):(a===43&&(o=o.slice(1)),c.s=1),cn.test(o)?Be(c,o):Pr(c,o);if(u==="bigint")return o<0?(o=-o,c.s=-1):c.s=1,Be(c,o.toString());throw Error(le+o)}if(i.prototype=h,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=Jr,i.clone=pn,i.isDecimal=_t,i.abs=Ur,i.acos=Hr,i.acosh=Zr,i.add=qr,i.asin=Wr,i.asinh=Xr,i.atan=Gr,i.atanh=jr,i.atan2=$r,i.cbrt=zr,i.ceil=Yr,i.clamp=Qr,i.cos=ei,i.cosh=ti,i.div=ni,i.exp=ri,i.floor=ii,i.hypot=oi,i.ln=si,i.log=ai,i.log10=ci,i.log2=ui,i.max=li,i.min=di,i.mod=fi,i.mul=mi,i.pow=hi,i.random=pi,i.round=gi,i.sign=vi,i.sin=bi,i.sinh=wi,i.sqrt=Si,i.sub=Ei,i.sum=Ti,i.tan=yi,i.tanh=Ci,i.trunc=Li,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 ni(t,e){return new this(t).div(e)}function ri(t){return new this(t).exp()}function ii(t){return E(t=new this(t),t.e+1,3)}function oi(){var t,e,n=new this(0);for(M=!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 M=!0,new this(1/0);n=e}return M=!0,n.sqrt()}function _t(t){return t instanceof xe||t&&t.toStringTag===un||!1}function si(t){return new this(t).ln()}function ai(t,e){return new this(t).log(e)}function ui(t){return new this(t).log(2)}function ci(t){return new this(t).log(10)}function li(){return fn(this,arguments,-1)}function di(){return fn(this,arguments,1)}function fi(t,e){return new this(t).mod(e)}function mi(t,e){return new this(t).mul(e)}function hi(t,e){return new this(t).pow(e)}function pi(t){var e,n,r,i,o=0,s=new this(1),a=[];if(t===void 0?t=this.precision:G(t,1,me),r=Math.ceil(t/T),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]:a[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):(a.push(i%1e7),o+=4);o=r/4}else throw Error(an);else for(;o<r;)a[o++]=Math.random()*1e7|0;for(r=a[--o],t%=T,r&&t&&(i=B(10,T-t),a[o]=(r/i|0)*i);a[o]===0;o--)a.pop();if(o<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=T)a.shift();for(r=1,i=a[0];i>=10;i/=10)r++;r<T&&(n-=T-r)}return s.e=n,s.d=a,s}function gi(t){return E(t=new this(t),t.e+1,this.rounding)}function vi(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function bi(t){return new this(t).sin()}function wi(t){return new this(t).sinh()}function Si(t){return new this(t).sqrt()}function Ei(t,e){return new this(t).sub(e)}function Ti(){var t=0,e=arguments,n=new this(e[t]);for(M=!1;n.s&&++t<e.length;)n=n.plus(e[t]);return M=!0,E(n,this.precision,this.rounding)}function yi(t){return new this(t).tan()}function Ci(t){return new this(t).tanh()}function Li(t){return E(t=new this(t),t.e+1,1)}h[Symbol.for("nodejs.util.inspect.custom")]=h.toString;h[Symbol.toStringTag]="Decimal";var xe=h.constructor=pn(ot);Ue=new xe(Ue);He=new xe(He);class ae{static formatToTimecode(e,n,r=!1){let i=new xe(n),o,s=i.round();o=i.mul(e).floor();let a,u,c,l,d=s.mul(86400),f=o.mod(d),m=s.mul(3600),b=s.mul(60);return l=f.divToInt(m),f=f.minus(l.mul(m)),c=f.divToInt(b),f=f.minus(c.mul(b)),u=f.divToInt(s),a=f.minus(u.mul(s)),ae.formatTimecodeText(l.toNumber(),c.toNumber(),u.toNumber(),a.toNumber(),r)}static formatTimecodeText(e,n,r,i,o=!1){let s=o?".":":";return`${ae.padZero(e)}:${ae.padZero(n)}:${ae.padZero(r)}${s}${ae.padZero(i)}`}static padZero(e){return e<10?`0${e}`:`${e}`}}class Mi{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=Mi.resolveFrameRateValueFromFraction(n);return ae.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}`}};S(Q,"timeRangePattern",/^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$/);let U=Q;class Ai{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 ut{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,a){this.type=e,this.groupId=n,this.name=r,this.isDefault=i,this.autoSelect=o,this.channels=s,this.uri=a}}class Ii{constructor(e,n){this.duration=e,this.uri=n}}class kt{constructor(){this.playlist=new Ai}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 Nt{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}
@@ -21,7 +21,7 @@ ${r.uri}`),n+=`
21
21
  `),n+=`#EXTINF:${r.duration},
22
22
  ${r.uri}
23
23
  `}),e.endList&&(n+=`#EXT-X-ENDLIST
24
- `),n}}function Oi(t,e){if(!t.some(l=>{var d;return l.streamInfo||((d=l.mediaInfo)==null?void 0:d.type)==="AUDIO"}))throw new Error("Can't create an hls manifest without audio or video source");const r=new kt().setVersion(10).setIndependentSegments(e.independentSegments);let i=t.some(({streamInfo:l,mediaInfo:d})=>l&&!d),o=!1;for(let l=0;l<t.length;l++){const{segments:d,metadata:f,streamInfo:h,mediaInfo:w}=t[l];let v=f.targetDuration;v===void 0&&(v=Math.max(...d.map(H=>H.duration),1));const L=new kt().setVersion(f.version??3).setIndependentSegments(f.independentSegments??!0).setTargetDuration(Math.ceil(v));f.programDateTime&&L.setProgramDateTime(f.programDateTime),f.playlistType&&L.setPlaylistType(f.playlistType),d.forEach(H=>L.addSegment(H,H.uri==="http://byomakase.org/non-playable-gap")),L.setEndList();const M=L.build(),F=Nt.write(M),A=new Blob([F],{type:"application/vnd.apple.mpegurl"}),N=URL.createObjectURL(A);if(h&&!w){const H=new ut(h.bandwidth,h.averageBandwidth,h.resolution,h.frameRate,N);r.addStreamInfo(H)}else if(w){const H=new xi(w.type,w.groupId??w.type.toLowerCase(),w.name??"",w.isDefault,w.autoSelect,w.channels,N);if(r.addMedia(H),!i&&w.type==="AUDIO"&&!o){const x=new ut((h==null?void 0:h.bandwidth)??0,(h==null?void 0:h.averageBandwidth)??0,null,null,N);r.addStreamInfo(x),o=!0}}}const s=r.build(),a=Nt.write(s),c=new Blob([a],{type:"application/vnd.apple.mpegurl"});return URL.createObjectURL(c)}function _i(t){return t===void 0?t:t.flatMap((e,n)=>{var a;if(t.length-1===n)return[e];const r=t.at(n+1),i=U.timeMomentToSeconds(U.parseTimeRange(e.timerange).end),o=U.timeMomentToSeconds(U.parseTimeRange(r.timerange).start);if(Math.abs(i-o)<.001)return[e];const s=U.toTimeRange(U.secondsToTimeMoment(i),U.secondsToTimeMoment(o),!0,!1);return[e,{timerange:U.formatTimeRangeExpr(s),ts_offset:e.ts_offset,get_urls:(a=e.get_urls)==null?void 0:a.map(()=>"http://byomakase.org/non-playable-gap"),object_id:"non-playable-gap"}]})}function ki(t,e,n){const r=[],i=(s,a)=>{var d;if(s.format!=="urn:x-nmos:format:video"&&s.format!=="urn:x-nmos:format:audio")return;const c=((d=_i(a))==null?void 0:d.map(f=>{var w,v;const h=U.timerangeExprDuration(f.timerange);return new Ii(h,((v=(w=f.get_urls)==null?void 0:w.at(-1))==null?void 0:v.url)??"http://byomakase.org/non-playable-gap")}))??[],u=Math.max(...c.map(f=>f.duration),1),l={playlistType:"VOD",targetDuration:Math.ceil(u),version:3,independentSegments:!0};if(s.format==="urn:x-nmos:format:video"){const h=s.essence_parameters,w={width:h.frame_width,height:h.frame_height},v=h.frame_rate?h.frame_rate.denominator?h.frame_rate.numerator/h.frame_rate.denominator:h.frame_rate.numerator:null,L=new ut(s.avg_bit_rate??0,s.avg_bit_rate??0,w,v,"");r.push({segments:c,metadata:l,streamInfo:L})}else if(s.format==="urn:x-nmos:format:audio"){const h=s.essence_parameters,w={type:"AUDIO",groupId:"audio",name:ge.isNullUndefinedOrWhitespace(s.description)?"":s.description,isDefault:!0,autoSelect:!0,channels:h.channels.toString()},v={bandwidth:s.avg_bit_rate??0,averageBandwidth:s.avg_bit_rate??0,resolution:null,frameRate:null,uri:""};r.push({segments:c,metadata:l,mediaInfo:w,streamInfo:v})}};return t.format==="urn:x-nmos:format:multi"?e==null||e.forEach(s=>{const a=n==null?void 0:n.get(s.id);a!=null&&a.length&&i(s,a)}):i(t,n==null?void 0:n.get(t.id)),Oi(r,{independentSegments:!0})}const Ni=p.memo(function({flow:e,childFlows:n,flowsSegments:r,videoLoadOptions:i,onVideoLoadedCallback:o,config:s,timerange:a,enableHotkey:c}){const u=p.useMemo(()=>ki(e,n,r),[e,r,n,a]);return p.createElement(rn,{videoUrl:u,videoLoadOptions:i,onVideoLoadedCallback:o,config:s,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 Ri=`
24
+ `),n}}function Oi(t,e){if(!t.some(l=>{var d;return l.streamInfo||((d=l.mediaInfo)==null?void 0:d.type)==="AUDIO"}))throw new Error("Can't create an hls manifest without audio or video source");const r=new kt().setVersion(10).setIndependentSegments(e.independentSegments);let i=t.some(({streamInfo:l,mediaInfo:d})=>l&&!d),o=!1;for(let l=0;l<t.length;l++){const{segments:d,metadata:f,streamInfo:m,mediaInfo:b}=t[l];let v=f.targetDuration;v===void 0&&(v=Math.max(...d.map(H=>H.duration),1));const y=new kt().setVersion(f.version??3).setIndependentSegments(f.independentSegments??!0).setTargetDuration(Math.ceil(v));f.programDateTime&&y.setProgramDateTime(f.programDateTime),f.playlistType&&y.setPlaylistType(f.playlistType),d.forEach(H=>y.addSegment(H,H.uri==="http://byomakase.org/non-playable-gap")),y.setEndList();const C=y.build(),D=Nt.write(C),A=new Blob([D],{type:"application/vnd.apple.mpegurl"}),N=URL.createObjectURL(A);if(m&&!b){const H=new ut(m.bandwidth,m.averageBandwidth,m.resolution,m.frameRate,N);r.addStreamInfo(H)}else if(b){const H=new xi(b.type,b.groupId??b.type.toLowerCase(),b.name??"",b.isDefault,b.autoSelect,b.channels,N);if(r.addMedia(H),!i&&b.type==="AUDIO"&&!o){const x=new ut((m==null?void 0:m.bandwidth)??0,(m==null?void 0:m.averageBandwidth)??0,null,null,N);r.addStreamInfo(x),o=!0}}}const s=r.build(),a=Nt.write(s),u=new Blob([a],{type:"application/vnd.apple.mpegurl"});return URL.createObjectURL(u)}function _i(t){return t===void 0?t:t.flatMap((e,n)=>{var a;if(t.length-1===n)return[e];const r=t.at(n+1),i=U.timeMomentToSeconds(U.parseTimeRange(e.timerange).end),o=U.timeMomentToSeconds(U.parseTimeRange(r.timerange).start);if(Math.abs(i-o)<.001)return[e];const s=U.toTimeRange(U.secondsToTimeMoment(i),U.secondsToTimeMoment(o),!0,!1);return[e,{timerange:U.formatTimeRangeExpr(s),ts_offset:e.ts_offset,get_urls:(a=e.get_urls)==null?void 0:a.map(()=>"http://byomakase.org/non-playable-gap"),object_id:"non-playable-gap"}]})}function ki(t,e,n){const r=[],i=Math.max(...[t,...e??[]].filter(u=>u.format==="urn:x-nmos:format:audio").map(u=>u.essence_parameters.channels)),o=[t,...e??[]].filter(u=>u.format==="urn:x-nmos:format:audio").find(u=>u.essence_parameters.channels===i),s=(u,c)=>{var m;if(u.format!=="urn:x-nmos:format:video"&&u.format!=="urn:x-nmos:format:audio")return;const l=((m=_i(c))==null?void 0:m.map(b=>{var y,C;const v=U.timerangeExprDuration(b.timerange);return new Ii(v,((C=(y=b.get_urls)==null?void 0:y.at(-1))==null?void 0:C.url)??"http://byomakase.org/non-playable-gap")}))??[],d=Math.max(...l.map(b=>b.duration),1),f={playlistType:"VOD",targetDuration:Math.ceil(d),version:3,independentSegments:!0};if(u.format==="urn:x-nmos:format:video"){const v=u.essence_parameters,y={width:v.frame_width,height:v.frame_height},C=v.frame_rate?v.frame_rate.denominator?v.frame_rate.numerator/v.frame_rate.denominator:v.frame_rate.numerator:null,D=new ut(u.avg_bit_rate??0,u.avg_bit_rate??0,y,C,"");r.push({segments:l,metadata:f,streamInfo:D})}else if(u.format==="urn:x-nmos:format:audio"){const v=u.essence_parameters,y={type:"AUDIO",groupId:"audio",name:ge.isNullUndefinedOrWhitespace(u.description)?"":u.description,isDefault:(o==null?void 0:o.id)===u.id,autoSelect:!0,channels:v.channels.toString()},C={bandwidth:u.avg_bit_rate??0,averageBandwidth:u.avg_bit_rate??0,resolution:null,frameRate:null,uri:""};r.push({segments:l,metadata:f,mediaInfo:y,streamInfo:C})}};return t.format==="urn:x-nmos:format:multi"?e==null||e.forEach(u=>{const c=n==null?void 0:n.get(u.id);c!=null&&c.length&&s(u,c)}):s(t,n==null?void 0:n.get(t.id)),Oi(r,{independentSegments:!0})}const Ni=p.memo(function({flow:e,childFlows:n,flowsSegments:r,videoLoadOptions:i,onVideoLoadedCallback:o,config:s,timerange:a,enableHotkey:u}){const c=p.useMemo(()=>ki(e,n,r),[e,r,n,a]);return p.createElement(rn,{videoUrl:c,videoLoadOptions:i,onVideoLoadedCallback:o,config:s,enableHotkeys:u})});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 Ri=`
25
25
  .omakase-time-range-selector-segments {
26
26
  display: flex;
27
27
  width: 700px;
@@ -215,5 +215,5 @@ ${r.uri}
215
215
  </defs>
216
216
  </svg>
217
217
 
218
- `,R={container:"omakase-time-range-selector-container",segments:"omakase-time-range-selector-segments",segment:"omakase-time-range-selector-segment",segmentMarker:"omakase-time-range-selector-segment-marker",segmentTick:"omakase-time-range-selector-segment-tick",segmentLabel:"omakase-time-range-selector-segment-label",firstSegmentLabel:"omakase-time-range-selector-segment-first-label",secondSegmentLabel:"omakase-time-range-selector-segment-second-label",rangeSelector:"omakase-time-range-selector-range-selector",rangeSelectorHandle:"omakase-time-range-selector-range-selector-handle",rangeSelectorDuration:"omakase-time-range-selector-range-selector-duration",buttonContainer:"omakase-time-range-selector-button-container",invisible:"omakase-time-range-selector-invisible"},De={leftHandle:"omakase-time-range-selector-range-selector-left-handle",rightHandle:"omakase-time-range-selector-range-selector-right-handle",rangeDuration:"omakase-time-range-selector-range-selector-range-duration",segments:"omakase-time-range-selector-segments"};class Rt extends HTMLElement{constructor(){super();S(this,"_container");S(this,"_rangeSelector");S(this,"_rangeSelectorLeftHandle");S(this,"_rangeSelectorRightHandle");S(this,"_rangeSelectorRangeDisplay");S(this,"_buttonContainer");S(this,"_segments");S(this,"_numberOfSegments",5);S(this,"_firstLabelIndex",0);S(this,"_initialFirstLabelIndex",0);S(this,"_labels",[]);S(this,"minWidth",10);S(this,"minValue");S(this,"maxValue");S(this,"maxRange");S(this,"segmentSize");S(this,"sliderStart");S(this,"sliderEnd");S(this,"maxWidthPercent");S(this,"onCheckmarkClickCallback");S(this,"currentStart",0);S(this,"currentEnd",100);S(this,"resetSegments",()=>{this._container.removeChild(this._segments),this._segments=this.buildSegments(this._labels.slice(this.firstLabelIndex,this.lastLabelIndex+1)),this._segments.classList.add(R.segments),this._container.append(this._segments)});S(this,"getBounds",()=>({wrapperLeft:this._container.offsetLeft,wrapperRight:this._container.offsetLeft+this._container.offsetWidth,wrapperWidth:this._container.offsetWidth,selectorLeft:this._rangeSelector.offsetLeft,selectorWidth:this._rangeSelector.offsetWidth}));S(this,"getSliderValues",()=>{const{wrapperWidth:n,selectorLeft:r,selectorWidth:i}=this.getBounds(),o=this._labels.at(this.firstLabelIndex),s=this._labels.at(this.lastLabelIndex),a=Math.round(o+r/n*(s-o)),c=Math.round(o+(r+i)/n*(s-o));return{start:a,end:c}});S(this,"getSelectorBounds",(n,r)=>{const{wrapperWidth:i}=this.getBounds(),o=this._labels.at(this.firstLabelIndex),s=this._labels.at(this.lastLabelIndex),a=Math.round((n-o)/(s-o)*i),c=Math.round((r-n)/(s-o)*i);return{selectorLeft:a,selectorWidth:c}});S(this,"initSlider",(n,r)=>{const i=this.getSelectorBounds(n,r);this._rangeSelector.style.left=i.selectorLeft.toString()+"px",this._rangeSelector.style.width=i.selectorWidth.toString()+"px",this.updateDuration()});S(this,"showButtons",()=>{const{start:n,end:r}=this.getSliderValues();n===this.currentStart&&r===this.currentEnd||this._buttonContainer.classList.remove(R.invisible)});S(this,"hideButtons",()=>{this._buttonContainer.classList.add(R.invisible)});S(this,"updateDuration",()=>{const{start:n,end:r}=this.getSliderValues(),i=r-n;this._rangeSelectorRangeDisplay.textContent=Re(i)});S(this,"onXclick",()=>{this.firstLabelIndex=this._initialFirstLabelIndex,this.resetSegments();const n=this.getSelectorBounds(this.currentStart,this.currentEnd);this._rangeSelector.style.left=n.selectorLeft.toString()+"px",this._rangeSelector.style.width=n.selectorWidth.toString()+"px",this.updateDuration(),this.hideButtons()});S(this,"onCheckmarkClick",()=>{const{start:n,end:r}=this.getSliderValues();this.currentStart=n,this.currentEnd=r,this._initialFirstLabelIndex=this.firstLabelIndex,this.updateDuration(),this.hideButtons(),this.onCheckmarkClickCallback!==void 0&&this.onCheckmarkClickCallback(n,r)});S(this,"onMouseDownRight",n=>{n.preventDefault();const r=n.clientX,{selectorWidth:i,wrapperWidth:o,selectorLeft:s}=this.getBounds();let a=null,c=null;const u=d=>{let f=d.clientX-r,h=Math.max(this.minWidth,i+f);const w=Math.min(o*this.maxWidthPercent,o-s),v=h>w,L=performance.now();v?a===null&&(a=L,c=window.setTimeout(()=>{this.outOfBoundsCallback(!0),c=window.setInterval(()=>this.outOfBoundsCallback(!0),400)},500)):(c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null),h=Math.min(h,w),this._rangeSelector.style.width=`${h}px`,this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",l),c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null};document.addEventListener("mousemove",u),document.addEventListener("mouseup",l)});S(this,"onMouseDownLeft",n=>{n.preventDefault();const r=n.clientX,{selectorLeft:i,selectorWidth:o,wrapperWidth:s}=this.getBounds();let a=null,c=null;const u=d=>{let f=d.clientX-r,h=i+f;const w=h<0,v=performance.now();w?a===null&&(a=v,c=window.setTimeout(()=>{this.outOfBoundsCallback(!1),c=window.setInterval(()=>this.outOfBoundsCallback(!1),400)},500)):(c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null),h<0&&(f=-i,h=0);let L=Math.min(Math.max(this.minWidth,o-f),s);h+L>s&&(h=s-L),L>this.minWidth&&L<s*this.maxWidthPercent&&(this._rangeSelector.style.left=`${h}px`,this._rangeSelector.style.width=`${L}px`),this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",l),c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null};document.addEventListener("mousemove",u),document.addEventListener("mouseup",l)});S(this,"outOfBoundsCallback",n=>{n?this.firstLabelIndex+=1:this.firstLabelIndex-=1,this.resetSegments()});S(this,"onMouseDownDrag",n=>{if(n.target instanceof HTMLElement&&n.target.classList.contains(R.rangeSelectorHandle))return;n.preventDefault();const r=n.clientX,{selectorLeft:i,selectorWidth:o,wrapperWidth:s}=this.getBounds();let a=null,c=null;const u=d=>{let f=d.clientX-r,h=i+f;const w=s-o,v=h<0||h>w,L=performance.now();if(v){if(a===null){const M=h>w;a=L,c=window.setTimeout(()=>{this.outOfBoundsCallback(M),c=window.setInterval(()=>this.outOfBoundsCallback(M),400)},500)}}else c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null;h=Math.max(0,Math.min(h,w)),this._rangeSelector.style.left=`${h}px`,this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",l),c!==null&&(clearTimeout(c),clearInterval(c))};document.addEventListener("mousemove",u),document.addEventListener("mouseup",l)})}set numberOfSegments(n){n>2&&(this._numberOfSegments=n)}get numberOfSegments(){return this._numberOfSegments}static get observedAttributes(){return["minValue","maxValue","maxRange","segmentSize","sliderStart","sliderEnd","numberOfSegments"]}get firstLabelIndex(){return this._firstLabelIndex}set firstLabelIndex(n){if(n+this._numberOfSegments+1>=this._labels.length){this._firstLabelIndex=this._labels.length-1-this.numberOfSegments;return}if(n<0){this._firstLabelIndex=0;return}this._firstLabelIndex=n}get lastLabelIndex(){return this._firstLabelIndex+this._numberOfSegments}connectedCallback(){if(this.minValue=Number.parseInt(this.getAttribute("minValue")??"NaN"),this.maxValue=Number.parseInt(this.getAttribute("maxValue")??"NaN"),this.maxRange=Number.parseInt(this.getAttribute("maxRange")??"NaN"),this.segmentSize=Number.parseInt(this.getAttribute("segmentSize")??"NaN"),this.getAttribute("numberOfSegments")){const l=Number.parseInt(this.getAttribute("numberOfSegments"));if(Number.isNaN(l))throw new Error("Invalid atribute value");this._numberOfSegments=l}if(Number.isNaN(this.minValue)||Number.isNaN(this.maxValue)||Number.isNaN(this.maxRange)||Number.isNaN(this.segmentSize))throw new Error("Invalid attribute values.");const n=this.maxValue-this.minValue;if(n<this.numberOfSegments*this.segmentSize&&(this.segmentSize=n/this.numberOfSegments),this.maxWidthPercent=this.maxRange>this.numberOfSegments*this.segmentSize?1:this.maxRange/(this.numberOfSegments*this.segmentSize),this._labels=this.calculateLabels(),this.maxValue<this.minValue)throw new Error("Max value is lesser than min value");let r,i;if(this.getAttribute("sliderStart")&&this.getAttribute("sliderEnd")){if(r=Number.parseFloat(this.getAttribute("sliderStart")),i=Number.parseFloat(this.getAttribute("sliderEnd")),r>i)throw new Error("Slider start is bigger than slider end");if(r<this.minValue)throw new Error("Slider start is smaller than minimal value");i>this.maxValue&&(i=this.maxValue),this.currentStart=r,this.currentEnd=i}else r=this.minValue,i=this.segmentSize;this.resolveInitialSegment(r,i),this._container=document.createElement("div"),this._container.classList.add(R.container);const o=document.createElement("style");o.textContent=Ri,this._container.append(o),this._buttonContainer=document.createElement("div"),this._buttonContainer.classList.add(R.buttonContainer,R.invisible);const s=this.createButtonSvg(Di),a=this.createButtonSvg(Fi);s.onclick=this.onCheckmarkClick,a.onclick=this.onXclick,this._buttonContainer.append(s,a),this._container.append(this._buttonContainer),this._rangeSelector=document.createElement("div"),this._rangeSelector.classList.add(R.rangeSelector),this._rangeSelectorLeftHandle=document.createElement("div"),this._rangeSelectorLeftHandle.classList.add(R.rangeSelectorHandle),this._rangeSelectorLeftHandle.id=De.leftHandle,this._rangeSelectorRightHandle=document.createElement("div"),this._rangeSelectorRightHandle.classList.add(R.rangeSelectorHandle),this._rangeSelectorRightHandle.id=De.rightHandle,this._rangeSelectorRangeDisplay=document.createElement("div"),this._rangeSelectorRangeDisplay.classList.add(R.rangeSelectorDuration),this._rangeSelectorRangeDisplay.id=De.rangeDuration,this._rangeSelector.append(this._rangeSelectorLeftHandle,this._rangeSelectorRangeDisplay,this._rangeSelectorRightHandle),this._container.append(this._rangeSelector),this._segments=this.buildSegments(this._labels.slice(this.firstLabelIndex,this.lastLabelIndex+1)),this._segments.id=De.segments,this._segments.classList.add(R.segments),this._container.append(this._segments),this._rangeSelectorLeftHandle.addEventListener("mousedown",this.onMouseDownLeft),this._rangeSelectorRightHandle.addEventListener("mousedown",this.onMouseDownRight),this._rangeSelector.addEventListener("mousedown",this.onMouseDownDrag),this.append(this._container),this.initSlider(r,i);const{start:c,end:u}=this.getSliderValues();this.currentStart=c,this.currentEnd=u,this.updateDuration()}resolveInitialSegment(n,r){const i=this._numberOfSegments*this.segmentSize,o=r-n,s=this.maxValue-this.minValue,a=n-this.minValue,c=Math.ceil(s/this.segmentSize);let u=Math.floor(a/s*c);u+=Math.floor((i-o)/this.segmentSize);const d=u+Math.ceil(o/this.segmentSize)-this._numberOfSegments;this.firstLabelIndex=d,this._initialFirstLabelIndex=d}createButtonSvg(n){const r=document.createElement("button");return r.innerHTML=n,r}calculateLabels(){const n=this.minValue,r=this.maxValue,i=Math.floor((this.maxValue-this.minValue)/this.segmentSize)-1,o=[n];let s=this.minValue;for(let a=0;a<i;a++)s+=this.segmentSize,o.push(s);return o.push(r),o}buildSegments(n){const r=document.createElement("div");n.slice(0,-2).forEach(u=>{const l=document.createElement("div");l.classList.add(R.segment);const d=document.createElement("div");d.classList.add(R.segmentMarker);const f=document.createElement("div");f.classList.add(R.segmentTick);const h=document.createElement("div");h.classList.add(R.segmentLabel),h.innerHTML=Re(u),l.append(d,f,h),r.append(l)});const i=document.createElement("div");i.classList.add(R.segment);const o=document.createElement("div");o.classList.add(R.segmentMarker);const s=document.createElement("div");s.classList.add(R.segmentTick);const a=document.createElement("div");a.classList.add(R.segmentLabel,R.firstSegmentLabel),a.innerHTML=Re(n.at(-2));const c=document.createElement("div");return c.classList.add(R.segmentLabel,R.secondSegmentLabel),c.innerHTML=Re(n.at(-1)),i.append(o,s,a,c),r.append(i),r}}const Dt="omakase-time-range-selector-react-div",Vi=({timeRange:t,maxTimeRange:e,numberOfSegments:n,segmentSize:r,maxSliderRange:i,onCheckmarkClickCallback:o})=>(customElements.get("omakase-time-range-selector")||customElements.define("omakase-time-range-selector",Rt),p.useEffect(()=>{var h;const s=U.parseTimeRange(e),a=U.timeMomentToSeconds(s.start),c=U.timeMomentToSeconds(s.end),u=U.parseTimeRange(t),l=U.timeMomentToSeconds(u.start),d=U.timeMomentToSeconds(u.end),f=new Rt;f.setAttribute("minValue",a.toString()),f.setAttribute("maxValue",c.toString()),f.setAttribute("maxRange",i.toString()),f.setAttribute("segmentSize",r.toString()),f.setAttribute("numberOfSegments",n.toString()),f.setAttribute("sliderStart",l.toString()),f.setAttribute("sliderEnd",d.toString()),f.onCheckmarkClickCallback=o,(h=document.getElementById(Dt))==null||h.append(f)},[]),p.createElement("div",{id:Dt})),Bi=p.memo(({omakasePlayer:t,config:e,onCreateMarkerListCallback:n})=>(p.useEffect(()=>{const r=t.createMarkerList(e).subscribe({next:i=>{n==null||n(i)}});return()=>{r.unsubscribe()}},[e.source]),p.createElement("div",{id:e.markerListHTMLElementId})));exports.AudioFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformataudio:"urn:x-nmos:format:audio"}})(exports.AudioFlow||(exports.AudioFlow={}));const Pi={Video:"urn:x-nmos:format:video",Audio:"urn:x-nmos:format:audio",Data:"urn:x-nmos:format:data",Multi:"urn:x-nmos:format:multi"};exports.DataFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformatdata:"urn:x-nmos:format:data"}})(exports.DataFlow||(exports.DataFlow={}));exports.DeletionRequest=void 0;(t=>{t.StatusEnum={Created:"created",Started:"started",Done:"done",Error:"error"}})(exports.DeletionRequest||(exports.DeletionRequest={}));exports.MediaBucketObjectStorePreInner=void 0;(t=>{t.ActionEnum={CreateBucket:"create_bucket"}})(exports.MediaBucketObjectStorePreInner||(exports.MediaBucketObjectStorePreInner={}));exports.MultiEssenceFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformatmulti:"urn:x-nmos:format:multi"}})(exports.MultiEssenceFlow||(exports.MultiEssenceFlow={}));exports.ServiceMediaStore=void 0;(t=>{t.TypeEnum={HttpObjectStore:"http_object_store"}})(exports.ServiceMediaStore||(exports.ServiceMediaStore={}));exports.Source=void 0;(t=>{t.FormatEnum={Video:"urn:x-nmos:format:video",Audio:"urn:x-nmos:format:audio",Data:"urn:x-nmos:format:data",Multi:"urn:x-nmos:format:multi"}})(exports.Source||(exports.Source={}));exports.UncompressedAudioParameters=void 0;(t=>{t.UncTypeEnum={Interleaved:"interleaved",Planar:"planar",Pairs:"pairs"}})(exports.UncompressedAudioParameters||(exports.UncompressedAudioParameters={}));exports.UncompressedVideoParameters=void 0;(t=>{t.UncTypeEnum={Planar:"planar",Yuyv:"YUYV",Uyvy:"UYVY",Ayuv:"AYUV",V210:"v210",V216:"v216",Rgb:"RGB",Rgbx:"RGBx",XRgb:"xRGB",Bgrx:"BGRx",XBgr:"xBGR",Rgba:"RGBA",Argb:"ARGB",Bgra:"BGRA",Abgr:"ABGR",Alpha:"alpha"}})(exports.UncompressedVideoParameters||(exports.UncompressedVideoParameters={}));exports.VideoFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformatvideo:"urn:x-nmos:format:video"}})(exports.VideoFlow||(exports.VideoFlow={}));exports.VideoFlowEssenceParameters=void 0;(t=>{t.InterlaceModeEnum={Progressive:"progressive",InterlacedTff:"interlaced_tff",InterlacedBff:"interlaced_bff",InterlacedPsf:"interlaced_psf"},t.ColorspaceEnum={Bt601:"BT601",Bt709:"BT709",Bt2020:"BT2020",Bt2100:"BT2100"},t.TransferCharacteristicEnum={Sdr:"SDR",Hlg:"HLG",Pq:"PQ"},t.ComponentTypeEnum={YcbCr:"YCbCr",Rgb:"RGB"}})(exports.VideoFlowEssenceParameters||(exports.VideoFlowEssenceParameters={}));exports.ImageFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformatdata:"urn:x-tam:format:image"}})(exports.ImageFlow||(exports.ImageFlow={}));exports.Contentformat=Pi;exports.OmakaseMarkerListComponent=Bi;exports.OmakasePlayerComponent=rn;exports.OmakasePlayerTimelineBuilder=En;exports.OmakasePlayerTimelineComponent=wr;exports.OmakasePlayerTimelineControlsToolbar=kr;exports.OmakaseTamsPlayerComponent=Ni;exports.OmakaseTimeRangePicker=Vi;exports.TimeRangeUtil=U;exports.TimecodeUtil=ae;
218
+ `,R={container:"omakase-time-range-selector-container",segments:"omakase-time-range-selector-segments",segment:"omakase-time-range-selector-segment",segmentMarker:"omakase-time-range-selector-segment-marker",segmentTick:"omakase-time-range-selector-segment-tick",segmentLabel:"omakase-time-range-selector-segment-label",firstSegmentLabel:"omakase-time-range-selector-segment-first-label",secondSegmentLabel:"omakase-time-range-selector-segment-second-label",rangeSelector:"omakase-time-range-selector-range-selector",rangeSelectorHandle:"omakase-time-range-selector-range-selector-handle",rangeSelectorDuration:"omakase-time-range-selector-range-selector-duration",buttonContainer:"omakase-time-range-selector-button-container",invisible:"omakase-time-range-selector-invisible"},De={leftHandle:"omakase-time-range-selector-range-selector-left-handle",rightHandle:"omakase-time-range-selector-range-selector-right-handle",rangeDuration:"omakase-time-range-selector-range-selector-range-duration",segments:"omakase-time-range-selector-segments"};class Rt extends HTMLElement{constructor(){super();S(this,"_container");S(this,"_rangeSelector");S(this,"_rangeSelectorLeftHandle");S(this,"_rangeSelectorRightHandle");S(this,"_rangeSelectorRangeDisplay");S(this,"_buttonContainer");S(this,"_segments");S(this,"_numberOfSegments",5);S(this,"_firstLabelIndex",0);S(this,"_initialFirstLabelIndex",0);S(this,"_labels",[]);S(this,"minWidth",10);S(this,"minValue");S(this,"maxValue");S(this,"maxRange");S(this,"segmentSize");S(this,"sliderStart");S(this,"sliderEnd");S(this,"maxWidthPercent");S(this,"onCheckmarkClickCallback");S(this,"currentStart",0);S(this,"currentEnd",100);S(this,"resetSegments",()=>{this._container.removeChild(this._segments),this._segments=this.buildSegments(this._labels.slice(this.firstLabelIndex,this.lastLabelIndex+1)),this._segments.classList.add(R.segments),this._container.append(this._segments)});S(this,"getBounds",()=>({wrapperLeft:this._container.offsetLeft,wrapperRight:this._container.offsetLeft+this._container.offsetWidth,wrapperWidth:this._container.offsetWidth,selectorLeft:this._rangeSelector.offsetLeft,selectorWidth:this._rangeSelector.offsetWidth}));S(this,"getSliderValues",()=>{const{wrapperWidth:n,selectorLeft:r,selectorWidth:i}=this.getBounds(),o=this._labels.at(this.firstLabelIndex),s=this._labels.at(this.lastLabelIndex),a=Math.round(o+r/n*(s-o)),u=Math.round(o+(r+i)/n*(s-o));return{start:a,end:u}});S(this,"getSelectorBounds",(n,r)=>{const{wrapperWidth:i}=this.getBounds(),o=this._labels.at(this.firstLabelIndex),s=this._labels.at(this.lastLabelIndex),a=Math.round((n-o)/(s-o)*i),u=Math.round((r-n)/(s-o)*i);return{selectorLeft:a,selectorWidth:u}});S(this,"initSlider",(n,r)=>{const i=this.getSelectorBounds(n,r);this._rangeSelector.style.left=i.selectorLeft.toString()+"px",this._rangeSelector.style.width=i.selectorWidth.toString()+"px",this.updateDuration()});S(this,"showButtons",()=>{const{start:n,end:r}=this.getSliderValues();n===this.currentStart&&r===this.currentEnd||this._buttonContainer.classList.remove(R.invisible)});S(this,"hideButtons",()=>{this._buttonContainer.classList.add(R.invisible)});S(this,"updateDuration",()=>{const{start:n,end:r}=this.getSliderValues(),i=r-n;this._rangeSelectorRangeDisplay.textContent=Re(i)});S(this,"onXclick",()=>{this.firstLabelIndex=this._initialFirstLabelIndex,this.resetSegments();const n=this.getSelectorBounds(this.currentStart,this.currentEnd);this._rangeSelector.style.left=n.selectorLeft.toString()+"px",this._rangeSelector.style.width=n.selectorWidth.toString()+"px",this.updateDuration(),this.hideButtons()});S(this,"onCheckmarkClick",()=>{const{start:n,end:r}=this.getSliderValues();this.currentStart=n,this.currentEnd=r,this._initialFirstLabelIndex=this.firstLabelIndex,this.updateDuration(),this.hideButtons(),this.onCheckmarkClickCallback!==void 0&&this.onCheckmarkClickCallback(n,r)});S(this,"onMouseDownRight",n=>{n.preventDefault();const r=n.clientX,{selectorWidth:i,wrapperWidth:o,selectorLeft:s}=this.getBounds();let a=null,u=null;const c=d=>{let f=d.clientX-r,m=Math.max(this.minWidth,i+f);const b=Math.min(o*this.maxWidthPercent,o-s),v=m>b,y=performance.now();v?a===null&&(a=y,u=window.setTimeout(()=>{this.outOfBoundsCallback(!0),u=window.setInterval(()=>this.outOfBoundsCallback(!0),400)},500)):(u!==null&&(clearTimeout(u),clearInterval(u),u=null),a=null),m=Math.min(m,b),this._rangeSelector.style.width=`${m}px`,this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",l),u!==null&&(clearTimeout(u),clearInterval(u),u=null),a=null};document.addEventListener("mousemove",c),document.addEventListener("mouseup",l)});S(this,"onMouseDownLeft",n=>{n.preventDefault();const r=n.clientX,{selectorLeft:i,selectorWidth:o,wrapperWidth:s}=this.getBounds();let a=null,u=null;const c=d=>{let f=d.clientX-r,m=i+f;const b=m<0,v=performance.now();b?a===null&&(a=v,u=window.setTimeout(()=>{this.outOfBoundsCallback(!1),u=window.setInterval(()=>this.outOfBoundsCallback(!1),400)},500)):(u!==null&&(clearTimeout(u),clearInterval(u),u=null),a=null),m<0&&(f=-i,m=0);let y=Math.min(Math.max(this.minWidth,o-f),s);m+y>s&&(m=s-y),y>this.minWidth&&y<s*this.maxWidthPercent&&(this._rangeSelector.style.left=`${m}px`,this._rangeSelector.style.width=`${y}px`),this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",l),u!==null&&(clearTimeout(u),clearInterval(u),u=null),a=null};document.addEventListener("mousemove",c),document.addEventListener("mouseup",l)});S(this,"outOfBoundsCallback",n=>{n?this.firstLabelIndex+=1:this.firstLabelIndex-=1,this.resetSegments()});S(this,"onMouseDownDrag",n=>{if(n.target instanceof HTMLElement&&n.target.classList.contains(R.rangeSelectorHandle))return;n.preventDefault();const r=n.clientX,{selectorLeft:i,selectorWidth:o,wrapperWidth:s}=this.getBounds();let a=null,u=null;const c=d=>{let f=d.clientX-r,m=i+f;const b=s-o,v=m<0||m>b,y=performance.now();if(v){if(a===null){const C=m>b;a=y,u=window.setTimeout(()=>{this.outOfBoundsCallback(C),u=window.setInterval(()=>this.outOfBoundsCallback(C),400)},500)}}else u!==null&&(clearTimeout(u),clearInterval(u),u=null),a=null;m=Math.max(0,Math.min(m,b)),this._rangeSelector.style.left=`${m}px`,this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",l),u!==null&&(clearTimeout(u),clearInterval(u))};document.addEventListener("mousemove",c),document.addEventListener("mouseup",l)})}set numberOfSegments(n){n>2&&(this._numberOfSegments=n)}get numberOfSegments(){return this._numberOfSegments}static get observedAttributes(){return["minValue","maxValue","maxRange","segmentSize","sliderStart","sliderEnd","numberOfSegments"]}get firstLabelIndex(){return this._firstLabelIndex}set firstLabelIndex(n){if(n+this._numberOfSegments+1>=this._labels.length){this._firstLabelIndex=this._labels.length-1-this.numberOfSegments;return}if(n<0){this._firstLabelIndex=0;return}this._firstLabelIndex=n}get lastLabelIndex(){return this._firstLabelIndex+this._numberOfSegments}connectedCallback(){if(this.minValue=Number.parseInt(this.getAttribute("minValue")??"NaN"),this.maxValue=Number.parseInt(this.getAttribute("maxValue")??"NaN"),this.maxRange=Number.parseInt(this.getAttribute("maxRange")??"NaN"),this.segmentSize=Number.parseInt(this.getAttribute("segmentSize")??"NaN"),this.getAttribute("numberOfSegments")){const l=Number.parseInt(this.getAttribute("numberOfSegments"));if(Number.isNaN(l))throw new Error("Invalid atribute value");this._numberOfSegments=l}if(Number.isNaN(this.minValue)||Number.isNaN(this.maxValue)||Number.isNaN(this.maxRange)||Number.isNaN(this.segmentSize))throw new Error("Invalid attribute values.");const n=this.maxValue-this.minValue;if(n<this.numberOfSegments*this.segmentSize&&(this.segmentSize=n/this.numberOfSegments),this.maxWidthPercent=this.maxRange>this.numberOfSegments*this.segmentSize?1:this.maxRange/(this.numberOfSegments*this.segmentSize),this._labels=this.calculateLabels(),this.maxValue<this.minValue)throw new Error("Max value is lesser than min value");let r,i;if(this.getAttribute("sliderStart")&&this.getAttribute("sliderEnd")){if(r=Number.parseFloat(this.getAttribute("sliderStart")),i=Number.parseFloat(this.getAttribute("sliderEnd")),r>i)throw new Error("Slider start is bigger than slider end");if(r<this.minValue)throw new Error("Slider start is smaller than minimal value");i>this.maxValue&&(i=this.maxValue),this.currentStart=r,this.currentEnd=i}else r=this.minValue,i=this.segmentSize;this.resolveInitialSegment(r,i),this._container=document.createElement("div"),this._container.classList.add(R.container);const o=document.createElement("style");o.textContent=Ri,this._container.append(o),this._buttonContainer=document.createElement("div"),this._buttonContainer.classList.add(R.buttonContainer,R.invisible);const s=this.createButtonSvg(Di),a=this.createButtonSvg(Fi);s.onclick=this.onCheckmarkClick,a.onclick=this.onXclick,this._buttonContainer.append(s,a),this._container.append(this._buttonContainer),this._rangeSelector=document.createElement("div"),this._rangeSelector.classList.add(R.rangeSelector),this._rangeSelectorLeftHandle=document.createElement("div"),this._rangeSelectorLeftHandle.classList.add(R.rangeSelectorHandle),this._rangeSelectorLeftHandle.id=De.leftHandle,this._rangeSelectorRightHandle=document.createElement("div"),this._rangeSelectorRightHandle.classList.add(R.rangeSelectorHandle),this._rangeSelectorRightHandle.id=De.rightHandle,this._rangeSelectorRangeDisplay=document.createElement("div"),this._rangeSelectorRangeDisplay.classList.add(R.rangeSelectorDuration),this._rangeSelectorRangeDisplay.id=De.rangeDuration,this._rangeSelector.append(this._rangeSelectorLeftHandle,this._rangeSelectorRangeDisplay,this._rangeSelectorRightHandle),this._container.append(this._rangeSelector),this._segments=this.buildSegments(this._labels.slice(this.firstLabelIndex,this.lastLabelIndex+1)),this._segments.id=De.segments,this._segments.classList.add(R.segments),this._container.append(this._segments),this._rangeSelectorLeftHandle.addEventListener("mousedown",this.onMouseDownLeft),this._rangeSelectorRightHandle.addEventListener("mousedown",this.onMouseDownRight),this._rangeSelector.addEventListener("mousedown",this.onMouseDownDrag),this.append(this._container),this.initSlider(r,i);const{start:u,end:c}=this.getSliderValues();this.currentStart=u,this.currentEnd=c,this.updateDuration()}resolveInitialSegment(n,r){const i=this._numberOfSegments*this.segmentSize,o=r-n,s=this.maxValue-this.minValue,a=n-this.minValue,u=Math.ceil(s/this.segmentSize);let c=Math.floor(a/s*u);c+=Math.floor((i-o)/this.segmentSize);const d=c+Math.ceil(o/this.segmentSize)-this._numberOfSegments;this.firstLabelIndex=d,this._initialFirstLabelIndex=d}createButtonSvg(n){const r=document.createElement("button");return r.innerHTML=n,r}calculateLabels(){const n=this.minValue,r=this.maxValue,i=Math.floor((this.maxValue-this.minValue)/this.segmentSize)-1,o=[n];let s=this.minValue;for(let a=0;a<i;a++)s+=this.segmentSize,o.push(s);return o.push(r),o}buildSegments(n){const r=document.createElement("div");n.slice(0,-2).forEach(c=>{const l=document.createElement("div");l.classList.add(R.segment);const d=document.createElement("div");d.classList.add(R.segmentMarker);const f=document.createElement("div");f.classList.add(R.segmentTick);const m=document.createElement("div");m.classList.add(R.segmentLabel),m.innerHTML=Re(c),l.append(d,f,m),r.append(l)});const i=document.createElement("div");i.classList.add(R.segment);const o=document.createElement("div");o.classList.add(R.segmentMarker);const s=document.createElement("div");s.classList.add(R.segmentTick);const a=document.createElement("div");a.classList.add(R.segmentLabel,R.firstSegmentLabel),a.innerHTML=Re(n.at(-2));const u=document.createElement("div");return u.classList.add(R.segmentLabel,R.secondSegmentLabel),u.innerHTML=Re(n.at(-1)),i.append(o,s,a,u),r.append(i),r}}const Dt="omakase-time-range-selector-react-div",Vi=({timeRange:t,maxTimeRange:e,numberOfSegments:n,segmentSize:r,maxSliderRange:i,onCheckmarkClickCallback:o})=>(customElements.get("omakase-time-range-selector")||customElements.define("omakase-time-range-selector",Rt),p.useEffect(()=>{var m;const s=U.parseTimeRange(e),a=U.timeMomentToSeconds(s.start),u=U.timeMomentToSeconds(s.end),c=U.parseTimeRange(t),l=U.timeMomentToSeconds(c.start),d=U.timeMomentToSeconds(c.end),f=new Rt;f.setAttribute("minValue",a.toString()),f.setAttribute("maxValue",u.toString()),f.setAttribute("maxRange",i.toString()),f.setAttribute("segmentSize",r.toString()),f.setAttribute("numberOfSegments",n.toString()),f.setAttribute("sliderStart",l.toString()),f.setAttribute("sliderEnd",d.toString()),f.onCheckmarkClickCallback=o,(m=document.getElementById(Dt))==null||m.append(f)},[]),p.createElement("div",{id:Dt})),Bi=p.memo(({omakasePlayer:t,config:e,onCreateMarkerListCallback:n})=>(p.useEffect(()=>{const r=t.createMarkerList(e).subscribe({next:i=>{n==null||n(i)}});return()=>{r.unsubscribe()}},[e.source]),p.createElement("div",{id:e.markerListHTMLElementId})));exports.AudioFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformataudio:"urn:x-nmos:format:audio"}})(exports.AudioFlow||(exports.AudioFlow={}));const Pi={Video:"urn:x-nmos:format:video",Audio:"urn:x-nmos:format:audio",Data:"urn:x-nmos:format:data",Multi:"urn:x-nmos:format:multi"};exports.DataFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformatdata:"urn:x-nmos:format:data"}})(exports.DataFlow||(exports.DataFlow={}));exports.DeletionRequest=void 0;(t=>{t.StatusEnum={Created:"created",Started:"started",Done:"done",Error:"error"}})(exports.DeletionRequest||(exports.DeletionRequest={}));exports.MediaBucketObjectStorePreInner=void 0;(t=>{t.ActionEnum={CreateBucket:"create_bucket"}})(exports.MediaBucketObjectStorePreInner||(exports.MediaBucketObjectStorePreInner={}));exports.MultiEssenceFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformatmulti:"urn:x-nmos:format:multi"}})(exports.MultiEssenceFlow||(exports.MultiEssenceFlow={}));exports.ServiceMediaStore=void 0;(t=>{t.TypeEnum={HttpObjectStore:"http_object_store"}})(exports.ServiceMediaStore||(exports.ServiceMediaStore={}));exports.Source=void 0;(t=>{t.FormatEnum={Video:"urn:x-nmos:format:video",Audio:"urn:x-nmos:format:audio",Data:"urn:x-nmos:format:data",Multi:"urn:x-nmos:format:multi"}})(exports.Source||(exports.Source={}));exports.UncompressedAudioParameters=void 0;(t=>{t.UncTypeEnum={Interleaved:"interleaved",Planar:"planar",Pairs:"pairs"}})(exports.UncompressedAudioParameters||(exports.UncompressedAudioParameters={}));exports.UncompressedVideoParameters=void 0;(t=>{t.UncTypeEnum={Planar:"planar",Yuyv:"YUYV",Uyvy:"UYVY",Ayuv:"AYUV",V210:"v210",V216:"v216",Rgb:"RGB",Rgbx:"RGBx",XRgb:"xRGB",Bgrx:"BGRx",XBgr:"xBGR",Rgba:"RGBA",Argb:"ARGB",Bgra:"BGRA",Abgr:"ABGR",Alpha:"alpha"}})(exports.UncompressedVideoParameters||(exports.UncompressedVideoParameters={}));exports.VideoFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformatvideo:"urn:x-nmos:format:video"}})(exports.VideoFlow||(exports.VideoFlow={}));exports.VideoFlowEssenceParameters=void 0;(t=>{t.InterlaceModeEnum={Progressive:"progressive",InterlacedTff:"interlaced_tff",InterlacedBff:"interlaced_bff",InterlacedPsf:"interlaced_psf"},t.ColorspaceEnum={Bt601:"BT601",Bt709:"BT709",Bt2020:"BT2020",Bt2100:"BT2100"},t.TransferCharacteristicEnum={Sdr:"SDR",Hlg:"HLG",Pq:"PQ"},t.ComponentTypeEnum={YcbCr:"YCbCr",Rgb:"RGB"}})(exports.VideoFlowEssenceParameters||(exports.VideoFlowEssenceParameters={}));exports.ImageFlow=void 0;(t=>{t.FormatEnum={UrnxNmosformatdata:"urn:x-tam:format:image"}})(exports.ImageFlow||(exports.ImageFlow={}));exports.Contentformat=Pi;exports.OmakaseMarkerListComponent=Bi;exports.OmakasePlayerComponent=rn;exports.OmakasePlayerTimelineBuilder=En;exports.OmakasePlayerTimelineComponent=br;exports.OmakasePlayerTimelineControlsToolbar=kr;exports.OmakaseTamsPlayerComponent=Ni;exports.OmakaseTimeRangePicker=Vi;exports.TimeRangeUtil=U;exports.TimecodeUtil=ae;
219
219
  //# sourceMappingURL=index.cjs.js.map