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