/*******************************************************************************
 * This source code is the proprietary property of Bitmovin, Inc. Unauthorized
 * copying, distribution, or use of this code, or any portion thereof, is
 * strictly prohibited. © 2026 Bitmovin, Inc. All rights reserved. This
 * source code is subject to the terms and conditions of the accompanying
 * license agreement.
 *
 * Bitmovin Player X Version 10.2.0-beta.12
 *******************************************************************************/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["native-presentation"]=t():(e.bitmovin=e.bitmovin||{},e.bitmovin.playerx=e.bitmovin.playerx||{},e.bitmovin.playerx["native-presentation"]=t())}(self,(()=>(()=>{"use strict";var e={97085:(e,t)=>{function r(e,t,r){const o=t;return o._name=e,{onAdd:o,dependencies:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.createPackage=void 0,t.createPackage=r},91270:(e,t)=>{function r(e,t){const r=t;return r._name=e,r}function o(e){return(...t)=>{const[o,a]=e(...t);return r(o,a)}}function a(e){var t;return null!==(t=e._name)&&void 0!==t?t:e.name}Object.defineProperty(t,"__esModule",{value:!0}),t.getTaskName=t.createTaskClosure=t.createTask=void 0,t.createTask=r,t.createTaskClosure=o,t.getTaskName=a},14809:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreExportNames=void 0,function(e){e.Utils="utils",e.Constants="constants",e.CoreEffects="core-effects",e.CoreStateAtoms="core-state-atoms"}(t.CoreExportNames||(t.CoreExportNames={}))},54472:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NativePresentationState=void 0,t.NativePresentationState="native-presentation-state"},74447:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NativePresentationPackage=void 0;const o=r(97085),a=r(14809),s=r(7269),n=r(54472),i=r(41586);t.NativePresentationPackage=(0,o.createPackage)("native-presentation",((e,t)=>{const{StateEffectFactory:r,EventListenerEffectFactory:o}=t.registry.get(a.CoreExportNames.CoreEffects),n=t.using(r,o),{state:c}=n.effects,u=n.registry.get(s.SourceExportNames.SourceState),d=(0,i.VideoElementNativeSubscriber)();c.subscribe(n,u.video,d)}),[a.CoreExportNames.Utils,a.CoreExportNames.Constants,s.SourceExportNames.SourceState,a.CoreExportNames.CoreStateAtoms,a.CoreExportNames.CoreEffects,n.NativePresentationState]),t.default=t.NativePresentationPackage},67418:(e,t)=>{function r(e,t){if(e.src){t.log("Revoking MSE src object URL");try{URL.revokeObjectURL(e.src)}catch(e){t.warn("Revoking MSE src object URL failed:",e)}}for(;e.firstChild;)e.firstChild.remove();e.setAttribute("src",""),e.removeAttribute("src"),e.load()}Object.defineProperty(t,"__esModule",{value:!0}),t.resetVideoSource=void 0,t.resetVideoSource=r},41586:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VideoElementNativeSubscriber=void 0;const o=r(91270),a=r(14809),s=r(7269),n=r(54472),i=r(67418);function c(e,t){const r=document.createElement("source");return r.src=e,t&&(r.type=t),r}const u=(0,o.createTaskClosure)((e=>["timeupdate-subscriber",(t,r)=>{const{state:o}=r.effects,a=r.registry.get(s.SourceExportNames.SourceState);Number.isFinite(e.duration)&&o.dispatch(a.playback.duration.setValue,e.duration),o.dispatch(a.playback.playhead.setPosition,e.currentTime)}]));t.VideoElementNativeSubscriber=(0,o.createTaskClosure)((()=>["native-video-element-subscriber",(e,t)=>{const{registry:r,effects:o,abortSignal:s}=t,{loop:d,abortable:l,events:f}=o,p=t.effects.logger,v=r.get(n.NativePresentationState),{ResourceType:m}=r.get(a.CoreExportNames.Constants);if(void 0===e.element)return p.log("Cannot set up native presentation task - no video element"),l((e=>e()));const b=e.element,S=v.resource;if((0,i.resetVideoSource)(b,p),void 0===S)throw new Error("No native-compatible resource found");if(p.log(`Setting native video source: ${S.url}`),S.type===m.Hls){const e=c(S.url);b.appendChild(e),b.load()}else b.src=S.url,b.load();return f.subscribe(t,b,"timeupdate",u(b)),d(s)}]))},7269:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SourceExportNames=void 0,function(e){e.CreateSourceStateAtom="create-source-state-atom",e.CreateSourceReference="create-source-reference",e.SourceReferences="source-references",e.SourceState="source-state-atom"}(t.SourceExportNames||(t.SourceExportNames={}))}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}return r(74447)})()));