@ekolabs/eko-gallery-react 4.0.7-user-manual-release-1157015.0 → 4.0.7
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
CHANGED
|
@@ -179,14 +179,13 @@ The eko gallery dispatches events through the `onEvent` handler. Use this to tra
|
|
|
179
179
|
|
|
180
180
|
#### Event Types
|
|
181
181
|
|
|
182
|
-
| Event
|
|
183
|
-
|
|
184
|
-
| `galleryinit`
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `swipe` | Fired when the user swipes within the interactive video |
|
|
182
|
+
| Event | Description |
|
|
183
|
+
|---------------------|-------------------------------------------------------------------|
|
|
184
|
+
| `galleryinit` | Fired when the gallery component initializes |
|
|
185
|
+
| `galleryloaded` | Fired when the interactive smart gallery is fully loaded |
|
|
186
|
+
| `activeitemchanged` | Fired when the active gallery item changes |
|
|
187
|
+
| `click` | Fired when the user click on a non-interactive part of the video |
|
|
188
|
+
| `swipe` | Fired when the user swipes within the interactive video |
|
|
190
189
|
|
|
191
190
|
#### Event Payloads
|
|
192
191
|
|
|
@@ -199,20 +198,12 @@ Fired when the displayed gallery item changes (via thumbnail click, carousel scr
|
|
|
199
198
|
| `index` | Number | The zero-based index of the newly active item |
|
|
200
199
|
| `step` | Number | The zero-based index of the newly active item's step/sub-item |
|
|
201
200
|
|
|
202
|
-
##### `
|
|
201
|
+
##### `click` event
|
|
203
202
|
|
|
204
|
-
| Property
|
|
205
|
-
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
| `elementtype` | String | The type of element (e.g., `start`, `next button`, `choice button`) |
|
|
209
|
-
| `elementname` | String | A textual representation of the element |
|
|
210
|
-
|
|
211
|
-
Common `elementid` values from the gallery:
|
|
212
|
-
- `thumbnail-{index}` - Thumbnail navigation item clicked
|
|
213
|
-
- `nav` - Navigation strip scrolled
|
|
214
|
-
- `carousel` - Main carousel scrolled
|
|
215
|
-
- `eko-nav-arrow-prev` / `eko-nav-arrow-next` - Navigation arrows clicked
|
|
203
|
+
| Property | Type | Description |
|
|
204
|
+
|---------------|--------|----------------------------|
|
|
205
|
+
| `x` | Number | x value of the click event |
|
|
206
|
+
| `y` | Number | y value of the click event |
|
|
216
207
|
|
|
217
208
|
##### `swipe` event
|
|
218
209
|
|
|
@@ -230,17 +221,14 @@ const onEkoGalleryEvent = useCallback((event, data) => {
|
|
|
230
221
|
case 'galleryinit':
|
|
231
222
|
console.log('Gallery initialized');
|
|
232
223
|
break;
|
|
233
|
-
case 'gallerycoverdisplayed':
|
|
234
|
-
console.log('Cover image loaded');
|
|
235
|
-
break;
|
|
236
224
|
case 'galleryloaded':
|
|
237
225
|
console.log('Interactive gallery ready');
|
|
238
226
|
break;
|
|
239
227
|
case 'activeitemchanged':
|
|
240
228
|
console.log(`Active item changed to: ${data.index} ${data.step}`);
|
|
241
229
|
break;
|
|
242
|
-
case '
|
|
243
|
-
console.log(`
|
|
230
|
+
case 'click':
|
|
231
|
+
console.log(`Click: ${data}`);
|
|
244
232
|
break;
|
|
245
233
|
case 'swipe':
|
|
246
234
|
console.log('User swiped in interactive video', data);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,a as t,b as n,c as o,d as i}from"./index.esm.js";import"react";const r="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},l=r&&r.performance,s=l&&"function"==typeof l.now?()=>l.now():()=>Date.now(),a=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize"}),d=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),c=`11px ${d}`,u=`12px ${d}`;function f(e){return"number"==typeof e&&Number.isFinite(e)}function p(e){return f(e)&&e>0}function y(e){return f(e)?Math.min(1,Math.max(0,e)):0}function m(e,t=3){return f(e)?e.toFixed(t):String(e)}function h(e,t){const n=Number(e),o=Number(t);return!Number.isFinite(n)||!Number.isFinite(o)||n<=0||o<=0?"n/a":`${Math.round(n)}x${Math.round(o)}`}var g=new WeakMap,v=new WeakMap,b=new WeakMap,w=new WeakMap,E=new WeakMap,x=new WeakMap,I=new WeakMap,C=new WeakSet;class A{constructor({width:i=220,height:l=48,windowMs:s=6e4,maxValue:a=60,autoScale:d=!1,formatValue:c}={}){e(this,C),t(this,g,void 0),t(this,v,void 0),t(this,b,[]),t(this,w,void 0),t(this,E,void 0),t(this,x,void 0),t(this,I,void 0);const u=null==r?void 0:r.document;if(!u||"function"!=typeof u.createElement)throw new Error("Debug overlay graph requires document.createElement.");n(g,this,u.createElement("canvas")),o(g,this).width=i,o(g,this).height=l,o(g,this).style.width=`${i}px`,o(g,this).style.height=`${l}px`,o(g,this).style.borderRadius="6px",o(g,this).style.background="#111",n(v,this,o(g,this).getContext("2d")),n(w,this,s),n(E,this,a),n(x,this,!!d),n(I,this,"function"==typeof c?c:null)}get element(){return o(g,this)}push(e,t){if(o(g,this)&&o(v,this)&&Number.isFinite(e)&&Number.isFinite(t)){for(o(b,this).push({t:t,v:e});o(b,this).length&&t-o(b,this)[0].t>o(w,this);)o(b,this).shift();i(C,this,k).call(this)}}dispose(){n(b,this,[]),n(v,this,null),n(g,this,null)}}function k(){const e=o(v,this),t=o(g,this);if(!e||!t)return;const n=t.width,i=t.height;if(!n||!i)return;if(e.clearRect(0,0,n,i),e.fillStyle="#111",e.fillRect(0,0,n,i),!o(b,this).length)return;const r=o(b,this)[0].t;if(!(o(b,this)[o(b,this).length-1].t>r))return;const l=o(x,this)?o(b,this).reduce(((e,t)=>t.v>e?t.v:e),0):o(E,this),s=l>0?l:o(E,this);e.strokeStyle="#0f0",e.lineWidth=2,e.beginPath();for(let t=0;t<o(b,this).length;t+=1){const l=o(b,this)[t],a=(l.t-r)/o(w,this)*n,d=i-(s>0?Math.min(1,Math.max(0,l.v/s)):0)*i;0===t?e.moveTo(a,d):e.lineTo(a,d)}e.stroke();const a=o(b,this).length?o(b,this)[o(b,this).length-1]:null,d=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===d)return;const u=o(I,this)?o(I,this).call(this,d):d.toFixed(1);if("string"!=typeof u||!u)return;e.font=c,e.textAlign="right",e.textBaseline="top";const f=e.measureText(u),p=Math.ceil(f.width)+8,y=n-p-2;e.fillStyle="rgba(0,0,0,0.55)",e.fillRect(y,2,p,14),e.fillStyle="#fff",e.fillText(u,n-2-4,4)}const N=new Intl.NumberFormat("en-US");function T(e,t){const n=(null==e?void 0:e.trackId)||"",o=(null==t?void 0:t.trackId)||"";if(n!==o)return n<o?-1:1;const i=(null==e?void 0:e.nodeId)||"",r=(null==t?void 0:t.nodeId)||"";if(i!==r)return i<r?-1:1;const l=(null==e?void 0:e.segmentId)||"",s=(null==t?void 0:t.segmentId)||"";return l!==s?l<s?-1:1:("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)-("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)}function R(e,t){for(e.push(t);e.length&&t-e[0]>1e3;)e.shift();if(e.length<2)return 0;const n=e[e.length-1]-e[0];return n<=0?0:1e3*(e.length-1)/n}function S(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId),o=null==n?void 0:n.tracks;if(!Array.isArray(o))return;const i=o.find((e=>(null==e?void 0:e.id)===t.trackId)),r=null==i?void 0:i.segments;return Array.isArray(r)?r.find((e=>(null==e?void 0:e.id)===t.segmentId)):void 0}function D(e,t){var n;const o=S(e,t);return(null==o?void 0:o.abrDecision)||(null==o||null===(n=o.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function L(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${N.format(Math.round(t))}kbps`}function M(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${N.format(Math.round(t/1e3))}kbps`}function P(e,t=3){const n=Number(e);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t}):String(e)}function $(e,t){var n;if("function"!=typeof e||!t)return;const o=e(t.nodeId),i=null==o||null===(n=o.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof i&&i?i:void 0}function F(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function B(e,t){const n=function(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,o]=t[e],i=Number(n),r=Number(o);if(Number.isFinite(i)&&Number.isFinite(r)&&i>0&&r>0)return{width:i,height:r}}}(null==t?void 0:t.frame)||{},o=Number.isFinite(null==t?void 0:t.width)?t.width:n.width,i=Number.isFinite(null==t?void 0:t.height)?t.height:n.height,r=null===(l=S(e,t))||void 0===l?void 0:l.chosenRepresentation;var l;if(!r)return f(o)&&f(i)?{width:o,height:i}:null;const s=r.width||r.codedWidth||o,a=r.height||r.codedHeight||i;return{id:r.id,codecs:r.codecs,mime:r.mime,bandwidth:r.bandwidth,width:s,height:a}}function O(e){const t=Number(e);if(Number.isFinite(t)&&!(t<=0))return t/1e3}function _(e,t){const n=Number(null==e?void 0:e.bandwidthKbps),o=Number(null==t?void 0:t.bandwidthKbps),i=Number.isFinite(n)&&n>0,r=Number.isFinite(o)&&o>0;if(i&&r&&n!==o)return n-o;if(i!==r)return i?-1:1;const l=(null==e?void 0:e.id)||"",s=(null==t?void 0:t.id)||"";return l===s?0:l<s?-1:1}function V(e,t,n,o){const i=[];if(Array.isArray(null==o?void 0:o.availableRepresentations)&&o.availableRepresentations.forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;if(!t)return;const n=Number(null==e?void 0:e.bandwidthKbps);i.push({id:t,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!i.length){const n=S(e,t);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;t&&i.push({id:t,bandwidthKbps:O(null==e?void 0:e.bandwidth)})}))}!i.length&&(null==n?void 0:n.id)&&i.push({id:n.id,bandwidthKbps:O(n.bandwidth)});const r=new Map;return i.forEach((e=>{const t=null==e?void 0:e.id;t&&!r.has(t)&&r.set(t,e)})),Array.from(r.values()).sort(_)}const W=1024,U=1048576,q=1073741824;function j(e){return f(e)?e>=1e3?`${m(e/1e3,1)} Mbps`:`${m(e,1)} kbps`:"n/a"}function H({downloadSpeed:e,downloadEvents:t}={}){const n=r.document,o="function"==typeof(null==e?void 0:e.getKbps)?e.getKbps():void 0;let i=0;const{metricsRow:l,setInitial:s,setTotal:a}=function(e){const t=e.createElement("div");t.style.display="grid",t.style.gridTemplateColumns="1fr 1fr",t.style.gap="8px",t.style.font=u;const n=e.createElement("div"),o=e.createElement("div");return t.appendChild(n),t.appendChild(o),{metricsRow:t,setInitial:e=>{n.textContent=`initial=${j(e)}`},setTotal:e=>{var t;o.textContent="total="+(f(t=e)?t<W?`${Math.round(t)} B`:t<U?`${m(t/W,1)} KB`:t<q?`${m(t/U,2)} MB`:`${m(t/q,2)} GB`:"n/a")}}}(n),{graphWrap:d,speedGraph:p}=function(e,t){const n=e.createElement("div");n.style.marginTop="10px";const o=e.createElement("div");o.textContent="download speed",o.style.font=c,o.style.opacity="0.9";const i=f(t)&&t>0?t:1,r=new A({autoScale:!0,maxValue:i,formatValue:j});return n.appendChild(o),n.appendChild(r.element),{graphWrap:n,speedGraph:r}}(n,o);s(o),a(i);const y=e=>{const t=Number(null==e?void 0:e.kbps);Number.isFinite(t)&&p.push(t,null!=r&&r.performance&&"function"==typeof r.performance.now?r.performance.now():Date.now())},h=e=>{const t=Number(null==e?void 0:e.bytes);Number.isFinite(t)&&(i+=t,a(i))};return e&&"function"==typeof e.on&&e.on("download:speed",y),t&&"function"==typeof t.on&&t.on("download:sample",h),{id:"downloads",title:"Downloads",render:e=>{e.appendChild(l),e.appendChild(d)},dispose:()=>{e&&"function"==typeof e.off&&e.off("download:speed",y),t&&"function"==typeof t.off&&t.off("download:sample",h),p.dispose()}}}function K(e){return f(e)?m(e,3):"n/a"}function z(){return null!=r&&r.performance&&"function"==typeof r.performance.now?r.performance.now():Date.now()}var Y,G,Q,X,J={exports:{}},Z=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}((Y||(Y=1,Q=J.exports,X=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],i={},r=null;function l(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(){for(var n=this.getLevel(),i=0;i<o.length;i++){var r=o[i];this[r]=i<n?e:this.methodFactory(r,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function d(e){return function(){typeof console!==t&&(a.call(this),this[e].apply(this,arguments))}}function c(o,i,r){return"debug"===(a=o)&&(a="log"),typeof console!==t&&("trace"===a&&n?s:void 0!==console[a]?l(console,a):void 0!==console.log?l(console,"log"):e)||d.apply(this,arguments);var a}function u(e,n){var l,s,d,u=this,f="loglevel";function p(){var e;if(typeof window!==t&&f){try{e=window.localStorage[f]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,o=encodeURIComponent(f),i=n.indexOf(o+"=");-1!==i&&(e=/^([^;]+)/.exec(n.slice(i+o.length+1))[1])}catch(e){}return void 0===u.levels[e]&&(e=void 0),e}}function y(e){var t=e;if("string"==typeof t&&void 0!==u.levels[t.toUpperCase()]&&(t=u.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=u.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?f+=":"+e:"symbol"==typeof e&&(f=void 0),u.name=e,u.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},u.methodFactory=n||c,u.getLevel=function(){return null!=d?d:null!=s?s:l},u.setLevel=function(e,n){return d=y(e),!1!==n&&function(e){var n=(o[e]||"silent").toUpperCase();if(typeof window!==t&&f){try{return void(window.localStorage[f]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(f)+"="+n+";"}catch(e){}}}(d),a.call(u)},u.setDefaultLevel=function(e){s=y(e),p()||u.setLevel(e,!1)},u.resetLevel=function(){d=null,function(){if(typeof window!==t&&f){try{window.localStorage.removeItem(f)}catch(e){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),a.call(u)},u.enableAll=function(e){u.setLevel(u.levels.TRACE,e)},u.disableAll=function(e){u.setLevel(u.levels.SILENT,e)},u.rebuild=function(){if(r!==u&&(l=y(r.getLevel())),a.call(u),r===u)for(var e in i)i[e].rebuild()},l=y(r?r.getLevel():"WARN");var m=p();null!=m&&(d=y(m)),a.call(u)}(r=new u).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=i[e];return t||(t=i[e]=new u(e,r.methodFactory)),t};var f=typeof window!==t?window.log:void 0;return r.noConflict=function(){return typeof window!==t&&window.log===r&&(window.log=f),r},r.getLoggers=function(){return i},r.default=r,r},(G=J).exports?G.exports=X():Q.log=X()),J.exports));const ee=()=>{},te=["trace","log","debug","info","warn","error","getLevel","setLevel"],ne=["trace","debug","info","warn","error","silent"],oe={TRACE:"color: white; background-color: magenta;",DEBUG:"color: black; background-color: turquoise;",INFO:"color: white; background-color: green;",WARN:"color: black; background-color: yellow;",ERROR:"color: white; background-color: red;"},ie="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let re={level:"trace",appName:""},le=[];const se="object"==typeof ie&&ie.performance&&"function"==typeof ie.performance.now?ie.performance.now.bind(ie.performance):Date.now.bind(Date),ae=e=>e&&"string"==typeof e?e.toLowerCase().trim():"",de=(()=>{try{const e=new URLSearchParams(document.location.search),t=[].concat(e.getAll("log")).concat(e.getAll("ekolog")).concat(e.getAll("ekologger")).join(",").split(",");if(0===t.length)return{};let n={};return t.forEach((e=>{const[t,o]=e.split(":");n[ae(t)]=ae(o)||"trace"})),n}catch(e){return{}}})(),ce=(e,t="")=>{const n=ae(e),o=Z.getLogger(n);if(o.__ekologger)return o.__ekologger;t||de[n]||de["*"]||(o.__noExplicitLevel=!0);const i=o.methodFactory;o.methodFactory=(t,n,o)=>{const r=i(t,n,o),l=t.toUpperCase();return(...t)=>{r(`[${((e,t=3)=>(se()/1e3).toFixed(t))()}] %c[${l}] ${re.appName?`[${re.appName}] `:""}[${e}]`,oe[l],...t)}},t=de[n]||de["*"]||t||re.level,o.setLevel(t,!1);const r=(...e)=>o.log(...e);return te.forEach((e=>{r[e]=(...t)=>(le.forEach((n=>{n[e](...t)})),o[e](...t))})),o.__ekologger=r,r};ce.setDefaults=({appName:e="",level:t})=>{e&&"string"==typeof e&&(re.appName=e),(t=ae(t))&&ne.includes(t)&&(re.level=t,Object.values(Z.getLoggers()).filter((e=>e.__noExplicitLevel)).forEach((e=>e.setLevel(re.level,!1))))},ce.installDriver=e=>{const t={...te.reduce(((t,n)=>(t[n]="function"==typeof(null==e?void 0:e[n])?e[n]:ee,t)),{})};le.push(t)},ce("download","warn");Object.freeze(Object.entries({disabledTracks:{default:["audio"],targetPaths:["NodeRepository.disabledTracks"]},muted:{default:!1,targetPaths:["AudioPlaybackManager.muted"]},volume:{default:1,targetPaths:["AudioPlaybackManager.volume"]},encodeProfile:{default:null,targetPaths:["AssetsDeliveryService.profile"]},forceVideoCodec:{default:void 0,targetPaths:["NodeRepository.forceVideoCodec"]},forceImageFallback:{default:!1,targetPaths:["NodeRepository.forceImageFallback"]},mediaHostRewriteMap:{default:{"storageeko.s3.amazonaws.com":"https://storage.eko.com","studioz-post.s3.amazonaws.com":"https://studioz-post.eko.com"},targetPaths:["NodeRepository.mediaHostRewriteMap"]},playbackRate:{default:1,targetPaths:["PlaybackClock.playbackRate"]},initialKbps:{default:"auto",targetPaths:["DownloadSpeed.initialKbps"]},defaultRenderParams:{default:void 0,targetPaths:["Renderer.defaultRenderParams"]},maxBufferedVideoFrames:{default:24,targetPaths:["Timeline.maxBufferedVideoFrames"]},waitingBufferAheadSeconds:{default:3,targetPaths:["Timeline.waitingBufferAheadSeconds"]},abrStrategy:{default:"auto",targetPaths:["ABRSelector.abrStrategy"]},segmentEvictionEnabled:{default:!0,targetPaths:["SegmentEvictionCoordinator.enabled"]},segmentEvictionBufferBehindSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferBehindSeconds"]},segmentEvictionBufferAheadSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferAheadSeconds"]},segmentEvictionMaxRetainedBytes:{default:52428800,targetPaths:["SegmentEvictionCoordinator.maxRetainedBytes"]},autoplay:{default:!0,targetPaths:["Idle.autoplay"]},autoPauseOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoPauseOnVisibilityChange"]},autoResumeOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoResumeOnVisibilityChange"]},trackingEnabled:{default:!0,targetPaths:["Tracker.trackingEnabled"]}}).reduce(((e,[t,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(e[t]=n.default),e)),{})),ce("config","warn");const ue=18,fe="rgba(83,170,255,0.9)",pe={pending:"rgba(255,255,255,0.55)",resolving:"rgba(255,200,87,0.9)",ready:"rgba(102,214,141,0.9)",failed:"rgba(255,92,92,0.9)",missing:"rgba(160,160,160,0.9)"},ye={border:"1px solid rgba(102,214,141,0.28)",background:"rgba(102,214,141,0.16)",color:"rgba(167,240,185,1)"},me={border:"1px solid rgba(255,200,87,0.3)",background:"rgba(255,200,87,0.16)",color:"rgba(255,227,171,1)"},he="noop",ge="seek",ve="copy-node-id",be="copy-node-context",we="copy-source-video-url",Ee=[{value:he,label:"NOOP"},{value:ge,label:"Seek"},{value:ve,label:"Copy Node ID"},{value:be,label:"Copy Node Context"},{value:we,label:"Copy Source Video URL"}],xe=["type","url","mimeType","assetId","assetRevision","encodeProfile","duration","width","height"],Ie=["id","url","mime","codecs","baseCodec","bandwidth","timescale","sizeBytes","width","height","frameRate","segStart","segDuration"];function Ce(e,t){if(p(null==e?void 0:e.nodeDurationOverride))return e.nodeDurationOverride;if("function"!=typeof t)return null;const n=t(null==e?void 0:e.nodeId),o=null==n?void 0:n.duration;return p(o)?o:null}function Ae(e){const t=Number(null==e?void 0:e.duration);return t===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:p(t)?t:null}function ke(e){return e===Number.POSITIVE_INFINITY}function Ne(e){return f(e)?String(e):""}function Te(e,t=[]){return t.reduce(((t,n)=>(void 0!==(null==e?void 0:e[n])&&(t[n]=e[n]),t)),{})}function Re(e){const t=Ee.find((t=>t.value===e));return t?t.value:he}function Se(e){return e?"string"==typeof(null==e?void 0:e.message)&&e.message?e.message:"string"==typeof e&&e?e:null:null}function De(e){return e&&f(e.start)&&f(e.end)?{start:e.start,end:e.end}:null}function Le(e){return e?Te(e,Ie):null}function Me(e,t){const n="string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:"",o="function"==typeof t&&n?t(n):null,i=(s=null==o?void 0:o.manifestRef)?"string"==typeof s?s:Te(s,xe):null,r=i&&"object"==typeof i?i.assetId:void 0,l={placement:{placementId:"string"==typeof(null==e?void 0:e.placementId)?e.placementId:void 0,nodeId:n||void 0,offset:f(null==e?void 0:e.offset)?e.offset:void 0,duration:Ce(e,t),offsetPending:!0===(null==e?void 0:e.offsetPending),nodeOffsetOverride:f(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:void 0,nodeDurationOverride:f(null==e?void 0:e.nodeDurationOverride)?e.nodeDurationOverride:void 0},node:o?{id:o.id||n||void 0,state:"string"==typeof o.state?o.state:void 0,duration:f(o.duration)?o.duration:null,mainTrackId:"string"==typeof o.mainTrackId?o.mainTrackId:void 0,assetId:"string"==typeof r?r:void 0,manifestRef:i,buffered:De(o.buffered),imageFallbackActive:!0===o.imageFallbackActive,retainedByteLength:f(o.retainedByteLength)?o.retainedByteLength:0,children:Array.isArray(o.children)?o.children.map((e=>({nodeId:"string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:void 0,weight:f(null==e?void 0:e.weight)?e.weight:void 0}))):[],tracks:Array.isArray(o.tracks)?o.tracks.map((e=>function(e){return e?{id:e.id,type:e.type,offset:f(e.offset)?e.offset:0,duration:f(e.duration)?e.duration:null,endTime:f(e.endTime)?e.endTime:null,buffered:De(e.buffered),segments:Array.isArray(e.segments)?e.segments.map((e=>function(e){if(!e)return null;const t={id:e.id,isInit:!0===e.isInit,offset:f(e.offset)?e.offset:0,duration:f(e.duration)?e.duration:0,bufferedRatio:f(e.bufferedRatio)?e.bufferedRatio:0,retainedByteLength:f(e.retainedByteLength)?e.retainedByteLength:0,isLoaded:!0===e.isLoaded,loadAttempts:f(Number(e.loadAttempts))?Number(e.loadAttempts):0,appliedFilters:Array.isArray(e.appliedFilters)?e.appliedFilters.slice():[],chosenRepresentation:Le(e.chosenRepresentation),representations:Array.isArray(e.representations)?e.representations.map((e=>Le(e))).filter(Boolean):[]},n=Se(e.loadError);return n&&(t.loadError=n),t}(e))).filter(Boolean):[]}:null}(e))).filter(Boolean):[]}:null};var s;if(o){const e=Number(o.manifestLoadAttempts);f(e)&&e>0&&(l.node.manifestLoadAttempts=e);const t=Se(o.manifestLoadError);t&&(l.node.manifestLoadError=t);const n=Se(o.error);n&&(l.node.error=n)}return l}function Pe(e=[],t=[],n){return`${function(e=[],t){return Array.isArray(e)&&e.length?e.map((e=>e?["string"==typeof e.placementId?e.placementId:"","string"==typeof e.nodeId?e.nodeId:"",Ne(e.offset),Ne(Ce(e,t)),!0===e.offsetPending?"1":"0",Ne(e.nodeOffsetOverride),Ne(e.nodeDurationOverride)].join("|"):"null")).join(";"):""}(e,n)}::${function(e=[]){return Array.isArray(e)&&e.length?e.map((e=>{if(!e)return"null";const t="string"==typeof e.renderPlacementId?e.renderPlacementId:"",n="string"==typeof e.type?e.type:"",o=Ne(e.offset),i=Ae(e);return[t,n,o,i===Number.POSITIVE_INFINITY?"inf":Ne(i),!0===e.offsetPending?"1":"0"].join("|")})).join(";"):""}(t)}`}function $e(e=[],t){if(!Array.isArray(e)||!e.length)return!1;for(let n=0;n<e.length;n+=1){const o=e[n];if(!o||!0===o.offsetPending)continue;if(p(o.nodeDurationOverride))continue;if("function"!=typeof t)return!0;const i=t(o.nodeId);if(!p(null==i?void 0:i.duration))return!0}return!1}function Fe(e=[]){return!(!Array.isArray(e)||!e.length)&&e.some((e=>!0===(null==e?void 0:e.offsetPending)))}function Be(e=[],t=[]){return Fe(e)||Fe(t)}function Oe(e,t=[],n){if(!e||!Array.isArray(t)||!t.length)return;const o=e.querySelector('[data-segment-boundary="true"]');t.forEach((t=>{if(!t||!f(t.startRatio)||!f(t.endRatio))return;const i=y(t.startRatio),l=y(t.endRatio);if(!(l>i))return;const s=r.document.createElement("div");s.dataset.bufferedSegment="true",s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.left=100*i+"%",s.style.width=100*(l-i)+"%",s.style.background=n,s.style.opacity="0.8",s.style.pointerEvents="none",s.style.zIndex="0",o?e.insertBefore(s,o):e.appendChild(s)}))}function _e(e,t){if(!e)return;const n=e.querySelector('[data-active-highlight="true"]');if(!t)return void(n&&n.remove());if(n)return;const o=r.document.createElement("div");o.dataset.activeHighlight="true",o.style.position="absolute",o.style.top="0",o.style.bottom="0",o.style.left="0",o.style.right="0",o.style.border="1px solid rgba(255,255,255,0.9)",o.style.borderRadius="4px",o.style.pointerEvents="none",o.style.zIndex="1",e.appendChild(o)}function Ve({timeline:e,getNode:t,assetsDeliveryServiceUrl:n}={}){const o=null==r?void 0:r.document;if(!o||"function"!=typeof o.createElement)throw new Error("Debug overlay timeline tab requires document.createElement.");const i=o.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.position="relative";const l=o.createElement("div");l.style.position="absolute",l.style.display="none",l.style.pointerEvents="none",l.style.zIndex="2",l.style.padding="4px 6px",l.style.borderRadius="6px",l.style.background="rgba(0,0,0,0.8)",l.style.border="1px solid rgba(255,255,255,0.2)",l.style.color="#fff",l.style.font=c,l.style.maxWidth="220px",l.style.whiteSpace="nowrap",l.style.overflow="hidden",l.style.textOverflow="ellipsis";const s=o.createElement("div");s.dataset.timelineHoverDetails="true",s.style.position="absolute",s.style.display="none",s.style.pointerEvents="none",s.style.zIndex="3",s.style.padding="6px 8px",s.style.borderRadius="8px",s.style.background="rgba(0,0,0,0.85)",s.style.border="1px solid rgba(255,255,255,0.25)",s.style.color="#fff",s.style.font=c,s.style.maxWidth="260px",s.style.flexDirection="column",s.style.gap="6px";const a=o.createElement("div");a.style.font=u,a.style.opacity="0.95";const d=o.createElement("div");d.style.font=c,d.style.opacity="0.7",d.style.textTransform="uppercase",d.style.marginTop="4px";const h=o.createElement("div");h.style.display="flex",h.style.flexDirection="column",h.style.gap="4px",s.appendChild(a),s.appendChild(d),s.appendChild(h);const g=o.createElement("div");g.style.display="flex",g.style.justifyContent="space-between",g.style.alignItems="center";const v=o.createElement("div");v.style.display="flex",v.style.alignItems="baseline",v.style.gap="10px";const b=o.createElement("div");b.style.font=u,b.style.opacity="0.9";const w=o.createElement("div");w.style.font=c,w.style.opacity="0.65",v.appendChild(b),v.appendChild(w);const E=o.createElement("label");E.style.display="inline-flex",E.style.alignItems="center",E.style.gap="6px",E.style.font=c;const x=o.createElement("span");x.textContent="Click action";const I=o.createElement("select");I.style.font=c,I.style.background="rgba(255,255,255,0.08)",I.style.color="#fff",I.style.border="1px solid rgba(255,255,255,0.2)",I.style.borderRadius="4px",I.style.padding="2px 6px",I.style.minHeight="24px",I.style.cursor="pointer",Ee.forEach((e=>{const t=o.createElement("option");t.value=e.value,t.textContent=e.label,I.appendChild(t)})),I.value=he;const C=o.createElement("div");C.dataset.timelineCopyStatus="true",C.setAttribute("role","status"),C.setAttribute("aria-live","polite"),C.style.display="none",C.style.position="absolute",C.style.right="0",C.style.bottom="calc(100% + 4px)",C.style.alignItems="center",C.style.padding="1px 6px",C.style.borderRadius="999px",C.style.border=ye.border,C.style.background=ye.background,C.style.color=ye.color,C.style.font=c,C.style.whiteSpace="nowrap",C.style.pointerEvents="none",C.style.zIndex="4",C.style.opacity="0",C.style.transform="translateY(2px)",C.style.transition=["opacity 180ms ease","transform 180ms ease"].join(", "),E.appendChild(x),E.appendChild(I);const A=o.createElement("div");A.style.display="flex",A.style.alignItems="center",A.style.position="relative",A.style.flexShrink="0",A.appendChild(C),A.appendChild(E),g.appendChild(v),g.appendChild(A);const k=o.createElement("div");function N(e,t,{alignTop:n=!1}={}){const i=o.createElement("div");i.style.display="grid",i.style.gridTemplateColumns="64px 1fr",i.style.alignItems=n?"start":"center",i.style.gap="8px";const r=o.createElement("div");r.textContent=e,r.style.font=c,r.style.opacity="0.8",n&&(r.style.paddingTop="2px");const l=o.createElement("div");l.style.position="relative",l.style.borderRadius="6px",l.style.background="rgba(255,255,255,0.08)",l.style.overflow="hidden",t&&(l.dataset.timelineLane=t);const s=o.createElement("div");return s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.width="2px",s.style.background="rgba(255,255,255,0.8)",l.appendChild(s),i.appendChild(r),i.appendChild(l),k.appendChild(i),{track:l,indicator:s}}k.style.display="grid",k.style.gridTemplateRows="auto auto",k.style.gap="8px",i.appendChild(g),i.appendChild(k),i.appendChild(l),i.appendChild(s);const T=N("Nodes","nodes",{alignTop:!0}),R=N("Render","render");let S=[],D=[],L=0,M=he,P=1;const $=new Map,F=new Map,B=new Map,O=new Map;let _=new Set,V=null,W=!1,U="",q=!1,j=0,H=0,K=null,z=null,Y=null;function G(e){for(;e.childNodes.length>1;)e.removeChild(e.lastChild)}function Q(){K&&(clearTimeout(K),K=null)}function X(){z&&(((null==r?void 0:r.clearTimeout)||clearTimeout)(z),z=null)}function J(){Y&&(((null==r?void 0:r.clearTimeout)||clearTimeout)(Y),Y=null)}function Z(){C.style.display="none",C.style.opacity="0",C.style.transform="translateY(2px)",C.textContent=""}function ee(){return!!q||!!e&&(Array.isArray(e.placements)||Array.isArray(e.renderPlacements))}function te(){if(!e)return!1;const t=Array.isArray(e.placements),n=Array.isArray(e.renderPlacements);if(!t&&!n)return!1;const o=t?e.placements:[],i=n?e.renderPlacements:[];return(o.length!==j||i.length!==H)&&(Fe(o,i),!0)}function ne(){if(!q)return!1;const e=Pe(S,D,t);return e!==U&&(U=e,Te(),Le(),!0)}function oe(){ee()?K=function({shouldSchedule:e,isScheduled:t,intervalMs:n,onTick:o}){return t?null:setTimeout(o,n)}({shouldSchedule:!0,isScheduled:!!K,intervalMs:q?100:250,onTick:()=>{K=null,ee()&&(te()||ne()||oe())}}):Q()}function ie(e,t){const n=t>0?L/t:0;e.style.left=100*y(n)+"%",e.style.transform="translateX(-1px)"}function re(){l.style.display="none"}function le(){X(),J(),Z()}function se(e,{tone:t="success"}={}){if(!e)return void le();X(),J(),function(e="success"){const t=function(e="success"){return"warning"===e?me:ye}(e);C.style.border=t.border,C.style.background=t.background,C.style.color=t.color}(t),C.textContent=e,C.style.display="inline-flex",C.style.opacity="0",C.style.transform="translateY(2px)","function"==typeof C.getBoundingClientRect&&C.getBoundingClientRect(),C.style.opacity="1",C.style.transform="translateY(0)";const n=(null==r?void 0:r.setTimeout)||setTimeout;z=n((()=>{z=null,function(){X(),J(),C.style.opacity="0",C.style.transform="translateY(-2px)";const e=(null==r?void 0:r.setTimeout)||setTimeout;Y=e((()=>{Y=null,Z()}),180)}()}),1800)}function ae(e,t){if(!e)return void re();l.textContent=e,l.style.display="block";const n=i.getBoundingClientRect(),o=l.getBoundingClientRect(),r=((null==t?void 0:t.clientX)||0)-n.left+12,s=((null==t?void 0:t.clientY)||0)-n.top+12,a=n.width-o.width-8,d=n.height-o.height-8,c=Math.max(8,Math.min(r,a)),u=Math.max(8,Math.min(s,d));l.style.left=`${c}px`,l.style.top=`${u}px`}function de(){s.style.display="none"}function ce(e,n){const r="function"==typeof t&&e?t(e):null,l=Array.isArray(null==r?void 0:r.children)?r.children:[];if(!l.length)return void de();if(a.textContent=e,d.textContent="children",function(){for(;h.firstChild;)h.removeChild(h.firstChild)}(),l.forEach((e=>{e&&e.nodeId&&h.appendChild(function(e){const n=o.createElement("div");n.style.display="grid",n.style.gridTemplateColumns="10px 1fr auto auto",n.style.alignItems="center",n.style.gap="6px";const i="string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:"",r=p(null==e?void 0:e.weight)?e.weight:1,l=function(e){if(!e||"function"!=typeof t)return"missing";const n=t(e);if(!n)return"missing";const o="string"==typeof n.state?n.state.trim().toLowerCase():"";return"pending"===o||"resolving"===o||"ready"===o||"failed"===o?o:"pending"}(i);n.dataset.childId=i,n.dataset.childStatus=l;const s=o.createElement("span");s.dataset.statusIndicator=l,s.style.width="8px",s.style.height="8px",s.style.borderRadius="999px",s.style.background=pe[l]||pe.pending,s.style.display="inline-block";const a=o.createElement("span");a.textContent=i||"unknown",a.style.overflow="hidden",a.style.textOverflow="ellipsis",a.style.whiteSpace="nowrap";const d=o.createElement("span");d.textContent=`w=${m(r,0)}`,d.style.opacity="0.8";const c=o.createElement("span");return c.textContent=l,c.style.opacity="0.75",n.appendChild(s),n.appendChild(a),n.appendChild(d),n.appendChild(c),n}(e))})),!h.childNodes.length)return void de();s.style.display="flex";const c=i.getBoundingClientRect(),u=s.getBoundingClientRect(),f=((null==n?void 0:n.clientX)||0)-c.left+12,y=((null==n?void 0:n.clientY)||0)-c.top+12,g=c.width-u.width-8,v=c.height-u.height-8,b=Math.max(8,Math.min(f,g)),w=Math.max(8,Math.min(y,v));s.style.left=`${b}px`,s.style.top=`${w}px`}function xe(){const t=L;if(e&&"function"==typeof e.getPlacementsActiveAtTime){const n=e.getPlacementsActiveAtTime(t),o=new Set(n.map((e=>null==e?void 0:e.placementId)).filter((e=>"string"==typeof e&&e.length)));_.forEach((e=>{o.has(e)||_e(B.get(e),!1)})),o.forEach((e=>{_.has(e)||_e(B.get(e),!0)})),_=o}else T.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((e=>{const n="true"===e.dataset.hasDuration,o=Number(e.dataset.start),i=Number(e.dataset.end);_e(e,n&&f(t)&&t>=o&&t<i)}));if(e&&"function"==typeof e.getActiveRenderPlacement){const n=e.getActiveRenderPlacement(t),o=null==n?void 0:n.renderPlacementId;V&&V!==o&&_e(O.get(V),!1),o&&V!==o&&_e(O.get(o),!0),V=o||null}else R.track.querySelectorAll('[data-timeline-item="render"]').forEach((e=>{const n="true"===e.dataset.hasDuration,o=Number(e.dataset.start),i=Number(e.dataset.end);_e(e,n&&f(t)&&t>=o&&t<i)}))}function Ie(e){const n=Ce(e,t);if(!p(n)||"function"!=typeof t)return{boundaries:[],buffered:[]};const o=t(null==e?void 0:e.nodeId),i=function(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];if(!t.length)return null;if(null!=e&&e.mainTrackId){const n=t.find((t=>(null==t?void 0:t.id)===e.mainTrackId));if(n)return n}return t.find((e=>Array.isArray(null==e?void 0:e.segments)&&e.segments.length))||null}(o);if(!i)return{boundaries:[],buffered:[]};const r=e=>{if(!e)return 0;const t=Number(null==e?void 0:e.bufferedRatio);if(Number.isFinite(t))return y(t);const n=Number(null==e?void 0:e.retainedByteLength);if(!p(n))return 0;const o=null==e?void 0:e.chosenRepresentation,i=p(null==o?void 0:o.sizeBytes)?o.sizeBytes:null;return p(i)?y(n/i):1},l=Array.isArray(i.segments)?i.segments:[],s=f(null==i?void 0:i.offset)?i.offset:0,a=f(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:0;if(!l.length){const e=null==o?void 0:o.buffered,t=f(null==e?void 0:e.start)?e.start-a:0,i=f(null==e?void 0:e.end)?e.end-a:0,r=Math.max(0,t),l=Math.min(n,i);return l>r?{boundaries:[],buffered:[{startRatio:r/n,endRatio:l/n}]}:{boundaries:[],buffered:[]}}if("image"===(null==i?void 0:i.type)){const e=l.find((e=>e&&!e.isInit))||l[0],t=e?r(e):0;return t>0?{boundaries:[],buffered:[{startRatio:0,endRatio:y(t)}]}:{boundaries:[],buffered:[]}}return function(e,t,n,o,i){const r=[],l=[];let s=0;return e.forEach((e=>{if(null!=e&&e.isInit)return;f(null==e?void 0:e.offset)&&(s=e.offset);const a=s;if(!f(a))return;const d=f(null==e?void 0:e.duration)?e.duration:0,c=n+a-o,u=n+(a+d)-o;c>0&&c<t&&r.push(c/t);const p="function"==typeof i?i(e):0;if(d>0&&u>0&&c<t&&p>0){const e=Math.max(0,c),n=Math.min(t,u);if(n>e){const o=e+(n-e)*y(p);l.push({startRatio:e/t,endRatio:o/t})}}d>0&&(f(null==e?void 0:e.offset)?s=e.offset+d:s+=d)})),{boundaries:r,buffered:l}}(l,n,s,a,r)}function Ne(){const e=Array.isArray(S)?S:[],t=new Map(e.map((e=>[null==e?void 0:e.placementId,e])));for(const[e,n]of B.entries()){if(!e)continue;const o=t.get(e);o&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((e=>e.remove())),Oe(n,Ie(o).buffered,fe))}}function Te(){const e=new Set(S.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length)));e.forEach((e=>{if(F.has(e))return;const n="function"==typeof t?t(e):null;if(!n||"function"!=typeof n.on)return;const o=e=>function(e={}){if(!e||e.isInit)return;const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.segmentId,o=Number(null==e?void 0:e.loaded),i=Number(null==e?void 0:e.total);if(!t||!n||!f(o))return;const l=`${t}:${n}`,s=$.get(l)||{},a={loaded:Math.max(f(s.loaded)?s.loaded:0,o),total:p(i)?i:s.total};$.set(l,a),function(){if(W)return;W=!0;const e=null==r?void 0:r.requestAnimationFrame;"function"!=typeof e?((null==r?void 0:r.setTimeout)||setTimeout)((()=>{W=!1,Ne()}),0):e((()=>{W=!1,Ne()}))}()}(e);n.on("segment:chunk",o),F.set(e,{node:n,handler:o})}));for(const[t,n]of F.entries())e.has(t)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),F.delete(t))}function Se({track:e,color:t,start:n,duration:i,startTime:l,durationSeconds:s,segmentRatios:a,bufferedSegments:d,placementId:u,nodeId:m,label:h,rowIndex:g=0,rowHeight:v=18,rowGap:b=0,laneId:w,isClickable:E,isActive:x,tooltip:I,hoverDetailsNodeId:C,showLabel:A,onClick:k}){const N=o.createElement("div");!function(e,t){e.style.position="absolute",e.style.borderRadius="4px",e.style.background=t,e.style.opacity="0.9",e.style.font=c,e.style.color="#fff",e.style.display="flex",e.style.alignItems="center",e.style.whiteSpace="nowrap",e.style.overflow="hidden",e.style.textOverflow="ellipsis"}(N,t),function(e,{startRatio:t,durationRatio:n,rowIndex:o=0,rowHeight:i=18,rowGap:r=0}={}){const l=o*(i+r)+2,s=Math.max(1,i-4);e.style.top=`${l}px`,e.style.height=`${s}px`;const a=y(t);if(p(n)){const t=Math.max(0,Math.min(n,1-a));return e.style.left=100*a+"%",e.style.width=100*t+"%",void(e.style.padding="0 4px")}e.style.left=100*a+"%",e.style.width="2px",e.style.padding="0"}(N,{startRatio:n,durationRatio:i,rowIndex:g,rowHeight:v,rowGap:b}),function(e,{laneId:t,label:n,isClickable:o,shouldShowLabel:i,onClick:l}={}){if(t&&(e.dataset.timelineItem=t),i&&n){const t=r.document.createElement("span");t.textContent=n,t.style.position="relative",t.style.zIndex="2",t.style.pointerEvents="none",e.appendChild(t)}o&&(e.style.cursor="pointer"),"function"==typeof l&&e.addEventListener("click",l)}(N,{laneId:w,label:h,isClickable:E,shouldShowLabel:"boolean"==typeof A?A:p(i),onClick:k}),I&&(N.title=I),f(l)&&(N.dataset.start=String(l)),p(s)||ke(s)?(N.dataset.end=String(l+s),N.dataset.hasDuration="true"):(N.dataset.end="",N.dataset.hasDuration="false"),u&&(N.dataset.placementId=u),m&&(N.dataset.nodeId=m),N.style.pointerEvents="auto",Oe(N,d,fe),function(e,t=[]){e&&Array.isArray(t)&&t.length&&t.forEach((t=>{if(!f(t)||t<=0||t>=1)return;const n=r.document.createElement("div");n.dataset.segmentBoundary="true",n.style.position="absolute",n.style.top="2px",n.style.bottom="2px",n.style.width="1px",n.style.left=100*y(t)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",e.appendChild(n)}))}(N,a),_e(N,x),I&&(N.addEventListener("mouseenter",(e=>ae(I,e))),N.addEventListener("mousemove",(e=>ae(I,e))),N.addEventListener("mouseleave",re)),C&&(N.addEventListener("mouseenter",(e=>ce(C,e))),N.addEventListener("mousemove",(e=>ce(C,e))),N.addEventListener("mouseleave",de)),e.appendChild(N),"nodes"===w&&u?B.set(u,N):"render"===w&&u&&O.set(u,N)}async function De({event:o,placement:i,rangeEnd:l,track:s}){const a=Re(M);if(a===he)return;if(a===ge)return void function(t,n,o){if(!e)return;if(!p(n)||!o)return;const i="function"==typeof o.getBoundingClientRect?o.getBoundingClientRect():null,r=p(null==i?void 0:i.width)?i.width:o.clientWidth;if(!p(r))return;const l=f(null==i?void 0:i.left)?i.left:0,s=y(((f(null==t?void 0:t.clientX)?t.clientX:0)-l)/r)*n;f(s)&&(e.currentTime=s)}(o,l,s);const d="string"==typeof(null==i?void 0:i.nodeId)?i.nodeId:"",c="function"==typeof t&&d?t(d):null,u=a===ve?d:a===be?JSON.stringify(Me(i,t),null,2):function(e,t){return function(e,t){return function(e,t,n){const o=(e||"").replace(/\/$/,""),i=null==n?void 0:n.assetId,r=null==n?void 0:n.assetRevision;if(o&&"string"==typeof i&&"number"==typeof r)return`${o}/raw/${encodeURIComponent(i)}/${r}`}(e,0,t)}(t,null==e?void 0:e.manifestRef)}(c,n),m=a===ve?"Copied node ID":a===be?"Copied node context":"Copied source video URL";if(u)try{await async function(e,t){const n=null==r||null===(t=r.navigator)||void 0===t?void 0:t.clipboard;if(!n||"function"!=typeof n.writeText)throw new Error("Clipboard API unavailable.");await n.writeText(e)}(u),se(m)}catch(e){}else a===we&&se("Source video URL unavailable",{tone:"warning"})}function Le(){const n=function(){let e=0;const n=Array.isArray(S)?S:[],o=Array.isArray(D)?D.filter((e=>!0!==(null==e?void 0:e.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const o=f(null==n?void 0:n.offset)?n.offset:void 0;if(!f(o))return;const i=Ce(n,t);e=p(i)?Math.max(e,o+i):Math.max(e,o)})),o.forEach((t=>{const n=f(null==t?void 0:t.offset)?t.offset:0,o=Ae(t);e=p(o)?Math.max(e,n+o):Math.max(e,n)})),p(e)?e:1}();P=n,b.textContent=`t=${m(L)}s`,w.textContent=`range=0-${m(n)}s`,re(),de(),G(T.track),G(R.track),B.clear(),O.clear(),_=new Set,V=null,W=!1;const o=Array.isArray(S)?S:[],i=Array.isArray(D)?D:[],l=function(n){const o=(Array.isArray(n)?n.slice():[]).map((e=>{if(!0===(null==e?void 0:e.offsetPending))return null;const n=f(null==e?void 0:e.offset)?e.offset:void 0;if(!f(n))return null;const o=Ce(e,t);return{placement:e,offset:n,duration:o,end:p(o)?n+o:n,rowIndex:0}})).filter(Boolean).sort(((e,t)=>{var n,o,i,r;const l=e.offset-t.offset;if(0!==l)return l;const s="string"==typeof(null===(n=e.placement)||void 0===n?void 0:n.nodeId)?e.placement.nodeId:"",a="string"==typeof(null===(o=t.placement)||void 0===o?void 0:o.nodeId)?t.placement.nodeId:"";if(s!==a)return s.localeCompare(a);const d="string"==typeof(null===(i=e.placement)||void 0===i?void 0:i.placementId)?e.placement.placementId:"",c="string"==typeof(null===(r=t.placement)||void 0===r?void 0:r.placementId)?t.placement.placementId:"";return d.localeCompare(c)})),i=[],r=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(e);return o.forEach((e=>{const t=e.offset,n=f(e.end)?e.end:t;let o=-1;for(let e=0;e<i.length;e+=1)if(i[e]<=t+r){o=e;break}-1===o?(o=i.length,i.push(n)):i[o]=Math.max(i[o],n),e.rowIndex=o})),{items:o,rowCount:Math.max(1,i.length)}}(o);var s;!function(e){const t=e.rowCount*ue+4*(e.rowCount-1);T.track.style.height=`${t}px`,R.track.style.height="18px",T.track.style.cursor="default",T.track.style.pointerEvents="auto",R.track.style.pointerEvents="auto"}(l),function(e,t){e.items.forEach((e=>{const n=e.placement,o=e.offset,i=e.duration,r=(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId)||"node",l=!!f(L)&&L>=o&&(!p(i)||L<o+i),s=Ie(n),a=Re(M)!==he;Se({track:T.track,color:"rgba(255,255,255,0.16)",start:y(o/t),duration:p(i)?y(i/t):null,startTime:o,durationSeconds:i,segmentRatios:s.boundaries,bufferedSegments:s.buffered,placementId:null==n?void 0:n.placementId,nodeId:null==n?void 0:n.nodeId,label:r,rowIndex:e.rowIndex,rowHeight:ue,rowGap:4,laneId:"nodes",isClickable:a,isActive:l,tooltip:(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId),hoverDetailsNodeId:null==n?void 0:n.nodeId,onClick:a?e=>{De({event:e,placement:n,rangeEnd:t,track:T.track})}:void 0})}))}(l,n),s=n,i.forEach((e=>{const t=f(null==e?void 0:e.offset)?e.offset:void 0;if(!f(t))return;const n=Ae(e),o=ke(n),i=(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId)||"render",l=function(e){const t="string"==typeof e?e.trim().toLowerCase():"";return"switch"===t||"switching"===t||"switchingrendernode"===t}(null==e?void 0:e.type),a=l?()=>{"function"==typeof(null==r?void 0:r.switchTo)&&r.switchTo("next")}:void 0;let d=!1;f(L)&&(o?d=L>=t:p(n)&&(d=L>=t&&L<t+n));const c=o&&p(s)?y((s-t)/s):p(n)?y(n/s):null;Se({track:R.track,color:"rgba(248,162,62,0.9)",start:y(t/s),duration:c,startTime:t,durationSeconds:n,label:i,placementId:null==e?void 0:e.renderPlacementId,rowIndex:0,rowHeight:ue,rowGap:0,laneId:"render",isClickable:!!l,isActive:d,tooltip:(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId),showLabel:p(n)||o,onClick:a})})),ie(T.indicator,n),ie(R.indicator,n),xe(),Ne(),q=Be(S,D)||$e(S,t),U=q?Pe(S,D,t):"",j=Array.isArray(S)?S.length:0,H=Array.isArray(D)?D.length:0,oe()}function Fe(e,n){S=Array.isArray(e)?e.slice():[],D=Array.isArray(n)?n.slice():[],q=Be(S,D)||$e(S,t),Te(),Le()}return I.addEventListener("change",(()=>{M=Re(I.value),I.value=M,Le()})),{id:"timeline",title:"Timeline",render:e=>{e.appendChild(i),Le()},updatePlacements:Fe,updateTime:function(e){if(L=f(e)?e:L,te())return;if(q&&ne())return;const t=P;f(t)&&(b.textContent=`t=${m(L)}s`,w.textContent=`range=0-${m(t)}s`,ie(T.indicator,t),ie(R.indicator,t),xe())},refresh:()=>Le(),dispose:()=>{Q(),le();for(const e of F.values())(null==e?void 0:e.node)&&"function"==typeof e.node.off&&e.node.off("segment:chunk",e.handler);F.clear(),$.clear()}}}const We=1024,Ue=1048576,qe=1073741824;function je(e){return f(e)?e<We?`${Math.round(e)} B`:e<Ue?`${m(e/We,1)} KB`:e<qe?`${m(e/Ue,2)} MB`:`${m(e/qe,2)} GB`:"n/a"}const He="ekoplayer-debug-overlay";var Ke=new WeakMap,ze=new WeakMap,Ye=new WeakMap,Ge=new WeakMap,Qe=new WeakSet;class Xe{constructor({tabBarEl:o,contentEl:i}){e(this,Qe),t(this,Ke,[]),t(this,ze,void 0),t(this,Ye,void 0),t(this,Ge,void 0),n(Ye,this,o),n(Ge,this,i)}registerTab(e){e&&"string"==typeof e.id&&"string"==typeof e.title&&"function"==typeof e.render&&(o(Ke,this).some((t=>t.id===e.id))||(o(Ke,this).push(e),i(Qe,this,Je).call(this),o(ze,this)||this.selectTab(e.id)))}selectTab(e){o(Ke,this).find((t=>t.id===e))&&(n(ze,this,e),i(Qe,this,Je).call(this),i(Qe,this,Ze).call(this))}dispose(){o(Ye,this)&&(o(Ye,this).innerHTML=""),o(Ge,this)&&(o(Ge,this).innerHTML=""),n(Ke,this,[]),n(Ye,this,null),n(Ge,this,null)}}function Je(){const e=o(Ye,this);e&&(e.innerHTML="",o(Ke,this).forEach((t=>{const n=r.document.createElement("button");n.type="button",n.textContent=t.title,n.style.cursor="pointer",n.style.padding="6px 10px",n.style.borderRadius="6px",n.style.border="1px solid rgba(255,255,255,0.2)",n.style.background=t.id===o(ze,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=u,n.addEventListener("click",(()=>this.selectTab(t.id))),e.appendChild(n)})))}function Ze(){const e=o(Ge,this);if(!e)return;e.innerHTML="";const t=o(Ke,this).find((e=>e.id===o(ze,this)));t&&t.render(e)}function et({mountElement:e,canvasElement:t,timeline:n,assetsDeliveryServiceUrl:o,getNode:i,listNodes:l,downloadSpeed:d,downloadEvents:p,qoe:y,qoeEvents:g,options:v={},playbackStartedAtMs:b,playerVersion:w}={}){if(!e)throw new Error("Debug overlay requires mountElement.");if(!n||"function"!=typeof n.on)throw new Error("Debug overlay requires a Timeline with .on/.off.");!function(e){if(!e||!e.style)return;const t=null==r?void 0:r.window,n=t&&"function"==typeof t.getComputedStyle?t.getComputedStyle(e):null,o=n?n.position:e.style.position;o&&"static"!==o||(e.style.position="relative")}(e);const E=r.document.getElementById(He);E&&E.parentNode&&E.parentNode.removeChild(E);const x=function({mountElement:e,playerVersion:t}){const n=null==r?void 0:r.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const o=n.createElement("div");o.id=He,o.style.position="absolute",o.style.inset="0",o.style.zIndex="999999",o.style.pointerEvents="none";const i=n.createElement("div");i.style.position="absolute",i.style.top="8px",i.style.left="8px",i.style.width="460px",i.style.maxWidth="calc(100% - 16px)",i.style.background="rgba(0,0,0,0.65)",i.style.border="1px solid rgba(255,255,255,0.18)",i.style.borderRadius="10px",i.style.padding="10px",i.style.color="#fff",i.style.pointerEvents="auto",i.style.backdropFilter="blur(6px)";const l=n.createElement("div");l.style.display="flex",l.style.justifyContent="space-between",l.style.alignItems="center",l.style.gap="10px";const s=n.createElement("div");s.textContent="EkoPlayer Debug",s.style.font="600 13px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";const a=n.createElement("button");a.type="button",a.textContent="Hide",a.style.cursor="pointer",a.style.padding="6px 10px",a.style.borderRadius="8px",a.style.border="1px solid rgba(255,255,255,0.2)",a.style.background="rgba(0,0,0,0.2)",a.style.color="#fff",l.appendChild(s),l.appendChild(a);const d=n.createElement("div");d.style.display="flex",d.style.gap="8px",d.style.marginTop="10px";const u=n.createElement("div");u.style.marginTop="10px";const f=n.createElement("div");f.style.marginTop="10px",f.style.font=c,f.style.display="flex",f.style.justifyContent="space-between",f.style.alignItems="center",f.style.gap="10px";const p=n.createElement("div");p.style.color="rgba(140, 224, 255, 0.9)",p.textContent="Playback started @ --";const y=n.createElement("div");y.style.opacity="0.7",y.style.marginLeft="auto",y.textContent=t?`version ${t}`:"version n/a",f.appendChild(p),f.appendChild(y);const m=n.createElement("button");return m.type="button",m.textContent="Debug",m.style.position="absolute",m.style.top="8px",m.style.left="8px",m.style.cursor="pointer",m.style.padding="6px 10px",m.style.borderRadius="10px",m.style.border="1px solid rgba(255,255,255,0.25)",m.style.background="rgba(0,0,0,0.55)",m.style.color="#fff",m.style.pointerEvents="auto",m.style.display="none",i.appendChild(l),i.appendChild(d),i.appendChild(u),i.appendChild(f),o.appendChild(i),o.appendChild(m),e.appendChild(o),{overlayRoot:o,panel:i,tabBar:d,content:u,hideBtn:a,showBtn:m,footerPlayback:p}}({mountElement:e,playerVersion:w||(null==v?void 0:v.playerVersion)}),I=new Xe({tabBarEl:x.tabBar,contentEl:x.content});let C=!0;function k(){C=!1,x.panel.style.display="none",x.showBtn.style.display="inline-block"}function N(){C=!0,x.panel.style.display="block",x.showBtn.style.display="none"}x.hideBtn.addEventListener("click",k),x.showBtn.addEventListener("click",N);const S=Ve({timeline:n,getNode:i,assetsDeliveryServiceUrl:o}),O=function({getNode:e}){const t=r.document,n=t.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=u,n.style.lineHeight="1.35";const o=t.createElement("div");o.style.display="flex",o.style.flexDirection="column",o.style.gap="8px",o.style.marginTop="6px";const i=t.createElement("div");i.style.display="flex",i.style.gap="10px",i.style.marginTop="10px",i.style.alignItems="center",i.style.flexWrap="wrap";const l=new A({maxValue:60}),s=new A({maxValue:60}),a=t.createElement("div"),d=t.createElement("div");d.textContent="browserfps",d.style.font=c,d.style.opacity="0.9",a.appendChild(d),a.appendChild(l.element);const f=t.createElement("div"),p=t.createElement("div");return p.textContent="fps",p.style.font=d.style.font,p.style.opacity="0.9",f.appendChild(p),f.appendChild(s.element),i.appendChild(a),i.appendChild(f),{id:"frames",title:"Frames",render:e=>{e.appendChild(n),e.appendChild(o),e.appendChild(i)},pushBrowserFps:(e,t)=>l.push(e,t),pushVisualFps:(e,t)=>s.push(e,t),updateInfo:function({time:i,entries:r}){const l=Array.isArray(r)?r.slice().sort(T):[];if(!l.length)return n.textContent="",void(o.innerHTML="");n.textContent=`t=${P(i)}s tracks=${l.length}`,o.innerHTML="";for(let n=0;n<l.length;n+=1){const i=l[n],r=B(e,i),s=(null==r?void 0:r.id)||"n/a",a=(null==r?void 0:r.codecs)||(null==r?void 0:r.mime)||"n/a",d=M(null==r?void 0:r.bandwidth),c=h(null==r?void 0:r.width,null==r?void 0:r.height),f=$(e,i)||"n/a",p=F(e,i),y=p?` fallback=${p}`:"",m=D(e,i),g=(null==m?void 0:m.strategy)||"n/a",v=(null==m?void 0:m.decisionReason)||"n/a",b=L(null==m?void 0:m.measuredDownloadSpeedKbps),w=L(null==m?void 0:m.safeBandwidthKbps),E=t.createElement("div");E.style.display="flex",E.style.flexDirection="column",E.style.gap="2px";const x=t.createElement("pre");x.style.margin="0",x.style.whiteSpace="pre-wrap",x.style.font=u,x.style.lineHeight="1.35",x.textContent=[`${(null==i?void 0:i.nodeId)||"?"} ${(null==i?void 0:i.trackId)||"?"} ${(null==i?void 0:i.segmentId)||"?"} pts=${P(null==i?void 0:i.presentationTime)}s`,`rep=${s} encodeProfile=${f}${y} res=${c} codec=${a} repBW=${d}`,`abr=strategy:${g} reason:${v} measuredBW:${b} safeBW:${w}`].join("\n"),E.appendChild(x);const I=(null==m?void 0:m.selectedRepresentationId)||(null==r?void 0:r.id),C=V(e,i,r,m);if(C.length){const e=t.createElement("div");e.style.display="flex",e.style.alignItems="center",e.dataset.abrLadderRow="true",e.dataset.trackId=(null==i?void 0:i.trackId)||"",e.dataset.segmentId=(null==i?void 0:i.segmentId)||"";const n=t.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",C.forEach((e=>{const o=t.createElement("span"),i=!!I&&e.id===I;o.dataset.abrLadderBlock="true",o.dataset.repId=e.id||"",o.dataset.selected=i?"true":"false",o.style.display="inline-block",o.style.width="10px",o.style.height="8px",o.style.borderRadius="2px",o.style.border="1px solid rgba(255,255,255,0.35)",o.style.background=i?"rgba(74, 222, 128, 0.95)":"rgba(156, 163, 175, 0.55)",o.title=`${e.id||"?"} ${L(e.bandwidthKbps)}`,n.appendChild(o)})),e.appendChild(n),E.appendChild(e)}o.appendChild(E)}},dispose:()=>{l.dispose(),s.dispose()}}}({getNode:i}),_=H({downloadSpeed:d,downloadEvents:p}),W=function({qoe:e,qoeEvents:t}={}){const n=null==r?void 0:r.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay QoE tab requires document.createElement.");const o=n.createElement("pre");o.style.margin="0",o.style.whiteSpace="pre-wrap",o.style.font=u;const{graphWrap:i,graph:l}=function(e){const t=e.createElement("div");t.style.marginTop="10px";const n=e.createElement("div");n.textContent="qoe score",n.style.font=c,n.style.opacity="0.9";const o=new A({maxValue:1,windowMs:3e4,formatValue:e=>K(e)});return t.appendChild(n),t.appendChild(o.element),{graphWrap:t,graph:o}}(n);let s=null;const a=()=>{o.textContent=function(e){if(!e)return"QoE unavailable";const t="string"==typeof e.status?e.status:"n/a";return[`score=${K(e.score)}`,`status=${t}`,`streamQualityScore=${K(e.streamQualityScore)}`,`fpsScore=${K(e.fpsScore)}`,`browserFps=${K(e.browserFps)}`,`waitingSeconds=${K(e.waitingSeconds)}`,`playingSeconds=${K(e.playingSeconds)}`].join("\n")}(e)},d=()=>{if(!e)return;const t=Number(e.score);Number.isFinite(t)&&l.push(t,z())},f=e=>{const t=Number(e);Number.isFinite(t)&&l.push(t,z()),a()},p=()=>{a()};if(a(),d(),t&&"function"==typeof t.on&&(t.on("qoescore",f),t.on("qoestatus",p)),e){const e="function"==typeof(null==r?void 0:r.setInterval)?r.setInterval:setInterval;s=e((()=>{d(),a()}),1e3)}return{id:"qoe",title:"QoE",render:e=>{e.appendChild(o),e.appendChild(i)},dispose:()=>{t&&"function"==typeof t.off&&(t.off("qoescore",f),t.off("qoestatus",p)),s&&(("function"==typeof(null==r?void 0:r.clearInterval)?r.clearInterval:clearInterval)(s),s=null),l.dispose()}}}({qoe:y,qoeEvents:g}),U=function({timeline:e,getNode:t,listNodes:n,options:o}={}){const i=null==r?void 0:r.document;if(!i||"function"!=typeof i.createElement)throw new Error("Debug overlay Memory tab requires document.createElement.");const l=i.createElement("pre");l.style.margin="0",l.style.whiteSpace="pre-wrap",l.style.font=u;const s=i.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=c,s.style.opacity="0.9";const a=i.createElement("pre");a.style.margin="6px 0 0 0",a.style.whiteSpace="pre-wrap",a.style.font=u;let d=null;const p=()=>{const i=function({timeline:e,getNode:t,listNodes:n}){const o=[];let i=0;if("function"==typeof n){let e;try{e=n()}catch(t){e=null}if(Array.isArray(e))return e.forEach((e=>{const t=null==e?void 0:e.id;if("string"!=typeof t||!t.length)return;const n=Number(null==e?void 0:e.retainedByteLength);Number.isFinite(n)&&(i+=n,o.push({nodeId:t,bytes:n}))})),o.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:i,nodes:o,available:!0}}if(!e||"function"!=typeof t)return{totalBytes:0,nodes:[],available:!1};const r=Array.isArray(e.placements)?e.placements:[];return new Set(r.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length))).forEach((e=>{const n=t(e),r=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(r)&&(i+=r,o.push({nodeId:e,bytes:r}))})),o.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:i,nodes:o,available:!0}}({timeline:e,getNode:t,listNodes:n}),r=function({timeline:e}){if(!e||"function"!=typeof e.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const t=e.getDecodedFrameStats(),n=Number(null==t?void 0:t.totalBytes),o=Number(null==t?void 0:t.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(o)?o:0,available:!1!==(null==t?void 0:t.available)}}catch(e){return{totalBytes:0,frames:0,available:!1}}}({timeline:e}),s=function(e,t,n,o){const i=Number(null!==(n=null==e||null===(o=e.publicOptions)||void 0===o?void 0:o.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==e?void 0:e.segmentEvictionMaxRetainedBytes),r=f(i)&&i>=0,l=r?je(i):"n/a";return{active:r&&f(t)&&t>i,thresholdLabel:l}}(o,i.available?i.totalBytes:NaN),d=s.active?"on":"off",c=r.available?je(r.totalBytes):"n/a",u=r.available?r.frames:"n/a";if(!i.available)return l.textContent=[`decoded=${c} decodedFrames=${u}`,`retained=n/a eviction=${d} threshold=${s.thresholdLabel}`].join("\n"),void(a.textContent="");if(l.textContent=[`decoded=${c} decodedFrames=${u}`,[`retained=${je(i.totalBytes)}`,`nodes=${i.nodes.length}`,`eviction=${d}`,`threshold=${s.thresholdLabel}`].join(" ")].join("\n"),!i.nodes.length)return void(a.textContent="none");const p=i.nodes.slice(0,8).map((e=>`${e.nodeId}: ${je(e.bytes)}`));a.textContent=p.join("\n")};p();const y="function"==typeof(null==r?void 0:r.setInterval)?r.setInterval:setInterval;return d=y(p,1e3),{id:"memory",title:"Memory",render:e=>{e.appendChild(l),e.appendChild(s),e.appendChild(a)},refresh:p,dispose:()=>{d&&(("function"==typeof(null==r?void 0:r.clearInterval)?r.clearInterval:clearInterval)(d),d=null)}}}({timeline:n,getNode:i,listNodes:l,options:v});I.registerTab(S),I.registerTab(O),I.registerTab(_),I.registerTab(W),I.registerTab(U),I.registerTab(function({options:e}={}){const t=null==r?void 0:r.document;if(!t||"function"!=typeof t.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=t.createElement("pre");n.style.margin="0",n.style.font=u,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const o=null==e?void 0:e.publicOptions,i=o&&"object"==typeof o?Object.keys(o):[];if(i.length){const e=i.map((e=>`${e}=${function(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;if("string"===t)return e;if("number"===t||"boolean"===t)return String(e);try{return JSON.stringify(e)}catch(t){return String(e)}}(o[e])}`));n.textContent=e.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:e=>{e.appendChild(n)}}}({options:v}));const q=[],j=[];let Y=0,G=0,Q=null,X=!1,J=0,Z=null;function ee(e){const t=Number(e);Number.isFinite(t)&&(t-J<250||(J=t,O.pushBrowserFps(Y,t),O.pushVisualFps(G,t)))}r.window&&"function"==typeof r.window.requestAnimationFrame&&(Q=r.window.requestAnimationFrame((function e(t){X||(Y=R(q,t),ee(t),Q=r.window.requestAnimationFrame(e))})));const te=(e={})=>{if(X||!C)return;const t=Array.isArray(e.frames)?e.frames:[];if(!t.length)return void(Z=null);const n=null!=r&&r.performance&&"function"==typeof r.performance.now?r.performance.now():Date.now(),o=t.map((e=>`${null==e?void 0:e.nodeId}:${null==e?void 0:e.trackId}:${null==e?void 0:e.segmentId}@${null==e?void 0:e.presentationTime}`)).join("|");o!==Z&&(G=R(j,n),Z=o),O.updateInfo({time:e.time,entries:t}),ee(n)};let ne=Number.isFinite(b)?b:void 0;if(Number.isFinite(ne)&&x.footerPlayback){const e=ne/1e3;x.footerPlayback.textContent=`Playback started @ ${m(e)}s`}const oe=(e={})=>{if(!X&&void 0===ne&&"playing"===(null==e?void 0:e.event)&&(ne=s(),x.footerPlayback)){const e=ne/1e3;x.footerPlayback.textContent=`Playback started @ ${m(e)}s`}},ie=()=>{const e=Array.isArray(null==n?void 0:n.placements)?n.placements:[],t=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];S.updatePlacements(e,t)},re=(e={})=>{if(X)return;const t=Number.isFinite(null==e?void 0:e.time)?e.time:null==n?void 0:n.currentTime;S.updateTime(t),U&&"function"==typeof U.refresh&&U.refresh()},le=()=>{X||ie()},se=()=>{X||ie()},ae=null==n?void 0:n.trackBuffers,de=()=>{X||("function"==typeof S.refresh?S.refresh():ie(),U&&"function"==typeof U.refresh&&U.refresh())};return n.on(a.VISUAL_FRAMES_AVAILABLE,te),n.on(a.TIMELINE_TIME_UPDATE,re),n.on(a.PLACEMENT_ADDED,le),n.on(a.RENDER_PLACEMENT_ADDED,se),n.on(a.TIMELINE_PLAYER_STATE,oe),ae&&"function"==typeof ae.on&&ae.on("track:bufferupdate",de),ie(),S.updateTime(null==n?void 0:n.currentTime),{show:N,hide:k,dispose:function(){X||(X=!0,Q&&r.window&&"function"==typeof r.window.cancelAnimationFrame&&r.window.cancelAnimationFrame(Q),Q=null,n&&"function"==typeof n.off&&(n.off(a.VISUAL_FRAMES_AVAILABLE,te),n.off(a.TIMELINE_TIME_UPDATE,re),n.off(a.PLACEMENT_ADDED,le),n.off(a.RENDER_PLACEMENT_ADDED,se),n.off(a.TIMELINE_PLAYER_STATE,oe)),ae&&"function"==typeof ae.off&&ae.off("track:bufferupdate",de),O&&"function"==typeof O.dispose&&O.dispose(),S&&"function"==typeof S.dispose&&S.dispose(),_&&"function"==typeof _.dispose&&_.dispose(),W&&"function"==typeof W.dispose&&W.dispose(),U&&"function"==typeof U.dispose&&U.dispose(),I.dispose(),x.overlayRoot&&x.overlayRoot.parentNode&&x.overlayRoot.parentNode.removeChild(x.overlayRoot))},registerTab:function(e){I.registerTab(e)},selectTab:function(e){I.selectTab(e)}}}export{et as createDebugOverlay,et as default};
|