diff --git a/demo/bundle.js b/demo/bundle.js index ac4b3ee3..52746e2f 100644 --- a/demo/bundle.js +++ b/demo/bundle.js @@ -1,2 +1,2 @@ /*! For license information please see bundle.js.LICENSE.txt */ -(()=>{var t={657:function(t,e,n){t.exports=function(t){"use strict";const e="--mc-player";var n={play:'\x3c!-- Generated by IcoMoon.io --\x3e\n\nplay\n\n',pause:'\x3c!-- Generated by IcoMoon.io --\x3e\n\npause\n\n',"expand-full":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nexpand-full\n\n\n',"angle-left":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nangle-left\n\n',"angle-right":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nangle-right\n\n',settings:'\x3c!-- Generated by IcoMoon.io --\x3e\n\nsettings\n\n',loop:'\x3c!-- Generated by IcoMoon.io --\x3e\n\nloop\n\n',"volume-on":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nvolume-on\n\n',"volume-off":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nvolume-off\n\n',"donkeyclip-logo":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nDonkeyClip\n\n',spinner:'
',"check-solid":'\x3c!-- Generated by IcoMoon.io --\x3e\n\ncheck-solid\n\n'};const i="volume-change",s="mute-change",r="speed-change",o="loop-change",a="scale-change",l="show-volume-change",c="state-change",u="duration-change",p="mouseup",h="mousemove",d="touchend",m="touchmove";function g(){try{document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}catch(t){console.error(t)}}function f(t){try{t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()}catch(t){console.error(t)}}function y(t){const e=t.clip.props.host.className.includes("full-screen");t.clip.props.host!==t.options.host&&(e?t.options.host.appendChild(t.elements.mcPlayer):t.clip.props.host.appendChild(t.elements.mcPlayer)),e?g():f(t.clip.props.host)}function v(t){A(t,null,"play")}const b=new t.TimeCapsule;let x=setTimeout((()=>{}),0);function w(t,e){return t.getElementsByClassName(e)[0]}function C(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i{clearTimeout(x),t.elements.playPausePanel.classList.remove("hide"),t.elements.playPausePanel.classList.remove("run-animation-play"),t.elements.playPausePanel.classList.remove("run-animation-pause"),t.elements.playPausePanel.classList.remove("run-animation-idle"),"idle"===t.clip.runTimeInfo.state?(t.play(),v(t.elements.playPausePanelContainer),t.elements.playPausePanel.classList.add("run-animation-idle")):"playing"!==t.clip.runTimeInfo.state?(t.play(),v(t.elements.playPausePanelContainer),t.elements.playPausePanel.classList.add("run-animation-play")):(t.pause(),A(t.elements.playPausePanelContainer,null,"pause"),t.elements.playPausePanel.classList.add("run-animation-pause")),x=setTimeout((()=>{t.elements.playPausePanel.classList.add("hide")}),800)},P=/^[+-]?(\d+([.]\d*)?|[.]\d+)/gi;function E(t){const e=t.match(P)[0],n=t.substring(e.length);if("number"==typeof(i=Number(e))&&isFinite(i)&&("%"!==n||"px"!==n))return{number:Number(e),unit:n};var i}function S(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function k(t,e,n){t.document.addEventListener(p,e,!1),t.document.addEventListener(d,e,!1),t.document.addEventListener(h,n,{passive:!1}),t.document.addEventListener(m,n,{passive:!1})}function M(t,e,n){t.document.removeEventListener(p,e,!1),t.document.removeEventListener(d,e,!1),t.document.removeEventListener(h,n,{passive:!1}),t.document.removeEventListener(m,n,{passive:!1})}function O(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];C(e,"mousedown",t,{passive:n}),C(e,"touchstart",t,{passive:n})}function A(t,e,i){e&&(t.classList.remove(`icon-${e}`),t.innerHTML=""),i&&(t.classList.add(`icon-${i}`),t.innerHTML=n[i])}function T(t,e){return t-e}function _(t,e){if(t.id??=Date.now(),t.showVolume??=!!Object.keys(t.clip?.audioClip?.children||[]).length,t.showIndicator??=!1,t.theme??="default",t.host??=t.clip.props.host,t.buttons??={},t.buttons.donkeyclip=!("undefined"==typeof window||!window.Donkeyclip?.clipId)&&t.buttons.donkeyclip,t.timeFormat??="ss",t.backgroundColor??="black",t.fullscreen??=!1,t.scaleToFit??=!0,t.sectionsEasing??="easeOutQuart",t.pointerEvents??=!1,t.scrollAnimation??=!1,t.onMillisecondChange??=null,t.speedValues??=[-1,0,.5,1,2],t.speed??=1,t.muted??=!1,t.maxScrollStorage??=50,t.controls??=!0,t.loop??=!1,t.volume??=1,t.currentScript??=null,t.millisecond){const n=e.clip;t.millisecond>n.duration&&(t.millisecond=n.duration),(t.millisecond<0||!isFinite(t.millisecond))&&(t.millisecond=0),e.goToMillisecond(t.millisecond)}for(const e in t.speedValues)isFinite(t.speedValues[e])||t.speedValues.splice(e,1);return t.speedValues.sort(T),t}var D=t=>{B(t);const{mcPlayer:e}=t.elements;var i;t.elements.pointerEventPanel=w(e,"--mcp-pointer-events-panel"),t.elements.playPausePanel=w(e,"--mcp-play-pause-panel"),t.elements.playPausePanelContainer=w(e,"--mcp-play-pause-panel-container"),t.elements.listenerHelper=w(e,"--mcp-listener-helper"),t.elements.loopBar=w(e,"--mcp-loopbar"),t.elements.totalBar=w(e,"--mcp-totalbar"),t.elements.indicator=w(e,"--mcp-indicator"),t.elements.loopButton=w(e,"--mcp-loop-btn"),t.elements.volumeBar=w(e,"--mcp-volumebar"),t.elements.totalTime=w(e,"--mcp-time-total"),t.elements.volumeControl=w(e,"--mcp-volume"),t.elements.volumeBtn=w(e,"--mcp-volume-btn"),t.elements.runningBar=w(e,"--mcp-runningbar"),t.elements.loopBarEnd=w(e,"--mcp-loopbar-end"),t.elements.statusButton=w(e,"--mcp-status-btn"),t.elements.speedBar=w(e,"--mcp-speed-values"),t.elements.currentTime=w(e,"--mcp-time-current"),t.elements.timeDisplay=w(e,"--mcp-time-display"),t.elements.speedButtonShow=w(e,"--mcp-speed-btn-show"),t.elements.speedButtonHide=w(e,"--mcp-speed-btn-hide"),t.elements.speedCurrent=w(e,"--mcp-speed-current"),t.elements.loopBarStart=w(e,"--mcp-loopbar-start"),t.elements.volumeCursor=w(e,"--mcp-volume-cursor"),t.elements.settingsButton=w(e,"--mcp-settings-btn"),t.elements.donkeyclipButton=w(e,"--mcp-dc-btn"),t.elements.timeSeparator=w(e,"--mcp-time-separator"),t.elements.settingsPanel=w(e,"--mcp-settings-panel"),t.elements.background=w(e,"--mcp-background"),t.elements.settingsMainPanel=w(e,"--mcp-main-settings"),t.elements.fullScreenButton=w(e,"--mcp-full-screen-btn"),t.elements.context=w(e,"--mcp-context"),t.elements.volumeBarHelper=w(e,"--mcp-volumebar"),t.elements.volumeBarActive=w(e,"--mcp-volumebar-color-active"),t.elements.settingsSpeedPanel=w(e,"--mcp-speed-settings"),t.elements.settingsShowVolume=w(e,"--mcp-settings-volume"),t.elements.settingsPointerEvents=w(e,"--mcp-settings-pointer-events"),t.elements.settingsSpeedButtonShow=w(e,"--mcp-settings-speed-show"),t.elements.settingsSpeedButtonHide=w(e,"--mcp-settings-speed-hide"),t.elements.controls=w(e,"--mcp-controls"),t.elements.volumeCheckbox=w(e,"--mcp-show-volume-checkbox"),t.elements.showVolumeCheckbox=w(e,"--mcp-show-volume-checkbox"),t.elements.showPointerEventsCheckbox=w(e,"--mcp-show-pointer-events-checkbox"),t.elements.leftButtons=w(e,"--mcp-left-buttons"),(i=t.elements).loopButton.innerHTML=n.loop,i.volumeBtn.innerHTML=n["volume-on"],i.statusButton.innerHTML=n.play,i.settingsButton.innerHTML=n.settings,i.donkeyclipButton.innerHTML=n["donkeyclip-logo"],i.fullScreenButton.innerHTML=n["expand-full"],i.speedButtonShow.innerHTML=n["angle-right"],i.speedButtonHide.innerHTML=n["angle-left"],L(t),j(t),V(t)};const B=t=>{const e=t.clip.props.host;if(e.offsetWidth||(e.style.width=t.clip.props.containerParams.width),e.offsetHeight||(e.style.height=t.clip.props.containerParams.height),e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.overflow="hidden",t.clip.props.host.style.position="relative",t.clip.props.host.style.zIndex=0,t.elements.mcPlayer=t.document.createElement("div"),t.elements.mcPlayer.id=`${t.name}`,t.elements.mcPlayer.className=`${t.className}`,t.elements.mcPlayer.innerHTML='
i
00:00 / 00:00
  • Pointer events

  • Show volume

  • Playback speed

  • Playback speed

    ',"string"==typeof t.options.host){const e=t.document.querySelectorAll(t.options.host);for(const n in e)isNaN(n)||e[n].appendChild(t.elements.mcPlayer)}else t.options.host.appendChild(t.elements.mcPlayer)},L=t=>{t.elements.volumeBarActive.style.width=100*t.settings.volume+"%",t.elements.currentTime.innerHTML=t.timeFormat(0),t.elements.totalTime.innerHTML=t.timeFormat(t.clip.duration),t.elements.timeSeparator.innerHTML="/",t.elements.settingsPanel.classList.add("m-fadeOut",`${t.name}-hide`),t.options.backgroundColor&&(t.elements.background.style.background=t.options.backgroundColor),"scroller"===t.options.type&&(window.document.body.style.overscrollBehaviorY="contain"),t.options.showIndicator?(t.elements.indicator.style.display=void 0,t.elements.statusButton.style.width="35px",t.elements.statusButton.style.height="20px",t.elements.statusButton.style.bottom="5px"):t.elements.indicator.style.display="none",t.elements.indicator.innerHTML=t.clip.runTimeInfo.state,t.elements.settingsSpeedPanel.style.display="none",t.elements.loopBarStart.classList.add("m-fadeOut",`${t.name}-hide`),t.elements.loopBarEnd.classList.add("m-fadeOut",`${t.name}-hide`),t.elements.volumeCheckbox.checked=t.options.showVolume,t.elements.showPointerEventsCheckbox.checked=t.options.pointerEvents,t.options.pointerEvents?t.elements.pointerEventPanel.style.pointerEvents="none":t.elements.pointerEventPanel.style.pointerEvents="auto",t.options.showVolume||t.elements.volumeControl.classList.toggle("m-fadeOut")},j=t=>{for(const e in t.options.speedValues){if(0==t.options.speedValues[e])continue;const n="check-solid",i="--mcp-selected",s=t.document.createElement("li");s.className="--mcp-speed-value",s.dataset.speedValue=t.options.speedValues[e];const r=t.document.createElement("span");s.append(r);const o=t.document.createElement("p"),a=1==t.options.speedValues[e];o.innerHTML=a?"Normal":t.options.speedValues[e],o.dataset.zone=e,o.classList.add("--mcp-speed-value-item"),(t.options.speedValues[e]==t.options.speed??t.clip.speed)&&(A(r,null,n),o.classList.add(i)),s.append(o),t.elements.speedBar.append(s),s.onclick=function(){t.options.speed=t.options.speedValues[e],t.clip.speed=t.options.speedValues[e],t.elements.speedCurrent.innerHTML=1==t.clip.speed?"Normal":t.clip.speed,A(w(t.elements.mcPlayer,"icon-check-solid"),n),A(r,null,n),w(t.elements.mcPlayer,i).classList.remove(i),o.classList.add(i)}}},V=t=>{!1===t.options.buttons.fullScreen&&t.elements.fullScreenButton.remove(),!1===t.options.buttons.settings&&t.elements.settingsButton.remove(),t.options.buttons.donkeyclip||t.elements.donkeyclipButton.remove(),!1===t.options.buttons.loop&&t.elements.loopButton.remove()},$="--mcp-force-show-controls",N="playing",F="volume-off",R="volume-on";var z='.--mc-player.theme-default{--activeColor:136,136,136;--defaultColor:255,255,255;--backgroundColor:29,31,37,1;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-yellow{--activeColor:255,235,59;--defaultColor:255,255,255;--backgroundColor:29,31,37,1;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-dark{--activeColor:136,136,136;--defaultColor:136,136,136;--backgroundColor:0,0,0,1;--backgroundSettingsColor:rgba(0,0,0,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-whiteGold{--activeColor:161,127,26;--defaultColor:136,136,136;--backgroundColor:245,245,245,1;--backgroundSettingsColor:hsla(0,0%,96%,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-darkGold{--activeColor:161,127,26;--defaultColor:136,136,136;--backgroundColor:0,0,0,1;--backgroundSettingsColor:rgba(0,0,0,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-transparent{--activeColor:255,0,0;--defaultColor:239,238,236;--backgroundColor:0,0,0,0;--backgroundSettingsColor:rgba(0,0,0,0.9);--loopBarColor:rgba(var(--defaultColor),0.2);--grad-display:block;--grad-color:0,0,0}.--mc-player.theme-green{--activeColor:0,184,139;--defaultColor:255,255,255;--backgroundColor:29,31,37,1;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-blue{--activeColor:0,153,225;--defaultColor:255,255,255;--backgroundColor:29,31,37,1;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-donkeyclip{--activeColor:0,153,225;--defaultColor:255,255,255;--backgroundColor:0,0,0,0;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:block;--grad-color:24,25,29}.--mc-player.theme-donkeyclipDark{--activeColor:0,153,225;--defaultColor:255,255,255;--backgroundColor:0,0,0,0;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:block;--grad-color:22,22,26}.--mc-player,.--mc-player *{user-select:none!important;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.--mc-player *{box-sizing:border-box;color:rgb(var(--defaultColor));cursor:default;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-size:13px}.--mc-player svg{width:22px}.--mcp-settings-panel:focus{outline:none}.--mc-player *{outline:none!important}.--mcp-settings-panel svg{width:10px}.--mc-player svg,.--mc-player svg *{fill:rgb(var(--defaultColor))!important}.--mc-player{left:0;overscroll-behavior:none;top:0}.--mc-player,.--mcp-background,.--mcp-context{height:100%;pointer-events:none;position:absolute;width:100%}.--mcp-background,.--mcp-context{display:flex;flex-direction:column}.--mcp-background{background:#000;z-index:-1000}.--mcp-pointer-events-panel.initial{min-height:100%;width:100%;z-index:100}.--mcp-pointer-events-panel{min-height:calc(100% - 50px);width:100%}.--mcp-pointer-events-panel.loading{align-items:center;background:rgba(0,0,0,.8);display:flex;justify-content:center}.--mcp-grad{background-image:linear-gradient(rgba(var(--grad-color),.001),rgba(var(--grad-color),.004),rgba(var(--grad-color),.007),rgba(var(--grad-color),.01),rgba(var(--grad-color),.04),rgba(var(--grad-color),.07),rgba(var(--grad-color),.1),rgba(var(--grad-color),.15),rgba(var(--grad-color),.2),rgba(var(--grad-color),.25),rgba(var(--grad-color),.3),rgba(var(--grad-color),.35),rgba(var(--grad-color),.4),rgba(var(--grad-color),.45),rgba(var(--grad-color),.5),rgba(var(--grad-color),.55),rgba(var(--grad-color),.6),rgba(var(--grad-color),.65),rgba(var(--grad-color),.7),rgba(var(--grad-color),.75),rgba(var(--grad-color),.8),rgba(var(--grad-color),.88));bottom:0;display:var(--grad-display);height:200px;left:0;pointer-events:none!important;position:absolute;width:100%;z-index:0}.--mc-player:hover .--mcp-controls,.--mcp-controls:active{opacity:1!important}.--mcp-controls{background:rgba(var(--backgroundColor));display:flex;flex-direction:column;height:50px;opacity:0;padding:0 15px;pointer-events:auto;position:relative;transition:all .2s ease;z-index:0}.--mcp-controls *{-webkit-user-select:none!important;-moz-user-select:none!important;user-select:none!important}.--mcp-play-pause-panel #play-svg{margin-left:4px}.--mcp-always-show-controls,.--mcp-force-show-controls{opacity:1!important}.--mcp-progressbar{align-items:center;display:flex;justify-content:center;position:relative}.--mcp-loopbar,.--mcp-runningbar,.--mcp-totalbar{height:5px;position:relative}.--mcp-cursor{background-color:rgb(var(--activeColor));border-radius:100%;height:14px;position:absolute;right:-8px;top:-5px;width:14px;z-index:10}.--mcp-totalbar{background-color:rgba(var(--defaultColor),.3);min-width:100%}.--mcp-loopbar{padding:10px 0;position:relative;top:-10px;width:100%}.--mcp-loopbar-color{background-color:var(--loopBarColor);bottom:5px;height:5px;left:0;position:absolute;width:100%}.--mcp-runningbar{background-color:rgb(var(--activeColor));width:0}.--mcp-buttons,.--mcp-left-buttons,.--mcp-left-buttons>div,.--mcp-right-buttons,.--mcp-right-buttons>div{align-items:center;display:flex;gap:5px;z-index:1}.--mcp-left-buttons{flex:1}.--mcp-buttons,.--mcp-left-buttons,.--mcp-right-buttons{gap:20px;height:100%}.--mcp-left-buttons{justify-content:flex-start}.--mcp-right-buttons{justify-content:flex-end}.--mcp-prevent-point-events{z-index:100}.--mcp-play-pause-panel,.--mcp-prevent-point-events{height:100%;left:0;position:absolute;top:0;width:100%}.--mcp-play-pause-panel{align-items:center;background-position:50%!important;background-repeat:no-repeat!important;background-size:contain!important;display:flex;justify-content:center;pointer-events:none;z-index:2}.--mcp-play-pause-panel.initial{background-color:#000}.--mcp-play-pause-panel.initial svg{height:32px;width:32px}.--mcp-play-pause-panel.initial .--mcp-play-pause-panel-container{height:80px;width:80px}.--mcp-play-pause-panel.hide{opacity:0}.run-animation-play{animation:scale-and-opaque .8s 1}.run-animation-pause{animation:scale-and-opaque1 .8s 1}.run-animation-idle{animation:scale-and-opaque2 .8s 1}.--mcp-play-pause-panel-container{align-items:center;background-color:#000000c7;border-radius:100%;display:flex;height:60px;justify-content:center;width:60px}.--mcp-play-pause-panel .--mcp-play-pause-panel-container{animation-duration:.8s;transform-origin:center center}@keyframes scale-and-opaque{0%{opacity:.5;transform:scale(1)}to{opacity:0;transform:scale(2)}}@keyframes scale-and-opaque1{0%{opacity:.5;transform:scale(1)}to{opacity:0;transform:scale(2)}}@keyframes scale-and-opaque2{0%{opacity:.5;transform:scale(1)}to{opacity:0;transform:scale(2)}}.--mcp-loop-boundaries{display:flex!important;position:relative}.--mcp-loop-boundaries span{background-color:#aeaeae;border-radius:100%;height:13px;left:-6px;position:absolute;top:-4px;width:13px;z-index:100}.--mcp-loopbar-start{left:0}.--mcp-loopbar-end{left:100%}.--mc-player svg,.--mc-player svg *,.--mcp-btn,.--mcp-cursor,.--mcp-loop-boundaries,.--mcp-loopbar,.--mcp-loopbar-color,.--mcp-runningbar,.--mcp-status-btn,.--mcp-volume *{cursor:pointer}.--mcp-btn{font-size:20px}.--mcp-btn,.--mcp-status-btn{align-items:center;display:flex;justify-content:center}.--mcp-status-btn{gap:3px}.--mcp-indicator{font-size:12px}.--mcp-listener-helper{pointer-events:none}.--mcp-volume-btn{font-size:15px}.--mcp-volumebar{align-items:center;display:flex;height:100%;justify-content:center;padding-left:0;padding-right:0;transition:all .2s ease;width:0}.--mcp-volume{height:100%}.--mcp-volume:hover{padding-right:10px}.--mcp-volume:active .--mcp-volumebar,.--mcp-volume:hover .--mcp-volumebar{padding-left:5px;width:52px}.--mcp-volume:active .--mcp-volume-cursor,.--mcp-volume:hover .--mcp-volume-cursor{display:block}.--mcp-btn:before{color:var(--defaultColor)!important}.--mcp-btn:before:hover{filter:brightness(40)}.--mcp-settings-speed-hide{border-bottom:1px solid hsla(0,0%,100%,.2)}ul.--mcp-speed-values{align-items:center;display:flex;justify-content:center;padding:0}ul.--mcp-speed-values li,ul.--mcp-speed-values li p{width:100%}.--mcp-settings-panel ul{display:flex;flex:1;flex-direction:column;list-style-type:none;margin:0;padding:5px 0}.--mcp-settings-panel ul li{align-items:center;cursor:pointer;display:flex;flex:1;min-height:40px;padding:0 21px}.--mcp-settings-panel ul li *{cursor:pointer}.--mcp-settings-panel ul li:not(.--mcp-no-hover):hover{background-color:rgba(var(--activeColor),.2)}.--mcp-settings-panel ul li>div{align-items:center;display:flex;flex:1;gap:10px;justify-content:flex-end;width:48px}.--mcp-settings-panel{background-color:var(--backgroundSettingsColor);bottom:60px;pointer-events:auto;position:absolute;right:15px;transition:all .2s ease;width:251px;z-index:1000}.--mcp-speed-values{padding:0}.--mcp-no-hover{padding:0!important}.--mcp-speed-value-item:not(.--mcp-selected){padding-left:15px}.--mcp-speed-value-item.--mcp-selected{padding-left:10px}.--mcp-speed-value .icon-check-solid{margin-left:-5px}.--mcp-settings-panel ul.--mcp-speed-settings li>div{flex:unset;justify-content:flex-start;width:20px}.--mcp-main-settings ul li>p{align-items:center;display:flex;flex:1;padding-left:10px}.--mc-player .switch{display:inline-block;height:14px;position:relative;width:36px}.--mc-player .switch input{display:none}.--mc-player .settings-switch:after{clear:both}.--mc-player .slider{background-color:#999;bottom:0;cursor:pointer;left:0;position:absolute;right:0;top:0;transition:.4s}.--mc-player .slider:before{background-color:#cfcfcf;bottom:-3px;content:"";height:20px;left:0;position:absolute;transition:.4s;width:20px}.--mc-player input:checked+.slider{background-color:rgb(var(--activeColor))}.--mc-player input:focus+.slider{box-shadow:0 0 1px rgb(var(--activeColor))}.--mc-player input:checked+.slider:before{background-color:#fff;transform:translateX(16px)}.--mc-player .slider.round{border-radius:34px}.--mc-player .slider.round:before{border-radius:50%}.--mc-player .m-fadeOut{display:none!important;opacity:0!important;visibility:hidden!important}.--mc-player .m-fadeIn{display:unset;opacity:1!important;visibility:visible!important}.--mcp-volume-cursor{background-color:rgb(var(--defaultColor));border-radius:100%;display:none;height:14px;position:absolute;right:-8px;width:14px}.--mcp-volumebar-color{background-color:rgba(var(--defaultColor),.3);height:3px;width:100%}.--mcp-volumebar-color-active{align-items:center;background-color:rgb(var(--defaultColor));display:flex;height:100%;justify-content:center;position:relative;width:100%}.lds-ring{aspect-ratio:1/1;display:inline-block;max-width:64px;position:relative;width:18%}.lds-ring div{animation:lds-ring 1.5s cubic-bezier(.5,.5,.5,.8) infinite;aspect-ratio:1/1;border:3px solid transparent;border-radius:50%;border-top-color:#fff;box-sizing:border-box;display:block;margin:3px;position:absolute;width:100%}.lds-ring div:first-child{animation-delay:-.3s}.lds-ring div:nth-child(2){animation-delay:-.2s}.lds-ring div:nth-child(3){animation-delay:-.1s}@keyframes lds-ring{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}';function H(t){t.settings.loopActivated=!t.settings.loopActivated,t.eventBroadcast(o,t.settings.loopActivated),t.elements.loopButton.classList.toggle("svg-selected"),t.elements.loopBarStart.classList.toggle("m-fadeOut"),t.elements.loopBarEnd.classList.toggle("m-fadeOut"),t.elements.loopBarStart.classList.toggle("m-fadeIn"),t.elements.loopBarStart.classList.toggle(`${t.name}-hide`),t.elements.loopBarEnd.classList.toggle("m-fadeIn"),t.elements.loopBarEnd.classList.toggle(`${t.name}-hide`),t.settings.needsUpdate=!0,t.settings.loopActivated||(t.elements.loopBar.style.left="0%",t.elements.loopBar.style.width="100%",t.settings.loopStartMillisecond=0,t.settings.loopEndMillisecond=t.clip.duration,t.settings.loopLastPositionXPxls=0,t.settings.loopLastPositionXPercentage=0,t.elements.runningBar.style.width=t.clip.runTimeInfo.currentMillisecond/t.clip.duration*100+"%")}const W=t=>{t.elements.showPointerEventsCheckbox.checked?(t.elements.showPointerEventsCheckbox.checked=!1,t.elements.mcPlayer.style.pointerEvents="none",t.elements.pointerEventPanel.style.pointerEvents="auto",t.elements.controls.style.pointerEvents="auto",t.elements.settingsPanel.style.pointerEvents="auto"):(t.elements.showPointerEventsCheckbox.checked=!0,t.options.pointerEvents=!1,t.elements.mcPlayer.style.pointerEvents="none",t.elements.pointerEventPanel.style.pointerEvents="none",t.elements.controls.style.pointerEvents="auto",t.elements.settingsPanel.style.pointerEvents="auto"),t.eventBroadcast("show-pointer-events-change",t.elements.showPointerEventsCheckbox.checked)},U=t=>{t.elements.volumeControl.classList.toggle("m-fadeOut"),t.elements.showVolumeCheckbox.checked?t.elements.showVolumeCheckbox.checked=!1:t.elements.showVolumeCheckbox.checked=!0,t.eventBroadcast(l,t.elements.showVolumeCheckbox.checked)};function G(t,e,n){const r=t.elements;void 0!==n&&(!1===n?(r.volumeBarActive.style.width=100*t.settings.volume+"%",t.clip.setVolume(t.settings.previousVolume),t.settings.volumeMute=!1,A(r.volumeBtn,F,R)):!0===n&&(t.settings.volumeMute=!0,r.volumeBarActive.style.width="0%",t.clip.setVolume(0),A(r.volumeBtn,R,F)),t.options.muted=t.settings.volumeMute,t.eventBroadcast(s,t.settings.volumeMute)),void 0!==e&&(t.settings.volume=e,t.settings.volume>0&&(t.settings.previousVolume=e),r.volumeBarActive.style.width=100*t.settings.volume+"%",t.clip.setVolume(t.settings.volume),t.settings.volume>0?(t.settings.volumeMute=!1,A(r.volumeBtn,F,R)):0===t.settings.volume&&(t.settings.volumeMute=!0,A(r.volumeBtn,R,F)),t.options.volume=t.settings.volume,t.eventBroadcast(i,t.settings.volume),t.eventBroadcast(s,t.settings.volumeMute))}const q={passive:!0};var K=t=>{C(window,"wheel",(e=>{t.stepper(e.deltaY)})),C(window,"touchmove",(e=>{const n=e.touches[0].clientY;t.lastY??=n;const i=-(n-t.lastY);t.stepper(i),t.lastY=n}),q),C(window,"touchend",(()=>{t.lastY=null}),q),C(window,"touchstart",(()=>{t.cancelAnimation(),t.lastY=null}),q)};const X={default:"theme-default",transparent:"theme-transparent",whiteGold:"theme-whiteGold",darkGold:"theme-darkGold",green:"theme-green",blue:"theme-blue",dark:"theme-dark",yellow:"theme-yellow",donkeyclip:"theme-donkeyclip",donkeyclipDark:"theme-donkeyclipDark"};function Y(t){A(t,"spinner",null),t.classList.remove("loading")}const J=[];return class{constructor(t){this.elements={},this.clip=t.clip,this.options=_(t,this),this.document=this.options.host.ownerDocument,this.className=e,this.id=this.options.id,this.name=e,this.clipClass=t.clipClass,this.state=this.clip.runTimeInfo.state,this.listeners={},this.settings={volume:1,journey:null,previousVolume:1,volumeMute:!1,needsUpdate:!0,resizeLoop:!1,loopJourney:!1,loopActivated:!1,requestingLoop:!1,playAfterResize:!1,loopStartMillisecond:0,loopLastPositionXPxls:0,loopLastPositionXPercentage:0,loopEndMillisecond:this.clip.duration,controls:!0},D(this),this.setTheme(),this.setSpeed(),this.subscribeToTimer(),this.subscribeToDurationChange(),this.addEventListeners(),this.scaleClipHost(),this.eventBroadcast(c,this.state),"scroller"===this.options.type&&(this.timeBucket=0,this.timeProgress=0,this.options.sections?.sort(T));const n=new ResizeObserver((()=>{window.innerWidth<450?this.elements.timeDisplay.style.display="none":this.elements.timeDisplay.style.display="block",this.options.scaleToFit&&this.scaleClipHost()}));this.changeSettings(t,!0),n.observe(this.options.host),this.options.autoPlay&&this.play(),window.clip=this.clip}play(){this.clip.play()}pause(){this.clip.pause()}enterFullScreen(){f(this.clip.props.host)}exitFullScreen(){g()}changeSettings(t,e){(t=_(Object.assign({},this.options,t),this)).clip!==this.options.clip&&(e=!0,this.clip=t.clip,this.options.clip=t.clip),!1===t.controls?this.elements.mcPlayer.style.display="none":!0===t.controls&&(this.elements.mcPlayer.style.display="block");const n={loop:()=>H(this),fullscreen:()=>y(this),muted:()=>G(this,void 0,t.mute),volume:()=>G(this,t.volume),speed:()=>function(t,e){e=parseFloat(e)||1,t.eventBroadcast(r,e);const n=1==e?"Normal":e;t.clip.executionSpeed=e,t.elements.speedCurrent.innerHTML=n}(this,t.speed),scaleToFit:()=>{this.options.scaleToFit=t.scaleToFit,this.scaleClipHost()},showVolume:()=>(this,void("showPointerEvents"=="showVolume"?W(this):U(this))),type:()=>{"scroller"===t.type&&K(this)},theme:()=>{this.options.theme=t.theme,this.setTheme()},overflow:()=>{this.clip.props.host.shadowRoot.children[0].style.overflow=t.overflow},outline:()=>{this.clip.props.host.shadowRoot.children[0].style.outline=t.outline},visible:()=>{"always"==t.visible?this.elements.controls.classList.add("--mcp-always-show-controls"):"normal"==t.visible&&this.elements.controls.classList.remove("--mcp-always-show-controls")}},i=["fullscreen","muted","volume","speed","scaleToFit","loop","overflow","outline","visible"];for(const s in n)void 0!==t[s]&&(this.options[s]!==t[s]||e&&!1!==this.options[s]&&i.includes(s))&&n[s]();this.options=Object.assign({},this.options,t)}scaleClipHost(){if(this.options.scaleToFit){const t=this.clip.props,e=function(t,e){let n,i,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!t)return{scale:1,position:{}};t.width&&(n=E(t.width)),t.height&&(i=E(t.height));let r=1,o=1;"px"===n?.unit&&n.number!==e.width&&(r=e.width/n.number),"px"===i?.unit&&i.number!==e.height&&(o=e.height/i.number);const a=(s?o>r:o<=r)?o:r,l={};if(null!=n){let t=n.number*a;"px"!==n.unit&&(t*=e.width/100);const i=e.width-t;l.left=i/2}if(null!=i){let t=i.number*a;"px"!==i.unit&&(t*=e.height/100);const n=e.height-t;l.top=n/2}return{scale:a,position:l}}(t.containerParams,{width:t.host.offsetWidth,height:t.host.offsetHeight-("always"==this.options.visible?50:0)},"cover"===this.options.scaleToFit);this.clip.realClip.rootElement.style.transform=`scale(${e.scale}`,this.clip.realClip.rootElement.style.left=`${e.position.left}px`,this.clip.realClip.rootElement.style.top=`${e.position.top}px`}else this.clip.realClip.rootElement.style.transform="scale(1)",this.clip.realClip.rootElement.style.left="0px",this.clip.realClip.rootElement.style.top="0px";this.eventBroadcast(a,this.options.scaleToFit)}goToMillisecond(t){let{before:e,after:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t>this.clip.duration?t=this.clip.duration:t<0&&(t=0),setTimeout((()=>{const i=this.clip;i.id&&(e&&i[e](),this.settings.journey=b.startJourney(i),this.settings.journey.station(t),this.settings.journey.destination(),n&&i[n]())}),0)}createLoop(t,e){this.settings.loopStartMillisecond=t,this.settings.loopEndMillisecond=e,this.elements.loopBar.style.left=t/this.clip.duration*100+"%",this.elements.loopBar.style.width=(e-t)/this.clip.duration*100+"%",this.goToMillisecond(t),this.elements.runningBar.style.width="0%",!this.settings.loopActivated&&H(this)}calculateMinMaxOfTimeProgress(){this.timeProgress>=this.clip.duration&&(this.timeProgress=this.clip.duration),this.timeProgress<=0&&(this.timeProgress=0)}requestAnimation(){this.requestAnimationID=window.requestAnimationFrame(this.animateTimeBucket.bind(this))}cancelAnimation(){window.cancelAnimationFrame(this.requestAnimationID),this.requestAnimationID=null}removeTimeFromBucket(){const t=Math.log(this.timeBucket),e=Math.pow(t,2);return this.timeBucket-=this.options.scrollAnimation?t:e,e}addTimeToProgress(t){this.timeProgress+=t*this.multiplier*this.clip.speed}checkIfBucketHasTime(){return!(this.timeBucket<=0&&(this.requestAnimationID=null,1))}calculateJourneyPosition(e){const n=t.utils.easings[this.options.sectionsEasing](e);return this.startPosition+n*this.options.speed*this.multiplier*this.endAnimationTime}animateTimeBucket(){if(this.checkIfBucketHasTime){if(this.addTimeToProgress(this.removeTimeFromBucket()),this.calculateMinMaxOfTimeProgress(),this.options.sections){const t=(Date.now()-this.startAnimationTime)/this.endAnimationTime;if(t>=1||0===this.endAnimationTime)return this.cancelAnimation();const e=this.calculateJourneyPosition(t);this.goToMillisecond(Math.ceil(e))}else this.goToMillisecond(this.timeProgress);this.requestAnimation()}}setUpTimeBucket(t){const e=t>0?1:-1;t=Math.ceil(Math.abs(t))*e,this.timeBucket+=Math.abs(t),e!=this.multiplier&&(this.timeBucket=Math.abs(t)),this.timeBucket>this.options.maxScrollStorage&&(this.timeBucket=this.options.maxScrollStorage),this.multiplier=e}getSectionTime(t){let e;const n=this.options.sections;if(t>0){const t=this.startPosition+this.timeBucket;for(let i=0;i=0;i--)if(t>n[i]){e=i;break}e??=0}return e}initializeSections(){this.startAnimationTime=Date.now(),this.startPosition=this.clip.runTimeInfo.currentMillisecond,this.currentSectionIndex=this.getSectionTime(this.multiplier),this.endAnimationTime=Math.abs(this.startPosition-this.options.sections[this.currentSectionIndex])}stepper(t){this.setUpTimeBucket(t),this.options.sections&&this.initializeSections(),this.requestAnimationID||this.animateTimeBucket()}millisecondChange(t,e,n,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const{totalBar:r,loopBar:o}=this.elements;if(this.state!==e&&(this.state=e,this.eventBroadcast(c,e)),!this.settings.needsUpdate)return this.clip.pause(),1;this.settings.loopActivated&&this.clip.speed&&this.calculateJourney(t);const a=this.clip.duration,l=t-a*o.offsetLeft/r.offsetWidth,u=a/r.offsetWidth*o.offsetWidth;i&&this.goToMillisecond(t,{after:this.settings.playAfterResize?"play":null}),this.elements.runningBar.style.width=l/u*100+"%";const p=this.timeFormat(t);this.elements.currentTime.innerHTML!==p&&(this.elements.currentTime.innerHTML=p),this.options.onMillisecondChange&&s&&this.options.onMillisecondChange(t)}calculateJourney(t){const{loopEndMillisecond:e,loopStartMillisecond:n}=this.settings,i=t>e||t===this.clip.duration,s=t0;if(this.clip.runTimeInfo.state===N){if(r)return!!i&&(this.goToMillisecond(n+1,{after:"play"}),!0);if(s)return this.goToMillisecond(e-1,{after:"play"}),!0}return!1}broadcastNotPlaying(t){var e;this.elements.controls.classList.value.includes($)||this.elements.controls.classList.toggle($),A(this.elements.statusButton,"pause","play"),this.elements.indicator.innerHTML=`${t.charAt(0).toUpperCase()+t.slice(1)}`,"blocked"==t?(A(e=this.elements.pointerEventPanel,null,"spinner"),e.classList.add("loading")):"idle"!==t&&Y(this.elements.pointerEventPanel)}changeInitParams(e){const n={result:!0};this.clip.pause();const i=this.clip?.exportLiveDefinition();i.props.host=this.clip.props.host;let s=this.clip.runTimeInfo.currentMillisecond;const r=this.clip.runTimeInfo.state===N,o=JSON.parse(JSON.stringify(i.props.initParams||{}));i.props.initParams=e,this.clip.realClip.context.unmount();for(const t in this.clip)delete this.clip[t];let a;try{if(a=t.utils.clipFromDefinition(i),a.nonBlockingErrorClip||a?.errors?.length)throw"Error: Params Error: Clip cannot be created!"}catch(e){n.result=!1,n.clip=a,console.error(e),i.props.initParams=o,a=t.utils.clipFromDefinition(i)}return this.clip=a,this.options.clip=this.clip,this.elements.totalTime.innerHTML=this.timeFormat(this.clip.duration),this.changeSettings(this.options,!0),this.subscribeToTimer(),this.subscribeToDurationChange(),s>this.clip.duration&&(s=this.clip.duration),this.goToMillisecond(s),r&&this.clip.play(),n}broadcastPlaying(t){Y(this.elements.pointerEventPanel),this.elements.controls.classList.value.includes($)&&this.elements.controls.classList.toggle($),this.elements.indicator.innerHTML="Playing",A(this.elements.statusButton,"play","pause"),t===N&&(this.clip.runTimeInfo.currentMillisecond===this.clip.duration&&this.clip.speed>=0?this.goToMillisecond(1,{after:"play"}):(this.clip.runTimeInfo.currentMillisecond===this.clip.duration||0===this.clip.runTimeInfo.currentMillisecond)&&this.clip.speed<0&&this.goToMillisecond(this.clip.duration-1,{after:"play"}))}broadcastDurationChange(){this.elements.totalTime.innerHTML=this.timeFormat(this.clip.duration),this.settings.loopEndMillisecond=this.clip.duration,this.elements.pointerEventPanel.innerHTML="",this.millisecondChange(this.clip.runTimeInfo.currentMillisecond)}broadcastVolumeChange(t){this.options.volume=t,this.options.currentScript.dataset.volume=t}broadcastSpeedChange(t){this.options.speed=t,this.options.currentScript.dataset.speed=t}broadcastMuteChange(t){if(t)return this.options.muted=!0,void(this.options.currentScript.dataset.muted="");this.options.muted=!1,delete this.options.currentScript.dataset.muted}broadcastLoopChange(t){if(t)return this.options.loop=!0,void(this.options.currentScript.dataset.loop="");this.options.loop=!1,delete this.options.currentScript.dataset.loop}broadcastScaleChange(t){if(t)return this.options.scaleToFit=t,void(this.options.currentScript.dataset.scaleToFit=t);this.options.scaleToFit=!1,delete this.options.currentScript.dataset.scaleToFit}broadcastShowVolumeChange(t){if(t)return this.options.showVolume=!0,void(this.options.currentScript.dataset.showVolume="");this.options.showVolume=!1,delete this.options.currentScript.dataset.showVolume}broadcastToScript(t,e){t===i?this.broadcastVolumeChange(e):t===r?this.broadcastSpeedChange(e):t===s?this.broadcastMuteChange(e):t===o?this.broadcastLoopChange(e):t===a?this.broadcastScaleChange(e):t===l&&this.broadcastShowVolumeChange(e)}calculateThumbnail(t){const e=this.options.thumbnail||this.options.thumbnailColor,n=0===this.clip.runTimeInfo.currentMillisecond&&this.clip.speed>0,i=this.options.autoPlay;if("idle"===t){if(i)return void this.elements.playPausePanel.classList.add("hide");if(n)return e?(v(this.elements.playPausePanelContainer),this.elements.playPausePanel.style.backgroundColor=this.options.thumbnailColor||"black",this.elements.playPausePanel.style.backgroundImage=this.options.thumbnail&&`url(${this.options.thumbnail})`,this.elements.playPausePanel.classList.add("initial"),void this.elements.pointerEventPanel.classList.add("initial")):void this.elements.playPausePanel.classList.add("hide")}this.elements.playPausePanel.style.backgroundColor="transparent",this.elements.playPausePanel.style.backgroundImage="none",this.elements.pointerEventPanel.classList.remove("initial"),this.elements.playPausePanel.classList.remove("initial")}eventBroadcast(t,e){t===c?(this.options.currentScript&&(this.options.currentScript.dataset.status=e),this.calculateThumbnail(e),["paused","idle","transitional","armed","blocked"].includes(e)?this.broadcastNotPlaying(e):this.broadcastPlaying(e)):t===u?this.broadcastDurationChange():this.options.currentScript&&this.broadcastToScript(t,e)}subscribeToDurationChange(){this.clip.subscribeToDurationChange(this.subscribeToDurationChangeCallback.bind(this))}subscribeToDurationChangeCallback(){this.eventBroadcast(u)}subscribeToTimer(){this.clip.subscribe(this.id,this.millisecondChange.bind(this))}handleDragStart(){this.settings.needsUpdate=!0,this.settings.journey=b.startJourney(this.clip)}timeFormat(t){if("ss"!==this.options.timeFormat)return t;const e=t-J[0];if(01&&void 0!==arguments[1])||arguments[1];isFinite(t)||(t=0);const{loopBar:n,totalBar:i,runningBar:s,currentTime:r}=this.elements,o=t+n.offsetLeft,a=Math.round(this.clip.duration*o/i.offsetWidth);r.innerHTML=this.timeFormat(a),s.style.width=t/n.offsetWidth*100+"%",this.settings.journey.station(a),this.options.onMillisecondChange&&e&&this.options.onMillisecondChange(a)}handleDragEnd(){this.settings.journey.destination()}createProgressDrag(t){this.handleDragStart(),this.handleDrag(t),this.handleDragEnd()}addEventListeners(){var t;(t=this).listeners.onCursorMoveLoopEnd=e=>{e.stopPropagation(),S()&&e.preventDefault();let n=(e.clientX||((e.touches||[])[0]||{}).clientX)-t.elements.totalBar.getBoundingClientRect().left;n<0?n=0:n>t.elements.totalBar.offsetWidth&&(n=t.elements.totalBar.offsetWidth),t.elements.runningBar.offsetWidth>=t.elements.loopBar.offsetWidth&&(t.elements.runningBar.style.width=t.elements.loopBar.offsetWidth+"px"),t.settings.loopLastPositionXPxls-n<0?t.elements.loopBar.style.width=Math.abs(t.settings.loopLastPositionXPxls-n)+"px":(t.elements.loopBar.style.left=n+"px",t.settings.loopLastPositionXPxls=n),t.settings.loopEndMillisecond=Math.round(t.clip.duration*((parseFloat(t.elements.loopBar.style.left)||0)+parseFloat(t.elements.loopBar.style.width))/t.elements.totalBar.offsetWidth),t.settings.loopEndMillisecondt.settings.loopEndMillisecond&&(t.settings.loopStartMillisecond=t.settings.loopEndMillisecond,t.settings.loopJourney=!0)},t.listeners.onMouseUpLoopEnd=()=>{t.elements.listenerHelper.style.pointerEvents="none",t.settings.resizeLoop=!1;const{loopBar:e,totalBar:n,runningBar:i}=t.elements;if(i.style.width=i.offsetWidth/e.offsetWidth*100+"%",e.style.left=e.offsetLeft/n.offsetWidth*100+"%",e.style.width=e.offsetWidth/n.offsetWidth*100+"%",t.settings.loopJourney&&(t.createProgressDrag(i.offsetWidth),t.settings.loopJourney=!1),M(t,t.listeners.onMouseUpLoopEnd,t.listeners.onCursorMoveLoopEnd),O(t.listeners.onMouseDown,e,!0),t.settings.playAfterResize){if("idle"===t.clip.runTimeInfo.state||"completed"===t.clip.runTimeInfo.state){let e;e=t.clip.speed>=0?t.settings.loopStartMillisecond+1:t.settings.loopEndMillisecond-1,t.settings.needsUpdate=!0,t.goToMillisecond(e,{before:"pause",after:"play"})}else t.clip.play();t.settings.playAfterResize=!1}},t.listeners.onMouseDownLoopEnd=e=>{e.stopPropagation(),t.elements.listenerHelper.style.pointerEvents="auto",t.settings.resizeLoop=!0,t.settings.needsUpdate=!0,"playing"===t.clip.runTimeInfo.state&&(t.clip.pause(),t.settings.playAfterResize=!0),t.elements.runningBar.style.width=`${t.elements.runningBar.offsetWidth}px`;const n=t.elements.loopBar;n.style.left=`${n.offsetLeft}px`,n.style.width=`${n.offsetWidth}px`,t.listeners.onCursorMoveLoopEnd(e),k(t,t.listeners.onMouseUpLoopEnd,t.listeners.onCursorMoveLoopEnd)},O(t.listeners.onMouseDownLoopEnd,t.elements.loopBarEnd,!1),(t=>{t.listeners.onCursorMove=e=>{e.stopPropagation(),S()&&e.preventDefault();let n=(e.clientX||((e.touches||[])[0]||{}).clientX)-t.elements.loopBar.getBoundingClientRect().left;n<0?n=0:n>t.elements.loopBar.offsetWidth&&(n=t.elements.loopBar.offsetWidth),t.handleDrag(n)},t.listeners.onMouseUp=()=>{t.elements.listenerHelper.style.pointerEvents="none",M(t,t.listeners.onMouseUp,t.listeners.onCursorMove),t.handleDragEnd(t.settings)},t.listeners.onMouseDown=e=>{t.elements.listenerHelper.style.pointerEvents="auto","playing"===t.clip.runTimeInfo.state&&(t.settings.playAfterResize=!0),t.handleDragStart(t.clip),t.listeners.onCursorMove(e),k(t,t.listeners.onMouseUp,t.listeners.onCursorMove)},O(t.listeners.onMouseDown,t.elements.loopBar)})(this),(t=>{t.listeners.onCursorMoveLoopStart=e=>{e.stopPropagation(),S()&&e.preventDefault();const n=e.clientX||((e.touches||[])[0]||{}).clientX,i=t.elements.totalBar.getBoundingClientRect();let s=Math.round(n-i.left);const r=Math.round(t.settings.loopEndMillisecond/t.clip.duration*t.elements.totalBar.offsetWidth);s<0?s=0:s>t.elements.totalBar.offsetWidth&&(s=t.elements.totalBar.offsetWidth);const o=t.clip.runTimeInfo.currentMillisecond/t.clip.duration*t.elements.totalBar.offsetWidth-s;t.elements.loopBar.style.left=s+"px",t.elements.loopBar.style.width=r-s+"px",t.elements.runningBar.style.width=o+"px",t.settings.loopLastPositionXPxls=s,t.settings.loopStartMillisecond=Math.round(t.clip.duration*t.elements.loopBar.offsetLeft/t.elements.totalBar.offsetWidth),t.settings.loopEndMillisecondt.clip.runTimeInfo.currentMillisecond&&(t.settings.loopJourney=!0)},t.listeners.onMouseUpLoopStart=()=>{if(t.elements.listenerHelper.style.pointerEvents="none",t.settings.resizeLoop=!1,t.settings.loopJourney&&(t.createProgressDrag(t.elements.runningBar.offsetWidth),t.settings.loopJourney=!1),t.elements.loopBar.style.left=t.elements.loopBar.offsetLeft/t.elements.totalBar.offsetWidth*100+"%",t.elements.loopBar.style.width=t.elements.loopBar.offsetWidth/t.elements.totalBar.offsetWidth*100+"%",t.settings.loopStartMillisecond=Math.round(t.clip.duration*t.elements.loopBar.offsetLeft/t.elements.totalBar.offsetWidth),t.elements.runningBar.style.width=t.elements.runningBar.offsetWidth/t.elements.loopBar.offsetWidth*100+"%",M(t,t.listeners.onMouseUpLoopStart,t.listeners.onCursorMoveLoopStart),O(t.listeners.onMouseDown,t.elements.loopBar,!0),t.settings.playAfterResize){if("idle"===t.clip.runTimeInfo.state){let e;e=t.clip.speed>=0?t.settings.loopStartMillisecond+1:t.settings.loopEndMillisecond-1,t.settings.needsUpdate=!0,t.goToMillisecond(e,{before:"pause",after:"play"})}else t.clip.play();t.settings.playAfterResize=!1}},t.listeners.onMouseDownLoopStart=e=>{e.stopPropagation(),t.elements.listenerHelper.style.pointerEvents="auto",t.settings.resizeLoop=!0,t.settings.needsUpdate=!0,"playing"===t.clip.runTimeInfo.state&&(t.clip.pause(),t.settings.playAfterResize=!0),t.listeners.onCursorMoveLoopStart(e),k(t,t.listeners.onMouseUpLoopStart,t.listeners.onCursorMoveLoopStart)},O(t.listeners.onMouseDownLoopStart,t.elements.loopBarStart)})(this),function(t){t.elements.context.onkeydown=e=>{switch(e.code){case"Space":I(t);break;case"ArrowRight":t.goToMillisecond(t.clip.runTimeInfo.currentMillisecond+5e3);break;case"ArrowLeft":t.goToMillisecond(t.clip.runTimeInfo.currentMillisecond-5e3)}}}(this),function(t){const e=t.elements;let n=!1;e.volumeBtn.onclick=()=>{t.settings.volumeMute?(e.volumeBarActive.style.width=100*t.settings.volume+"%",t.clip.setVolume(t.settings.previousVolume),e.volumeBarActive.style.width=100*t.settings.previousVolume+"%",t.settings.volumeMute=!1,A(e.volumeBtn,F,R)):(t.settings.volumeMute=!0,A(e.volumeBtn,R,F),e.volumeBarActive.style.width="0%",t.clip.setVolume(0)),t.eventBroadcast(i,t.settings.previousVolume),t.eventBroadcast(s,t.settings.volumeMute)};let r=!1;e.volumeBtn.onmouseover=()=>{r=!0},t.elements.leftButtons.onmouseout=()=>{if(!r||n)return;const e=event.toElement||event.relatedTarget||event.target;e===t.elements.leftButtons||function(t,e){let n=e.parentNode;for(;null!=n;){if(n==t)return!0;n=n.parentNode}return!1}(t.elements.leftButtons,e)||(r=!1)};const o=t.listeners;o.onCursorMoveVolumeBar=n=>{let r=(n.clientX||((n.touches||[])[0]||{}).clientX)-e.volumeBarHelper.getBoundingClientRect().left;if(r<0?r=0:r>e.volumeBarHelper.offsetWidth&&(r=e.volumeBarHelper.offsetWidth),t.settings.volume=Number((r/e.volumeBarHelper.offsetWidth).toFixed(2)),e.volumeBarActive.style.width=100*t.settings.volume+"%",t.clip.setVolume(t.settings.volume),t.settings.volume>=0){const n=0===t.settings.volume;t.settings.volumeMute=n,n?A(e.volumeBtn,R,F):A(e.volumeBtn,F,R)}t.eventBroadcast(i,t.settings.volume),t.eventBroadcast(s,t.settings.volumeMute)},o.onMouseUpVolumeBar=()=>{n=!1,e.listenerHelper.style.pointerEvents="none",t.settings.volume>0&&(t.settings.previousVolume=t.settings.volume),M(t,o.onMouseUpVolumeBar,o.onCursorMoveVolumeBar)},o.onMouseDownVolumeBar=i=>{n=!0,e.listenerHelper.style.pointerEvents="auto",o.onCursorMoveVolumeBar(i),k(t,o.onMouseUpVolumeBar,o.onCursorMoveVolumeBar)},O(o.onMouseDownVolumeBar,e.volumeBarHelper),O(o.onMouseDownVolumeBar,e.volumeCursor)}(this),(t=>{t.elements.statusButton.onclick=()=>{switch(t.clip.runTimeInfo.state){case"playing":t.clip.pause();break;case"paused":case"idle":case"transitional":case"armed":t.clip.play()}return!1}})(this),function(t){t.elements.settingsPanel.onblur=()=>{t.elements.settingsButton.click()},t.elements.settingsPointerEvents.onclick=()=>W(t),t.elements.settingsShowVolume.onclick=()=>U(t),t.elements.settingsButton.onclick=()=>{const e=n=>{if(t.elements.settingsPanel.contains(n.target))return!0;t.elements.settingsPanel.classList.toggle(`${t.name}-hide`),t.elements.settingsPanel.classList.toggle("m-fadeOut"),t.elements.settingsPanel.classList.toggle("m-fadeIn"),t.elements.settingsPanel.className.includes("m-fadeOut")?(t.document.removeEventListener("click",e,!1),t.eventBroadcast(c,t.state)):t.elements.settingsPanel.focus()};t.elements.settingsPanel.className.includes("m-fadeOut")?(t.elements.controls.classList.value.includes("--mcp-force-show-controls")||t.elements.controls.classList.toggle("--mcp-force-show-controls"),t.document.addEventListener("click",e,!1)):t.document.removeEventListener("click",e,!1)}}(this),function(t){t.elements.settingsSpeedButtonShow.onclick=t.elements.settingsSpeedButtonHide.onclick=()=>{t.elements.settingsPanel.classList.toggle(`${t.name}-settings-speed-panel`),t.elements.settingsPanel.className.includes(`${t.name}-settings-speed-panel`)?(t.elements.settingsMainPanel.style.display="none",t.elements.settingsSpeedPanel.style.display="block"):(t.elements.settingsSpeedPanel.style.display="none",t.elements.settingsMainPanel.style.display="block")}}(this),function(t){t.elements.loopButton.onclick=()=>H(t)}(this),function(t){t.elements.fullScreenButton.onclick=()=>y(t)}(this),function(t){t.elements.pointerEventPanel.onclick=()=>function(t){I(t)}(t),t.elements.pointerEventPanel.ondblclick=()=>y(t)}(this),(t=>{this.elements.donkeyclipButton.addEventListener("click",(()=>{const t=window.DonkeyClip?.clipId,e=window.location.host.includes("staging")?"staging.":"";window.open(`https://${e}donkeyclip.com/${t?`explore/donkeyclips/${t}`:""}`)}))})(),(t=>{function e(){t.elements.mcPlayer.classList.toggle("full-screen"),t.clip.props.host.classList.toggle("full-screen")}t.document.addEventListener("fullscreenchange",e),t.document.addEventListener("webkitfullscreenchange",e),t.document.addEventListener("mozfullscreenchange",e),t.document.addEventListener("MSFullscreenChange",e)})(this),"scroller"===this.options.type&&K(this)}setTheme(){this.options.theme.replace(/\s\s+/g," "),this.options.theme.trim();const t=X[this.options.theme];if(t)this.elements.mcPlayer.classList.add(t);else if(this.options.themeCSS&&!this.document.getElementById("--mc-player-style-custom")){this.options.themeCSS=this.options.themeCSS.replace(/(behaviour|javascript|expression)/gm,"");const t=this.document.createElement("style");t.id="--mc-player-style-custom",t.styleSheet?t.styleSheet.cssText=this.options.themeCSS:t.appendChild(document.createTextNode(this.options.themeCSS)),this.document.querySelector("head").appendChild(t),this.elements.mcPlayer.classList.add(this.options.theme)}if(!this.document.getElementById("--mc-player-style")){const t=this.document.createElement("style");t.id="--mc-player-style",t.styleSheet?t.styleSheet.cssText=z:t.appendChild(document.createTextNode(z)),this.document.querySelector("head").appendChild(t)}this.eventBroadcast("theme-change",this.options.theme)}setSpeed(){const t=1==this.clip.speed?"Normal":this.clip.speed;this.elements.speedCurrent.innerHTML=t}}}(n(584))},359:function(t){t.exports=function(){"use strict";function t(t){var e=t.split(":");try{var n=e[2].split(",");return 1===n.length&&(n=e[2].split(".")),3600*parseFloat(e[0],10)+60*parseFloat(e[1],10)+parseFloat(n[0],10)+parseFloat(n[1],10)/1e3}catch(t){return 0}}function e(t,e){for(var n=e;!t[n];)n++;return n}return function(){for(var n=[],i=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/(?:\r\n|\r|\n)/gm),s=function(t){for(var e=t.length-1;e>=0&&!t[e];)e--;return e}(i)+1,r=0,o=void 0,a=void 0,l=void 0,c=0;c[\t ]*/),l.start=t(o[0]),-1!==(r=o[1].indexOf(" "))&&(o[1]=o[1].substr(0,r)),l.end=t(o[1]);c/g,">"),l.text=l.text.replace(/<(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)(\/?)>/gi,"<$1$3$7>"),l.text=l.text.replace(/\\N/gi,"
    "),n.push(l)}return n}}()},584:(t,e,n)=>{"use strict";n.r(e),n.d(e,{AudioClip:()=>aa,AudioEffect:()=>Tl,AudioPlayback:()=>_l,BrowserClip:()=>oo,CSSEffect:()=>hl,Combo:()=>Sl,CoreAudioClip:()=>Dl,Effect:()=>st,ExtendableCSSEffect:()=>Qa,Group:()=>Pr,HTMLClip:()=>oa,MediaPlayback:()=>da,TimeCapsule:()=>Ml,loadPlugin:()=>Ka,setCSSCore:()=>pl,utils:()=>Ol,version:()=>xr});const i=[{key:"info",style:"color:#666;",level:5,consoleMethod:"log"},{key:"notice",style:"background:rgba(0,0,0,0.8);color:white;padding:8px;",level:4,consoleMethod:"log"},{key:"warning",style:"color:black;background:orange;",level:2,consoleMethod:"warn"},{key:"error",style:"color:black;background:red;",level:1,consoleMethod:"error"}],s="data-motorcortex2-id",r="MotorCortex",o="total",a="index",l="initParams",c=["object","array","any","boolean","class","tuple"],u="motor-cortex-js",p=`${u}-attribute`;var h=Object.defineProperty,d=(t,e,n)=>(((t,e,n)=>{e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);window.AudioContext||(window.AudioContext=window.webkitAudioContext);const m=new window.AudioContext;function g(t){return t===parseInt(t,10)}function f(t){return!isNaN(parseFloat(t))&&isFinite(t)}function y(t){return"string"==typeof t||t instanceof String}function v(t){return"object"==typeof t}function b(t){return t&&"[object Function]"==={}.toString.call(t)}function x(t,e){return!(null==e||!v(t))&&Object.prototype.hasOwnProperty.call(t,e)}function w(t){return JSON.parse(JSON.stringify(t))}const C=/^[+-]?(\d+([.]\d*)?|[.]\d+)/gi;function I(t,e){const n=null==t?void 0:t[e];if(!y(n))return null;let i=n.match(C)[0];const s=n.substring(i.length);return i=Number(i),!function(t){return"number"==typeof t&&isFinite(t)}(i)||"%"!==s&&"px"!==s?null:{number:i,unit:s}}const P=['originalDims should be an object containing both the "width" and "height" keys'];function E(t){return null==t?{result:!0,analysis:{width:null,height:null}}:v(t)&&x(t,"width")&&x(t,"height")?null==I(t,"width")?{result:!1,errors:["originalDims.width should be defined either on px or %."]}:null==I(t,"height")?{result:!1,errors:["originalDims.height should be defined either on px or %."]}:{result:!0,analysis:S(t)}:{result:!1,errors:P}}function S(t){return v(t)&&null!=t?{width:I(t,"width"),height:I(t,"height")}:{width:null,height:null}}function k(t){var e;const n=F(t),i=null==(e=/.*\((.*)\).*/.exec(n))?void 0:e[1];return null==i?void 0:i.split(",")}function M(t){const e=t.split("___");return{mcid:e[0],attribute:e[1]}}function O(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function A(t=!1){const e=t?"_":"-";return`${O()}${O()}${e}${O()}${e}${O()}`}function T(t,e){return`${t}___${e}`}function _(t,e){return!1}function D(t,e){return{result:!1}}function B(t,e,n){const i=e.split(".");let s=t;for(let t=0;t=n.level?this[n.key]=window.console[n.consoleMethod].bind(window.console,`MotorCortex - ${n.key}: `):this[n.key]=L}this.log=e>=3?window.console.log.bind(window.console,"MotorCortex - "):L}};function V(t,e,n){const i=e(t);if(i.length>0){let t=`Error on plugin's "${n.plugin_npm_name}" "${n.ClassName}" instantiation. Errors (op props):`;for(let e=0;e":">",'"':""","'":"'","/":"/"};return`${t}`.replace(/[&<>"'/]/g,(function(t){return e[t]}))}function N(t,e,n){const i=[];for(let s=0;s(((t,e,n)=>{e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);function H(t){return t.result?{result:!0,execute:t.execute}:{result:!1,errors:t.errors}}const W={result:!0,execute:function(){}};class U{constructor(t){z(this,"context"),z(this,"getIncidentById"),z(this,"runTimeInfo"),this.runTimeInfo=t.runTimeInfo||{},this.context=t.context,this.onInitialise(),this.getIncidentById=t.getIncidentById}static get type(){return"plain"}static set type(t){}onInitialise(){}_resize(t){j.log("Please overwite the _resize method of the Channel")}addIncidents(t){return H(this.checkAddition(t))}editIncidents(t,e){return H(this.checkEdit(t,e))}removeIncidents(t,e={}){return H(this.checkDelete(t,e))}recalcScratchValues(t){}checkAddition(t){return W}checkEdit(t,e){return W}checkDelete(t,e){return W}checkResizedIncidents(t){return W}moveTo(t,e,n,i){}}var G=Object.defineProperty,q=(t,e,n)=>(((t,e,n)=>{e in t?G(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class K extends U{constructor(){super(...arguments),q(this,"incidents",[]),q(this,"incidentsById",{})}onInitialise(){this.incidents=[],this.incidentsById={}}_incidentById(t){return this.incidentsById[t]}_resize(t){for(let e=0;e0?{result:!1,errors:e}:{result:!0,execute:()=>{this.incidentsById=Object.assign(this.incidentsById,n),this.incidents||(this.incidents=[]),this.incidents.push(...i),this.incidents.sort(((t,e)=>t.millisecond-e.millisecond));for(let e=0;et.millisecond-e.millisecond))}}}checkDelete(t){const e=this,n=[];for(let e=0;e!n.includes(t.id)));e.incidents=t;for(let t=0;tt.millisecond-e.millisecond))}}}moveTo(t,e,n,i=!1){if(i)for(let t=0;ti.millisecond+s.duration?s.onProgress(1,s.duration,n,!0):s.onProgress((e-i.millisecond)/s.duration,e-i.millisecond,n,!0)}else for(let t=0;t=1?1:a;o=a>=1?r.duration:e-o,r.onProgress(l,o,n,!1)}function s(n,i){let s=e,r=t;return e>t&&(s=r,r=e),i+n>=s&&i+n<=r||n+i>=r&&i<=r}}}function X(t){const e=new t.Class(t.attrs,t.props);if(!1===e.result)return e;if(x(t,"incidents"))for(const n in t.incidents){const i=t.incidents[n],s=X(i.leaf);if(!1===s.result)return s;const r=e.addIncident(s,i.position);if(!1===r.result)return r}return e}var Y=(t=>(t._UP="up",t._DOWN="down",t))(Y||{}),J=(t=>(t._ROOTOFTREE="native.tree.rootoftree",t))(J||{});const Z="native.tree.bypass";var Q=Object.defineProperty,tt=(t,e,n)=>(((t,e,n)=>{e in t?Q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class et{constructor(){tt(this,"DescriptiveIncident"),tt(this,"blockID"),tt(this,"mc_plugin_npm_name"),tt(this,"id")}getIncidentsByChannel(t=0,e=0){return{[this.mc_plugin_npm_name]:[{millisecond:t,parentMillisecond:e,incident:this,id:this.id}]}}setBlock(t,e={}){null!=this.blockID||e.blockId||(this.blockID=A()),this.DescriptiveIncident?this.DescriptiveIncident.putMessageOnPipe("setBlock",{id:this.blockID||e.blockId,description:t,incidentId:this.DescriptiveIncident.id,realIncidentId:this.id,options:e},"rootClip",{selfExecute:!0,direction:Y._UP}):j.error("Descriptive incident doesn't exist, failed to block")}unblock(t=null){this.DescriptiveIncident?this.DescriptiveIncident.putMessageOnPipe("unBlock",{id:null!=t?t:this.blockID},"rootClip",{selfExecute:!0,direction:Y._UP}):j.error("Descriptive incident doesn't exist, failed to unblock")}}var nt=Object.defineProperty,it=(t,e,n)=>(((t,e,n)=>{e in t?nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class st extends et{constructor(t={animatedAttrs:{}},e={},n){var i;super(),it(this,"attributeKey"),it(this,"attrs"),it(this,"autoGenerated"),it(this,"context",{}),it(this,"dna"),it(this,"gotContext"),it(this,"hasIncidents"),it(this,"initialValues",{}),it(this,"mcid"),it(this,"modelId"),it(this,"plugin_channel_class"),it(this,"props"),it(this,"pureInitialValues"),it(this,"userDefinedInitialValues"),it(this,"runTimeInfo"),this.attrs=t,this.props=e,this.dna=n,this.context=(null==n?void 0:n.context)||{},this.mcid=null==n?void 0:n.mcid,this.id=e.id||A(),this.modelId=e.modelId,this.gotContext=!1,this.plugin_channel_class=U,this.mc_plugin_npm_name=u,x(e,"plugin_channel_class")&&(this.plugin_channel_class=e.plugin_channel_class),x(e,"mc_plugin_npm_name")&&(this.mc_plugin_npm_name=e.mc_plugin_npm_name),this.hasIncidents=!1,this.initialValues={},this.userDefinedInitialValues=t.initialValues||{},this.pureInitialValues=null,this.autoGenerated=!1,x(this.attrs,"animatedAttrs")&&(this.attributeKey=Object.keys(null!=(i=this.attrs.animatedAttrs)?i:{})[0]),this.onInitialise()}get duration(){}set duration(t){}get selector(){return this.props.selector}get animAttributes(){return this.attrs.animatedAttrs}set animAttributes(t){this.attrs.animatedAttrs[this.attributeKey]=t}getScratchValue(){return 0}get element(){return null===this.context?[]:this.context.getElementByMCID?this.context.getElementByMCID(this.mcid):this.context.getElements(this.selector)[0]}get targetValue(){return this.animAttributes[this.attributeKey]}getElementAttribute(t){return this.element.getAttribute(t)}getFraction(t){return t/this.props.duration}hasUserDefinedInitialValue(){return x(this.userDefinedInitialValues,this.attributeKey)}setInitialValue(t,e=!0){if(e&&(this.pureInitialValues=w(t)),this.hasUserDefinedInitialValue())if(v(this.targetValue)){for(const e in this.userDefinedInitialValues[this.attributeKey])t[e]=this.userDefinedInitialValues[this.attributeKey][e];this.initialValues[this.attributeKey]=t}else this.initialValues[this.attributeKey]=this.userDefinedInitialValues[this.attributeKey];else this.initialValues[this.attributeKey]=t}get initialValue(){return this.initialValues[this.attributeKey]}_onGetContextOnce(t){try{if(this.context.fragment)return;this.gotContext||(this.onGetContext(),this.gotContext=!0)}catch(t){j.error(t,this.mcid)}}onGetContext(){j.info('Overwrite the "onGetContext" method with the code you want to get executed',"info")}lastWish(){}onInitialise(){j.info('Overwrite the "onInialise" method with the code you want to get executed',"info")}onProgress(t,e,n,i){}}var rt=Object.defineProperty,ot=Object.defineProperties,at=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,ct=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable,pt=(t,e,n)=>e in t?rt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;class ht extends st{constructor(t,e,n){var i;super(t,e,n),pt(this,"symbol"!=typeof(i="ownClip")?i+"":i,void 0),this.runTimeInfo={currentMillisecond:0}}get duration(){return this.DescriptiveIncident.realClip.duration}lastWish(){this.ownClip&&this.ownClip.context.unmount()}onGetContext(){const t=this.DescriptiveIncident.realClip.exportConstructionArguments(),e=(n=this.context,i=this.mcid,n.rootElement.querySelectorAll(`[${s}="${i}"]`)[0]);var n,i;const r=this.DescriptiveIncident.constructor,o=(a=((t,e)=>{for(var n in e||(e={}))ct.call(e,n)&&pt(t,n,e[n]);if(lt)for(var n of lt(e))ut.call(e,n)&&pt(t,n,e[n]);return t})({},t.props),l={selector:void 0,host:e,containerParams:this.DescriptiveIncident.props.containerParams||{},originalDims:r.originalDims||{}},ot(a,at(l)));var a,l;this.ownClip=new r.Incident(t.attrs,o,this.DescriptiveIncident),this.ownClip.clipCopyId=this.id,this.DescriptiveIncident.realClip.addContext({clipId:this.id,context:this.ownClip.context},!0)}onProgress(t,e=!1){if(!1!==this.ownClip.ownContext.contextLoaded){for(const n in this.DescriptiveIncident.realClip.instantiatedChannels)this.DescriptiveIncident.realClip.instantiatedChannels[n].moveTo(this.runTimeInfo.currentMillisecond,t,this.id,e);this.runTimeInfo.currentMillisecond=t}else this.setBlock("context loading",{blockId:this.id})}}var dt=Object.defineProperty,mt=Object.defineProperties,gt=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,yt=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable,bt=(t,e,n)=>e in t?dt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xt=(t,e)=>{for(var n in e||(e={}))yt.call(e,n)&&bt(t,n,e[n]);if(ft)for(var n of ft(e))vt.call(e,n)&&bt(t,n,e[n]);return t},wt=(t,e)=>mt(t,gt(e));function Ct(t,e=!1){const n=e?t.DescriptiveIncident:{context:t.context,mcid:t.mcid},i=new t.Incident(t.attrs,wt(xt({},t.props),{id:t.id||A()}),n);return i.mc_plugin_npm_name=t.plugin_npm_name,i.plugin_channel_class=t.Channel,i.DescriptiveIncident=t.DescriptiveIncident,i}const It="Incidents with dynamic duration can't be resized. Once the Incident enters a Clip it'll become resizable";var Pt=Object.defineProperty;const Et={supportedTypes:["amount","color","date","email","measurement","number","string"],preface:"attribute"},St=new RegExp(`^@${Et.preface}\\([_A-z0-9-]*\\)$`),kt={Handler:class{constructor(t){var e;((t,e,n)=>{((t,e,n)=>{e in t?Pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"expressionProps"),this.expressionProps={attribute:null==(e=/\(([^)]+)\)/.exec(t.value))?void 0:e[1]}}calculateValues(t){const e=[];for(let n=0;nfunction(){return e||(0,t[Ot(t)[0]])((e={exports:{}}).exports,e),e.exports},Tt="INUMBER",_t="IOP1",Dt="IOP2",Bt="IOP3",Lt="IVAR",jt="IVARNAME",Vt="IFUNCALL",$t="IFUNDEF",Nt="IEXPR",Ft="IEXPREVAL",Rt="IMEMBER",zt="IENDSTATEMENT",Ht="IARRAY";function Wt(t,e){this.type=t,this.value=null!=e?e:0}function Ut(t){return new Wt(_t,t)}function Gt(t){return new Wt(Dt,t)}function qt(t){return new Wt(Bt,t)}function Kt(t,e,n,i,s){for(var r,o,a,l,c=[],u=[],p=0;p1)o=c.pop(),r=c.pop(),l=n[h.value],h=new Wt(Tt,l(r.value,o.value)),c.push(h);else if(d===Bt&&c.length>2)a=c.pop(),o=c.pop(),r=c.pop(),"?"===h.value?c.push(r.value?o.value:a.value):(l=i[h.value],h=new Wt(Tt,l(r.value,o.value,a.value)),c.push(h));else if(d===_t&&c.length>0)r=c.pop(),l=e[h.value],h=new Wt(Tt,l(r.value)),c.push(h);else if(d===Nt){for(;c.length>0;)u.push(c.shift());u.push(new Wt(Nt,Kt(h.value,e,n,i,s)))}else if(d===Rt&&c.length>0)r=c.pop(),c.push(new Wt(Tt,r.value[h.value]));else{for(;c.length>0;)u.push(c.shift());u.push(h)}}for(;c.length>0;)u.push(c.shift());return u}function Xt(t,e,n){for(var i=[],s=0;s0;)a.unshift(Qt(c.pop(),n));if(!(o=c.pop()).apply||!o.call)throw new Error(o+" is not a function");c.push(o.apply(void 0,a))}else if(d===$t)c.push(function(){for(var t=c.pop(),i=[],s=h.value;s-- >0;)i.unshift(c.pop());var r=c.pop(),o=function(){for(var s=Object.assign({},n),r=0,o=i.length;r0;)a.unshift(c.pop());c.push(a)}}if(c.length>1)throw new Error("invalid Expression (parity)");return 0===c[0]?0:Qt(c[0],n)}function Jt(t,e,n){return Zt(t)?t:{type:Ft,value:function(n){return Yt(t.value,e,n)}}}function Zt(t){return t&&t.type===Ft}function Qt(t,e){return Zt(t)?t.value(e):t}function te(t,e){for(var n,i,s,r,o,a,l=[],c=0;c0;)o.unshift(l.pop());r=l.pop(),l.push(r+"("+o.join(", ")+")")}else if(p===$t){for(i=l.pop(),a=u.value,o=[];a-- >0;)o.unshift(l.pop());n=l.pop(),e?l.push("("+n+" = function("+o.join(", ")+") { return "+i+" })"):l.push("("+n+"("+o.join(", ")+") = "+i+")")}else if(p===Rt)n=l.pop(),l.push(n+"."+u.value);else if(p===Ht){for(a=u.value,o=[];a-- >0;)o.unshift(l.pop());l.push("["+o.join(", ")+"]")}else if(p===Nt)l.push("("+te(u.value,e)+")");else if(p!==zt)throw new Error("invalid Expression")}return l.length>1&&(l=e?[l.join(",")]:[l.join(";")]),String(l[0])}function ee(t){return"string"==typeof t?JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"):t}function ne(t,e){for(var n=0;n=this.expression.length?this.newToken(re,"EOF"):this.isWhitespace()||this.isComment()?this.next():this.isRadixInteger()||this.isNumber()||this.isOperator()||this.isString()||this.isParen()||this.isBracket()||this.isComma()||this.isSemicolon()||this.isNamedOp()||this.isConst()||this.isName()?this.current:void this.parseError('Unknown character "'+this.expression.charAt(this.pos)+'"')},ge.prototype.isString=function(){var t=!1,e=this.pos,n=this.expression.charAt(e);if("'"===n||'"'===n)for(var i=this.expression.indexOf(n,e+1);i>=0&&this.pos"9")))break}if(e>t){var i=this.expression.substring(t,e);if(i in this.consts)return this.current=this.newToken(ae,this.consts[i]),this.pos+=i.length,!0}return!1},ge.prototype.isNamedOp=function(){for(var t=this.pos,e=t;e"9")))break}if(e>t){var i=this.expression.substring(t,e);if(this.isOperatorEnabled(i)&&(i in this.binaryOps||i in this.unaryOps||i in this.ternaryOps))return this.current=this.newToken(oe,i),this.pos+=i.length,!0}return!1},ge.prototype.isName=function(){for(var t=this.pos,e=t,n=!1;e"9"))break}else n=!0}if(n){var s=this.expression.substring(t,e);return this.current=this.newToken(he,s),this.pos+=s.length,!0}return!1},ge.prototype.isWhitespace=function(){for(var t=!1,e=this.expression.charAt(this.pos);!(" "!==e&&"\t"!==e&&"\n"!==e&&"\r"!==e||(t=!0,this.pos++,this.pos>=this.expression.length));)e=this.expression.charAt(this.pos);return t};var fe=/^[0-9a-f]{4}$/i;function ye(t,e,n){this.parser=t,this.tokens=e,this.current=null,this.nextToken=null,this.next(),this.savedCurrent=null,this.savedNextToken=null,this.allowMemberAccess=!1!==n.allowMemberAccess}ge.prototype.unescape=function(t){var e=t.indexOf("\\");if(e<0)return t;for(var n=t.substring(0,e);e>=0;){var i=t.charAt(++e);switch(i){case"'":n+="'";break;case'"':n+='"';break;case"\\":n+="\\";break;case"/":n+="/";break;case"b":n+="\b";break;case"f":n+="\f";break;case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+="\t";break;case"u":var s=t.substring(e+1,e+5);fe.test(s)||this.parseError("Illegal escape sequence: \\u"+s),n+=String.fromCharCode(parseInt(s,16)),e+=4;break;default:throw this.parseError('Illegal escape sequence: "\\'+i+'"')}++e;var r=t.indexOf("\\",e);n+=t.substring(e,r<0?t.length:r),e=r}return n},ge.prototype.isComment=function(){return"/"===this.expression.charAt(this.pos)&&"*"===this.expression.charAt(this.pos+1)&&(this.pos=this.expression.indexOf("*/",this.pos)+2,1===this.pos&&(this.pos=this.expression.length),!0)},ge.prototype.isRadixInteger=function(){var t,e,n=this.pos;if(n>=this.expression.length-2||"0"!==this.expression.charAt(n))return!1;if(++n,"x"===this.expression.charAt(n))t=16,e=/^[0-9a-f]$/i,++n;else{if("b"!==this.expression.charAt(n))return!1;t=2,e=/^[01]$/i,++n}for(var i=!1,s=n;n="0"&&t<="9"||!r&&"."===t);)"."===t?r=!0:o=!0,n++,e=o;if(e&&(s=n),"e"===t||"E"===t){n++;for(var a=!0,l=!1;n="0"&&t<="9"))break;l=!0,a=!1}else a=!1;n++}l||(n=s)}return e?(this.current=this.newToken(ae,parseFloat(this.expression.substring(i,n))),this.pos=n):this.pos=s,e},ge.prototype.isOperator=function(){var t=this.pos,e=this.expression.charAt(this.pos);if("+"===e||"-"===e||"*"===e||"/"===e||"%"===e||"^"===e||"?"===e||":"===e||"."===e)this.current=this.newToken(oe,e);else if("∙"===e||"•"===e)this.current=this.newToken(oe,"*");else if(">"===e)"="===this.expression.charAt(this.pos+1)?(this.current=this.newToken(oe,">="),this.pos++):this.current=this.newToken(oe,">");else if("<"===e)"="===this.expression.charAt(this.pos+1)?(this.current=this.newToken(oe,"<="),this.pos++):this.current=this.newToken(oe,"<");else if("|"===e){if("|"!==this.expression.charAt(this.pos+1))return!1;this.current=this.newToken(oe,"||"),this.pos++}else if("="===e)"="===this.expression.charAt(this.pos+1)?(this.current=this.newToken(oe,"=="),this.pos++):this.current=this.newToken(oe,e);else{if("!"!==e)return!1;"="===this.expression.charAt(this.pos+1)?(this.current=this.newToken(oe,"!="),this.pos++):this.current=this.newToken(oe,e)}return this.pos++,!!this.isOperatorEnabled(this.current.value)||(this.pos=t,!1)},ge.prototype.isOperatorEnabled=function(t){return this.parser.isOperatorEnabled(t)},ge.prototype.getCoordinates=function(){var t,e=0,n=-1;do{e++,t=this.pos-n,n=this.expression.indexOf("\n",n+1)}while(n>=0&&n=",">","in"];ye.prototype.parseComparison=function(t){for(this.parseAddSub(t);this.accept(oe,ve);){var e=this.current;this.parseAddSub(t),t.push(Gt(e.value))}};var be=["+","-","||"];ye.prototype.parseAddSub=function(t){for(this.parseTerm(t);this.accept(oe,be);){var e=this.current;this.parseTerm(t),t.push(Gt(e.value))}};var xe=["*","/","%"];function we(t,e){return Number(t)+Number(e)}function Ce(t,e){return t-e}function Ie(t,e){return t*e}function Pe(t,e){return t/e}function Ee(t,e){return t%e}function Se(t,e){return Array.isArray(t)&&Array.isArray(e)?t.concat(e):""+t+e}function ke(t,e){return t===e}function Me(t,e){return t!==e}function Oe(t,e){return t>e}function Ae(t,e){return t=e}function _e(t,e){return t<=e}function De(t,e){return Boolean(t&&e)}function Be(t,e){return Boolean(t||e)}function Le(t,e){return ne(e,t)}function je(t){return(Math.exp(t)-Math.exp(-t))/2}function Ve(t){return(Math.exp(t)+Math.exp(-t))/2}function $e(t){return t===1/0?1:t===-1/0?-1:(Math.exp(t)-Math.exp(-t))/(Math.exp(t)+Math.exp(-t))}function Ne(t){return t===-1/0?t:Math.log(t+Math.sqrt(t*t+1))}function Fe(t){return Math.log(t+Math.sqrt(t*t-1))}function Re(t){return Math.log((1+t)/(1-t))/2}function ze(t){return Math.log(t)*Math.LOG10E}function He(t){return-t}function We(t){return!t}function Ue(t){return t<0?Math.ceil(t):Math.floor(t)}function Ge(t){return Math.random()*(t||1)}function qe(t){return Ye(t+1)}ye.prototype.parseTerm=function(t){for(this.parseFactor(t);this.accept(oe,xe);){var e=this.current;this.parseFactor(t),t.push(Gt(e.value))}},ye.prototype.parseFactor=function(t){var e=this.tokens.unaryOps;if(this.save(),this.accept(oe,(function(t){return t.value in e}))){if("-"!==this.current.value&&"+"!==this.current.value){if(this.nextToken.type===ce&&"("===this.nextToken.value)return this.restore(),void this.parseExponential(t);if(this.nextToken.type===de||this.nextToken.type===pe||this.nextToken.type===re||this.nextToken.type===ce&&")"===this.nextToken.value)return this.restore(),void this.parseAtom(t)}var n=this.current;this.parseFactor(t),t.push(Ut(n.value))}else this.parseExponential(t)},ye.prototype.parseExponential=function(t){for(this.parsePostfixExpression(t);this.accept(oe,"^");)this.parseFactor(t),t.push(Gt("^"))},ye.prototype.parsePostfixExpression=function(t){for(this.parseFunctionCall(t);this.accept(oe,"!");)t.push(Ut("!"))},ye.prototype.parseFunctionCall=function(t){var e=this.tokens.unaryOps;if(this.accept(oe,(function(t){return t.value in e}))){var n=this.current;this.parseAtom(t),t.push(Ut(n.value))}else for(this.parseMemberExpression(t);this.accept(ce,"(");)if(this.accept(ce,")"))t.push(new Wt(Vt,0));else{var i=this.parseArgumentList(t);t.push(new Wt(Vt,i))}},ye.prototype.parseArgumentList=function(t){for(var e=0;!this.accept(ce,")");)for(this.parseExpression(t),++e;this.accept(pe);)this.parseExpression(t),++e;return e},ye.prototype.parseMemberExpression=function(t){for(this.parseAtom(t);this.accept(oe,".")||this.accept(ue,"[");){var e=this.current;if("."===e.value){if(!this.allowMemberAccess)throw new Error('unexpected ".", member access is not permitted');this.expect(he),t.push(new Wt(Rt,this.current.value))}else{if("["!==e.value)throw new Error("unexpected symbol: "+e.value);if(!this.tokens.isOperatorEnabled("["))throw new Error('unexpected "[]", arrays are disabled');this.parseExpression(t),this.expect(ue,"]"),t.push(Gt("["))}}};var Ke=4.7421875,Xe=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function Ye(t){var e,n;if(function(t){return isFinite(t)&&t===Math.round(t)}(t)){if(t<=0)return isFinite(t)?1/0:NaN;if(t>171)return 1/0;for(var i=t-2,s=t-1;i>1;)s*=i,i--;return 0===s&&(s=1),s}if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*Ye(1-t));if(t>=171.35)return 1/0;if(t>85){var r=t*t,o=r*t,a=o*t,l=a*t;return Math.sqrt(2*Math.PI/t)*Math.pow(t/Math.E,t)*(1+1/(12*t)+1/(288*r)-139/(51840*o)-571/(2488320*a)+163879/(209018880*l)+5246819/(75246796800*l*t))}--t,n=Xe[0];for(var c=1;c0?(i=s/e)*i:s}return e===1/0?1/0:e*Math.sqrt(t)}function Qe(t,e,n){return t?e:n}function tn(t,e){return void 0===e||0==+e?Math.round(t):(t=+t,e=-+e,isNaN(t)||"number"!=typeof e||e%1!=0?NaN:(t=t.toString().split("e"),+((t=(t=Math.round(+(t[0]+"e"+(t[1]?+t[1]-e:-e)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+e:e))))}function en(t,e,n){return n&&(n[t]=e),e}function nn(t,e){return t[0|e]}function sn(t){return 1===arguments.length&&Array.isArray(t)?Math.max.apply(Math,t):Math.max.apply(Math,arguments)}function rn(t){return 1===arguments.length&&Array.isArray(t)?Math.min.apply(Math,t):Math.min.apply(Math,arguments)}function on(t,e){if("function"!=typeof t)throw new Error("First argument to map is not a function");if(!Array.isArray(e))throw new Error("Second argument to map is not an array");return e.map((function(e,n){return t(e,n)}))}function an(t,e,n){if("function"!=typeof t)throw new Error("First argument to fold is not a function");if(!Array.isArray(n))throw new Error("Second argument to fold is not an array");return n.reduce((function(e,n,i){return t(e,n,i)}),e)}function ln(t,e){if("function"!=typeof t)throw new Error("First argument to filter is not a function");if(!Array.isArray(e))throw new Error("Second argument to filter is not an array");return e.filter((function(e,n){return t(e,n)}))}function cn(t,e){if(!Array.isArray(e)&&"string"!=typeof e)throw new Error("Second argument to indexOf is not a string or array");return e.indexOf(t)}function un(t,e){if(!Array.isArray(e))throw new Error("Second argument to join is not an array");return e.join(t)}function pn(t){return(t>0)-(t<0)||+t}var hn=1/3;function dn(t){return t<0?-Math.pow(-t,hn):Math.pow(t,hn)}function mn(t){return Math.exp(t)-1}function gn(t){return Math.log(1+t)}function fn(t){return Math.log(t)/Math.LN2}function yn(t){this.options=t||{},this.unaryOps={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sinh:Math.sinh||je,cosh:Math.cosh||Ve,tanh:Math.tanh||$e,asinh:Math.asinh||Ne,acosh:Math.acosh||Fe,atanh:Math.atanh||Re,sqrt:Math.sqrt,cbrt:Math.cbrt||dn,log:Math.log,log2:Math.log2||fn,ln:Math.log,lg:Math.log10||ze,log10:Math.log10||ze,expm1:Math.expm1||mn,log1p:Math.log1p||gn,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc||Ue,"-":He,"+":Number,exp:Math.exp,not:We,length:Je,"!":qe,sign:Math.sign||pn},this.binaryOps={"+":we,"-":Ce,"*":Ie,"/":Pe,"%":Ee,"^":Math.pow,"||":Se,"==":ke,"!=":Me,">":Oe,"<":Ae,">=":Te,"<=":_e,and:De,or:Be,in:Le,"=":en,"[":nn},this.ternaryOps={"?":Qe},this.functions={random:Ge,fac:qe,min:rn,max:sn,hypot:Math.hypot||Ze,pyt:Math.hypot||Ze,pow:Math.pow,atan2:Math.atan2,if:Qe,gamma:Ye,roundTo:tn,map:on,fold:an,filter:ln,indexOf:cn,join:un},this.consts={E:Math.E,PI:Math.PI,true:!0,false:!1}}yn.prototype.parse=function(t){var e=[],n=new ye(this,new ge(this,t),{allowMemberAccess:this.options.allowMemberAccess});return n.parseExpression(e),n.expect(re,"EOF"),new se(e,this)},yn.prototype.evaluate=function(t,e){return this.parse(t).evaluate(e)};var vn=new yn;yn.parse=function(t){return vn.parse(t)},yn.evaluate=function(t,e){return vn.parse(t).evaluate(e)};var bn={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"remainder","^":"power","!":"factorial","<":"comparison",">":"comparison","<=":"comparison",">=":"comparison","==":"comparison","!=":"comparison","||":"concatenate",and:"logical",or:"logical",not:"logical","?":"conditional",":":"conditional","=":"assignment","[":"array","()=":"fndef"};yn.prototype.isOperatorEnabled=function(t){var e=function(t){return bn.hasOwnProperty(t)?bn[t]:t}(t),n=this.options.operators||{};return!(e in n)||!!n[e]};const xn=new Set(["getValue","setValue","_getFromProxy","__createPathProxies","hasOwnProperty","pushValue","removePathKey","removeKey","restoreKey","getKeys","exportFlattened","isArray","push","sortBy","findIndex"]);function wn(t){const e={},n=new Set,i=Array.isArray(t);let s=i?t.length:0,r=null;return new Proxy(t,{get:function(o,a){return"length"===a&&i?s:xn.has(a)?this[a]:n.has(a)?void 0:(i&&null!==r&&(a=r[a]),x(e,a)?e[a]:t[a])},isArray:()=>i,_getFromProxy:t=>x(e,t)?e[t]:void 0,set:_,sortBy(t){return r=null,!!i&&(r=function(t,e){const n=[];for(let e=0;e!n.has(t))),s},exportFlattened(){let n;if(i)if(n=[],null!==r)for(let i=0;i{if("initParams"===t||"attrs"===t)return r("undefined");let i=In(t,"",e.items);return y(i)&&(i=`'${n?$(i):i}'`),i}))),!1!==c&&(a=a.replaceAll(c,(t=>{let i=e.keys[t];return y(i)&&(i=`'${n?$(i):i}'`),i}))),a.match(Tn)){const t=a.split(/===|==/);return t[0]=Bn(t[0]),t[1]=Bn(t[1]),r((t[0]===t[1]).toString())}try{const t=_n.parse(a),n=Object.assign({},e.keys,e.items),i=t.evaluate(n);if(void 0!==i&&!isNaN(i))return r(i)}catch(t){}if(a.match(An))return r(Bn(a));const u=/===|==|>=|>|<=|<|!==|!=/g,p=a.split(u);if(2===p.length){const n=a.match(u)[0];try{const t=_n.parse(p[0]),i=_n.parse(p[1]),s=Object.assign({},e.keys,e.items);return r(function(t,e,n){switch(n){case"==":case"===":return t===e;case"!=":case"!==":return t!==e;case">":return t>e;case">=":return t>=e;case"<":return t{((t,e,n)=>{e in t?Fn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"expressionProps");const e=Nn(t.value);this.expressionProps={unit:e.unit,expression:e.expression}}resize(t){const e=`(${Nn(this.expressionProps.expression).expression}*${t})`;return`${Rn}(${e})${this.expressionProps.unit}`}calculateValues(t,e){const n=t.length,i=[],s={[o]:n,[l]:e};for(let t=0;t{((t,e,n)=>{e in t?Wn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"expressionProps"),this.expressionProps={expression:t.value}}calculateValues(t,e){const n=t.length,i={[o]:n,[l]:e},s=this.expressionProps.expression.substring(this.expressionProps.expression.indexOf(".")+1),r=[];for(let n=0;nVn(`[{{${t.substring(1,t.length-1)}}}]`,{items:i}))),"",e);r.push(t)}return r}},validation:function(t,e){return!!Un.test(t)||(e(`Invalid ${Hn.preface} expression`),!1)},preface:Hn.preface,supportedTypes:Hn.supportedTypes},qn={supportedTypes:["amount","array","boolean","color","currency","date","email","enum","measurement","number","object","string","tuple","url"],preface:"pattern"},Kn=new RegExp(`^@${qn.preface}\\(( *#*[_A-z0-9.%-]+?( *, *#*[_A-z0-9.%-]+)*?)\\)$`),Xn={Handler:class{constructor(t){let e=k(t.value)||[],n=!0;const i=[];for(let t=0;tt,easeInQuad:t=>t*t,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t*t:(4-2*t)*t-1,easeInCubic:t=>t*t*t,easeOutCubic:t=>--t*t*t+1,easeInOutCubic:t=>t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1,easeInQuart:t=>t*t*t*t,easeOutQuart:t=>1- --t*t*t*t,easeInOutQuart:t=>t<.5?8*t*t*t*t:1-8*--t*t*t*t,easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>1+--t*t*t*t*t,easeInOutQuint:t=>t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t,easeInSine:t=>-1*Math.cos(t*(Math.PI/2))+1,easeOutSine:t=>Math.sin(t*(Math.PI/2)),easeInOutSine:t=>-(Math.cos(Math.PI*t)-1)/2,easeInExpo:t=>0==t?1:1*Math.pow(2,10*(t-1)),easeOutExpo:t=>1==t?1:1*(1-Math.pow(2,-10*t)),easeInOutExpo:t=>0==t||1==t?t:(t*=2)<1?Math.pow(2,10*(t-1))/2:(2-Math.pow(2,-10*--t))/2,easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t=t/1-1)*t),easeInOutCirc:t=>(t*=2)<1?-(Math.sqrt(1-t*t)-1)/2:(Math.sqrt(1-(t-=2)*t)+1)/2,easeInElastic(t){if(0==t||1==t)return t;const e=.3/Jn*Math.asin(1);return-Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*Jn/.3)},easeOutElastic(t){if(0==t||1==t)return t;const e=.3/Jn*Math.asin(1);return Math.pow(2,-10*t)*Math.sin((t-e)*Jn/.3)+1},easeInOutElastic(t){if(0==t||1==t)return t;const e=.3*1.5,n=e/Jn*Math.asin(1);return t<1?-Math.pow(2,10*(t-=1))*Math.sin((t-n)*Jn/e)/2:Math.pow(2,-10*(t-=1))*Math.sin((t-n)*Jn/e)/2+1},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=-1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t*=2)<1?t*t*((1+(e*=1.525))*t-e)/2:((t-=2)*t*((1+(e*=1.525))*t+e)+2)/2},easeInBounce:t=>1-Zn.easeOutBounce(1-t),easeOutBounce:t=>t<1/2.75?7.5625*t*t*1:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,easeInOutBounce:t=>(t<.5?Zn.easeInBounce(2*t):Zn.easeOutBounce(2*t-1)+1)/2};var Qn=Object.defineProperty;function ti(t){var e;t=F(t);const n=((null==(e=/.*\((.*)\).*/.exec(t))?void 0:e[1])||"").split(",");return{start:n[0],end:n[1],startFraction:1*n[2]||0,easing:n[3]||"linear",mode:n[4]||"linear",reverse:"true"===n[5]}}function ei(t,e,n,i="linear"){return Zn[i](n)*(e-t)+t}const ni=Object.keys(Zn),ii={Handler:class{constructor(t){var e,n;((t,e,n)=>{((t,e,n)=>{e in t?Qn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"staggerProps");const i=ti(t.value),s=(null==(e=i.start.match(C))?void 0:e[0])||[],r=null==(n=i.end.match(C))?void 0:n[0],o=i.start.toString().substring(s.length);this.staggerProps={from:1*s,to:1*r,mode:i.mode,unit:o,fraction:i.startFraction,easing:i.easing,reverse:i.reverse,type:""===o?"amount":"measurement",integer:t.integer}}resize(t){return this.staggerProps.from*=t,this.staggerProps.to*=t,!0===this.staggerProps.integer&&(this.staggerProps.from=Math.round(this.staggerProps.from),this.staggerProps.to=Math.round(this.staggerProps.to)),`@stagger(${this.staggerProps.from}${this.staggerProps.unit}, ${this.staggerProps.to}${this.staggerProps.unit}, ${this.staggerProps.fraction||0}, ${this.staggerProps.easing||"linear"}, ${this.staggerProps.mode||"linear"}, ${this.staggerProps.reverse||!1})`}calculateValues(t){const e=t.length;if(e<2)return[this.staggerProps.from];const n=function(t,e=0,n="linear",i=!1){const s=[];if("linear"===n)for(let n=0;n1)return e(`The ${Yn.preface} fraction must be a number >=0 and <=1`),!1;if(!ni.includes(s.easing))return e(`The ${Yn.preface} easing (${s.easing}) is not supported by the system`),!1;if("linear"!==s.mode&&"omni"!==s.mode)return e(`The ${Yn.preface} mode should be either "linear" or "omni"`),!1;if(!0!==s.reverse&&!1!==s.reverse)return e(`The ${Yn.preface} reverse should be either true or false`),!1;const r=s.start.match(C),o=s.end.match(C);if(null===r||null===o)return e(`The start and end units of a @stagger should always be the same. This doesn't stand for the couple ${s.start}, ${s.end}`),!1;const a=r[0],l=o[0],c=s.start.toString().substring(a.length),u=s.end.toString().substring(l.length);return c!==u?(e(`The start and end units of a @stagger should always be the same. ${c}, ${u} provided`),!1):n(["number"===i.type?parseFloat(s.start):s.start,"number"===i.type?parseFloat(s.end):s.end])},preface:Yn.preface,supportedTypes:Yn.supportedTypes},si=[];function ri(t){si.push(t)}function oi(){return si}ri(kt),ri(zn),ri(Gn),ri(Xn),ri(ii);const ai=oi();function li(t,e=""){if(!t)return[];const n=[];for(const[i,s]of Object.entries(t)){if(s instanceof Element)continue;if(v(s)){const t=li(s,`${e}${""===e?"":"."}${i}`);n.push(...t);continue}if(!y(s))continue;const t=s.trim();for(let s=0;s(((t,e,n)=>{e in t?ci(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class pi extends et{constructor(t={duration:0}){super(),ui(this,"constructionIngredients"),ui(this,"mcid"),ui(this,"easing"),ui(this,"plugin_channel_class"),ui(this,"attributesStaggers"),ui(this,"propsStaggers"),ui(this,"dynamicDurationValue"),ui(this,"blockingWaitings"),ui(this,"_duration"),ui(this,"realClip"),ui(this,"originalContextKey"),ui(this,"contexts"),ui(this,"attrs"),ui(this,"_inheritedSelector",null),ui(this,"isNode"),ui(this,"passive"),ui(this,"parentNode"),ui(this,"props"),ui(this,"children"),this.parentNode=null,this.isNode=!1,this.id=x(t,"id")?t.id:A(),this.props=t,this.resetDuration()}get name(){var t;return null==(t=this.props)?void 0:t.name}set name(t){this.props.name=t}get inheritedSelector(){return this._inheritedSelector}set inheritedSelector(t){this._inheritedSelector=t}get delay(){return x(this.props,"delay")?this.props.delay:0}set delay(t){0!==t&&(this.props.delay=t),this.resetDuration()}get hiatus(){return x(this.props,"hiatus")?this.props.hiatus:0}set hiatus(t){0!==t&&(this.props.hiatus=t),this.resetDuration()}get repeats(){return x(this.props,"repeats")?this.props.repeats:1}set repeats(t){this.props.repeats=t,this.resetDuration()}resetDuration(t=!1){this._duration=this.repeats*(this.delay+this.props.duration+this.hiatus),t&&this.putMessageOnPipe("recalcDuration",{},"Groups",{selfExecute:!1,direction:Y._UP})}get duration(){return this._duration}set duration(t){const e=t/this.duration;this.props.duration*=e,this.hiatus*=e,this.delay*=e,this.resetDuration()}setNewDuration(t){this.duration=t,this.putMessageOnPipe("recalcDuration",{},"Groups",{selfExecute:!1,direction:Y._UP})}systoleDiastole(t){this.duration*=t}get hasParent(){return null!==this.parentNode}attachToNode(t){this.parentNode=t}detachFromParent(){this.parentNode=null,this.inheritedSelector=null}putMessageOnPipe(t,e,n,i={}){if(x(i,"direction")||(i.direction=Y._DOWN),i.direction!==Y._DOWN||x(i,"positionDelta")||(i.positionDelta=0),i.selfExecute){const r=`handle${s=t,s.charAt(0).toUpperCase()+s.slice(1)}`;if("function"==typeof this[r]){const t=this[r](n,e);if(t!==Z){const e={response:t,responder:this};return i.direction===Y._UP?e:(e.positionDelta=i.positionDelta,[e])}}}var s;return i.direction!==Y._UP?[]:this.hasParent?this.parentNode.putMessageOnPipe(t,e,n,{selfExecute:!0,direction:Y._UP}):{response:!1,responder:null}}bypass(){return Z}get positionOnPyramidion(){return this.getPositionOnPyramidion()}getPositionOnPyramidion(t=0){return this.hasParent?this.putMessageOnPipe("getPositionOnPyramidion",{delta:t,id:this.id},"Parent",{selfExecute:!1,direction:Y._UP}).response:t}editAttributes(t){if(null!==this.constructor.attrsValidationRules){const e=this.constructor.attrsValidationMethod(t);if(e.length>0)return{result:!1,errors:e}}return this.putMessageOnPipe("checkForClip",{},J._DECISIONAUTHORITY,{selfExecute:!0,direction:Y._UP}).response?this.manageEditAttrProps(t,"attrs"):(this.attrs=t,{result:!0})}editProperties(t){const e=V(t,this.constructor.propsValidationRules,this.constructor);return e.result?this.putMessageOnPipe("checkForClip",{},J._DECISIONAUTHORITY,{selfExecute:!0,direction:Y._UP}).response?this.manageEditAttrProps(t,"props"):(this.props=t,{result:!0}):e}resize(t,e={check:!0}){var n;if("dynamic"===this.duration)return{result:!1,reason:It};if(t===this.duration)return{result:!0,meta:{unprocessed:!0}};if(t<=0)return{result:!1,reason:"Size must always be > 0"};if(e.check&&this.hasParent){const e=this.putMessageOnPipe("checkResize",{id:this.id,newSize:t,fraction:t/this.duration},J._DECISIONAUTHORITY,{selfExecute:!1,direction:Y._UP});if(!(null==(n=e.response)?void 0:n.result))return e.response}return this.setNewDuration(t),{result:!0}}clone(t={},e={}){const n=this.exportLiveDefinition();for(const e in t)Cn(e,t[e],!0,"attrs",n);for(const t in e)Cn(t,e[t],!0,"props",n);return X(n)}selector(){var t;return null===this.inheritedSelector?x(this.props,"selector")?this.props.selector:null:x(this.props,"selector")?(null==(t=this.props.selector)?void 0:t.startsWith("&"))?this.inheritedSelector+this.props.selector.substring(1):`${this.inheritedSelector} ${this.props.selector}`:this.inheritedSelector}getElements(t){return null!=this.props.host?[this.props.host]:this.hasParent&&this.putMessageOnPipe("checkForClip",{},J._DECISIONAUTHORITY,{selfExecute:!0,direction:Y._UP}).response?this.putMessageOnPipe("getElements",{selector:this.selector()},J._DECISIONAUTHORITY,{selfExecute:!1,direction:Y._UP}).response:[]}setupDynamicValues(){const t={attrs:{},props:{}};for(const e of["attrs","props"]){const n=li(this[e]);for(const i of n){const n=i.Handler,s={value:i.value,integer:i.integer};this[("attrs"===e?"attributes":"props")+"Staggers"].push({path:i.path,stagger:new n(s)}),x(t[e],i.dynamicType)?t[e][i.dynamicType]+=1:t[e][i.dynamicType]=1}}return t}_calculateDuration(t){}}const hi=.1,di="function"==typeof Float32Array;function mi(t,e){return 1-3*e+3*t}function gi(t,e){return 3*e-6*t}function fi(t){return 3*t}function yi(t,e,n){return((mi(e,n)*t+gi(e,n))*t+fi(e))*t}function vi(t,e,n){return 3*mi(e,n)*t*t+2*gi(e,n)*t+fi(e)}function bi(t){return t}function xi(t,e,n,i){if(!(0<=t&&t<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===i)return bi;const s=di?new Float32Array(11):new Array(11);for(let e=0;e<11;++e)s[e]=yi(e*hi,t,n);function r(e){let i=0,r=1;for(;10!==r&&s[r]<=e;++r)i+=hi;--r;const o=i+(e-s[r])/(s[r+1]-s[r])*hi,a=vi(o,t,n);return a>=.001?function(t,e,n,i){for(let s=0;s<4;++s){const s=vi(e,n,i);if(0===s)return e;e-=(yi(e,n,i)-t)/s}return e}(e,o,t,n):0===a?o:function(t,e,n,i,s){let r,o,a=0;do{o=e+(n-e)/2,r=yi(o,i,s)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++a<10);return o}(e,i,i+hi,t,n)}return function(t){return 0===t||1===t?t:yi(r(t),e,i)}}var wi=Object.defineProperty,Ci=Object.defineProperties,Ii=Object.getOwnPropertyDescriptors,Pi=Object.getOwnPropertySymbols,Ei=Object.prototype.hasOwnProperty,Si=Object.prototype.propertyIsEnumerable,ki=(t,e,n)=>e in t?wi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Mi=(t,e)=>{for(var n in e||(e={}))Ei.call(e,n)&&ki(t,n,e[n]);if(Pi)for(var n of Pi(e))Si.call(e,n)&&ki(t,n,e[n]);return t},Oi=(t,e)=>Ci(t,Ii(e));class Ai extends pi{constructor(t,e,n,i){var s;super(Oi(Mi({},t.props),{id:`${t.incidentId}_${n}`})),ki(this,"symbol"!=typeof(s="timeScale")?s+"":s,void 0),this.contexts={},this.constructionIngredients=t,this.mcid=n,this.DescriptiveIncident=i,this.mc_plugin_npm_name=t.plugin_npm_name,this.plugin_channel_class=t.Channel,this.addContext(e),this.timeScale=1,i.realClip.duration>0&&(this.timeScale=this.props.duration/i.realClip.duration),i.realClip.subscribeToDurationChange((t=>{this.props.duration=this.timeScale*t,this.resetDuration(),this.putMessageOnPipe("recalcDuration",{},"Groups",{selfExecute:!1,direction:Y._UP})})),x(this.props,"easing")?this.easing=Array.isArray(this.props.easing)?xi(this.props.easing[0],this.props.easing[1],this.props.easing[2],this.props.easing[3]):Zn[this.props.easing]:this.easing=Zn.linear}get originalContext(){return this.contexts[this.originalContextKey]}onProgress(t,e,n,i=!1){let s=e%(this.delay+this.props.duration+this.hiatus);0!==e&&0===s&&(s=this.delay+this.props.duration);let r=s-this.delay;r<0?r=0:r>this.props.duration&&(r=this.props.duration);const o=0===this.props.duration?0:r/this.props.duration,a=this.easing(o)*this.props.duration*(1/this.timeScale);this.originalContext.context&&!1!==this.originalContext.context.contextLoaded&&this.contexts[n].onProgress(a,i)}addContext(t,e=!1){0===Object.keys(this.contexts).length&&(this.originalContextKey=t.clipId);const n=Oi(Mi({},this.constructionIngredients),{context:t.context,mcid:this.mcid,Incident:ht,DescriptiveIncident:this.DescriptiveIncident});this.contexts[t.clipId]=Ct(n),e&&this.contexts[t.clipId]._onGetContextOnce()}handleAddContext(t,e){return this.addContext(e,!0),!0}handleContextLoaded(t,e){this._onGetContextOnce()}gotContext(){for(const t in this.contexts)this.contexts[t].gotContext()}_onGetContextOnce(){if(!1!==this.originalContext.contextLoaded)for(const t in this.contexts)this.contexts[t]._onGetContextOnce()}lastWish(){for(const t in this.contexts)this.contexts[t].lastWish()}onGetContext(){if(!1!==this.originalContext.contextLoaded)for(const t in this.contexts)this.contexts[t].onGetContext()}exportLiveDefinition(t){throw new Error("Method not implemented.")}manageEditAttrProps(t,e){throw new Error("Method not implemented.")}}const Ti="Leaf has already been attached to another Node",_i="Negative positioning of childs on nodes is not allowed",Di="The Leaf with the requested id couldn't be found on the TimedTree";var Bi=Object.defineProperty,Li=Object.defineProperties,ji=Object.getOwnPropertyDescriptors,Vi=Object.getOwnPropertySymbols,$i=Object.prototype.hasOwnProperty,Ni=Object.prototype.propertyIsEnumerable,Fi=(t,e,n)=>e in t?Bi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ri=(t,e)=>{for(var n in e||(e={}))$i.call(e,n)&&Fi(t,n,e[n]);if(Vi)for(var n of Vi(e))Ni.call(e,n)&&Fi(t,n,e[n]);return t},zi=(t,e,n)=>(Fi(t,"symbol"!=typeof e?e+"":e,n),n);class Hi extends pi{constructor(t){super(t),zi(this,"calculatedDuration"),zi(this,"runTimeInfo"),this.isNode=!0,this.children={},this.calculatedDuration=0,this.resetDuration()}resetDuration(){this._duration=this.repeats*(this.delay+this.calculatedDuration+this.hiatus)}get duration(){return this._duration}set duration(t){if(0===this.duration)return;const e=t/this.duration;this.calculatedDuration*=e,this.hiatus*=e,this.delay*=e,this.resetDuration();for(const t in this.children){const n=this.children[t];this.editPosition(n.id,n.position*e,!0),n.leaf.systoleDiastole(e)}}_calculateDuration(t){if(!t||null!=t.childId){const e=this.children[null==t?void 0:t.childId],n=e.leaf.duration+e.position;return n>this.calculatedDuration&&(this.calculatedDuration=n,this.resetDuration(),!0)}let e=0;for(const t in this.children){const n=this.children[t];n.position+n.leaf.duration>e&&(e=n.position+n.leaf.duration)}return e!==this.calculatedDuration&&(this.calculatedDuration=e,this.resetDuration(),!0)}handleRecalcDuration(t,e){return!this._calculateDuration(e)||this.putMessageOnPipe("recalcDuration",e.childId?{childId:this.id}:{},"Groups",{selfExecute:!1,direction:Y._UP})}getLeafById(t,e=!1){if(x(this.children,t))return this.children[t].leaf;if(!e)for(const e in this.children){const n=this.children[e].leaf;if(n.isNode){const e=n.getLeafById(t);if(null!=e)return e}}return null}getLeafPosition(t){if(x(this.children,t))return this.children[t].position;const e=this.putMessageOnPipe("getLeafPosition",{id:t},"Groups",{selfExecute:!1,direction:Y._DOWN});return e.length>0?e[0].positionDelta+e[0].response:void 0}handleGetLeafPosition(t,e){return this.getLeafPosition(e.id)}checkAddition(t,e){return t.hasParent?{result:!1,reason:Ti}:e<0?{result:!1,reason:_i}:{result:!0}}addChild(t,e){return t.hasParent?{result:!1,reason:Ti}:(this.children[t.id]={id:t.id,leaf:t,position:e},t.attachToNode(this),this.putMsgOnPipeWithResult("recalcDuration",{childId:t.id},"Groups",{selfExecute:!0,direction:Y._UP}))}checkRemoveChild(t){return x(this.children,t)?{result:!0}:{result:!1,reason:Di}}removeChild(t){return this.children[t].leaf.detachFromParent(),delete this.children[t],this.putMsgOnPipeWithResult("recalcDuration",{},"Groups",{selfExecute:!0,direction:Y._UP})}checkEditPosition(t,e){return e<0?{result:!1,reason:_i}:x(this.children,t)?{result:!0}:{result:!1,reason:Di}}editPosition(t,e,n=!1){if(x(this.children,t))return this.children[t].position=e,n||this.putMessageOnPipe("recalcDuration",{},"Groups",{selfExecute:!0,direction:Y._UP}),{result:!0}}putMessageOnPipe(t,e,n,i={}){if(x(i,"direction")||(i.direction=Y._DOWN),i.direction!==Y._DOWN||x(i,"positionDelta")||(i.positionDelta=0),i.direction===Y._UP)return super.putMessageOnPipe(t,e,n,i);const s=super.putMessageOnPipe(t,e,n,i);if(s.length)return s;for(const a in this.children){const{leaf:l}=this.children[a],c=(r=Ri({},i),o={selfExecute:!0,positionDelta:i.positionDelta+this.children[a].position},Li(r,ji(o)));s.push(...l.putMessageOnPipe(t,e,n,c))}var r,o;return s}putMsgOnPipeWithResult(t,e,n,i={}){return this.putMessageOnPipe(t,e,n,i),{result:!0}}handleGetPositionOnPyramidion(t,e){const n=e.delta+this.getLeafPosition(e.id);return this.getPositionOnPyramidion(n)}}var Wi=Object.defineProperty,Ui=(t,e,n)=>(((t,e,n)=>{e in t?Wi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class Gi extends Hi{constructor(t,e){super(e),Ui(this,"hasIncidents"),Ui(this,"instantiatedCopiesContexts"),Ui(this,"handleRemoveIncident",this.handleMoveIncident),this.mc_plugin_npm_name=u,this.plugin_channel_class=U,this.hasIncidents=!0,this.onGroupInitialise(),this.calculatedDuration=0}onGroupInitialise(){}handleAddIncident(t,e){if(this.id===t){const t=(0,e.incidentFromDescription)(e.incident,e.contextData);if(null!==t)return t}return this.bypass()}handleMoveIncident(t,e){if(this.id===t){const t=this.getLeafById(e.incidentId,!0);if(null!==t)return t}return this.bypass()}handleResize(t){return this.id===t?this:this.bypass()}removeChild(t){return this.children[t].leaf.lastWish(),super.removeChild(t)}getIncidentsByChannel(t=0,e=0){const n={[u]:[{millisecond:t,parentMillisecond:e,incident:this,id:this.id}]};for(const e in this.children){const i=this.children[e],s=i.leaf.getIncidentsByChannel(t+i.position,t);for(const t in s)x(n,t)?n[t]=n[t].concat(s[t]):n[t]=s[t]}return n}lastWish(){for(const t in this.children)this.children[t].leaf.lastWish()}}var qi=Object.defineProperty,Ki=Object.defineProperties,Xi=Object.getOwnPropertyDescriptors,Yi=Object.getOwnPropertySymbols,Ji=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,Qi=(t,e,n)=>e in t?qi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ts=(t,e)=>{for(var n in e||(e={}))Ji.call(e,n)&&Qi(t,n,e[n]);if(Yi)for(var n of Yi(e))Zi.call(e,n)&&Qi(t,n,e[n]);return t},es=(t,e)=>Ki(t,Xi(e)),ns=(t,e,n)=>(Qi(t,"symbol"!=typeof e?e+"":e,n),n);class is extends pi{constructor(t,e,n,i){if(super(es(ts({},t.props),{id:`${t.incidentId}_${n}${null!=i?"_"+i:""}`})),ns(this,"attribute"),ns(this,"originalAnimatedAttributeValue"),ns(this,"repeatDuration"),ns(this,"originalClipContext"),this.contexts={},this.constructionIngredients=t,this.mcid=n,this.attribute=i,this.mc_plugin_npm_name=t.plugin_npm_name,this.plugin_channel_class=t.Channel,this.DescriptiveIncident=t.DescriptiveIncident,this.addContext(e),null!==i){const t=this.constructionIngredients.attrs.animatedAttrs[this.attribute];Array.isArray(t)?this.originalAnimatedAttributeValue=[...t]:v(t)?this.originalAnimatedAttributeValue=ts({},t):this.originalAnimatedAttributeValue=t}this.easing=Zn.linear,x(this.props,"easing")&&(this.easing=Array.isArray(this.props.easing)?xi(this.props.easing[0],this.props.easing[1],this.props.easing[2],this.props.easing[3]):Zn[this.props.easing]),this._duration=super.duration,this.repeatDuration=this.delay+this.props.duration+this.hiatus}exportLiveDefinition(t){throw new Error("Method not implemented.")}manageEditAttrProps(t,e){throw new Error("Method not implemented.")}get originalContext(){return this.contexts[this.originalContextKey]}get duration(){return this._duration}set duration(t){super.duration=t;for(const e in this.contexts)this.contexts[e].duration=t;this._duration=super.duration,this.repeatDuration=this.delay+this.props.duration+this.hiatus}addContext(t,e=!1){let n=!1;0===Object.keys(this.contexts).length&&(this.originalContextKey=t.clipId,this.originalClipContext=t.context,n=!0);const i=Ct(es(ts({},this.constructionIngredients),{context:t.context,mcid:this.mcid}));this.contexts[t.clipId]=i,n||null==this.attribute||this.contexts[t.clipId].setInitialValue(this.initialValue),e&&this.contexts[t.clipId].context.contextLoaded&&this.contexts[t.clipId]._onGetContextOnce()}handleAddContext(t,e){return this.addContext(e,!0),!0}handleContextLoaded(t,e){return this._onGetContextOnce(),!0}onProgress(t,e){const n=this.props.delay||0;let i=t%this.repeatDuration;0!==t&&0===i&&(i=n+this.props.duration);let s=i-n;s<0?s=0:s>this.props.duration&&(s=this.props.duration);const r=s/this.props.duration,o=this.easing(r)*this.props.duration;if(null!=e)this.contexts[e].onProgress(o);else for(const t in this.contexts)this.originalContextKey===t&&!0===this.originalContext.fragment||this.contexts[t].onProgress(o)}get animatedAttributeValue(){return this.constructionIngredients.attrs.animatedAttrs[this.attribute]}set animatedAttributeValue(t){this.constructionIngredients.attrs.animatedAttrs[this.attribute]=t}gotContext(){for(const t in this.contexts)this.contexts[t].gotContext()}_onGetContextOnce(){if(this.originalContext.context.contextLoaded)for(const t in this.contexts)this.contexts[t]._onGetContextOnce()}lastWish(){for(const t in this.contexts)this.contexts[t].lastWish()}onGetContext(){if(0!=!this.originalContext.contextLoaded)for(const t in this.contexts)this.contexts[t].context.contextLoaded&&this.contexts[t].onGetContext()}get initialValue(){return this.originalContext.initialValue}get scratchValue(){return this.originalContext.scratchValue}get pureInitialValues(){return this.originalContext.pureInitialValues}setInitialValue(t,e=!0){const n=w(null!=t?t:this.getScratchValue());for(const t in this.contexts)this.contexts[t].setInitialValue(n,e)}getScratchValue(t=null){if(!1===this.originalContext.context.contextLoaded)return 0;if(null!=t)return this.contexts[t].getScratchValue();if(x(this.originalClipContext,"nonFragmentedContext"))return Ct(es(ts({},this.constructionIngredients),{context:this.originalClipContext.nonFragmentedContext,mcid:this.mcid})).getScratchValue();const e=Object.keys(this.contexts);return 1===e.length?this.originalContext.getScratchValue():this.contexts[e[1]].getScratchValue()}play(t,e,n){return this.contexts[n].play(e)}stop(t){this.contexts[t].stop()}}var ss=Object.defineProperty,rs=Object.defineProperties,os=Object.getOwnPropertyDescriptors,as=Object.getOwnPropertySymbols,ls=Object.prototype.hasOwnProperty,cs=Object.prototype.propertyIsEnumerable,us=(t,e,n)=>e in t?ss(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ps=(t,e)=>{for(var n in e||(e={}))ls.call(e,n)&&us(t,n,e[n]);if(as)for(var n of as(e))cs.call(e,n)&&us(t,n,e[n]);return t},hs=(t,e)=>rs(t,os(e));class ds extends Gi{constructor(t,e,n,i,s){var r;super({},{id:`${t.id}_${n}`}),us(this,"symbol"!=typeof(r="data")?r+"":r,void 0),this.mcid=n,this.selector=i,this.data=s,this.setUp(t,e)}exportLiveDefinition(t){throw new Error("Method not implemented.")}manageEditAttrProps(t,e){throw new Error("Method not implemented.")}setUp(t,e){for(const n in this.data.attrs.animatedAttrs){const i={[n]:this.data.attrs.animatedAttrs[n]},s=hs(ps({},this.data.attrs),{animatedAttrs:i}),r=hs(ps({},this.data.props),{selector:this.selector}),o={incidentId:t.id,attrs:s,props:r,Incident:t.constructor.Incident,plugin_npm_name:t.constructor.plugin_npm_name,Channel:t.constructor.Channel,DescriptiveIncident:t},a=new is(o,e,this.mcid,n);this.addChild(a,0)}}}var ms=Object.defineProperty,gs=(t,e,n)=>(((t,e,n)=>{e in t?ms(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class fs extends Gi{constructor(t,e){super({},{id:t.id,duration:t.duration}),gs(this,"initParams"),gs(this,"staggerAttrs"),gs(this,"staggerProps"),this.contexts={[e.clipId]:e.context},this.originalContextKey=e.clipId,this.initParams=e.context.initParams,this.instantiatedCopiesContexts=e.instantiatedCopiesContexts,this.descriptiveIncident=t,this.staggerAttrs=[],this.staggerProps=[],this.setUp(t,e)}get originalContext(){return this.contexts[this.originalContextKey]}parsePropsDynamicValues(t,e){for(let n=0;n0&&(this.descriptiveIncident.dynamicDurationValue=1*this.duration),n}lastWish(){this.descriptiveIncident.propsStaggers.length>0&&(this.descriptiveIncident.dynamicDurationValue=null,this.descriptiveIncident.putMessageOnPipe("setDurationDynamic",{},"Groups",{selfExecute:!1,direction:Y._UP})),super.lastWish()}_getElementMCID(t){let e=this.originalContext.getMCID(t);return e||(e=A(!0),this.originalContext.setMCID(t,e)),e}_setElementMCID(t,e,n){t.getMCID(e)||t.setMCID(e,n)}_prepareAttrsPropsForElement(t,e){const n=function(t,e){const n=[];for(let i=0;i0){s=w(t.attrs);for(let t=0;t0){r=w(t.props);for(let t=0;te in t?ys(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ps=(t,e)=>{for(var n in e||(e={}))ws.call(e,n)&&Is(t,n,e[n]);if(xs)for(var n of xs(e))Cs.call(e,n)&&Is(t,n,e[n]);return t},Es=(t,e)=>vs(t,bs(e));class Ss extends fs{constructor(t,e){super(t,e),this.realClip=t.realClip}_createElementIncident(t,e,n,i,s,r){const o=this._prepareAttrsPropsForElement(e,i);if(e.realClip.isNullClip){const t=X(Object.assign(e.exportLiveDefinition(),o));e.realClip=t.realClip,e.subscribe(A(),((e,n)=>{t._setState(n)}),0,1,!0),t.handleSetBlock=(n,i)=>e.putMessageOnPipe("setBlock",Es(Ps({},i),{id:t.id}),"rootClip",{selfExecute:!0,direction:Y._UP}),t.handleUnBlock=()=>e.putMessageOnPipe("unBlock",{id:t.id},"rootClip",{selfExecute:!0,direction:Y._UP})}const a=e.realClip.exportConstructionArguments(),l=Es(Ps(Ps(Es(Ps({},e.props),{duration:e.realClip.duration}),a.props),o.props),{selector:n.context.getElementSelectorByMCID(r)}),c={incidentId:e.id,attrs:a.attrs,props:l,Incident:e.constructor.Incident,plugin_npm_name:e.constructor.plugin_npm_name,Channel:K,DescriptiveIncident:e},u=new Ai(c,n,r,e);this.addChild(u,0)}exportLiveDefinition(t){throw new Error("Method not implemented.")}manageEditAttrProps(t,e){throw new Error("Method not implemented.")}}var ks=At({"../../node_modules/.pnpm/fastest-validator@1.17.0/node_modules/fastest-validator/dist/index.min.js"(t,e){var n=n||{};n.scope={},n.arrayIteratorImpl=function(t){var e=0;return function(){return e>>0,n.propertyToPolyfillSymbol[s]=n.IS_SYMBOL_NATIVE?n.global.Symbol(s):n.POLYFILL_PREFIX+t+"$"+s),n.defineProperty(r,n.propertyToPolyfillSymbol[s],{configurable:!0,writable:!0,value:e})))},n.initSymbol=function(){},n.polyfill("Symbol",(function(t){function e(t,e){this.$jscomp$symbol$id_=t,n.defineProperty(this,"description",{configurable:!0,writable:!0,value:e})}if(t)return t;e.prototype.toString=function(){return this.$jscomp$symbol$id_};var i="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",s=0;return function t(n){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(i+(n||"")+"_"+s++,n)}}),"es6","es3"),n.polyfill("Symbol.iterator",(function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var e="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i=r}}),"es6","es3"),n.owns=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.assign=n.TRUST_ES6_POLYFILLS&&"function"==typeof Object.assign?Object.assign:function(t,e){for(var i=1;i=s}}),"es6","es3"),n.polyfill("Number.isNaN",(function(t){return t||function(t){return"number"==typeof t&&isNaN(t)}}),"es6","es3"),n.polyfill("Object.entries",(function(t){return t||function(t){var e,i=[];for(e in t)n.owns(t,e)&&i.push([e,t[e]]);return i}}),"es8","es3");var i=t;function s(){function t(t){if(this.opts={},this.defaults={},this.messages=Object.assign({},O),this.rules={any:P,array:I,boolean:C,class:w,custom:x,currency:b,date:v,email:y,enum:f,equal:g,forbidden:m,function:d,multi:h,number:p,object:u,objectID:c,record:l,string:a,tuple:o,url:r,uuid:s,mac:i,luhn:n},this.aliases={},this.cache=new Map,t){if(S(this.opts,t),t.defaults&&S(this.defaults,t.defaults),t.messages)for(var E in t.messages)this.addMessage(E,t.messages[E]);if(t.aliases)for(var k in t.aliases)this.alias(k,t.aliases[k]);if(t.customRules)for(var M in t.customRules)this.add(M,t.customRules[M]);if(t.plugins){if(t=t.plugins,!Array.isArray(t))throw Error("Plugins type must be array");t.forEach(this.plugin.bind(this))}this.opts.debug&&(t=function(t){return t},"undefined"==typeof window&&(t=e),this._formatter=t)}}function e(t){return A||(A=M(),T={parser:"babel",useTabs:!1,printWidth:120,trailingComma:"none",tabWidth:4,singleQuote:!1,semi:!0,bracketSpacing:!0},_=M(),D={language:"js",theme:_.fromJson({keyword:["white","bold"],built_in:"magenta",literal:"cyan",number:"magenta",regexp:"red",string:["yellow","bold"],symbol:"plain",class:"blue",attr:"plain",function:["white","bold"],title:"plain",params:"green",comment:"grey"})}),t=A.format(t,T),_.highlight(t,D)}function n(t){return t.schema,t=t.messages,{source:'\n\t\t\tif (typeof value !== "string") {\n\t\t\t\t'+this.makeError({type:"string",actual:"value",messages:t})+'\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (typeof value !== "string")\n\t\t\t\tvalue = String(value);\n\n\t\t\tval = value.replace(/\\D+/g, "");\n\n\t\t\tvar array = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9];\n\t\t\tvar len = val ? val.length : 0,\n\t\t\t\tbit = 1,\n\t\t\t\tsum = 0;\n\t\t\twhile (len--) {\n\t\t\t\tsum += !(bit ^= 1) ? parseInt(val[len], 10) : array[val[len]];\n\t\t\t}\n\n\t\t\tif (!(sum % 10 === 0 && sum > 0)) {\n\t\t\t\t'+this.makeError({type:"luhn",actual:"value",messages:t})+"\n\t\t\t}\n\n\t\t\treturn value;\n\t\t"}}function i(t){return t.schema,t=t.messages,{source:'\n\t\t\tif (typeof value !== "string") {\n\t\t\t\t'+this.makeError({type:"string",actual:"value",messages:t})+"\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tvar v = value.toLowerCase();\n\t\t\tif (!"+G.toString()+".test(v)) {\n\t\t\t\t"+this.makeError({type:"mac",actual:"value",messages:t})+"\n\t\t\t}\n\t\t\t\n\t\t\treturn value;\n\t\t"}}function s(t){var e=t.schema;t=t.messages;var n=[];return n.push('\n\t\tif (typeof value !== "string") {\n\t\t\t'+this.makeError({type:"string",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\n\t\tvar val = value.toLowerCase();\n\t\tif (!"+U.toString()+".test(val)) {\n\t\t\t"+this.makeError({type:"uuid",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\n\t\tconst version = val.charAt(14) | 0;\n\t"),7>parseInt(e.version)&&n.push("\n\t\t\tif ("+e.version+" !== version) {\n\t\t\t\t"+this.makeError({type:"uuidVersion",expected:e.version,actual:"version",messages:t})+"\n\t\t\t\treturn value;\n\t\t\t}\n\t\t"),n.push('\n\t\tswitch (version) {\n\t\tcase 0:\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 6:\n\t\t\tbreak;\n\t\tcase 3:\n\t\tcase 4:\n\t\tcase 5:\n\t\t\tif (["8", "9", "a", "b"].indexOf(val.charAt(19)) === -1) {\n\t\t\t\t'+this.makeError({type:"uuid",actual:"value",messages:t})+"\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t"),{source:n.join("\n")}}function r(t){var e=t.schema;t=t.messages;var n=[];return n.push('\n\t\tif (typeof value !== "string") {\n\t\t\t'+this.makeError({type:"string",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\t"),e.empty?n.push("\n\t\t\tif (value.length === 0) return value;\n\t\t"):n.push("\n\t\t\tif (value.length === 0) {\n\t\t\t\t"+this.makeError({type:"urlEmpty",actual:"value",messages:t})+"\n\t\t\t\treturn value;\n\t\t\t}\n\t\t"),n.push("\n\t\tif (!"+W.toString()+".test(value)) {\n\t\t\t"+this.makeError({type:"url",actual:"value",messages:t})+"\n\t\t}\n\n\t\treturn value;\n\t"),{source:n.join("\n")}}function o(t,e,n){var i=t.schema,s=t.messages;if(t=[],null!=i.items){if(!Array.isArray(i.items))throw Error("Invalid '"+i.type+"' schema. The 'items' field must be an array.");if(0===i.items.length)throw Error("Invalid '"+i.type+"' schema. The 'items' field must not be an empty array.")}if(t.push("\n\t\tif (!Array.isArray(value)) {\n\t\t\t"+this.makeError({type:"tuple",actual:"value",messages:s})+"\n\t\t\treturn value;\n\t\t}\n\n\t\tvar len = value.length;\n\t"),!1===i.empty&&t.push("\n\t\t\tif (len === 0) {\n\t\t\t\t"+this.makeError({type:"tupleEmpty",actual:"value",messages:s})+"\n\t\t\t\treturn value;\n\t\t\t}\n\t\t"),null!=i.items){for(t.push("\n\t\t\tif ("+i.empty+" !== false && len === 0) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (len !== "+i.items.length+") {\n\t\t\t\t"+this.makeError({type:"tupleLength",expected:i.items.length,actual:"len",messages:s})+"\n\t\t\t\treturn value;\n\t\t\t}\n\t\t"),t.push("\n\t\t\tvar arr = value;\n\t\t\tvar parentField = field;\n\t\t"),s=0;s "+e.max+") {\n\t\t\t\t"+this.makeError({type:"stringMax",expected:e.max,actual:"len",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.length&&n.push("\n\t\t\tif (len !== "+e.length+") {\n\t\t\t\t"+this.makeError({type:"stringLength",expected:e.length,actual:"len",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.pattern){var s=e.pattern;"string"==typeof e.pattern&&(s=new RegExp(e.pattern,e.patternFlags)),n.push("\n\t\t\tif (!"+s.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringPattern",expected:'"'+s.toString().replace(/"/g,"\\$&")+'"',actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t")}return null!=e.contains&&n.push('\n\t\t\tif (value.indexOf("'+e.contains+'") === -1) {\n\t\t\t\t'+this.makeError({type:"stringContains",expected:'"'+e.contains+'"',actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.enum&&(s=JSON.stringify(e.enum),n.push("\n\t\t\tif ("+s+".indexOf(value) === -1) {\n\t\t\t\t"+this.makeError({type:"stringEnum",expected:'"'+e.enum.join(", ")+'"',actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t")),!0===e.numeric&&n.push("\n\t\t\tif (!"+$.toString()+".test(value) ) {\n\t\t\t\t"+this.makeError({type:"stringNumeric",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.alpha&&n.push("\n\t\t\tif(!"+N.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringAlpha",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.alphanum&&n.push("\n\t\t\tif(!"+F.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringAlphanum",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.alphadash&&n.push("\n\t\t\tif(!"+R.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringAlphadash",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.hex&&n.push("\n\t\t\tif(value.length % 2 !== 0 || !"+z.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringHex",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.singleLine&&n.push('\n\t\t\tif(value.includes("\\n")) {\n\t\t\t\t'+this.makeError({type:"stringSingleLine",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.base64&&n.push("\n\t\t\tif(!"+H.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringBase64",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),n.push("\n\t\treturn value;\n\t"),{sanitized:i,source:n.join("\n")}}function l(t,e,n){var i=t.schema,s=[];for(var r in s.push('\n\t\tif (typeof value !== "object" || value === null || Array.isArray(value)) {\n\t\t\t'+this.makeError({type:"record",actual:"value",messages:t.messages})+"\n\t\t\treturn value;\n\t\t}\n\t"),t=i.key||"string",i=i.value||"any",s.push("\n\t\tconst record = value;\n\t\tlet sanitizedKey, sanitizedValue;\n\t\tconst result = {};\n\t\tfor (let key in value) {\n\t"),s.push("sanitizedKey = value = key;"),(t=this.getRuleFromSchema(t)).messages)r.startsWith("string")&&(t.messages[r]=t.messages[r].replace(" field "," key "));return s.push(this.compileRule(t,n,null,"\n\t\tsanitizedKey = "+(n.async?"await ":"")+'context.fn[%%INDEX%%](key, field ? field + "." + key : key, record, errors, context);\n\t',"sanitizedKey")),s.push("sanitizedValue = value = record[key];"),r=this.getRuleFromSchema(i),s.push(this.compileRule(r,n,e+"[key]","\n\t\tsanitizedValue = "+(n.async?"await ":"")+'context.fn[%%INDEX%%](value, field ? field + "." + key : key, record, errors, context);\n\t',"sanitizedValue")),s.push("result[sanitizedKey] = sanitizedValue;"),s.push("\n\t\t}\n\t"),s.push("return result;"),{source:s.join("\n")}}function c(t,e,n){e=t.schema;var i=t.messages;t=t.index;var s=[];return n.customs[t]?n.customs[t].schema=e:n.customs[t]={schema:e},s.push("\n\t\tconst ObjectID = context.customs["+t+"].schema.ObjectID;\n\t\tif (!ObjectID.isValid(value)) {\n\t\t\t"+this.makeError({type:"objectID",actual:"value",messages:i})+"\n\t\t\treturn;\n\t\t}\n\t"),!0===e.convert?s.push("return new ObjectID(value)"):"hexString"===e.convert?s.push("return value.toString()"):s.push("return value"),{source:s.join("\n")}}function u(t,e,n){var i=t.schema;t=t.messages;var s=[];s.push('\n\t\tif (typeof value !== "object" || value === null || Array.isArray(value)) {\n\t\t\t'+this.makeError({type:"object",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\t");var r=i.properties||i.props;if(r){s.push("var parentObj = value;"),s.push("var parentField = field;");for(var o=Object.keys(r),a=0;a "+i.maxProps+") {\n\t\t\t\t"+this.makeError({type:"objectMaxProps",expected:i.maxProps,actual:"props.length",messages:t})+"\n\t\t\t}\n\t\t"),r?s.push("\n\t\t\treturn parentObj;\n\t\t"):s.push("\n\t\t\treturn value;\n\t\t"),{source:s.join("\n")}}function p(t){var e=t.schema;t=t.messages;var n=[];n.push("\n\t\tvar origValue = value;\n\t");var i=!1;return!0===e.convert&&(i=!0,n.push('\n\t\t\tif (typeof value !== "number") {\n\t\t\t\tvalue = Number(value);\n\t\t\t}\n\t\t')),n.push('\n\t\tif (typeof value !== "number" || isNaN(value) || !isFinite(value)) {\n\t\t\t'+this.makeError({type:"number",actual:"origValue",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\t"),null!=e.min&&n.push("\n\t\t\tif (value < "+e.min+") {\n\t\t\t\t"+this.makeError({type:"numberMin",expected:e.min,actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.max&&n.push("\n\t\t\tif (value > "+e.max+") {\n\t\t\t\t"+this.makeError({type:"numberMax",expected:e.max,actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.equal&&n.push("\n\t\t\tif (value !== "+e.equal+") {\n\t\t\t\t"+this.makeError({type:"numberEqual",expected:e.equal,actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.notEqual&&n.push("\n\t\t\tif (value === "+e.notEqual+") {\n\t\t\t\t"+this.makeError({type:"numberNotEqual",expected:e.notEqual,actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.integer&&n.push("\n\t\t\tif (value % 1 !== 0) {\n\t\t\t\t"+this.makeError({type:"numberInteger",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.positive&&n.push("\n\t\t\tif (value <= 0) {\n\t\t\t\t"+this.makeError({type:"numberPositive",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.negative&&n.push("\n\t\t\tif (value >= 0) {\n\t\t\t\t"+this.makeError({type:"numberNegative",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),n.push("\n\t\treturn value;\n\t"),{sanitized:i,source:n.join("\n")}}function h(t,e,n){var i=t.schema;t.messages,(t=[]).push("\n\t\tvar hasValid = false;\n\t\tvar newVal = value;\n\t\tvar checkErrors = [];\n\t\tvar errorsSize = errors.length;\n\t");for(var s=0;s "+e.max+") {\n\t\t\t\t"+this.makeError({type:"emailMax",expected:e.max,actual:"value.length",messages:t})+"\n\t\t\t}\n\t\t"),n.push("\n\t\tif (!"+i.toString()+".test(value)) {\n\t\t\t"+this.makeError({type:"email",actual:"value",messages:t})+"\n\t\t}\n\n\t\treturn value;\n\t"),{sanitized:s,source:n.join("\n")}}function v(t){var e=t.schema;t=t.messages;var n=[],i=!1;return n.push("\n\t\tvar origValue = value;\n\t"),!0===e.convert&&(i=!0,n.push("\n\t\t\tif (!(value instanceof Date)) {\n\t\t\t\tvalue = new Date(value.length && !isNaN(+value) ? +value : value);\n\t\t\t}\n\t\t")),n.push("\n\t\tif (!(value instanceof Date) || isNaN(value.getTime()))\n\t\t\t"+this.makeError({type:"date",actual:"origValue",messages:t})+"\n\n\t\treturn value;\n\t"),{sanitized:i,source:n.join("\n")}}function b(t){var e=t.schema;t=t.messages;var n=e.currencySymbol||null,i=e.thousandSeparator||",",s=e.decimalSeparator||".",r=e.customRegex;return e=!e.symbolOptional,e="(?=.*\\d)^(-?~1|~1-?)(([0-9]\\d{0,2}(~2\\d{3})*)|0)?(\\~3\\d{1,2})?$".replace(/~1/g,n?"\\"+n+(e?"":"?"):"").replace("~2",i).replace("~3",s),(n=[]).push("\n\t\tif (!value.match("+(r||new RegExp(e))+")) {\n\t\t\t"+this.makeError({type:"currency",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\n\t\treturn value;\n\t"),{source:n.join("\n")}}function x(t,e,n){var i=[];return i.push("\n\t\t"+this.makeCustomValidator({fnName:"check",path:e,schema:t.schema,messages:t.messages,context:n,ruleIndex:t.index})+"\n\t\treturn value;\n\t"),{source:i.join("\n")}}function w(t,e,n){e=t.schema;var i=t.messages;t=t.index;var s=[],r=e.instanceOf.name?e.instanceOf.name:"";return n.customs[t]?n.customs[t].schema=e:n.customs[t]={schema:e},s.push("\n\t\tif (!(value instanceof context.customs["+t+"].schema.instanceOf))\n\t\t\t"+this.makeError({type:"classInstanceOf",actual:"value",expected:"'"+r+"'",messages:i})+"\n\t"),s.push("\n\t\treturn value;\n\t"),{source:s.join("\n")}}function C(t){var e=t.schema;t=t.messages;var n=[],i=!1;return n.push("\n\t\tvar origValue = value;\n\t"),!0===e.convert&&(i=!0,n.push('\n\t\t\tif (typeof value !== "boolean") {\n\t\t\t\tif (\n\t\t\t\tvalue === 1\n\t\t\t\t|| value === "true"\n\t\t\t\t|| value === "1"\n\t\t\t\t|| value === "on"\n\t\t\t\t) {\n\t\t\t\t\tvalue = true;\n\t\t\t\t} else if (\n\t\t\t\tvalue === 0\n\t\t\t\t|| value === "false"\n\t\t\t\t|| value === "0"\n\t\t\t\t|| value === "off"\n\t\t\t\t) {\n\t\t\t\t\tvalue = false;\n\t\t\t\t}\n\t\t\t}\n\t\t')),n.push('\n\t\tif (typeof value !== "boolean") {\n\t\t\t'+this.makeError({type:"boolean",actual:"origValue",messages:t})+"\n\t\t}\n\t\t\n\t\treturn value;\n\t"),{sanitized:i,source:n.join("\n")}}function I(t,e,n){var i=t.schema,s=t.messages;t=[];var r=!1;if(!0===i.convert&&(r=!0,t.push("\n\t\t\tif (!Array.isArray(value) && value != null) {\n\t\t\t\tvalue = [value];\n\t\t\t}\n\t\t")),t.push("\n\t\tif (!Array.isArray(value)) {\n\t\t\t"+this.makeError({type:"array",actual:"value",messages:s})+"\n\t\t\treturn value;\n\t\t}\n\n\t\tvar len = value.length;\n\t"),!1===i.empty&&t.push("\n\t\t\tif (len === 0) {\n\t\t\t\t"+this.makeError({type:"arrayEmpty",actual:"value",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.min&&t.push("\n\t\t\tif (len < "+i.min+") {\n\t\t\t\t"+this.makeError({type:"arrayMin",expected:i.min,actual:"len",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.max&&t.push("\n\t\t\tif (len > "+i.max+") {\n\t\t\t\t"+this.makeError({type:"arrayMax",expected:i.max,actual:"len",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.length&&t.push("\n\t\t\tif (len !== "+i.length+") {\n\t\t\t\t"+this.makeError({type:"arrayLength",expected:i.length,actual:"len",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.contains&&t.push("\n\t\t\tif (value.indexOf("+JSON.stringify(i.contains)+") === -1) {\n\t\t\t\t"+this.makeError({type:"arrayContains",expected:JSON.stringify(i.contains),actual:"value",messages:s})+"\n\t\t\t}\n\t\t"),!0===i.unique&&t.push("\n\t\t\tif(len > (new Set(value)).size) {\n\t\t\t\t"+this.makeError({type:"arrayUnique",expected:"Array.from(new Set(value.filter((item, index) => value.indexOf(item) !== index)))",actual:"value",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.enum){var o=JSON.stringify(i.enum);t.push("\n\t\t\tfor (var i = 0; i < value.length; i++) {\n\t\t\t\tif ("+o+".indexOf(value[i]) === -1) {\n\t\t\t\t\t"+this.makeError({type:"arrayEnum",expected:'"'+i.enum.join(", ")+'"',actual:"value[i]",messages:s})+"\n\t\t\t\t}\n\t\t\t}\n\t\t")}return null!=i.items?(t.push("\n\t\t\tvar arr = value;\n\t\t\tvar parentField = field;\n\t\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t\t\tvalue = arr[i];\n\t\t"),e+="[]",i=this.getRuleFromSchema(i.items),t.push(this.compileRule(i,n,e,"arr[i] = "+(n.async?"await ":"")+'context.fn[%%INDEX%%](arr[i], (parentField ? parentField : "") + "[" + i + "]", parent, errors, context)',"arr[i]")),t.push("\n\t\t\t}\n\t\t"),t.push("\n\t\treturn arr;\n\t")):t.push("\n\t\treturn value;\n\t"),{sanitized:r,source:t.join("\n")}}function P(){var t=[];return t.push("\n\t\treturn value;\n\t"),{source:t.join("\n")}}function E(t,e,n){return t.replace(e,null==n?"":"function"==typeof n.toString?n:typeof n)}function S(t,e,n){for(var i in void 0===n&&(n={}),e){var s=e[i];(s="object"==typeof s&&!Array.isArray(s)&&null!=s&&0()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,L=/^\S+@\S+\.\S+$/,j=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/,V=/["'\\\n\r\u2028\u2029]/g,$=/^-?[0-9]\d*(\.\d+)?$/,N=/^[a-zA-Z]+$/,F=/^[a-zA-Z0-9]+$/,R=/^[a-zA-Z0-9_-]+$/,z=/^[0-9a-fA-F]+$/,H=/^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+/]{3}=)?$/,W=/^https?:\/\/\S+/,U=/^([0-9a-f]{8}-[0-9a-f]{4}-[1-6][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}|[0]{8}-[0]{4}-[0]{4}-[0]{4}-[0]{12})$/i,G=/^((([a-f0-9][a-f0-9]+[-]){5}|([a-f0-9][a-f0-9]+[:]){5})([a-f0-9][a-f0-9])$)|(^([a-f0-9][a-f0-9][a-f0-9][a-f0-9]+[.]){2}([a-f0-9][a-f0-9][a-f0-9][a-f0-9]))$/i;try{var q=new Function("return Object.getPrototypeOf(async function(){}).constructor")()}catch(t){}return t.prototype.validate=function(t,e){return this.compile(e)(t)},t.prototype.wrapRequiredCheckSourceCode=function(t,e,n,i){var s=[],r=this.opts.considerNullAsAValue;void 0===r&&(r=!1);var o=!0===t.schema.optional||"forbidden"===t.schema.type,a=r?!1!==t.schema.nullable||"forbidden"===t.schema.type:!0===t.schema.optional||!0===t.schema.nullable||"forbidden"===t.schema.type;return(r?null!=t.schema.default&&null!=t.schema.default:null!=t.schema.default)?(o=!1,r?!1===t.schema.nullable&&(a=!1):!0!==t.schema.nullable&&(a=!1),"function"==typeof t.schema.default?(n.customs[t.index]||(n.customs[t.index]={}),n.customs[t.index].defaultFn=t.schema.default,t="context.customs["+t.index+"].defaultFn.call(this, context.rules["+t.index+"].schema, field, parent, context)"):t=JSON.stringify(t.schema.default),i="\n\t\t\t\tvalue = "+t+";\n\t\t\t\t"+i+" = value;\n\t\t\t"):i=this.makeError({type:"required",actual:"value",messages:t.messages}),s.push("\n\t\t\tif (value === undefined) { "+(o?"\n// allow undefined\n":i)+" }\n\t\t\telse if (value === null) { "+(a?"\n// allow null\n":i)+" }\n\t\t\t"+(e?"else { "+e+" }":"")+"\n\t\t"),s.join("\n")},t.prototype.compile=function(t){function e(t,e){return i.data=t,e&&e.meta&&(i.meta=e.meta),r.call(n,t,i)}if(null===t||"object"!=typeof t)throw Error("Invalid schema.");var n=this,i={index:0,async:!0===t.$$async,rules:[],fn:[],customs:{},utils:{replace:E}};if(this.cache.clear(),delete t.$$async,i.async&&!q)throw Error("Asynchronous mode is not supported.");if(!0!==t.$$root)if(Array.isArray(t))t=this.getRuleFromSchema(t).schema;else{var s=Object.assign({},t);t={type:"object",strict:s.$$strict,properties:s},delete s.$$strict}s=["var errors = [];","var field;","var parent = null;","var label = "+(t.label?'"'+t.label+'"':"null")+";"],t=this.getRuleFromSchema(t),s.push(this.compileRule(t,i,null,(i.async?"await ":"")+"context.fn[%%INDEX%%](value, field, null, errors, context, label);","value")),s.push("if (errors.length) {"),s.push("\n\t\t\treturn errors.map(err => {\n\t\t\t\tif (err.message) {\n\t\t\t\t\terr.message = context.utils.replace(err.message, /\\{field\\}/g, err.label || err.field);\n\t\t\t\t\terr.message = context.utils.replace(err.message, /\\{expected\\}/g, err.expected);\n\t\t\t\t\terr.message = context.utils.replace(err.message, /\\{actual\\}/g, err.actual);\n\t\t\t\t}\n\t\t\t\tif(!err.label) delete err.label\n\t\t\t\treturn err;\n\t\t\t});\n\t\t"),s.push("}"),s.push("return true;"),t=s.join("\n");var r=new(i.async?q:Function)("value","context",t);return this.opts.debug&&console.log(this._formatter("// Main check function\n"+r.toString())),this.cache.clear(),e.async=i.async,e},t.prototype.compileRule=function(t,e,n,i,s){var r=[],o=this.cache.get(t.schema);return o?((t=o).cycle=!0,t.cycleStack=[],r.push(this.wrapRequiredCheckSourceCode(t,"\n\t\t\t\tvar rule = context.rules["+t.index+"];\n\t\t\t\tif (rule.cycleStack.indexOf(value) === -1) {\n\t\t\t\t\trule.cycleStack.push(value);\n\t\t\t\t\t"+i.replace(/%%INDEX%%/g,t.index)+"\n\t\t\t\t\trule.cycleStack.pop(value);\n\t\t\t\t}\n\t\t\t",e,s))):(this.cache.set(t.schema,t),t.index=e.index,e.rules[e.index]=t,o=null!=n?n:"$$root",e.index++,(n=t.ruleFunction.call(this,t,n,e)).source=n.source.replace(/%%INDEX%%/g,t.index),n=new(e.async?q:Function)("value","field","parent","errors","context","label",n.source),e.fn[t.index]=n.bind(this),r.push(this.wrapRequiredCheckSourceCode(t,i.replace(/%%INDEX%%/g,t.index),e,s)),r.push(this.makeCustomValidator({vName:s,path:o,schema:t.schema,context:e,messages:t.messages,ruleIndex:t.index})),this.opts.debug&&console.log(this._formatter("// Context.fn["+t.index+"]\n"+n.toString()))),r.join("\n")},t.prototype.getRuleFromSchema=function(t){t=this.resolveType(t);var e=this.aliases[t.type];if(e&&(delete t.type,t=S(t,e,{skipIfExist:!0})),!(e=this.rules[t.type]))throw Error("Invalid '"+t.type+"' type in validator schema.");return{messages:Object.assign({},this.messages,t.messages),schema:S(t,this.defaults[t.type],{skipIfExist:!0}),ruleFunction:e}},t.prototype.parseShortHand=function(t){var e=(t=t.split("|").map((function(t){return t.trim()})))[0],n=e.endsWith("[]")?this.getRuleFromSchema({type:"array",items:e.slice(0,-2)}).schema:{type:t[0]};return t.slice(1).map((function(t){var e=t.indexOf(":");if(-1!==e){var i=t.substr(0,e).trim();"true"===(t=t.substr(e+1).trim())||"false"===t?t="true"===t:Number.isNaN(Number(t))||(t=Number(t)),n[i]=t}else t.startsWith("no-")?n[t.slice(3)]=!1:n[t]=!0})),n},t.prototype.makeError=function(t){var e=t.type,n=t.field,i=t.expected,s=t.actual,r={type:'"'+e+'"',message:'"'+t.messages[e]+'"'};return r.field=n?'"'+n+'"':"field",null!=i&&(r.expected=i),null!=s&&(r.actual=s),r.label="label","errors.push({ "+Object.keys(r).map((function(t){return t+": "+r[t]})).join(", ")+" });"},t.prototype.makeCustomValidator=function(t){var e=t.vName;void 0===e&&(e="value");var n=t.fnName;void 0===n&&(n="custom");var i=t.ruleIndex,s=t.path,r=t.schema,o=t.context,a=t.messages;t="rule"+i;var l="fnCustomErrors"+i;return"function"==typeof r[n]?(o.customs[i]?(o.customs[i].messages=a,o.customs[i].schema=r):o.customs[i]={messages:a,schema:r},this.opts.useNewCustomCheckerFunction?"\n \t\tconst "+t+" = context.customs["+i+"];\n\t\t\t\t\tconst "+l+" = [];\n\t\t\t\t\t"+e+" = "+(o.async?"await ":"")+t+".schema."+n+".call(this, "+e+", "+l+" , "+t+'.schema, "'+s+'", parent, context);\n\t\t\t\t\tif (Array.isArray('+l+" )) {\n \t\t"+l+" .forEach(err => errors.push(Object.assign({ message: "+t+".messages[err.type], field }, err)));\n\t\t\t\t\t}\n\t\t\t\t":"\n\t\t\t\tconst "+t+" = context.customs["+i+"];\n\t\t\t\tconst "+(r="res_"+t)+" = "+(o.async?"await ":"")+t+".schema."+n+".call(this, "+e+", "+t+'.schema, "'+s+'", parent, context);\n\t\t\t\tif (Array.isArray('+r+")) {\n\t\t\t\t\t"+r+".forEach(err => errors.push(Object.assign({ message: "+t+".messages[err.type], field }, err)));\n\t\t\t\t}\n\t\t"):""},t.prototype.add=function(t,e){this.rules[t]=e},t.prototype.addMessage=function(t,e){this.messages[t]=e},t.prototype.alias=function(t,e){if(this.rules[t])throw Error("Alias name must not be a rule name");this.aliases[t]=e},t.prototype.plugin=function(t){if("function"!=typeof t)throw Error("Plugin fn type must be function");return t(this)},t.prototype.resolveType=function(t){var e=this;if("string"==typeof t)t=this.parseShortHand(t);else if(Array.isArray(t)){if(0===t.length)throw Error("Invalid schema.");(t={type:"multi",rules:t}).rules.map((function(t){return e.getRuleFromSchema(t)})).every((function(t){return!0===t.schema.optional}))&&(t.optional=!0);var n=!this.opts.considerNullAsAValue;t.rules.map((function(t){return e.getRuleFromSchema(t)})).every((function(t){return t.schema.nullable===n}))&&(t.nullable=n)}if(t.$$type){var i=this.getRuleFromSchema(t.$$type).schema;delete t.$$type;var s,r=Object.assign({},t);for(s in t)delete t[s];S(t,i,{skipIfExist:!0}),t.props=r}return t},t.prototype.normalize=function(t){var e=this,n=this.resolveType(t);return this.aliases[n.type]&&(n=S(n,this.normalize(this.aliases[n.type]),{skipIfExists:!0})),"multi"===(n=S(n,this.defaults[n.type],{skipIfExist:!0})).type?(n.rules=n.rules.map((function(t){return e.normalize(t)})),n.optional=n.rules.every((function(t){return!0===t.optional})),n):"array"===n.type?(n.items=this.normalize(n.items),n):("object"===n.type&&n.props&&Object.entries(n.props).forEach((function(t){return n.props[t[0]]=e.normalize(t[1])})),"object"==typeof t&&(t.type?(t=this.normalize(t.type),S(n,t,{skipIfExists:!0})):Object.entries(t).forEach((function(t){return n[t[0]]=e.normalize(t[1])}))),n)},t}"object"==typeof t&&void 0!==e?e.exports=s():"function"==typeof define&&define.amd?define(s):(i="undefined"!=typeof globalThis?globalThis:i||self).FastestValidator=s()}}),Ms=At({"optimize-deps:fastest-validator"(t,e){e.exports=ks()}})();const Os=new RegExp(/^[-+]?\d+$/),As=new Ms({messages:{color:"The '{field}' field must be an a valid color! Actual: {actual}",measurement:"The '{field}' must be a measurement with specs that are not met. You've either provided wrong value/units or an invalid @ expression. Actual: {actual}",measurementNotAString:"measurement - The provided value of {field} is not a string",measurementMin:"measurement - The provided value of {field} ({actual}) is smaller than the schema's min",measurementMax:"measurement - The provided value of {field} ({actual}) is bigger than the schema's max",measurementInt:"measurement - The provided value of {field} ({actual}) is not an integer"},useNewCustomCheckerFunction:!0});As.add("html",(function({messages:t},e,n){return{source:`\n if(value === null){\n ${this.makeError({type:"html",actual:"value",messages:t})}\n } else {\n return value;\n }\n `}})),As.add("css",(function({messages:t},e,n){return{source:`\n if(value === null){\n ${this.makeError({type:"css",actual:"value",messages:t})}\n } else {\n return value;\n }\n `}})),As.add("measurement",(function({schema:t,messages:e},n,i){const s=new RegExp("^[+-]?(\\d+([.]\\d*)?|[.]\\d+)("+t.units.join("|")+")$","gi");return{source:`\n const validUnits = ['${t.units.join("','")}'];\n\n if(typeof value !== 'string' && !(value instanceof String)){\n ${this.makeError({type:"measurementNotAString",actual:"value",messages:e})}\n return ;\n }\n\n if(!value.match(${s})){\n ${this.makeError({type:"measurement",actual:"value",messages:e})}\n } else {\n var numberPart = value.match(${C})[0];\n if(${x(t,"min")}){\n if(${t.min} > numberPart){\n ${this.makeError({type:"measurementMin",actual:"value",messages:e})}\n }\n }\n if(${x(t,"max")}){\n if(${t.max} < numberPart){\n ${this.makeError({type:"measurementMax",actual:"value",messages:e})}\n }\n }\n if(${x(t,"integer")}){\n if(!numberPart.match(${Os})){\n ${this.makeError({type:"measurementInt",actual:"value",messages:e})}\n }\n }\n }\n return value;\n `}})),As.add("color",(function({messages:t},e,n){return{source:`\n if(typeof value !== 'string' && !(value instanceof String)){\n ${this.makeError({type:"measurement",actual:"value",messages:t})}\n return ;\n }\n var option;\n function isColor(strColor) {\n if (!option ) {\n option = new Option().style;\n }\n option.color = strColor;\n const res = option.color !== '';\n option.color = '';\n return res;\n }\n if(!isColor(value)){\n ${this.makeError({type:"color",actual:"value",messages:t})}\n }\n return value;\n `}})),As.alias("amount",{type:"number"});const Ts=oi(),_s=(t,e)=>{const n=As.compile({[e]:t});return function(i,s,r){return function(t,e,n,i,s,r){const o=function(n){e.push({type:i.type,message:n,actual:t})};if(!y(t))return o("Not a dynamic value expression"),null;const a=function(t){if(c.includes(i.type))return j.warning(`${i.type} does not support checkValues method. Returning true without validation`),!0;let n=!0;for(let i=0;ie in t?Ds(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fs=(t,e)=>{for(var n in e||(e={}))Vs.call(e,n)&&Ns(t,n,e[n]);if(js)for(var n of js(e))$s.call(e,n)&&Ns(t,n,e[n]);return t},Rs=(t,e)=>Bs(t,Ls(e)),zs=(t,e,n)=>(Ns(t,"symbol"!=typeof e?e+"":e,n),n);function Hs(t){return t[t.length-1]}class Ws{constructor(t){zs(this,"adapted"),zs(this,"schema"),this.schema=t,this.adapted=wn(t)}entryChange(t,e){const n=t.join(".");if(Array.isArray(e))for(let n=0;ne in t?Gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qs=(t,e)=>{for(var n in e||(e={}))Ys.call(e,n)&&Zs(t,n,e[n]);if(Xs)for(var n of Xs(e))Js.call(e,n)&&Zs(t,n,e[n]);return t},tr=(t,e)=>qs(t,Ks(e));const er=["cm","mm","in","px","pt","pc","em","ex","ch","rem","vw","vh","vmin","vmax","%"],nr=[{type:"string",optional:!0,default:"linear",enum:Object.keys(Zn)},{type:"array",optional:!0,length:4,items:{type:"number"}}],ir={type:"string",empty:!1,trim:!0,optional:!0},sr={type:"string",empty:!1,trim:!0,optional:!0},rr={type:"string",empty:!1,optional:!1},or={type:"amount",optional:!0,integer:!0,min:0},ar={type:"amount",integer:!0,min:1,optional:!0},lr={type:"amount",integer:!0,min:0,optional:!0},cr={type:"amount",integer:!0,min:0,optional:!0},ur={type:"html",optional:!0},pr={type:"css",optional:!0},hr={type:"array",optional:!0,items:{type:"object",props:{type:{enum:["google-font"],type:"string"},src:{type:"string"}}}},dr={type:"array",items:{type:"object",strict:!0,props:{src:"string",id:"string",mcid:{type:"string",optional:!0},classes:{type:"array",optional:!0,items:"string"},base64:{type:"boolean",optional:!0},startValues:{optional:!0,type:"object",props:{gain:{optional:!0,type:"number"},pan:{optional:!0,type:"number"}}}}},optional:!0},mr=Us({id:ir,name:sr,selector:tr(Qs({},rr),{optional:!0}),easing:nr,duration:{type:"amount",optional:!1,integer:!0,min:0},startFrom:{type:"amount",integer:!0,min:0,optional:!0},repeats:ar,hiatus:lr,delay:cr}),gr={type:"object",optional:!0,props:{width:{type:"measurement",units:er,optional:!0},height:{type:"measurement",units:er,optional:!0}}},fr={type:"string",enum:["on","off","only"],optional:!0},yr=Us({props:[{type:"object",strict:!0,props:{id:ir,name:sr,selector:tr(Qs({},rr),{optional:!0}),repeats:ar,hiatus:lr,delay:cr,easing:nr,duration:or,html:ur,css:pr,audioSources:dr,audio:fr,containerParams:gr,fonts:hr,initParams:{type:"object",optional:!0}}},{type:"object",strict:!0,props:{id:ir,name:sr,host:{type:"any",optional:!1},duration:or,html:ur,css:pr,audioSources:dr,audio:fr,containerParams:gr,fonts:hr,initParams:{type:"object",optional:!0},initParamsValidationRules:{type:"object",optional:!0}}},{type:"object",strict:!0,props:{root:{type:"boolean",optional:!0},name:sr,id:ir,audioSources:dr,audio:tr(Qs({},fr),{enum:["on"]})}}]}),vr=Us({selector:tr(Qs({},rr),{optional:!0,strict:!0}),name:sr}),br=Us({selector:tr(Qs({},rr),{strict:!0,optional:!0}),name:sr,repeats:{type:"amount",integer:!0,min:1,optional:!0},hiatus:{type:"amount",integer:!0,min:0,optional:!0},delay:{type:"amount",integer:!0,min:0,optional:!0}});var xr="9.12.0";const wr="mc.descriptive.decisionAuthority";var Cr=Object.defineProperty,Ir=(t,e,n)=>(((t,e,n)=>{e in t?Cr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class Pr extends Hi{constructor(t={},e=null){super(null!=e?e:t),Ir(this,"passiveAddition"),null==e?(this.attrs={},this.props=t):(this.attrs=t,this.props=e);const n=V(this.props,vr,this.constructor);if(!n.result)return n;this._inheritedSelector=null,this.attributesStaggers=[],this.propsStaggers=[],this.setupDynamicValues(),this.passiveAddition=!0,this._buildTree(),this.passiveAddition=!1}_calculateDuration(t=!1){let e=0;for(const n in this.children){const i=this.children[n];if(!0===t&&!0===i.leaf.constructor.isGroup&&i.leaf._calculateDuration(!0),"dynamic"===i.leaf.duration){e="dynamic";break}i.position+i.leaf.duration>e&&(e=i.position+i.leaf.duration)}return e!==this.calculatedDuration&&(this.calculatedDuration=e,this.resetDuration(),!0)}_rebuildTree(){for(const t in this.children){const e=this.children[t];!0===e.leaf.passive&&this.removeIncident(e.id)}this.passiveAddition=!0,this.buildTree(),this.passiveAddition=!1}_buildTree(){this.buildTree()}buildTree(){}get duration(){return"dynamic"===this.calculatedDuration?this.calculatedDuration:super.duration}set duration(t){super.duration=t}manageEditAttrProps(t,e){const{parentNode:n}=this,i=n.getLeafPosition(this.id),s=w(this[e]);this[e]=t,n.removeIncident(this.id),this._rebuildTree();const r=n.addIncident(this,i);return r.result||(this[e]=s,this._rebuildTree(),n.addIncident(this,i)),this.resetDuration(),r}detachFromParent(){super.detachFromParent(),this.inheritedSelector=null}get inheritedSelector(){return this._inheritedSelector}set inheritedSelector(t){this._inheritedSelector=t;for(const t in this.children)this.children[t].leaf.inheritedSelector=this.selector()}get selectorToPassToChildren(){return this.selector()}exportDefinition(){const t={ClassName:this.constructor.ClassName,version:this.constructor.version,plugin:this.constructor.plugin||this.constructor.plugin_npm_name,plugin_npm_name:this.constructor.plugin_npm_name,attrs:this.attrs,props:this.props,incidents:{},duration:this.duration};for(const e in this.children){const n=this.children[e];!0!==n.leaf.passive&&(t.incidents[e]={id:n.id,position:n.position,leaf:n.leaf.exportDefinition()})}return t}exportLiveDefinition(t=!0){const e=w(this.props);t||delete e.id;const n={Class:this.constructor,attrs:w(this.attrs),props:e,incidents:{}};for(const e in this.children){const i=this.children[e];!0!==i.leaf.passive&&(n.incidents[e]={position:i.position,leaf:i.leaf.exportLiveDefinition(t)})}return n}addIncident(t,e,n={check:!0}){if(!(t instanceof pi))return j.warning("addIncident rejected, invalid incident provided"),{result:!1,errors:"Invalid Incident provided"};let i;if(t.inheritedSelector=this.selectorToPassToChildren,!0===n.check){const n=super.checkAddition(t,e);if(!n.result)return t.inheritedSelector=null,n;if(i=this.putMessageOnPipe("checkForClip",{},wr,{selfExecute:!0,direction:Y._UP}),!0===i.response){const e=t.putMessageOnPipe("checkForInvalidSelectors",{},null,{selfExecute:!0,direction:Y._DOWN});if(e.length>0){const t=[];for(let n=0;ni*(e||0)+(i+1)*(t||0)+i*n,refersToOwnSelector(t,e,n=0){let i=e;!1===Array.isArray(e)&&(i=e.split("."));const s=this.getItem(t,i.slice(0,2+n));return(""===s.props.selector||null==s.props.selector)&&("props"===i[2]||!this.isCombo(s)||this.refersToOwnSelector(t,i,n+3))},cascadeSelectors(t,e,n=""){let i=[];for(let s=0;s({constructor:{Incident:t.incidentClass.targetClass.Incident,plugin_npm_name:t.incidentClass.targetClass.plugin_npm_name,Channel:t.incidentClass.targetClass.Channel,isClip:!1},attrs:i||t.attrs,props:s||t.props,selector:()=>t.props.selector,id:t.props.id,audioClip:null,audio:"no",dynamicDurationValue:null,putMessageOnPipe:L,attributesStaggers:e,propsStaggers:n}),parseElementsDynamics(t,e,n,i,s){const r=`incidents.${s}.attrs`,o=`incidents.${s}.props`,a=wn(e),l=wn(n);for(let e=0;e{((t,e,n)=>{e in t?Er(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"childrenStaggers")}parseAttrsDynamicValues(t,e){this.childrenStaggers=[];for(let n=0;n{const{incidentAttrs:c,incidentProps:u}=kr.parseElementsDynamics(this.staggerAttrs,a.attrs,a.props,i,l),p=kr.getStaggersForChild(r,l,"attrs"),h=kr.getStaggersForChild(p.remainingDynamics,l,"props"),d=kr.getStaggersForChild(p.remainingDynamics,l,"position");r=h.remainingDynamics,o.setValue(`attrs.incidents.${l}.props.id`,`${this.id}_element${Sr}${i}_repeat${Sr}${t}_incident${Sr}${l}`);const m=Or(kr.createDescriptiveIncidentLikeObject(a,p.identifiedDynamics,h.identifiedDynamics,c,u),n);let g=a.position;1===d.identifiedDynamics.length&&(g=d.identifiedDynamics[0].stagger.calculateValues(new Array(s),this.initParams)[i]),e.addChild(m,g)})),a.addChild(e,kr.getRepeatPosition(o.props.delay,o.props.hiatus,e.duration,t))}this.addChild(a,0)}}function Or(t,e){const n=e.context.audio;if(n&&"off"===t.audio||!n&&"only"===t.audio)return null;if(x(t.props,"selector")&&(!n&&t.props.selector.startsWith("~")||n&&!t.props.selector.startsWith("~")&&!t.constructor.isClip))return null;if(t.constructor.isClip){if(!n){const n=new Ss(t,e);return n.plugin_channel_class=U,n}return n?t.audioClip:t.realClip}if(t.constructor.isCombo)return new Mr(t,e);if(t.constructor.isGroup){const n=Ct({id:t.id,attrs:t.attrs,props:t.props,Incident:t.constructor.Incident,plugin_npm_name:t.constructor.plugin_npm_name,Channel:t.constructor.Channel,DescriptiveIncident:t});for(const i in t.children){const s=Or(t.children[i].leaf,e);null!==s&&n.addChild(s,t.children[i].position)}return n}return new fs(t,e)}var Ar=Object.defineProperty,Tr=(t,e,n)=>(((t,e,n)=>{e in t?Ar(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);function _r(t){return function(){for(let e=0;e{i.execute();for(let n=0;n{i.execute();for(let t=0;t0&&(i=e[0].positionDelta);const s=this.checkResize(t.fraction,n,i);return s.result?{result:!0,execute:()=>{s.execute();for(let n=0;ne in t?Br(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Nr=(t,e,n)=>($r(t,"symbol"!=typeof e?e+"":e,n),n);class Fr{constructor(t){Nr(this,"_targetHost"),Nr(this,"context"),Nr(this,"customEntities"),Nr(this,"elementsByMCID"),Nr(this,"id"),Nr(this,"props"),this.props=t,this.customEntities={},this.elementsByMCID={},this.setContext()}setContext(t={}){this.context=((t,e)=>{for(var n in e||(e={}))jr.call(e,n)&&$r(t,n,e[n]);if(Lr)for(var n of Lr(e))Vr.call(e,n)&&$r(t,n,e[n]);return t})({audio:!1,contextLoaded:!1,getElements:this._getElements.bind(this),getElementSelectorByMCID:this._getElementSelectorByMCID.bind(this),getElementByMCID:this.getElementByMCID.bind(this),setCustomEntity:this.setCustomEntity.bind(this),getMCID:this._getMCID.bind(this),setMCID:this.setMCID.bind(this),unmount:this.unmount.bind(this)},t)}_getElements(t){if(null==t||""===t)return[];if(t.startsWith("!")){if((t=t.substring(1)).startsWith("#"))return[this.customEntities[t.substring(1)]];if(t.startsWith(".")){const e=[];for(const n in this.customEntities){const i=this.customEntities[n];i.classes.includes(t.substring(1))&&e.push(i)}return e}}return this.getElements(t)}_getMCID(t){return t.customEntity?t.id:this.getMCID(t)}_getElementSelectorByMCID(t){return x(this.customEntities,t)?`!#${t}`:this.getElementSelectorByMCID(t)}getElementByMCID(t){if(x(this.customEntities,t))return this.customEntities[t];if(x(this.elementsByMCID,t))return this.elementsByMCID[t];const e=this._getElements(this._getElementSelectorByMCID(t))[0];return this.elementsByMCID[t]=e,e}getElements(t){return[]}getMCID(t){}setMCID(t,e){}getElementSelectorByMCID(t){}unmount(){}setCustomEntity(t,e,n=[]){return x(this.customEntities,t)?(j.error(`Clip ${this.id} already has custom Entity with id: ${t}`),!1):(this.customEntities[t]={id:t,entity:e,classes:n,customEntity:!0},!0)}}var Rr=Object.defineProperty;class zr extends Fr{constructor(){super(...arguments),((t,e,n)=>{((t,e,n)=>{e in t?Rr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"rootElement")}calcClipDims(t){const e={use:!1,width:null,height:null};return x(t,"originalDims")&&null!=t.originalDims.width&&null!=t.originalDims.height?{use:!0,width:t.originalDims.width.number+t.originalDims.width.unit,height:t.originalDims.height.number+t.originalDims.height.unit}:(x(t,"containerParams")&&(x(t.containerParams,"width")&&(e.use=!0,e.width=t.containerParams.width),x(t.containerParams,"height")&&(e.use=!0,e.height=t.containerParams.height)),e)}scalingCalculator(t){if(!x(t,"containerParams")||!x(t,"originalDims")||null==t.originalDims.width&&null==t.originalDims.height)return{width:1,height:1};const e=S(t.containerParams);let n=null,i=null;return null!==e.width&&null!==t.originalDims.width&&(e.width.unit===t.originalDims.width.unit?n=e.width.number/t.originalDims.width.number:j.warning("containerParams and originalDims width of Incident have different dimensions.\ncontainerParams.width will be ignored")),null!=e.height&&null!=t.originalDims.height&&(e.height.unit===t.originalDims.height.unit?i=e.height.number/t.originalDims.height.number:j.warning("containerParams and originalDims height of Incident have different dimensions.\ncontainerParams.height will be ignored")),null==n&&null==i?{width:1,height:1}:(null!=n&&null==i?i=n:null!=i&&null==n&&(n=i),{width:n,height:i})}getElements(t){return Array.from(this.context.rootElement.querySelectorAll(t))}getMCID(t){return t.getAttribute(s)}setMCID(t,e){t.setAttribute(s,e)}getElementSelectorByMCID(t){return`[${s}="${t}"]`}}function Hr(t,e,n=!1){if(b(t))return t(e);const i=Vn(t,{items:{initParams:e},keys:{}},n);return y(i)?i:i.outerHTML}function Wr(t,e,n){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(n.createTextNode(e))}function Ur(t,e){if("google-font"===e.type)return function(t,e){const n=t.createElement("link");return n.setAttribute("rel","stylesheet"),e.src.trimStart().startsWith("https://fonts.googleapis.com/css")?(n.setAttribute("href",e.src),n):(j.error(`Only valid google font url are accepted on src of a google-font. ${e.src} provided. No font will loaded`),n)}(t,e);j.error(`The provided font type is not one of the supported. ${e.type} provided. Aborting loading font.`);const n=t.createElement("link");return n.setAttribute("rel","stylesheet"),n}const Gr="@donkeyclip/motorcortex/iframeContextHandler/css";class qr extends zr{constructor(t={}){super(t);const{ownerDocument:e}=t.host;if(!e.getElementById(Gr)){const t="iframe[seamless]{background-color:transparent;border:0 none transparent;padding:0;overflow: hidden;}",n=e.createElement("style");n.id=Gr,Wr(n,t,e),(e.head||e.getElementsByTagName("head")[0]).appendChild(n)}const n=e.createElement("iframe");t.host.appendChild(n);const i=this.scalingCalculator(t),s=this.calcClipDims(t);n.setAttribute("seamless","seamless"),!0===s.use&&(null!==s.width&&n.setAttribute("width",s.width),null!==s.height&&n.setAttribute("height",s.height)),n.style.transform=`scale(${i.width}, ${i.height})`,n.style.transformOrigin="top left",n.style.position="absolute",n.src="";let r=n.contentWindow||n.contentDocument;r.document&&(r=r.document),r.write(Hr(t.html,t.initParams,!0));const o=`${Hr(t.css,t.initParams)}body{padding:0;margin:0;}`,a=r.createElement("style");Wr(a,o,e);const l=r.head||r.getElementsByTagName("head")[0];if(l.appendChild(a),x(t,"fonts"))for(let e=0;e{((t,e,n)=>{e in t?Kr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"fontTags");const e=document.createElement("div");this.styleWrapper(e,this.props),e.innerHTML=Hr(t.html,t.initParams,!0),this.rootElement=e;let n=this.targetHost.shadowRoot;n||(n=this.targetHost.attachShadow({mode:"open"})),n.appendChild(e);const i=document.createElement("slot");n.appendChild(i);const s=document.createElement("style");if(Wr(s,`${s.styleSheet?"["+Xr+"] { all: initial; }":""}${Hr(t.css,t.initParams)}`,document),n.appendChild(s),this.fontTags=[],x(t,"fonts"))for(let e=0;e0;)t.removeAttribute(t.attributes[0].name);t.setAttribute(Xr,!0)}get targetHost(){return this.props.host}}var Jr=Object.defineProperty,Zr=Object.defineProperties,Qr=Object.getOwnPropertyDescriptors,to=Object.getOwnPropertySymbols,eo=Object.prototype.hasOwnProperty,no=Object.prototype.propertyIsEnumerable,io=(t,e,n)=>e in t?Jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,so=(t,e)=>{for(var n in e||(e={}))eo.call(e,n)&&io(t,n,e[n]);if(to)for(var n of to(e))no.call(e,n)&&io(t,n,e[n]);return t},ro=(t,e)=>Zr(t,Qr(e));class oo extends Dr{constructor(t={},e={},n){super(t,e,n),e=ro(so({},e),{html:""!==this.html?this.html:e.html,css:""!==this.css?this.css:e.css,fonts:this.fonts.length>0?this.fonts:e.fonts});const i=new(document.head.createShadowRoot||document.head.attachShadow?Yr:qr)(e);this.ownContext=ro(so({},i.context),{initParams:e.initParams}),this.iframe=i.iframeElement,this.onAfterRender()}onAfterRender(){}get html(){return""}get css(){return""}get fonts(){return[]}get rootElement(){return this.context.rootElement}exportConstructionArguments(){var t;return{attrs:this.attrs,props:ro(so({},this.props),{host:void 0,html:!0===(null==(t=this.DescriptiveIncident)?void 0:t.constructor).customClip?"":this.context.rootElement.innerHTML})}}}function ao(){return{result:!0}}var lo=Object.defineProperty,co=(t,e,n)=>(((t,e,n)=>{e in t?lo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class uo extends Pr{constructor(t,e){super(t,e),co(this,"isTheRootClip"),co(this,"listeners",{}),co(this,"previousTimeStamp"),co(this,"speed"),co(this,"pauseMoment"),this.runTimeInfo={currentMillisecond:0,state:"idle"},this.listeners={},this.previousTimeStamp=-1,this.speed=1}_setState(t,e={}){if(t!==this.runTimeInfo.state){this.runTimeInfo.state=t,this.putMessageOnPipe("setState",{newState:t,options:e},"Clips",{selfExecute:!1,direction:Y._DOWN});for(const n in this.listeners)this.listeners[n].funct(this.runTimeInfo.currentMillisecond,t,e)}}handleSetState(t,e){this._setState(e.newState,e.options||{})}play(t=!1){switch(this.runTimeInfo.state){case"idle":case"paused":case"armed":case"transitional":case"blocked":if("paused"===this.runTimeInfo.state){const t=(new Date).getTime()-this.pauseMoment;this.previousTimeStamp+=t}this._setState("playing"),this.onPlay(),t||window.requestAnimationFrame((t=>{this.step(t)}))}}pause(){"playing"===this.runTimeInfo.state&&(this._setState("paused"),this.pauseMoment=(new Date).getTime(),this.onWait())}arm(){"transitional"!==this.runTimeInfo.state&&"blocked"!==this.runTimeInfo.state||this._setState("armed")}complete(){this._setState("idle"),this.previousTimeStamp=-1}stop(){this._setState("transitional"),this.previousTimeStamp=-1}block(t={}){x(t,"exception")&&"playing"!==this.runTimeInfo.state||(this._setState("blocked",t),this.previousTimeStamp=-1)}onPlay(){}onWait(){}playableProgress(t,e){if(!this.isTheRootClip)return!1;for(const t in this.listeners){const s=this.listeners[t];!0!==s.onlyOnStateChange&&(Math.abs(e+s.cavaDelta-this.runTimeInfo.currentMillisecond)>s.threshold?(s.funct((n=e,i=s.roundTo,Math.round(n/i)*i),this.runTimeInfo.state),s.cavaDelta=0):s.cavaDelta+=Math.abs(e-this.runTimeInfo.currentMillisecond))}var n,i;return this.onProgress(t,e),this.runTimeInfo.currentMillisecond=e,!0}set executionSpeed(t){this.isTheRootClip&&(this.speed=parseFloat(t))}step(t,e=!1){if("playing"!==this.runTimeInfo.state)return;-1===this.previousTimeStamp&&(this.previousTimeStamp=t);const n=Math.round(this.runTimeInfo.currentMillisecond+(t-this.previousTimeStamp)*this.speed),i=n/this.duration;return i>=1?(this.playableProgress(1,this.duration),void this.complete()):i<0?(this.playableProgress(0,0),void this.complete()):(this.playableProgress(i,n),this.previousTimeStamp=t,void(e||window.requestAnimationFrame(this.step.bind(this))))}subscribe(t,e,n,i,s=!1){n||(n=0),i||(i=1),this.listeners[t]={funct:e,threshold:n,roundTo:i,cavaDelta:0,onlyOnStateChange:s}}unsubscribe(t){x(this.listeners,t)&&delete this.listeners[t]}subscribeToDurationChange(t){return!!this.isTheRootClip&&(this.realClip.subscribeToDurationChange(t),!0)}}var po=Object.defineProperty,ho=(t,e,n)=>(((t,e,n)=>{e in t?po(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class mo{constructor(){ho(this,"gainNode"),ho(this,"input"),ho(this,"output"),ho(this,"pannerNode"),this.output=m.createGain(),this.gainNode=m.createGain(),m.createStereoPanner&&(this.pannerNode=m.createStereoPanner()),m.createStereoPanner?(this.pannerNode.connect(this.gainNode),this.gainNode.connect(this.output),this.input=this.pannerNode):(this.gainNode.connect(this.output),this.input=this.gainNode)}connect(t){this.output.connect(t)}disconnect(){this.output.disconnect()}}var go=Object.defineProperty,fo=(t,e,n)=>(((t,e,n)=>{e in t?go(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);function yo(t){const e=window.atob(t),n=e.length,i=new Uint8Array(n);for(let t=0;t{this._setBuffer(s,t,e)}));else{const t=new XMLHttpRequest;t.open("GET",s.src,!0),t.responseType="arraybuffer",this.soundLoaded=!1,t.onload=()=>{m.decodeAudioData(t.response,(t=>{this._setBuffer(s,t,e)}),this.onError)},t.send()}}this.setContext({contextLoaded:!0,audio:!0,document,window,rootElement:document.body,unmount:L,masterNode:e,audioContext:m})}_setBuffer(t,e,n){var i;t.soundLoaded=!0,t.buffer=e,t.audioNodeSet=new mo,t.audioNodeSet.connect(n.input),null==(i=t.pubSub)||i.pub()}getElementByMCID(t){return x(this.elementsByMCID,t)?this.elementsByMCID[t]:null}getElements(t){if(!t.startsWith("~")){if(vo.exec(t)){const e=t.split('"')[1];return[this.elementsByMCID[e]]}return[]}if((t=t.substring(1)).startsWith("#"))return x(this.audioSources,t.substring(1))?[this.audioSources[t.substring(1)]]:[];if(!t.startsWith("."))return[];const e=t.substring(1),n=[];for(const t in this.audioSources)t.classes.indexOf(e)>=0&&n.push(t);return n}getMCID(t){return t.mcid}setMCID(t,e){t.mcid=e}getElementSelectorByMCID(t){return`[data-mcid="${t}"]`}}var wo=Object.defineProperty,Co=(t,e,n)=>(((t,e,n)=>{e in t?wo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class Io extends Dr{constructor(t,e){super(t,e),Co(this,"audioNodeSet"),Co(this,"parentClipContext"),this.audioNodeSet=new mo,this.audioNodeSet.connect(m.destination);const n=new xo(this.props.audioSources,this.audioNodeSet).context;n.initParams=e.initParams,this.ownContext=n}handleRecalcDuration(t,e){return!!super.handleRecalcDuration(t,e)&&!!this.putMessageOnPipe("recalcDuration",e.childId?{childId:this.id}:{},"Groups",{selfExecute:!1,direction:Y._UP}).response}onProgress(t,e,n,i=!1){if(e>this.duration)return super.onProgress(1,this.duration,this.id,i);const s=this.delay+this.calculatedDuration+this.hiatus;let r=0===s?0:e%s;0!==e&&0===r&&(r=this.delay+this.calculatedDuration);let o=r-this.delay;if(o<0)return;o>this.calculatedDuration&&(o=this.calculatedDuration);const a=0===this.calculatedDuration?0:o/this.calculatedDuration;super.onProgress(a,o,this.id,i)}_onGetContextOnce(t){var e;this.audioNodeSet.disconnect(),this.parentClipContext=t,this.audioNodeSet.connect(null==(e=t.masterNode)?void 0:e.input)}lastWish(){this.audioNodeSet.output.disconnect(),this.audioNodeSet.output.connect(m.destination)}get volume(){return this.audioNodeSet.output.gain.value}set volume(t){this.audioNodeSet.output.gain.value=t}}var Po=Object.defineProperty,Eo=(t,e,n)=>(((t,e,n)=>{e in t?Po(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class So extends Yr{constructor(t={}){super(t),Eo(this,"removeDOMTimeout"),Eo(this,"rendered"),this.context.fragment=!0,this.rendered=!1,this.removeDOMTimeout=null}get targetHost(){return this._targetHost||(this._targetHost=document.createElement("div"),this._targetHost.style.zIndex="-1",this._targetHost.style.width="0px",this._targetHost.style.height="0px",this._targetHost.style.overflow="hidden",this._targetHost.style.position="relative"),this._targetHost}checkProps(){return v(this.props)?(x(this.props,"html")||(this.props.html=""),x(this.props,"css")||(this.props.css=""),!0):(j.error(`HTMLFragmentContextHandler expects an object on its constructor. ${typeof this.props} passed`),!1)}renderOnDOM(){this.removeDOMTimeout&&clearTimeout(this.removeDOMTimeout),this.rendered||(document.body.append(this._targetHost),this.rendered=!0)}removeFromDOM(){this.removeDOMTimeout&&clearTimeout(this.removeDOMTimeout),this.removeDOMTimeout=setTimeout((()=>{try{document.body.removeChild(this._targetHost),this.rendered=!1}catch(t){j.info("Clip's DOM element was not found and thus not removed from DOM")}}),50)}}var ko=Object.defineProperty,Mo=Object.defineProperties,Oo=Object.getOwnPropertyDescriptors,Ao=Object.getOwnPropertySymbols,To=Object.prototype.hasOwnProperty,_o=Object.prototype.propertyIsEnumerable,Do=(t,e,n)=>e in t?ko(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Bo=(t,e)=>{for(var n in e||(e={}))To.call(e,n)&&Do(t,n,e[n]);if(Ao)for(var n of Ao(e))_o.call(e,n)&&Do(t,n,e[n]);return t},Lo=(t,e)=>Mo(t,Oo(e)),jo=(t,e,n)=>(Do(t,"symbol"!=typeof e?e+"":e,n),n);class Vo extends Dr{constructor(t={},e=null,n){let i=t,s=e;null==s&&(i={},s=t),super(i,s,n),jo(this,"contextHandler"),jo(this,"html"),jo(this,"css"),jo(this,"fonts"),s.html=x(s,"html")?s.html:this.html,s.css=x(s,"css")?s.css:this.css,s.fonts=x(s,"fonts")?s.fonts:this.fonts;const r=new So(s);this.ownContext=Lo(Bo({},r.context),{isHostedClip:!1}),this.iframe=r.iframeElement,this.contextHandler=r,this.onDOMCLipInitialise()}exportConstructionArguments(){return{attrs:this.attrs,props:Lo(Bo({},this.props),{html:this.context.rootElement.innerHTML})}}onDOMCLipInitialise(){}get rootElement(){return this.context.rootElement}renderOnDOM(){this.contextHandler.renderOnDOM()}removeFromDOM(){this.contextHandler.removeFromDOM()}}var $o=Object.defineProperty,No=(t,e,n)=>(((t,e,n)=>{e in t?$o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class Fo{constructor(){No(this,"isNullClip"),No(this,"context",{}),this.isNullClip=!0}get duration(){return 0}set duration(t){}addIncident(){return W}moveIncident(){return W}removeIncident(){return W}resizeIncident(){return W}getIncidentsByChannel(){return{}}flash(){}_resize(){}onProgress(){}renderOnDOM(){}removeFromDOM(){}get volume(){return 0}set volume(t){}setVolume(){}}var Ro=Object.defineProperty,zo=Object.defineProperties,Ho=Object.getOwnPropertyDescriptors,Wo=Object.getOwnPropertySymbols,Uo=Object.prototype.hasOwnProperty,Go=Object.prototype.propertyIsEnumerable,qo=(t,e,n)=>e in t?Ro(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ko=(t,e,n)=>(qo(t,"symbol"!=typeof e?e+"":e,n),n);class Xo{constructor(t){Ko(this,"id"),Ko(this,"ownClip"),Ko(this,"realClip"),Ko(this,"runTimeInfo"),this.runTimeInfo={currentMillisecond:0,state:"transitional"},this.id=A(),this.realClip=t.descriptiveIncident.realClip;const e=t.descriptiveIncident.realClip.exportConstructionArguments(),n=(i=((t,e)=>{for(var n in e||(e={}))Uo.call(e,n)&&qo(t,n,e[n]);if(Wo)for(var n of Wo(e))Go.call(e,n)&&qo(t,n,e[n]);return t})({},e.props),s={selector:void 0,host:t.host,id:this.id},zo(i,Ho(s)));var i,s;this.ownClip=new t.descriptiveIncident.constructor.Incident(e.attrs,n),t.descriptiveIncident.realClip.addContext({clipId:this.id,context:this.ownClip.context,synchronize:t.synchronize,runTimeInfo:this.runTimeInfo},!0)}onProgress(t,e,n=!1){for(const t in this.realClip.instantiatedChannels)this.realClip.instantiatedChannels[t].moveTo(this.runTimeInfo.currentMillisecond,e,this.id,!0);this.runTimeInfo.currentMillisecond=e}}var Yo=Object.defineProperty,Jo=Object.defineProperties,Zo=Object.getOwnPropertyDescriptors,Qo=Object.getOwnPropertySymbols,ta=Object.prototype.hasOwnProperty,ea=Object.prototype.propertyIsEnumerable,na=(t,e,n)=>e in t?Yo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ia=(t,e)=>{for(var n in e||(e={}))ta.call(e,n)&&na(t,n,e[n]);if(Qo)for(var n of Qo(e))ea.call(e,n)&&na(t,n,e[n]);return t},sa=(t,e,n)=>(na(t,"symbol"!=typeof e?e+"":e,n),n);function ra(t,e,n){const i=t.realClip[e](n),s=t.audioClip[e](n);return i.result&&s.result?(i.execute(),s.execute(),t.putMsgOnPipeWithResult("flash",{},"RootClip",{selfExecute:!0,direction:Y._UP})):i}class oa extends uo{constructor(t,e=null){let n=t,i=e;if(null===i&&(n={},i=t),super(n,i),sa(this,"mustHaveNullClip"),sa(this,"initParams"),sa(this,"volumeChangeSubsribers",{}),sa(this,"audio"),sa(this,"audioClip"),sa(this,"statusBeforeBlock"),sa(this,"nonBlockingErrorClip"),this.mustHaveNullClip=!1,this.initParams=i.initParams||{},x(i,"initParamsValidationRules")){const t=function(t,e,n="Error on validation"){try{const i=Us(t)(e);if(!0===i)return{result:!0};let s=`${n}:`;for(let t=0;t',css:"",fonts:[]});a.props.host=t.rootElement,a.Incident=this.constructor.Incident}else"only"===this.audio&&!0!==this.props.root?this.isTheRootClip=!1:(this.isTheRootClip=!0,this.blockingWaitings={},a.Incident=this.constructor.Incident);if("on"===this.audio||"only"===this.audio){const t={id:this.id,attrs:{},props:{audioSources:x(i,"audioSources")?i.audioSources:this.audioSources,runTimeInfo:this.runTimeInfo,subscribe:this.subscribe.bind(this),hiatus:this.hiatus,delay:this.delay,repeats:this.repeats,initParams:this.initParams},plugin_npm_name:this.constructor.plugin_npm_name,Channel:this.constructor.Channel,Incident:Io,DescriptiveIncident:this};x(i,"audioSources")&&(t.props.audioSources=this.resolveAudioSources(i.audioSources)),this.audioClip=Ct(t)}else this.audio="off",this.audioClip=new Fo;"only"===this.audio?this.realClip=new Fo:!this.isTheRootClip&&(x(o.attrs,"expression")||x(o.props,"expression")||x(o.attrs,"initParams")||x(o.props,"initParams"))?(this.mustHaveNullClip=!0,this.realClip=new Fo):this.realClip=Ct(a,!0),this.dynamicDurationValue=null,this.passiveAddition=!0,this._buildTree(),this.passiveAddition=!1,this.constructor.isAnimation&&x(this.props,"duration")&&this.resize(this.duration)}get selectorToPassToChildren(){return null}get inheritedSelector(){return this._inheritedSelector}set inheritedSelector(t){this._inheritedSelector=t}get html(){return""}get css(){return""}get fonts(){return[]}get audioSources(){return[]}resolveAudioSources(t){const e=w(t);for(let t=0;t0&&!this.isTheRootClip?"dynamic":x(this.props,"duration")?this.repeats*(this.delay+this.props.duration+this.hiatus):super.duration}set duration(t){if(0!=this.propsStaggers.length){for(let e=0;e{i.block(n)}),0)}handleUnBlock(t,e){if(!this.isTheRootClip)return this.bypass();x(this.blockingWaitings,e.id)&&(delete this.blockingWaitings[e.id],0===Object.keys(this.blockingWaitings).length&&("playing"===this.statusBeforeBlock?(this.previousTimeStamp=-1,this.play()):this.arm()))}stop(){super.stop(),this.blockingWaitings={}}onProgress(t,e){this.realClip.onProgress(t,e),this.audioClip.onProgress(t,e)}paste(t){return this.isTheRootClip?new Xo({host:t,descriptiveIncident:this}):null}flash(){this.realClip.flash(),this.audioClip.flash()}get volume(){return"off"===this.audio?0:this.audioClip.volume}setVolume(t){if("off"===this.audio)return{result:!1,errors:[{type:"can not set volume of Clip with audio off"}]};if(t<0||t>1)return{result:!1,errors:[{type:"invalid volume number"}]};this.audioClip.volume=t;for(const e in this.volumeChangeSubsribers)this.volumeChangeSubsribers[e](t);return{result:!0}}attachMediaElementSource(t){var e,n;"off"!==this.audio&&(null==(n=this.audioClip.context.audioContext)||n.createMediaElementSource(t).connect(null==(e=this.audioClip.context.masterNode)?void 0:e.input))}volumeChangeSubscribe(t,e){return this.putMessageOnPipe("volumeChangeSubscribe",{type:"subscribe",id:t,funct:e},"RootClip",{selfExecute:!0,direction:Y._UP}).response}volumeChangeUnsubscribe(t){return this.putMessageOnPipe("volumeChangeSubscribe",{type:"unsubscribe",id:t},"RootClip",{selfExecute:!0,direction:Y._UP}),0}handleVolumeChangeSubscribe(t,e){if(!this.isTheRootClip)return this.bypass();switch(e.type){case"subscribe":return this.volumeChangeSubsribers[e.id]=e.funct,this.volume;case"unsubscribe":return delete this.volumeChangeSubsribers[e.id],0}return!1}}sa(oa,"isClip",!0),sa(oa,"Incident",oo),sa(oa,"plugin_npm_name","@donkeyclip/self-contained-incidents"),sa(oa,"version",xr),sa(oa,"Channel",K),sa(oa,"ClassName","HTMLClip"),sa(oa,"propsValidationRules",yr);class aa extends oa{constructor(t,e=null){let n=t,i=e;null===e&&x(t,"audioSources")?(n={},i=t):null===e&&(i={}),i.audio="only",super(n,i)}}var la=Object.defineProperty,ca=(t,e,n)=>(((t,e,n)=>{e in t?la(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class ua extends K{constructor(t){super(t),ca(this,"playingIncidentsIds"),ca(this,"transitioned"),this.playingIncidentsIds=[],this.transitioned=!1,t.subscribe(A(),this._stateChange.bind(this),0,1,!0)}_stateChange(t,e,n={}){"paused"!==e&&"idle"!==e&&"blocked"!==e||(this._stopPlayingIncidents(n),this.transitioned=!0)}_stopPlayingIncidents(t={}){for(let e=0;er+o.duration?o.duration:e-r,o.onProgress(a,n,!0)}return}this.transitioned&&(t=0,this.transitioned=!1);const r=t>e;for(let i=0;it&&u<=e||r){l.stop(n);const t=this.playingIncidentsIds.indexOf(p);t>-1&&this.playingIncidentsIds.splice(t,1)}if(a>=(r?0:t)&&ae){const t=(e-a)/c>=1,i=t?c:e-a,s=t?1:i/c;l.play(s,i,n)&&this.playingIncidentsIds.push(p)}}this.runTimeInfo.currentMillisecond=e}}var pa=Object.defineProperty,ha=(t,e,n)=>(((t,e,n)=>{e in t?pa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class da extends et{constructor(t={},e={},n){super(),ha(this,"attrs"),ha(this,"autoGenerated"),ha(this,"context"),ha(this,"dna"),ha(this,"gotContext"),ha(this,"hasIncidents"),ha(this,"mcid"),ha(this,"modelId"),ha(this,"plugin_channel_class"),ha(this,"props"),this.attrs=t,this.props=e,this.dna=n,this.context=n.context,this.mcid=n.mcid,this.id=e.id||A(),this.modelId=e.modelId,this.gotContext=!1,this.plugin_channel_class=ua,this.mc_plugin_npm_name="motor-cortex-js-media-playback",x(e,"plugin_channel_class")&&(this.plugin_channel_class=e.plugin_channel_class),x(e,"mc_plugin_npm_name")&&(this.mc_plugin_npm_name=e.mc_plugin_npm_name),this.hasIncidents=!1,this.autoGenerated=!1,this.onInitialise(t,e)}get selector(){return this.props.selector}get element(){return this.context.getElementByMCID(this.mcid)}_onGetContextOnce(){if(!this.context.fragment)try{this.gotContext||(this.onGetContext(),this.gotContext=!0)}catch(t){j.error(t,this.mcid)}}onGetContext(){j.info('Overwrite the "onGetContext" method with the code you want to get executed',"info")}lastWish(){}onInitialise(t,e){j.info('Overwrite the "onInialise" method with the code you want to get executed',"info")}onProgress(t){}play(t){return!0}stop(){}}var ma=Object.defineProperty;const ga={npm_name:"@donkeyclip/motorcortex-soundsystem",name:"Internal MotorCortex Soundsystem",incidents:[{exportable:class extends da{constructor(){super(...arguments),((t,e,n)=>{((t,e,n)=>{e in t?ma(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"audioNode")}play(t){if(!this.element.soundLoaded)return this.setBlock("loading sound"),this.element.pubSub.sub(this.id,(()=>{this.unblock()})),!1;let e=0;return x(this.props,"startFrom")&&(e=this.props.startFrom),this.audioNode=m.createBufferSource(),this.audioNode.buffer=this.element.buffer,this.audioNode.connect(this.element.audioNodeSet.input),this.audioNode.start(0,(t+e)/1e3),!0}stop(){this.audioNode&&this.audioNode.stop()}},name:"AudioPlayback"},{exportable:class extends st{onProgress(t){const e=this.getFraction(t);if(!this.element.soundLoaded)return this.setBlock("loading sound"),this.element.pubSub.sub(this.id,(()=>{this.unblock()})),!1;const n=(this.targetValue-this.initialValue)*e+this.initialValue;switch(this.attributeKey){case"gain":this.element.audioNodeSet.gainNode.gain.value=n;break;case"pan":this.element.audioNodeSet.pannerNode.pan.value=n}return!0}getScratchValue(){return"pan"===this.attributeKey?x(this.element.startValues,"pan")?this.element.startValues.pan:0:"gain"===this.attributeKey?x(this.element.startValues,"gain")?this.element.startValues.gain:1:void 0}},name:"AudioEffect"}],Clip:{exportable:Io},audio:"only"},fa="forwards",ya="backwards";var va=Object.defineProperty,ba=Object.getOwnPropertySymbols,xa=Object.prototype.hasOwnProperty,wa=Object.prototype.propertyIsEnumerable,Ca=(t,e,n)=>e in t?va(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ia=(t,e,n)=>(Ca(t,"symbol"!=typeof e?e+"":e,n),n);class Pa{constructor(){Ia(this,"_bwExecutionSubscribers"),Ia(this,"_currentPeriod"),Ia(this,"_executionSubscribers"),Ia(this,"_nextIterationLanes"),Ia(this,"subPeriod"),this._executionSubscribers={},this._bwExecutionSubscribers={},this.subPeriod=10,this._currentPeriod={},this._nextIterationLanes={}}reset(){this._executionSubscribers={},this._bwExecutionSubscribers={},this._nextIterationLanes={}}executionSubscribers(t,e){const n=e===fa?this._executionSubscribers:this._bwExecutionSubscribers;return null!=n[t]||(n[t]={}),n[t]}subscribe(t,e,n,i,s){const r=this.executionSubscribers(t,e);null!=r[n]||(r[n]={}),r[n][i]=()=>{var e;null!=(e=this._nextIterationLanes)[t]||(e[t]={}),this._nextIterationLanes[t][i]=s}}nextIterationLanes(t,e){var n;return null!=(n=this._nextIterationLanes)[t]||(n[t]=((t,e)=>{for(var n in e||(e={}))xa.call(e,n)&&Ca(t,n,e[n]);if(ba)for(var n of ba(e))wa.call(e,n)&&Ca(t,n,e[n]);return t})({},e)),this._nextIterationLanes[t]}setNextIterationLanes(t,e){this._nextIterationLanes[t]=e}currentPeriod(t){var e;return null!=(e=this._currentPeriod)[t]||(e[t]=0),this._currentPeriod[t]}setCurrentPeriod(t,e){this._currentPeriod[t]=e}}function Ea(t,e,n,i,s=!1){const r=e[t[i].id];r.setInitialValue(n,s);const o=function(t,e,n,i){let s=!1;const r=Object.keys(e);for(let t=0;te in t?Sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ta=(t,e)=>{for(var n in e||(e={}))Ma.call(e,n)&&Aa(t,n,e[n]);if(ka)for(var n of ka(e))Oa.call(e,n)&&Aa(t,n,e[n]);return t},_a=(t,e,n)=>(Aa(t,"symbol"!=typeof e?e+"":e,n),n);class Da{constructor(t={}){var e;_a(this,"belongingLaneKeysByAnimationId"),_a(this,"comboAttributes"),_a(this,"incidentsById"),_a(this,"lanes"),_a(this,"lastAnimatedItemPerLane"),this.lanes=t.lanes||{},this.lastAnimatedItemPerLane={},this.comboAttributes=null!=(e=t.comboAttributes)?e:{},this.belongingLaneKeysByAnimationId=t.belongingLaneKeysByAnimationId||{},this.incidentsById=t.incidentsById||{}}_resize(t){const e=Object.keys(this.lanes);for(let n=0;n=t&&i.millisecondt&&i.millisecond+c<=l+t||i.millisecondl+t)&&a.push(i)}return a}addElementToLane(t,e,n,i){const s=[],r=T(t,e);this.incidentsById[i.id]=i;const o={millisecond:n,id:i.id};this.laneExists(t,e,!0),this.lanes.pushValue(r,o),this.lanes[r].sortBy("millisecond");const a=Array.from(this.lanes[r]),l=a.findIndex((t=>t.id===i.id));if(x(i.id)?this.belongingLaneKeysByAnimationId.pushValue(i.id,r):this.belongingLaneKeysByAnimationId.setValue(i.id,[r]),0===l)if(a.length>1){const t=this.incidentsById[a[1].id].pureInitialValues;s.push((()=>{i.setInitialValue(t)}))}else s.push((()=>{i.setInitialValue()}));else s.push((()=>{const t=this.incidentsById[a[l-1].id].animatedAttributeValue;i.setInitialValue(t)}));if(x(this.comboAttributes,e)&&s.push((()=>{Ea(a,this.incidentsById,i.initialValue,l)})),l+1{this.incidentsById[t].setInitialValue(i.animatedAttributeValue),this.incidentsById[t].gotContext&&(this.incidentsById[t].lastWish(),this.incidentsById[t].onGetContext())}))}return s}updateLane(t,e){const n={},i=this;for(let e=0;et.millisecond-e.millisecond));const a=x(this.comboAttributes,i.attribute);for(let t=0;tt.millisecond-e.millisecond)),this.lanes[t]=s;for(let t=0;tt.id===e)),i=s.findIndex((t=>t.id===e));if(n===i&&i<=1)continue;const l=this.incidentsById[s[i].id];if(n+1n?n:i;Ea(s,this.incidentsById,this.incidentsById[o[n-1].id].animatedAttributeValue,t,!0)}else this.incidentsById[o[n+1].id].setInitialValue(this.incidentsById[o[n-1].id].animatedAttributeValue),this.incidentsById[o[n+1].id].onGetContext();if(0===i?a?Ea(s,this.incidentsById,this.incidentsById[o[0].id].pureInitialValues,i,!0):(l.setInitialValue(this.incidentsById[o[0].id].pureInitialValues),l.onGetContext()):a?Ea(s,this.incidentsById,this.incidentsById[s[i-1].id].animatedAttributeValue,i,!0):(l.setInitialValue(this.incidentsById[s[i-1].id].animatedAttributeValue),l.onGetContext()),i+1>=s.length)continue;if(a){Ea(s,this.incidentsById,l.animatedAttributeValue,i+1,!0);continue}const c=this.incidentsById[s[i+1].id];c.setInitialValue(l.animatedAttributeValue),c.onGetContext()}}}deleteAnimations(t){const e={};for(let n=0;n=n.length||!1===u)continue;if(x(this.comboAttributes,l.attribute)){Ea(n,this.incidentsById,u,r,!0);continue}const p=this.incidentsById[n[r].id];p.setInitialValue(u),p.onGetContext()}delete this.belongingLaneKeysByAnimationId[t[n]]}return e}recalcScratchValues(t){const e=Object.keys(this.lanes);for(let n=0;n0){const e=this.incidentsById[s[0].id],n=e.getScratchValue(t),r=M(i);x(this.comboAttributes,r.attribute)?Ea(s,this.incidentsById,n,0,!0):e.setInitialValue(n),e.lastWish(),e.onGetContext()}}}getLastAffectedIndex(t,e,n){return this.lastAnimatedItemPerLane[t]?this.lastAnimatedItemPerLane[t][e]&&!n||(this.lastAnimatedItemPerLane[t][e]=[0,this.incidentsById[this.lanes[e][0].id].duration+this.lanes[e][0].millisecond]):this.lastAnimatedItemPerLane[t]={[e]:[0,this.incidentsById[this.lanes[e][0].id].duration+this.lanes[e][0].millisecond]},this.lastAnimatedItemPerLane[t][e]}setLastAffectedIndex(t,e,n){this.lastAnimatedItemPerLane[t]||(this.lastAnimatedItemPerLane[t]={}),this.lastAnimatedItemPerLane[t][e]=[n,this.incidentsById[this.lanes[e][n].id].duration+this.lanes[e][n].millisecond]}}var Ba=Object.defineProperty,La=Object.getOwnPropertySymbols,ja=Object.prototype.hasOwnProperty,Va=Object.prototype.propertyIsEnumerable,$a=(t,e,n)=>e in t?Ba(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Na=(t,e)=>{for(var n in e||(e={}))ja.call(e,n)&&$a(t,n,e[n]);if(La)for(var n of La(e))Va.call(e,n)&&$a(t,n,e[n]);return t},Fa=(t,e,n)=>($a(t,"symbol"!=typeof e?e+"":e,n),n);function Ra(t){if(t){const e=Object.keys(t);for(let n=0;n0){const t=this.incidentsById[p[0].id];o=!0,r.push({type:"unauthorised, overlapping incidents on the same element",element_mcid:c,attribute:u,millisecond:p[0].millisecond,incident:t?{attrs:t.DescriptiveIncident.attrs,props:t.DescriptiveIncident.props,duration:t.duration}:void 0})}if(!o){const t=n.addElementToLane(c,u,a.millisecond,l);s.push((()=>{for(let e=0;e0&&"all-or-nothing"===e)return{result:!1,errors:r};const o=this.LanesHandler;return{result:!0,errors:r,execute:function(){for(let t=0;tt.millisecond-e.millisecond)),n.lanes.setValue(e,s)}for(let t=0;t0&&s.push({type:"unauthorised, overlapping animations on the same element",meta:{element_mcid:a,attribute:l,newAnimation:o,overlappingAnims:u}});break}}if(s.length>0)return{result:!1,errors:s};const r=this;return{result:!0,execute:function(){r.LanesHandler.updateLane(n,e),r.irema.reset()}}}checkResizedIncidents(t,e=!1){const n=[];for(let e=0;e0&&s.push({type:"unauthorized overlapping animations on the same element",meta:{element_mcid:o,attribute:a,newAnimation:p,overlappingAnims:h}})}}if(s.length>0)return{result:!1,errors:s};const r=this;return{execute:function(){for(let e=0;e=i){if(!r||0===h){const n=Math.floor(l.millisecond/this.irema.subPeriod);this.irema.subscribe(s,fa,n,t,e)}o=!1;break}if(u<=n)h=n&&u<=i)){a.push(l),c=h,p=!1;break}a.push(l),c=h,p=!0,h=0;p--){const a=e[p];if(cn)p>0?e[p-1].millisecond+this.incidentsById[e[p-1].id].durationi)){o.push(a),l=p,u=!1;break}o.push(a),l=p,u=!0,p>0?c=this.incidentsById[e[p-1].id].duration+e[p-1].millisecond:r=!1}}if(l!==a[0]&&this.LanesHandler.setLastAffectedIndex(s,t,l),0===o.length)return!0;const p=o.length-1,h=this.incidentsById[o[p].id],d=o[p].millisecond,m=u?0:i-d;return h.onProgress(m,s),r}moveTo(t,e,n,i=!1){const s=e>=t?fa:ya,r=this.irema.executionSubscribers(n,s);(i||s!==this.direction)&&(this.irema._nextIterationLanes={});const o=this.irema.nextIterationLanes(n,this.lanes),a=this.irema.currentPeriod(n),l=Math.floor(e/this.irema.subPeriod);if(s===fa)for(let t=a;t<=l;t++)Ra(r[t]);else for(let t=a;t>=l;t--)Ra(r[t]);const c={},u=Object.keys(o),p=s===fa?this.slipIntoLaneForwards.bind(this):this.slipToLaneBackwards.bind(this);for(let s=0;s(((t,e,n)=>{e in t?Ha(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);class Ua extends pi{constructor(t,e){super(null!=e?e:t),void 0===e&&(e=t||{},t={});const n=V(e,mr,this.constructor);if(!n.result)return n;this.inheritedSelector=null,this.attrs=t,x(e,"duration")||(e.duration=0),this.props=e,this.attributesStaggers=[],this.propsStaggers=[],this.setupDynamicValues(),this.dynamicDurationValue=null,this.passive=!1}get duration(){return null!==this.dynamicDurationValue?this.dynamicDurationValue:this.propsStaggers.length>0?"dynamic":super.duration}set duration(t){if(this.propsStaggers.length>0){for(let e=0;e(((t,e,n)=>{e in t?Ga(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);function Ka(t){if((null==t?void 0:t.default)&&(t=t.default),(null==t?void 0:t.npm_name)||(t.npm_name=`plugin_${(new Date).getTime()}`),!function(t){x(t,"default")&&(t=t.default);const e=t.npm_name;if(x(t,"name")||j.notice(`Notice on plugin ${e}. A plugin should have its name under the key "name". It's missing from this plugin`),x(t,"version")||j.notice(`Notice on ${e}. Plugin should always expose its version number.\n Plugin version is missing`),!x(t,"incidents"))return!!x(t,"Clip")||(j.error(`Error on plugin ${e}. A plugin must expose at least one Incident or a Clip.\n Exposed plugin Incidents should be defined on the "incidents" key of the index.js file while Clips on the "Clip".`),!1);if(!Array.isArray(t.incidents))return j.error(`Error on plugin ${e}. thePlugin exposed Incidents are defined on the "incidents" key of the index.js file in array format.\n Please refer to the documentation`),!1;let n=!0;for(let i=0;i0){let e=`Error on plugin's "${t.npm_name}" Clip instantiation. Errors:`;for(let t=0;t0){let e=`Error on plugin's "${t.npm_name}" "${o.name}" instantiation. Errors:`;for(let t=0;td}}const Ya=Math.PI/180,Ja=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skewX","skewY"];var Za=Object.defineProperty;class Qa extends st{constructor(t={},e={},n){super(t,e,n),((t,e,n)=>{((t,e,n)=>{e in t?Za(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"compoAttributes"),this.compoAttributes={transform:Ja}}getScratchValue(){let t=this.attributeKey;if("cssOffset"===t&&(t="offset"),"transform"!==t){const e=this.context.window.getComputedStyle(this.element)[t];return void 0!==e&&""!==e?e:0}const e=this.compoAttributes[t],n=function(t,e){const n=t.getComputedStyle(e).transform;return""===n||"none"===n?{rotate:"0deg",rotateX:"0deg",rotateY:"0deg",scaleX:1,scaleY:1,scale:1,skewX:"0deg",skewY:"0deg",translateX:"0px",translateY:"0px"}:function(t){const e=Math.atan2(t[1],t[0]),n=Math.pow(t[0],2)+Math.pow(t[1],2),i=Math.pow(t[2],2)+Math.pow(t[3],2),s=Math.round(100*Math.sqrt(n))/100,r=Math.round((t[0]*t[3]-t[2]*t[1])/s*100||0)/100,o=Math.atan2(t[0]*t[2]+t[1]*t[3],n),a=Math.atan2(t[1]*t[3]+t[0]*t[2],i);return{rotate:`${e/Ya||0}deg`,scaleX:s===r?1:null!=s?s:1,scaleY:s===r?1:null!=r?r:1,scale:s===r&&null!=s?r:1,skewX:(1===n?o/Ya:0)+"deg",skewY:(1===i?a/Ya:0)+"deg",translateX:`${t[4].trim()}px`,translateY:`${t[5].trim()}px`}}(n.split("(")[1].split(")")[0].split(","))}(this.context.window,this.element),i=this.context.window.getComputedStyle(this.element),s={};let r;for(let t=0;t(((t,e,n)=>{e in t?tl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);const nl=["deg","rad","grad","turn"],il="measurement",sl="color",rl={type:"object",props:{background:{optional:!0,type:sl},backgroundColor:{optional:!0,type:sl},backgroundPosition:{optional:!0,type:"string"},backgroundSize:{optional:!0,type:"string"},border:{optional:!0,type:"string"},borderBottom:{optional:!0,type:"string"},borderBottomColor:{optional:!0,type:sl},borderBottomLeftRadius:{optional:!0,type:il,units:er},borderBottomRightRadius:{optional:!0,type:il,units:er},borderBottomWidth:{optional:!0,type:il,units:er},borderColor:{optional:!0,type:sl},borderEndEndRadius:{optional:!0,type:il,units:er},borderEndStartRadius:{optional:!0,type:il,units:er},borderImageOutset:{optional:!0,type:il,units:er,min:0},borderImageSlice:{optional:!0,type:il,units:er,min:0},borderImageWidth:{optional:!0,type:il,units:er,min:0},borderLeft:{optional:!0,type:"string"},borderLeftColor:{optional:!0,type:sl},borderLeftWidth:{optional:!0,type:il,units:er},borderRadius:{optional:!0,type:il,units:er},borderRight:{optional:!0,type:"string"},borderRightColor:{optional:!0,type:sl},borderRightWidth:{optional:!0,type:il,units:er},borderStartEndRadius:{optional:!0,type:il,units:er},borderStartStartRadius:{optional:!0,type:il,units:er},borderTop:{optional:!0,type:"string"},borderTopColor:{optional:!0,type:sl},borderTopLeftRadius:{optional:!0,type:il,units:er},borderTopRightRadius:{optional:!0,type:il,units:er},borderTopWidth:{optional:!0,type:il,units:er},borderWidth:{optional:!0,type:il,units:er},bottom:{optional:!0,type:il,units:er},boxShadow:{optional:!0,type:"string"},caretColor:{optional:!0,type:sl},color:{optional:!0,type:sl},columnCount:{optional:!0,type:"number",min:0,integer:!0},columnGap:{optional:!0,type:il,units:er},columnRule:{optional:!0,type:"string"},columnRuleColor:{optional:!0,type:sl},columnRuleWidth:{optional:!0,type:il,units:er},columns:{optional:!0,type:"number",min:0,integer:!0},columnWidth:{optional:!0,type:il,units:er},flex:{optional:!0,type:"number",min:0,integer:!0},flexBasis:{optional:!0,type:il,units:er},flexGrow:{optional:!0,type:"number",min:0,integer:!0},flexShrink:{optional:!0,type:"number",min:0,integer:!0},font:{optional:!0,type:"string"},fontSize:{optional:!0,type:il,units:er},fontSizeAdjust:{optional:!0,type:il,units:er,min:0},fontStretch:{optional:!0,type:il,units:["%"]},fontWeight:{optional:!0,type:"string"},gap:{optional:!0,type:il,units:er},gridColumnGap:{optional:!0,type:il,units:er},gridGap:{optional:!0,type:il,units:er},gridRowGap:{optional:!0,type:il,units:er},gridTemplateColumns:{optional:!0,type:il,units:er},gridTemplateRows:{optional:!0,type:il,units:er},height:{optional:!0,type:il,units:er,min:0},inset:{optional:!0,type:il,units:er,min:0},insetBlock:{optional:!0,type:il,units:er},insetBlockEnd:{optional:!0,type:il,units:er},insetBlockStart:{optional:!0,type:il,units:er},insetInline:{optional:!0,type:il,units:er},insetInlineEnd:{optional:!0,type:il,units:er},insetInlineStart:{optional:!0,type:il,units:er},left:{optional:!0,type:il,units:er},letterSpacing:{optional:!0,type:il,units:er},lineClamp:{optional:!0,type:"number",min:0,integer:!0},lineHeight:{optional:!0,type:il,units:er,min:0},margin:{optional:!0,type:"string"},marginBottom:{optional:!0,type:il,units:er},marginLeft:{optional:!0,type:il,units:er},marginRight:{optional:!0,type:il,units:er},marginTop:{optional:!0,type:il,units:er},maskBorder:{optional:!0,type:il,units:er,min:0},maskPosition:{optional:!0,type:"string"},maskSize:{optional:!0,type:"string"},maxHeight:{optional:!0,type:il,units:er,min:0},maxWidth:{optional:!0,type:il,units:er,min:0},objectPosition:{optional:!0,type:"string"},cssOffset:{optional:!0,type:"any"},offsetAnchor:{optional:!0,type:"string"},offsetDistance:{optional:!0,type:il,units:er},offsetPath:{optional:!0,type:"string"},offsetPosition:{optional:!0,type:"string"},offsetRotate:{optional:!0,type:il,units:nl},opacity:{optional:!0,type:"number",min:0,max:1},order:{optional:!0,type:"number",integer:!0},outline:{optional:!0,type:"string"},outlineColor:{optional:!0,type:sl},outlineOffset:{optional:!0,type:il,units:er},outlineRadius:{optional:!0,type:il,units:er},outlineRadiusBottomleft:{optional:!0,type:il,units:er},outlineRadiusBottomright:{optional:!0,type:il,units:er},outlineRadiusTopleft:{optional:!0,type:il,units:er},outlineRadiusTopright:{optional:!0,type:il,units:er},outlineWidth:{optional:!0,type:il,units:er},padding:{optional:!0,type:il,units:er},paddingBottom:{optional:!0,type:il,units:er},paddingLeft:{optional:!0,type:il,units:er},paddingRight:{optional:!0,type:il,units:er},paddingTop:{optional:!0,type:il,units:er},perspective:{optional:!0,type:il,units:er},perspectiveOrigin:{optional:!0,type:"string"},r:{optional:!0,type:"string"},right:{optional:!0,type:il,units:er},rotate:{optional:!0,type:il,units:nl},rowGap:{optional:!0,type:il,units:er},scale:{optional:!0,type:"number",min:0},scrollbarColor:{optional:!0,type:sl},scrollMargin:{optional:!0,type:il,units:er},scrollMarginBlock:{optional:!0,type:il,units:er},scrollMarginBlockEnd:{optional:!0,type:il,units:er},scrollMarginBlockStart:{optional:!0,type:il,units:er},scrollMarginBottom:{optional:!0,type:il,units:er},scrollMarginInline:{optional:!0,type:il,units:er},scrollMarginInlineEnd:{optional:!0,type:il,units:er},scrollMarginInlineStart:{optional:!0,type:il,units:er},scrollMarginLeft:{optional:!0,type:il,units:er},scrollMarginRight:{optional:!0,type:il,units:er},scrollMarginTop:{optional:!0,type:il,units:er},scrollPadding:{optional:!0,type:il,units:er},scrollPaddingBlock:{optional:!0,type:il,units:er},scrollPaddingBlockEnd:{optional:!0,type:il,units:er},scrollPaddingBlockStart:{optional:!0,type:il,units:er},scrollPaddingBottom:{optional:!0,type:il,units:er},scrollPaddingInline:{optional:!0,type:il,units:er},scrollPaddingInlineEnd:{optional:!0,type:il,units:er},scrollPaddingInlineStart:{optional:!0,type:il,units:er},scrollPaddingLeft:{optional:!0,type:il,units:er},scrollPaddingRight:{optional:!0,type:il,units:er},scrollPaddingTop:{optional:!0,type:il,units:er},scrollSnapCoordinate:{optional:!0,type:"string"},scrollSnapDestination:{optional:!0,type:il,units:er},shapeImageThreshold:{optional:!0,type:"string"},shapeMargin:{optional:!0,type:il,units:er},shapeOutside:{optional:!0,type:"string"},tabSize:{optional:!0,type:"string"},textDecoration:{optional:!0,type:"string"},textDecorationColor:{optional:!0,type:sl},textDecorationThickness:{optional:!0,type:il,units:er},textEmphasis:{optional:!0,type:"string"},textEmphasisColor:{optional:!0,type:sl},textFillColor:{optional:!0,type:sl},textIndent:{optional:!0,type:il,units:er},textShadow:{optional:!0,type:"string"},textStroke:{optional:!0,type:"string"},textStrokeColor:{optional:!0,type:sl},textUnderlineOffset:{optional:!0,type:il,units:er},top:{optional:!0,type:il,units:er},transform:{optional:!0,type:"object",props:{translateX:{type:il,units:er,optional:!0},translateY:{type:il,units:er,optional:!0},translateZ:{type:il,units:er,optional:!0},rotate:{type:il,units:nl,optional:!0},rotateX:{type:il,units:nl,optional:!0},rotateY:{type:il,units:nl,optional:!0},rotateZ:{type:il,units:nl,optional:!0},scale:{type:"number",min:0,optional:!0},scaleX:{type:"number",min:0,optional:!0},scaleY:{type:"number",min:0,optional:!0},scaleZ:{type:"number",min:0,optional:!0},skewX:{type:il,units:nl,optional:!0},skewY:{type:il,units:nl,optional:!0},perspective:{type:il,units:er,optional:!0}}},transformOrigin:{optional:!0,type:"string"},verticalAlign:{optional:!0,type:"string"},visibility:{optional:!0,type:"string"},width:{optional:!0,type:il,units:er},wordSpacing:{optional:!0,type:il,units:er},zIndex:{optional:!0,type:"number",integer:!0},zoom:{optional:!0,type:il,units:["%"],min:0}},transformOrigin:{type:"string"},verticalAlign:{type:"string"},visibility:{type:"string"},width:{type:il,units:er},wordSpacing:{type:il,units:er},zIndex:{type:"number",integer:!0},zoom:{type:il,units:["%"],min:0}},ol={npm_name:"@donkeyclip/css-layer",incidents:[{exportable:class extends Qa{constructor(){super(...arguments),el(this,"CSSAnimationLayerElement"),el(this,"options"),el(this,"animation")}onGetContext(){var t,e,n,i,s;if(null!=(t=this.context).CSSAnimationLayer||(t.CSSAnimationLayer={}),null!=(e=this.context.CSSAnimationLayer)[n=this.element.dataset.motorcortex2Id]||(e[n]={}),null!=(i=this.context.CSSAnimationLayer[this.element.dataset.motorcortex2Id])[s=this.attributeKey]||(i[s]={id:null,animation:{cancel:L}}),this.CSSAnimationLayerElement=this.context.CSSAnimationLayer[this.element.dataset.motorcortex2Id][this.attributeKey],x(this.compoAttributes,this.attributeKey)){this.options={transform:["",""]};for(const t of this.compoAttributes[this.attributeKey])x(this.targetValue,t)&&(this.options.transform[0]+=`${[t]}(${this.initialValue[t]||0})`,this.options.transform[1]+=`${[t]}(${this.targetValue[t]})`)}else this.options={[this.attributeKey]:[this.initialValue,this.targetValue]}}createAnimation(){this.animation=new Animation(new KeyframeEffect(this.element,[{[this.attributeKey]:this.options[this.attributeKey][0]},{[this.attributeKey]:this.options[this.attributeKey][1]}],{duration:this.props.duration,fill:"forwards",easing:"linear"})),this.CSSAnimationLayerElement.id=this.id,this.CSSAnimationLayerElement.animation=this.animation}onProgress(t){this.CSSAnimationLayerElement.id!==this.id&&this.createAnimation(),this.animation.currentTime=t}},name:"CSSEffect",attributesValidationRules:{animatedAttrs:rl}}],compositeAttributes:{transform:Ja}};var al=Object.defineProperty;const ll=Ka(ol);if(!ll)throw new Error("failed to create css layer");const cl=ll;let ul=null;function pl(t){ul=t}class hl{constructor(t,e){const n=new cl.CSSEffect(t,e);return!1===n.result||null!=ul&&(n.constructor.Incident=ul),n}}((t,e,n)=>{e in t?al(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(hl,"targetClass",cl.CSSEffect.targetClass);var dl=Object.defineProperty,ml=Object.defineProperties,gl=Object.getOwnPropertyDescriptors,fl=Object.getOwnPropertySymbols,yl=Object.prototype.hasOwnProperty,vl=Object.prototype.propertyIsEnumerable,bl=(t,e,n)=>e in t?dl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xl=(t,e)=>{for(var n in e||(e={}))yl.call(e,n)&&bl(t,n,e[n]);if(fl)for(var n of fl(e))vl.call(e,n)&&bl(t,n,e[n]);return t},wl=(t,e)=>ml(t,gl(e)),Cl=(t,e,n)=>(bl(t,"symbol"!=typeof e?e+"":e,n),n);const Il=Us({incidents:{type:"array",items:{type:"object",props:{position:{type:"amount",integer:!0,min:0,optional:!1},attrs:{type:"object",optional:!1},props:{type:"object",optional:!1},incidentClass:{type:"any",optional:!1}}}}}),Pl="Combos don't allow external addition or manipulation to their Incidents";function El(){return j.error(Pl),{result:!1,errors:[Pl]}}class Sl extends Pr{constructor(t,e){super(t,e),Cl(this,"addIncident",El),Cl(this,"moveIncident",El),Cl(this,"removeIncident",El),Cl(this,"handleCheckAddition",D),Cl(this,"handleCheckMove",D),Cl(this,"handleCheckDeletion",D),Cl(this,"handleCheckResize",D),null!==this.incidents&&(this.attrs.incidents=this.incidents,this.attributesStaggers=[],this.propsStaggers=[],this.setupDynamicValues());const n=V(this.props,br,this.constructor);if(!n.result)return n;const i=Il(this.attrs);if(i.length>0)return j.error("The provided attributes for Combo Incident are invalid"),{result:!1,errors:i};let s=[];for(let t=0;t0&&(s=s.concat(t.errors))}const n=V(e.props,e.incidentClass.propsValidationRules,e.incidentClass);n.result||(s=s.concat(n.errors))}if(s.length>0)return{result:!1,errors:s};this.dynamicDurationValue=null}get incidents(){return null}get duration(){return null!==this.dynamicDurationValue?this.dynamicDurationValue:"dynamic"}set duration(t){super.duration=t}exportDefinition(){const t=wl(xl({},this.attrs),{incidents:function t(e){const n=[];for(let i=0;i{((t,e,n)=>{e in t?kl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(this,e+"",void 0)})(0,"memory"),this.memory=[]}startJourney(t){return t?function(t,e){const n=[],i=1*t.runTimeInfo.currentMillisecond,s=t.runTimeInfo.state;return t.stop(),{station(e){n.push(e),t.playableProgress(e/t.duration,e)},exportLog:()=>({startMillisecond:i,startState:s,stations:n}),destination(i){null!=i?this.station(i):i=n[n.length-1],t.playableProgress(i/t.duration,i),"playing"===s||"blocked"===s&&"playing"===t.statusBeforeBlock?t.play():i>=t.duration?t.complete():t.arm(),e.push(this.exportLog)}}}(t,this.memory):(j.error("startJourney expects an Incident as an argument"),!1)}}const Ol={easings:Zn,clipFromDefinition:X},Al=Ka(ga);if(!Al)throw new Error("failed to create audio plugin");const{AudioEffect:Tl,AudioPlayback:_l,Clip:Dl}=Al}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t=n(584),e=n(657),i=n.n(e);const s=JSON.parse('{"u2":"@donkeyclip/motorcortex-subtitles","i8":"3.1.3"}');var r=n(359),o=n.n(r);class a extends t.Effect{getScratchValue(){return""}onProgress(t){for(const e in this.targetValue){const{start:n,end:i,text:s}=this.targetValue[e];if(t>=1e3*n&&t<1e3*i){this.element.innerHTML=s;break}this.element.innerHTML=""}}}const l={npm_name:"parse-text-definition",version:"1.0.0",incidents:[{exportable:a,name:"ParseTextIncident"}]},c=(0,t.loadPlugin)(l);class u extends t.HTMLClip{get html(){return'\n
    \n
    \n
    \n '}get css(){let t="flex-end";return"top"==this.attrs.position?t="flex-start":"center"==this.attrs.position&&(t="center"),`\n .container {\n display:flex;\n justify-content:center;\n align-items:${t};\n font-size:${this.attrs.fontSize||12}px;\n color:${this.attrs.textColor||"white"};\n text-shadow:${this.attrs.textShadow||"none"};\n font-family: ${this.attrs.fontFamily||"'Ubuntu'"};\n width: 100%;\n height: 100%;\n }\n\n #subs-container{\n max-width:${this.attrs.maxWidth?this.attrs.maxWidth+"px":"100%"};\n text-align:center;\n padding-top:${this.attrs.paddingTop||0}px;\n padding-bottom:${this.attrs.paddingBottom||0}px;\n }\n `}buildTree(){try{const t=o()(this.attrs.subtitles),e=new c.ParseTextIncident({animatedAttrs:{subsArray:t}},{duration:1e3*t[t.length-1].end,selector:"#subs-container"});this.addIncident(e,0)}catch(t){console.error("Error while loading subtitles",t)}}}const p={npm_name:s.u2,version:s.i8,incidents:[{exportable:u,name:"ParseText",attributesValidationRules:{fontSize:{type:"number",optional:!0},textColor:{type:"color",optional:!0},fontFamily:{type:"string",optional:!0},position:{type:"enum",optional:!0,values:["top","center","bottom"]},maxWidth:{type:"number",optional:!0},paddingTop:{type:"number",optional:!0},paddingBottom:{type:"number",optional:!0},subtitles:"string"}}]},h=(0,t.loadPlugin)(p),d=new t.HTMLClip({html:'\n
    \n
    \n
    ',css:"\n .container{\n width:100%;\n height:100%;\n position:relative;\n background:#151515;\n }\n",host:document.getElementById("clip"),containerParams:{width:"720px",height:"640px"}}),m=new h.ParseText({fontSize:14,textColor:"white",fontFamily:"Ubuntu",subtitles:"\n1\n00:00:00,001 --\x3e 00:00:05,000\nThese are some captions\n\n2\n00:00:05,000 --\x3e 00:00:10,000\nThese are some other captions\n\n3\n00:00:12,000 --\x3e 00:00:15,000\nThese are some other captions that are here. A Long\nlong long long long long long long long long long\nlong long long long long long long long long long\nlong long long long long long long long long long\nlong long long long long long long long long text.\n\n4\n00:00:20,000 --\x3e 00:00:23,000\nThis is the end of subtitles.. That was fun!? Right?\n",position:"bottom",maxWidth:400,paddingBottom:50},{selector:"#subs-container",containerParams:{width:"720px",height:"640px"}});d.addIncident(m,0),new(i())({clip:d})})()})(); \ No newline at end of file +(()=>{var t={657:function(t,e,n){t.exports=function(t){"use strict";const e="--mc-player";var n={play:'\x3c!-- Generated by IcoMoon.io --\x3e\n\nplay\n\n',pause:'\x3c!-- Generated by IcoMoon.io --\x3e\n\npause\n\n',"expand-full":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nexpand-full\n\n\n',"angle-left":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nangle-left\n\n',"angle-right":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nangle-right\n\n',settings:'\x3c!-- Generated by IcoMoon.io --\x3e\n\nsettings\n\n',loop:'\x3c!-- Generated by IcoMoon.io --\x3e\n\nloop\n\n',"volume-on":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nvolume-on\n\n',"volume-off":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nvolume-off\n\n',"donkeyclip-logo":'\x3c!-- Generated by IcoMoon.io --\x3e\n\nDonkeyClip\n\n',spinner:'
    ',"check-solid":'\x3c!-- Generated by IcoMoon.io --\x3e\n\ncheck-solid\n\n'};const i="volume-change",s="mute-change",r="speed-change",o="loop-change",a="scale-change",l="show-volume-change",c="state-change",u="duration-change",p="mouseup",h="mousemove",d="touchend",m="touchmove";function g(){try{document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}catch(t){console.error(t)}}function f(t){try{t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()}catch(t){console.error(t)}}function y(t){const e=t.clip.props.host.className.includes("full-screen");t.clip.props.host!==t.options.host&&(e?t.options.host.appendChild(t.elements.mcPlayer):t.clip.props.host.appendChild(t.elements.mcPlayer)),e?g():f(t.clip.props.host)}function v(t){T(t,null,"play")}const b=new t.TimeCapsule;let x=setTimeout((()=>{}),0);function C(t,e){return t.getElementsByClassName(e)[0]}function w(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i{clearTimeout(x),t.elements.playPausePanel.classList.remove("hide"),t.elements.playPausePanel.classList.remove("run-animation-play"),t.elements.playPausePanel.classList.remove("run-animation-pause"),t.elements.playPausePanel.classList.remove("run-animation-idle"),"idle"===t.clip.runTimeInfo.state?(t.play(),v(t.elements.playPausePanelContainer),t.elements.playPausePanel.classList.add("run-animation-idle")):"playing"!==t.clip.runTimeInfo.state?(t.play(),v(t.elements.playPausePanelContainer),t.elements.playPausePanel.classList.add("run-animation-play")):(t.pause(),T(t.elements.playPausePanelContainer,null,"pause"),t.elements.playPausePanel.classList.add("run-animation-pause")),x=setTimeout((()=>{t.elements.playPausePanel.classList.add("hide")}),800)},E=/^[+-]?(\d+([.]\d*)?|[.]\d+)/gi;function k(t){const e=t.match(E)[0],n=t.substring(e.length);if("number"==typeof(i=Number(e))&&isFinite(i)&&("%"!==n||"px"!==n))return{number:Number(e),unit:n};var i}function P(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function S(t,e,n){t.document.addEventListener(p,e,!1),t.document.addEventListener(d,e,!1),t.document.addEventListener(h,n,{passive:!1}),t.document.addEventListener(m,n,{passive:!1})}function M(t,e,n){t.document.removeEventListener(p,e,!1),t.document.removeEventListener(d,e,!1),t.document.removeEventListener(h,n,{passive:!1}),t.document.removeEventListener(m,n,{passive:!1})}function A(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];w(e,"mousedown",t,{passive:n}),w(e,"touchstart",t,{passive:n})}function T(t,e,i){e&&(t.classList.remove(`icon-${e}`),t.innerHTML=""),i&&(t.classList.add(`icon-${i}`),t.innerHTML=n[i])}function _(t,e){return t-e}function O(t,e){if(t.id??=Date.now(),t.showVolume??=!!Object.keys(t.clip?.audioClip?.children||[]).length,t.showIndicator??=!1,t.theme??="default",t.host??=t.clip.props.host,t.buttons??={},t.buttons.donkeyclip=!("undefined"==typeof window||!window.Donkeyclip?.clipId)&&t.buttons.donkeyclip,t.timeFormat??="ss",t.backgroundColor??="black",t.fullscreen??=!1,t.scaleToFit??=!0,t.sectionsEasing??="easeOutQuart",t.pointerEvents??=!1,t.scrollAnimation??=!1,t.onMillisecondChange??=null,t.speedValues??=[-1,0,.5,1,2],t.speed??=1,t.muted??=!1,t.maxScrollStorage??=50,t.controls??=!0,t.loop??=!1,t.volume??=1,t.currentScript??=null,t.millisecond){const n=e.clip;t.millisecond>n.duration&&(t.millisecond=n.duration),(t.millisecond<0||!isFinite(t.millisecond))&&(t.millisecond=0),e.goToMillisecond(t.millisecond)}for(const e in t.speedValues)isFinite(t.speedValues[e])||t.speedValues.splice(e,1);return t.speedValues.sort(_),t}var D=t=>{B(t);const{mcPlayer:e}=t.elements;var i;t.elements.pointerEventPanel=C(e,"--mcp-pointer-events-panel"),t.elements.playPausePanel=C(e,"--mcp-play-pause-panel"),t.elements.playPausePanelContainer=C(e,"--mcp-play-pause-panel-container"),t.elements.listenerHelper=C(e,"--mcp-listener-helper"),t.elements.loopBar=C(e,"--mcp-loopbar"),t.elements.totalBar=C(e,"--mcp-totalbar"),t.elements.indicator=C(e,"--mcp-indicator"),t.elements.loopButton=C(e,"--mcp-loop-btn"),t.elements.volumeBar=C(e,"--mcp-volumebar"),t.elements.totalTime=C(e,"--mcp-time-total"),t.elements.volumeControl=C(e,"--mcp-volume"),t.elements.volumeBtn=C(e,"--mcp-volume-btn"),t.elements.runningBar=C(e,"--mcp-runningbar"),t.elements.loopBarEnd=C(e,"--mcp-loopbar-end"),t.elements.statusButton=C(e,"--mcp-status-btn"),t.elements.speedBar=C(e,"--mcp-speed-values"),t.elements.currentTime=C(e,"--mcp-time-current"),t.elements.timeDisplay=C(e,"--mcp-time-display"),t.elements.speedButtonShow=C(e,"--mcp-speed-btn-show"),t.elements.speedButtonHide=C(e,"--mcp-speed-btn-hide"),t.elements.speedCurrent=C(e,"--mcp-speed-current"),t.elements.loopBarStart=C(e,"--mcp-loopbar-start"),t.elements.volumeCursor=C(e,"--mcp-volume-cursor"),t.elements.settingsButton=C(e,"--mcp-settings-btn"),t.elements.donkeyclipButton=C(e,"--mcp-dc-btn"),t.elements.timeSeparator=C(e,"--mcp-time-separator"),t.elements.settingsPanel=C(e,"--mcp-settings-panel"),t.elements.background=C(e,"--mcp-background"),t.elements.settingsMainPanel=C(e,"--mcp-main-settings"),t.elements.fullScreenButton=C(e,"--mcp-full-screen-btn"),t.elements.context=C(e,"--mcp-context"),t.elements.volumeBarHelper=C(e,"--mcp-volumebar"),t.elements.volumeBarActive=C(e,"--mcp-volumebar-color-active"),t.elements.settingsSpeedPanel=C(e,"--mcp-speed-settings"),t.elements.settingsShowVolume=C(e,"--mcp-settings-volume"),t.elements.settingsPointerEvents=C(e,"--mcp-settings-pointer-events"),t.elements.settingsSpeedButtonShow=C(e,"--mcp-settings-speed-show"),t.elements.settingsSpeedButtonHide=C(e,"--mcp-settings-speed-hide"),t.elements.controls=C(e,"--mcp-controls"),t.elements.volumeCheckbox=C(e,"--mcp-show-volume-checkbox"),t.elements.showVolumeCheckbox=C(e,"--mcp-show-volume-checkbox"),t.elements.showPointerEventsCheckbox=C(e,"--mcp-show-pointer-events-checkbox"),t.elements.leftButtons=C(e,"--mcp-left-buttons"),(i=t.elements).loopButton.innerHTML=n.loop,i.volumeBtn.innerHTML=n["volume-on"],i.statusButton.innerHTML=n.play,i.settingsButton.innerHTML=n.settings,i.donkeyclipButton.innerHTML=n["donkeyclip-logo"],i.fullScreenButton.innerHTML=n["expand-full"],i.speedButtonShow.innerHTML=n["angle-right"],i.speedButtonHide.innerHTML=n["angle-left"],L(t),V(t),$(t)};const B=t=>{const e=t.clip.props.host;if(e.offsetWidth||(e.style.width=t.clip.props.containerParams.width),e.offsetHeight||(e.style.height=t.clip.props.containerParams.height),e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.overflow="hidden",t.clip.props.host.style.position="relative",t.clip.props.host.style.zIndex=0,t.elements.mcPlayer=t.document.createElement("div"),t.elements.mcPlayer.id=`${t.name}`,t.elements.mcPlayer.className=`${t.className}`,t.elements.mcPlayer.innerHTML='
    i
    00:00 / 00:00
    • Pointer events

    • Show volume

    • Playback speed

    • Playback speed

      ',"string"==typeof t.options.host){const e=t.document.querySelectorAll(t.options.host);for(const n in e)isNaN(n)||e[n].appendChild(t.elements.mcPlayer)}else t.options.host.appendChild(t.elements.mcPlayer)},L=t=>{t.elements.volumeBarActive.style.width=100*t.settings.volume+"%",t.elements.currentTime.innerHTML=t.timeFormat(0),t.elements.totalTime.innerHTML=t.timeFormat(t.clip.duration),t.elements.timeSeparator.innerHTML="/",t.elements.settingsPanel.classList.add("m-fadeOut",`${t.name}-hide`),t.options.backgroundColor&&(t.elements.background.style.background=t.options.backgroundColor),"scroller"===t.options.type&&(window.document.body.style.overscrollBehaviorY="contain"),t.options.showIndicator?(t.elements.indicator.style.display=void 0,t.elements.statusButton.style.width="35px",t.elements.statusButton.style.height="20px",t.elements.statusButton.style.bottom="5px"):t.elements.indicator.style.display="none",t.elements.indicator.innerHTML=t.clip.runTimeInfo.state,t.elements.settingsSpeedPanel.style.display="none",t.elements.loopBarStart.classList.add("m-fadeOut",`${t.name}-hide`),t.elements.loopBarEnd.classList.add("m-fadeOut",`${t.name}-hide`),t.elements.volumeCheckbox.checked=t.options.showVolume,t.elements.showPointerEventsCheckbox.checked=t.options.pointerEvents,t.options.pointerEvents?t.elements.pointerEventPanel.style.pointerEvents="none":t.elements.pointerEventPanel.style.pointerEvents="auto",t.options.showVolume||t.elements.volumeControl.classList.toggle("m-fadeOut")},V=t=>{for(const e in t.options.speedValues){if(0==t.options.speedValues[e])continue;const n="check-solid",i="--mcp-selected",s=t.document.createElement("li");s.className="--mcp-speed-value",s.dataset.speedValue=t.options.speedValues[e];const r=t.document.createElement("span");s.append(r);const o=t.document.createElement("p"),a=1==t.options.speedValues[e];o.innerHTML=a?"Normal":t.options.speedValues[e],o.dataset.zone=e,o.classList.add("--mcp-speed-value-item"),(t.options.speedValues[e]==t.options.speed??t.clip.speed)&&(T(r,null,n),o.classList.add(i)),s.append(o),t.elements.speedBar.append(s),s.onclick=function(){t.options.speed=t.options.speedValues[e],t.clip.speed=t.options.speedValues[e],t.elements.speedCurrent.innerHTML=1==t.clip.speed?"Normal":t.clip.speed,T(C(t.elements.mcPlayer,"icon-check-solid"),n),T(r,null,n),C(t.elements.mcPlayer,i).classList.remove(i),o.classList.add(i)}}},$=t=>{!1===t.options.buttons.fullScreen&&t.elements.fullScreenButton.remove(),!1===t.options.buttons.settings&&t.elements.settingsButton.remove(),t.options.buttons.donkeyclip||t.elements.donkeyclipButton.remove(),!1===t.options.buttons.loop&&t.elements.loopButton.remove()},N="--mcp-force-show-controls",j="playing",F="volume-off",R="volume-on";var z='.--mc-player.theme-default{--activeColor:136,136,136;--defaultColor:255,255,255;--backgroundColor:29,31,37,1;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-yellow{--activeColor:255,235,59;--defaultColor:255,255,255;--backgroundColor:29,31,37,1;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-dark{--activeColor:136,136,136;--defaultColor:136,136,136;--backgroundColor:0,0,0,1;--backgroundSettingsColor:rgba(0,0,0,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-whiteGold{--activeColor:161,127,26;--defaultColor:136,136,136;--backgroundColor:245,245,245,1;--backgroundSettingsColor:hsla(0,0%,96%,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-darkGold{--activeColor:161,127,26;--defaultColor:136,136,136;--backgroundColor:0,0,0,1;--backgroundSettingsColor:rgba(0,0,0,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-transparent{--activeColor:255,0,0;--defaultColor:239,238,236;--backgroundColor:0,0,0,0;--backgroundSettingsColor:rgba(0,0,0,0.9);--loopBarColor:rgba(var(--defaultColor),0.2);--grad-display:block;--grad-color:0,0,0}.--mc-player.theme-green{--activeColor:0,184,139;--defaultColor:255,255,255;--backgroundColor:29,31,37,1;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-blue{--activeColor:0,153,225;--defaultColor:255,255,255;--backgroundColor:29,31,37,1;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:none;--grad-color:0,0,0}.--mc-player.theme-donkeyclip{--activeColor:0,153,225;--defaultColor:255,255,255;--backgroundColor:0,0,0,0;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:block;--grad-color:24,25,29}.--mc-player.theme-donkeyclipDark{--activeColor:0,153,225;--defaultColor:255,255,255;--backgroundColor:0,0,0,0;--backgroundSettingsColor:rgba(29,31,37,0.9);--loopBarColor:rgba(var(--activeColor),0.2);--grad-display:block;--grad-color:22,22,26}.--mc-player,.--mc-player *{user-select:none!important;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.--mc-player *{box-sizing:border-box;color:rgb(var(--defaultColor));cursor:default;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-size:13px}.--mc-player svg{width:22px}.--mcp-settings-panel:focus{outline:none}.--mc-player *{outline:none!important}.--mcp-settings-panel svg{width:10px}.--mc-player svg,.--mc-player svg *{fill:rgb(var(--defaultColor))!important}.--mc-player{left:0;overscroll-behavior:none;top:0}.--mc-player,.--mcp-background,.--mcp-context{height:100%;pointer-events:none;position:absolute;width:100%}.--mcp-background,.--mcp-context{display:flex;flex-direction:column}.--mcp-background{background:#000;z-index:-1000}.--mcp-pointer-events-panel.initial{min-height:100%;width:100%;z-index:100}.--mcp-pointer-events-panel{min-height:calc(100% - 50px);width:100%}.--mcp-pointer-events-panel.loading{align-items:center;background:rgba(0,0,0,.8);display:flex;justify-content:center}.--mcp-grad{background-image:linear-gradient(rgba(var(--grad-color),.001),rgba(var(--grad-color),.004),rgba(var(--grad-color),.007),rgba(var(--grad-color),.01),rgba(var(--grad-color),.04),rgba(var(--grad-color),.07),rgba(var(--grad-color),.1),rgba(var(--grad-color),.15),rgba(var(--grad-color),.2),rgba(var(--grad-color),.25),rgba(var(--grad-color),.3),rgba(var(--grad-color),.35),rgba(var(--grad-color),.4),rgba(var(--grad-color),.45),rgba(var(--grad-color),.5),rgba(var(--grad-color),.55),rgba(var(--grad-color),.6),rgba(var(--grad-color),.65),rgba(var(--grad-color),.7),rgba(var(--grad-color),.75),rgba(var(--grad-color),.8),rgba(var(--grad-color),.88));bottom:0;display:var(--grad-display);height:200px;left:0;pointer-events:none!important;position:absolute;width:100%;z-index:0}.--mc-player:hover .--mcp-controls,.--mcp-controls:active{opacity:1!important}.--mcp-controls{background:rgba(var(--backgroundColor));display:flex;flex-direction:column;height:50px;opacity:0;padding:0 15px;pointer-events:auto;position:relative;transition:all .2s ease;z-index:0}.--mcp-controls *{-webkit-user-select:none!important;-moz-user-select:none!important;user-select:none!important}.--mcp-play-pause-panel #play-svg{margin-left:4px}.--mcp-always-show-controls,.--mcp-force-show-controls{opacity:1!important}.--mcp-progressbar{align-items:center;display:flex;justify-content:center;position:relative}.--mcp-loopbar,.--mcp-runningbar,.--mcp-totalbar{height:5px;position:relative}.--mcp-cursor{background-color:rgb(var(--activeColor));border-radius:100%;height:14px;position:absolute;right:-8px;top:-5px;width:14px;z-index:10}.--mcp-totalbar{background-color:rgba(var(--defaultColor),.3);min-width:100%}.--mcp-loopbar{padding:10px 0;position:relative;top:-10px;width:100%}.--mcp-loopbar-color{background-color:var(--loopBarColor);bottom:5px;height:5px;left:0;position:absolute;width:100%}.--mcp-runningbar{background-color:rgb(var(--activeColor));width:0}.--mcp-buttons,.--mcp-left-buttons,.--mcp-left-buttons>div,.--mcp-right-buttons,.--mcp-right-buttons>div{align-items:center;display:flex;gap:5px;z-index:1}.--mcp-left-buttons{flex:1}.--mcp-buttons,.--mcp-left-buttons,.--mcp-right-buttons{gap:20px;height:100%}.--mcp-left-buttons{justify-content:flex-start}.--mcp-right-buttons{justify-content:flex-end}.--mcp-prevent-point-events{z-index:100}.--mcp-play-pause-panel,.--mcp-prevent-point-events{height:100%;left:0;position:absolute;top:0;width:100%}.--mcp-play-pause-panel{align-items:center;background-position:50%!important;background-repeat:no-repeat!important;background-size:contain!important;display:flex;justify-content:center;pointer-events:none;z-index:2}.--mcp-play-pause-panel.initial{background-color:#000}.--mcp-play-pause-panel.initial svg{height:32px;width:32px}.--mcp-play-pause-panel.initial .--mcp-play-pause-panel-container{height:80px;width:80px}.--mcp-play-pause-panel.hide{opacity:0}.run-animation-play{animation:scale-and-opaque .8s 1}.run-animation-pause{animation:scale-and-opaque1 .8s 1}.run-animation-idle{animation:scale-and-opaque2 .8s 1}.--mcp-play-pause-panel-container{align-items:center;background-color:#000000c7;border-radius:100%;display:flex;height:60px;justify-content:center;width:60px}.--mcp-play-pause-panel .--mcp-play-pause-panel-container{animation-duration:.8s;transform-origin:center center}@keyframes scale-and-opaque{0%{opacity:.5;transform:scale(1)}to{opacity:0;transform:scale(2)}}@keyframes scale-and-opaque1{0%{opacity:.5;transform:scale(1)}to{opacity:0;transform:scale(2)}}@keyframes scale-and-opaque2{0%{opacity:.5;transform:scale(1)}to{opacity:0;transform:scale(2)}}.--mcp-loop-boundaries{display:flex!important;position:relative}.--mcp-loop-boundaries span{background-color:#aeaeae;border-radius:100%;height:13px;left:-6px;position:absolute;top:-4px;width:13px;z-index:100}.--mcp-loopbar-start{left:0}.--mcp-loopbar-end{left:100%}.--mc-player svg,.--mc-player svg *,.--mcp-btn,.--mcp-cursor,.--mcp-loop-boundaries,.--mcp-loopbar,.--mcp-loopbar-color,.--mcp-runningbar,.--mcp-status-btn,.--mcp-volume *{cursor:pointer}.--mcp-btn{font-size:20px}.--mcp-btn,.--mcp-status-btn{align-items:center;display:flex;justify-content:center}.--mcp-status-btn{gap:3px}.--mcp-indicator{font-size:12px}.--mcp-listener-helper{pointer-events:none}.--mcp-volume-btn{font-size:15px}.--mcp-volumebar{align-items:center;display:flex;height:100%;justify-content:center;padding-left:0;padding-right:0;transition:all .2s ease;width:0}.--mcp-volume{height:100%}.--mcp-volume:hover{padding-right:10px}.--mcp-volume:active .--mcp-volumebar,.--mcp-volume:hover .--mcp-volumebar{padding-left:5px;width:52px}.--mcp-volume:active .--mcp-volume-cursor,.--mcp-volume:hover .--mcp-volume-cursor{display:block}.--mcp-btn:before{color:var(--defaultColor)!important}.--mcp-btn:before:hover{filter:brightness(40)}.--mcp-settings-speed-hide{border-bottom:1px solid hsla(0,0%,100%,.2)}ul.--mcp-speed-values{align-items:center;display:flex;justify-content:center;padding:0}ul.--mcp-speed-values li,ul.--mcp-speed-values li p{width:100%}.--mcp-settings-panel ul{display:flex;flex:1;flex-direction:column;list-style-type:none;margin:0;padding:5px 0}.--mcp-settings-panel ul li{align-items:center;cursor:pointer;display:flex;flex:1;min-height:40px;padding:0 21px}.--mcp-settings-panel ul li *{cursor:pointer}.--mcp-settings-panel ul li:not(.--mcp-no-hover):hover{background-color:rgba(var(--activeColor),.2)}.--mcp-settings-panel ul li>div{align-items:center;display:flex;flex:1;gap:10px;justify-content:flex-end;width:48px}.--mcp-settings-panel{background-color:var(--backgroundSettingsColor);bottom:60px;pointer-events:auto;position:absolute;right:15px;transition:all .2s ease;width:251px;z-index:1000}.--mcp-speed-values{padding:0}.--mcp-no-hover{padding:0!important}.--mcp-speed-value-item:not(.--mcp-selected){padding-left:15px}.--mcp-speed-value-item.--mcp-selected{padding-left:10px}.--mcp-speed-value .icon-check-solid{margin-left:-5px}.--mcp-settings-panel ul.--mcp-speed-settings li>div{flex:unset;justify-content:flex-start;width:20px}.--mcp-main-settings ul li>p{align-items:center;display:flex;flex:1;padding-left:10px}.--mc-player .switch{display:inline-block;height:14px;position:relative;width:36px}.--mc-player .switch input{display:none}.--mc-player .settings-switch:after{clear:both}.--mc-player .slider{background-color:#999;bottom:0;cursor:pointer;left:0;position:absolute;right:0;top:0;transition:.4s}.--mc-player .slider:before{background-color:#cfcfcf;bottom:-3px;content:"";height:20px;left:0;position:absolute;transition:.4s;width:20px}.--mc-player input:checked+.slider{background-color:rgb(var(--activeColor))}.--mc-player input:focus+.slider{box-shadow:0 0 1px rgb(var(--activeColor))}.--mc-player input:checked+.slider:before{background-color:#fff;transform:translateX(16px)}.--mc-player .slider.round{border-radius:34px}.--mc-player .slider.round:before{border-radius:50%}.--mc-player .m-fadeOut{display:none!important;opacity:0!important;visibility:hidden!important}.--mc-player .m-fadeIn{display:unset;opacity:1!important;visibility:visible!important}.--mcp-volume-cursor{background-color:rgb(var(--defaultColor));border-radius:100%;display:none;height:14px;position:absolute;right:-8px;width:14px}.--mcp-volumebar-color{background-color:rgba(var(--defaultColor),.3);height:3px;width:100%}.--mcp-volumebar-color-active{align-items:center;background-color:rgb(var(--defaultColor));display:flex;height:100%;justify-content:center;position:relative;width:100%}.lds-ring{aspect-ratio:1/1;display:inline-block;max-width:64px;position:relative;width:18%}.lds-ring div{animation:lds-ring 1.5s cubic-bezier(.5,.5,.5,.8) infinite;aspect-ratio:1/1;border:3px solid transparent;border-radius:50%;border-top-color:#fff;box-sizing:border-box;display:block;margin:3px;position:absolute;width:100%}.lds-ring div:first-child{animation-delay:-.3s}.lds-ring div:nth-child(2){animation-delay:-.2s}.lds-ring div:nth-child(3){animation-delay:-.1s}@keyframes lds-ring{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}';function W(t){t.settings.loopActivated=!t.settings.loopActivated,t.eventBroadcast(o,t.settings.loopActivated),t.elements.loopButton.classList.toggle("svg-selected"),t.elements.loopBarStart.classList.toggle("m-fadeOut"),t.elements.loopBarEnd.classList.toggle("m-fadeOut"),t.elements.loopBarStart.classList.toggle("m-fadeIn"),t.elements.loopBarStart.classList.toggle(`${t.name}-hide`),t.elements.loopBarEnd.classList.toggle("m-fadeIn"),t.elements.loopBarEnd.classList.toggle(`${t.name}-hide`),t.settings.needsUpdate=!0,t.settings.loopActivated||(t.elements.loopBar.style.left="0%",t.elements.loopBar.style.width="100%",t.settings.loopStartMillisecond=0,t.settings.loopEndMillisecond=t.clip.duration,t.settings.loopLastPositionXPxls=0,t.settings.loopLastPositionXPercentage=0,t.elements.runningBar.style.width=t.clip.runTimeInfo.currentMillisecond/t.clip.duration*100+"%")}const H=t=>{t.elements.showPointerEventsCheckbox.checked?(t.elements.showPointerEventsCheckbox.checked=!1,t.elements.mcPlayer.style.pointerEvents="none",t.elements.pointerEventPanel.style.pointerEvents="auto",t.elements.controls.style.pointerEvents="auto",t.elements.settingsPanel.style.pointerEvents="auto"):(t.elements.showPointerEventsCheckbox.checked=!0,t.options.pointerEvents=!1,t.elements.mcPlayer.style.pointerEvents="none",t.elements.pointerEventPanel.style.pointerEvents="none",t.elements.controls.style.pointerEvents="auto",t.elements.settingsPanel.style.pointerEvents="auto"),t.eventBroadcast("show-pointer-events-change",t.elements.showPointerEventsCheckbox.checked)},U=t=>{t.elements.volumeControl.classList.toggle("m-fadeOut"),t.elements.showVolumeCheckbox.checked?t.elements.showVolumeCheckbox.checked=!1:t.elements.showVolumeCheckbox.checked=!0,t.eventBroadcast(l,t.elements.showVolumeCheckbox.checked)};function G(t,e,n){const r=t.elements;void 0!==n&&(!1===n?(r.volumeBarActive.style.width=100*t.settings.volume+"%",t.clip.setVolume(t.settings.previousVolume),t.settings.volumeMute=!1,T(r.volumeBtn,F,R)):!0===n&&(t.settings.volumeMute=!0,r.volumeBarActive.style.width="0%",t.clip.setVolume(0),T(r.volumeBtn,R,F)),t.options.muted=t.settings.volumeMute,t.eventBroadcast(s,t.settings.volumeMute)),void 0!==e&&(t.settings.volume=e,t.settings.volume>0&&(t.settings.previousVolume=e),r.volumeBarActive.style.width=100*t.settings.volume+"%",t.clip.setVolume(t.settings.volume),t.settings.volume>0?(t.settings.volumeMute=!1,T(r.volumeBtn,F,R)):0===t.settings.volume&&(t.settings.volumeMute=!0,T(r.volumeBtn,R,F)),t.options.volume=t.settings.volume,t.eventBroadcast(i,t.settings.volume),t.eventBroadcast(s,t.settings.volumeMute))}const q={passive:!0};var K=t=>{w(window,"wheel",(e=>{t.stepper(e.deltaY)})),w(window,"touchmove",(e=>{const n=e.touches[0].clientY;t.lastY??=n;const i=-(n-t.lastY);t.stepper(i),t.lastY=n}),q),w(window,"touchend",(()=>{t.lastY=null}),q),w(window,"touchstart",(()=>{t.cancelAnimation(),t.lastY=null}),q)};const X={default:"theme-default",transparent:"theme-transparent",whiteGold:"theme-whiteGold",darkGold:"theme-darkGold",green:"theme-green",blue:"theme-blue",dark:"theme-dark",yellow:"theme-yellow",donkeyclip:"theme-donkeyclip",donkeyclipDark:"theme-donkeyclipDark"};function Y(t){T(t,"spinner",null),t.classList.remove("loading")}const J=[];return class{constructor(t){this.elements={},this.clip=t.clip,this.options=O(t,this),this.document=this.options.host.ownerDocument,this.className=e,this.id=this.options.id,this.name=e,this.clipClass=t.clipClass,this.state=this.clip.runTimeInfo.state,this.listeners={},this.settings={volume:1,journey:null,previousVolume:1,volumeMute:!1,needsUpdate:!0,resizeLoop:!1,loopJourney:!1,loopActivated:!1,requestingLoop:!1,playAfterResize:!1,loopStartMillisecond:0,loopLastPositionXPxls:0,loopLastPositionXPercentage:0,loopEndMillisecond:this.clip.duration,controls:!0},D(this),this.setTheme(),this.setSpeed(),this.subscribeToTimer(),this.subscribeToDurationChange(),this.addEventListeners(),this.scaleClipHost(),this.eventBroadcast(c,this.state),"scroller"===this.options.type&&(this.timeBucket=0,this.timeProgress=0,this.options.sections?.sort(_));const n=new ResizeObserver((()=>{window.innerWidth<450?this.elements.timeDisplay.style.display="none":this.elements.timeDisplay.style.display="block",this.options.scaleToFit&&this.scaleClipHost()}));this.changeSettings(t,!0),n.observe(this.options.host),this.options.autoPlay&&this.play(),window.clip=this.clip}play(){this.clip.play()}pause(){this.clip.pause()}enterFullScreen(){f(this.clip.props.host)}exitFullScreen(){g()}changeSettings(t,e){(t=O(Object.assign({},this.options,t),this)).clip!==this.options.clip&&(e=!0,this.clip=t.clip,this.options.clip=t.clip),!1===t.controls?this.elements.mcPlayer.style.display="none":!0===t.controls&&(this.elements.mcPlayer.style.display="block");const n={loop:()=>W(this),fullscreen:()=>y(this),muted:()=>G(this,void 0,t.mute),volume:()=>G(this,t.volume),speed:()=>function(t,e){e=parseFloat(e)||1,t.eventBroadcast(r,e);const n=1==e?"Normal":e;t.clip.executionSpeed=e,t.elements.speedCurrent.innerHTML=n}(this,t.speed),scaleToFit:()=>{this.options.scaleToFit=t.scaleToFit,this.scaleClipHost()},showVolume:()=>(this,void("showPointerEvents"=="showVolume"?H(this):U(this))),type:()=>{"scroller"===t.type&&K(this)},theme:()=>{this.options.theme=t.theme,this.setTheme()},overflow:()=>{this.clip.props.host.shadowRoot.children[0].style.overflow=t.overflow},outline:()=>{this.clip.props.host.shadowRoot.children[0].style.outline=t.outline},visible:()=>{"always"==t.visible?this.elements.controls.classList.add("--mcp-always-show-controls"):"normal"==t.visible&&this.elements.controls.classList.remove("--mcp-always-show-controls")}},i=["fullscreen","muted","volume","speed","scaleToFit","loop","overflow","outline","visible"];for(const s in n)void 0!==t[s]&&(this.options[s]!==t[s]||e&&!1!==this.options[s]&&i.includes(s))&&n[s]();this.options=Object.assign({},this.options,t)}scaleClipHost(){if(this.options.scaleToFit){const t=this.clip.props,e=function(t,e){let n,i,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!t)return{scale:1,position:{}};t.width&&(n=k(t.width)),t.height&&(i=k(t.height));let r=1,o=1;"px"===n?.unit&&n.number!==e.width&&(r=e.width/n.number),"px"===i?.unit&&i.number!==e.height&&(o=e.height/i.number);const a=(s?o>r:o<=r)?o:r,l={};if(null!=n){let t=n.number*a;"px"!==n.unit&&(t*=e.width/100);const i=e.width-t;l.left=i/2}if(null!=i){let t=i.number*a;"px"!==i.unit&&(t*=e.height/100);const n=e.height-t;l.top=n/2}return{scale:a,position:l}}(t.containerParams,{width:t.host.offsetWidth,height:t.host.offsetHeight-("always"==this.options.visible?50:0)},"cover"===this.options.scaleToFit);this.clip.realClip.rootElement.style.transform=`scale(${e.scale}`,this.clip.realClip.rootElement.style.left=`${e.position.left}px`,this.clip.realClip.rootElement.style.top=`${e.position.top}px`}else this.clip.realClip.rootElement.style.transform="scale(1)",this.clip.realClip.rootElement.style.left="0px",this.clip.realClip.rootElement.style.top="0px";this.eventBroadcast(a,this.options.scaleToFit)}goToMillisecond(t){let{before:e,after:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t>this.clip.duration?t=this.clip.duration:t<0&&(t=0),setTimeout((()=>{const i=this.clip;i.id&&(e&&i[e](),this.settings.journey=b.startJourney(i),this.settings.journey.station(t),this.settings.journey.destination(),n&&i[n]())}),0)}createLoop(t,e){this.settings.loopStartMillisecond=t,this.settings.loopEndMillisecond=e,this.elements.loopBar.style.left=t/this.clip.duration*100+"%",this.elements.loopBar.style.width=(e-t)/this.clip.duration*100+"%",this.goToMillisecond(t),this.elements.runningBar.style.width="0%",!this.settings.loopActivated&&W(this)}calculateMinMaxOfTimeProgress(){this.timeProgress>=this.clip.duration&&(this.timeProgress=this.clip.duration),this.timeProgress<=0&&(this.timeProgress=0)}requestAnimation(){this.requestAnimationID=window.requestAnimationFrame(this.animateTimeBucket.bind(this))}cancelAnimation(){window.cancelAnimationFrame(this.requestAnimationID),this.requestAnimationID=null}removeTimeFromBucket(){const t=Math.log(this.timeBucket),e=Math.pow(t,2);return this.timeBucket-=this.options.scrollAnimation?t:e,e}addTimeToProgress(t){this.timeProgress+=t*this.multiplier*this.clip.speed}checkIfBucketHasTime(){return!(this.timeBucket<=0&&(this.requestAnimationID=null,1))}calculateJourneyPosition(e){const n=t.utils.easings[this.options.sectionsEasing](e);return this.startPosition+n*this.options.speed*this.multiplier*this.endAnimationTime}animateTimeBucket(){if(this.checkIfBucketHasTime){if(this.addTimeToProgress(this.removeTimeFromBucket()),this.calculateMinMaxOfTimeProgress(),this.options.sections){const t=(Date.now()-this.startAnimationTime)/this.endAnimationTime;if(t>=1||0===this.endAnimationTime)return this.cancelAnimation();const e=this.calculateJourneyPosition(t);this.goToMillisecond(Math.ceil(e))}else this.goToMillisecond(this.timeProgress);this.requestAnimation()}}setUpTimeBucket(t){const e=t>0?1:-1;t=Math.ceil(Math.abs(t))*e,this.timeBucket+=Math.abs(t),e!=this.multiplier&&(this.timeBucket=Math.abs(t)),this.timeBucket>this.options.maxScrollStorage&&(this.timeBucket=this.options.maxScrollStorage),this.multiplier=e}getSectionTime(t){let e;const n=this.options.sections;if(t>0){const t=this.startPosition+this.timeBucket;for(let i=0;i=0;i--)if(t>n[i]){e=i;break}e??=0}return e}initializeSections(){this.startAnimationTime=Date.now(),this.startPosition=this.clip.runTimeInfo.currentMillisecond,this.currentSectionIndex=this.getSectionTime(this.multiplier),this.endAnimationTime=Math.abs(this.startPosition-this.options.sections[this.currentSectionIndex])}stepper(t){this.setUpTimeBucket(t),this.options.sections&&this.initializeSections(),this.requestAnimationID||this.animateTimeBucket()}millisecondChange(t,e,n,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const{totalBar:r,loopBar:o}=this.elements;if(this.state!==e&&(this.state=e,this.eventBroadcast(c,e)),!this.settings.needsUpdate)return this.clip.pause(),1;this.settings.loopActivated&&this.clip.speed&&this.calculateJourney(t);const a=this.clip.duration,l=t-a*o.offsetLeft/r.offsetWidth,u=a/r.offsetWidth*o.offsetWidth;i&&this.goToMillisecond(t,{after:this.settings.playAfterResize?"play":null}),this.elements.runningBar.style.width=l/u*100+"%";const p=this.timeFormat(t);this.elements.currentTime.innerHTML!==p&&(this.elements.currentTime.innerHTML=p),this.options.onMillisecondChange&&s&&this.options.onMillisecondChange(t)}calculateJourney(t){const{loopEndMillisecond:e,loopStartMillisecond:n}=this.settings,i=t>e||t===this.clip.duration,s=t0;if(this.clip.runTimeInfo.state===j){if(r)return!!i&&(this.goToMillisecond(n+1,{after:"play"}),!0);if(s)return this.goToMillisecond(e-1,{after:"play"}),!0}return!1}broadcastNotPlaying(t){var e;this.elements.controls.classList.value.includes(N)||this.elements.controls.classList.toggle(N),T(this.elements.statusButton,"pause","play"),this.elements.indicator.innerHTML=`${t.charAt(0).toUpperCase()+t.slice(1)}`,"blocked"==t?(T(e=this.elements.pointerEventPanel,null,"spinner"),e.classList.add("loading")):"idle"!==t&&Y(this.elements.pointerEventPanel)}changeInitParams(e){const n={result:!0};this.clip.pause();const i=this.clip?.exportLiveDefinition();i.props.host=this.clip.props.host;let s=this.clip.runTimeInfo.currentMillisecond;const r=this.clip.runTimeInfo.state===j,o=JSON.parse(JSON.stringify(i.props.initParams||{}));i.props.initParams=e,this.clip.realClip.context.unmount();for(const t in this.clip)delete this.clip[t];let a;try{if(a=t.utils.clipFromDefinition(i),a.nonBlockingErrorClip||a?.errors?.length)throw"Error: Params Error: Clip cannot be created!"}catch(e){n.result=!1,n.clip=a,console.error(e),i.props.initParams=o,a=t.utils.clipFromDefinition(i)}return this.clip=a,this.options.clip=this.clip,this.elements.totalTime.innerHTML=this.timeFormat(this.clip.duration),this.changeSettings(this.options,!0),this.subscribeToTimer(),this.subscribeToDurationChange(),s>this.clip.duration&&(s=this.clip.duration),this.goToMillisecond(s),r&&this.clip.play(),n}broadcastPlaying(t){Y(this.elements.pointerEventPanel),this.elements.controls.classList.value.includes(N)&&this.elements.controls.classList.toggle(N),this.elements.indicator.innerHTML="Playing",T(this.elements.statusButton,"play","pause"),t===j&&(this.clip.runTimeInfo.currentMillisecond===this.clip.duration&&this.clip.speed>=0?this.goToMillisecond(1,{after:"play"}):(this.clip.runTimeInfo.currentMillisecond===this.clip.duration||0===this.clip.runTimeInfo.currentMillisecond)&&this.clip.speed<0&&this.goToMillisecond(this.clip.duration-1,{after:"play"}))}broadcastDurationChange(){this.elements.totalTime.innerHTML=this.timeFormat(this.clip.duration),this.settings.loopEndMillisecond=this.clip.duration,this.elements.pointerEventPanel.innerHTML="",this.millisecondChange(this.clip.runTimeInfo.currentMillisecond)}broadcastVolumeChange(t){this.options.volume=t,this.options.currentScript.dataset.volume=t}broadcastSpeedChange(t){this.options.speed=t,this.options.currentScript.dataset.speed=t}broadcastMuteChange(t){if(t)return this.options.muted=!0,void(this.options.currentScript.dataset.muted="");this.options.muted=!1,delete this.options.currentScript.dataset.muted}broadcastLoopChange(t){if(t)return this.options.loop=!0,void(this.options.currentScript.dataset.loop="");this.options.loop=!1,delete this.options.currentScript.dataset.loop}broadcastScaleChange(t){if(t)return this.options.scaleToFit=t,void(this.options.currentScript.dataset.scaleToFit=t);this.options.scaleToFit=!1,delete this.options.currentScript.dataset.scaleToFit}broadcastShowVolumeChange(t){if(t)return this.options.showVolume=!0,void(this.options.currentScript.dataset.showVolume="");this.options.showVolume=!1,delete this.options.currentScript.dataset.showVolume}broadcastToScript(t,e){t===i?this.broadcastVolumeChange(e):t===r?this.broadcastSpeedChange(e):t===s?this.broadcastMuteChange(e):t===o?this.broadcastLoopChange(e):t===a?this.broadcastScaleChange(e):t===l&&this.broadcastShowVolumeChange(e)}calculateThumbnail(t){const e=this.options.thumbnail||this.options.thumbnailColor,n=0===this.clip.runTimeInfo.currentMillisecond&&this.clip.speed>0,i=this.options.autoPlay;if("idle"===t){if(i)return void this.elements.playPausePanel.classList.add("hide");if(n)return e?(v(this.elements.playPausePanelContainer),this.elements.playPausePanel.style.backgroundColor=this.options.thumbnailColor||"black",this.elements.playPausePanel.style.backgroundImage=this.options.thumbnail&&`url(${this.options.thumbnail})`,this.elements.playPausePanel.classList.add("initial"),void this.elements.pointerEventPanel.classList.add("initial")):void this.elements.playPausePanel.classList.add("hide")}this.elements.playPausePanel.style.backgroundColor="transparent",this.elements.playPausePanel.style.backgroundImage="none",this.elements.pointerEventPanel.classList.remove("initial"),this.elements.playPausePanel.classList.remove("initial")}eventBroadcast(t,e){t===c?(this.options.currentScript&&(this.options.currentScript.dataset.status=e),this.calculateThumbnail(e),["paused","idle","transitional","armed","blocked"].includes(e)?this.broadcastNotPlaying(e):this.broadcastPlaying(e)):t===u?this.broadcastDurationChange():this.options.currentScript&&this.broadcastToScript(t,e)}subscribeToDurationChange(){this.clip.subscribeToDurationChange(this.subscribeToDurationChangeCallback.bind(this))}subscribeToDurationChangeCallback(){this.eventBroadcast(u)}subscribeToTimer(){this.clip.subscribe(this.id,this.millisecondChange.bind(this))}handleDragStart(){this.settings.needsUpdate=!0,this.settings.journey=b.startJourney(this.clip)}timeFormat(t){if("ss"!==this.options.timeFormat)return t;const e=t-J[0];if(01&&void 0!==arguments[1])||arguments[1];isFinite(t)||(t=0);const{loopBar:n,totalBar:i,runningBar:s,currentTime:r}=this.elements,o=t+n.offsetLeft,a=Math.round(this.clip.duration*o/i.offsetWidth);r.innerHTML=this.timeFormat(a),s.style.width=t/n.offsetWidth*100+"%",this.settings.journey.station(a),this.options.onMillisecondChange&&e&&this.options.onMillisecondChange(a)}handleDragEnd(){this.settings.journey.destination()}createProgressDrag(t){this.handleDragStart(),this.handleDrag(t),this.handleDragEnd()}addEventListeners(){var t;(t=this).listeners.onCursorMoveLoopEnd=e=>{e.stopPropagation(),P()&&e.preventDefault();let n=(e.clientX||((e.touches||[])[0]||{}).clientX)-t.elements.totalBar.getBoundingClientRect().left;n<0?n=0:n>t.elements.totalBar.offsetWidth&&(n=t.elements.totalBar.offsetWidth),t.elements.runningBar.offsetWidth>=t.elements.loopBar.offsetWidth&&(t.elements.runningBar.style.width=t.elements.loopBar.offsetWidth+"px"),t.settings.loopLastPositionXPxls-n<0?t.elements.loopBar.style.width=Math.abs(t.settings.loopLastPositionXPxls-n)+"px":(t.elements.loopBar.style.left=n+"px",t.settings.loopLastPositionXPxls=n),t.settings.loopEndMillisecond=Math.round(t.clip.duration*((parseFloat(t.elements.loopBar.style.left)||0)+parseFloat(t.elements.loopBar.style.width))/t.elements.totalBar.offsetWidth),t.settings.loopEndMillisecondt.settings.loopEndMillisecond&&(t.settings.loopStartMillisecond=t.settings.loopEndMillisecond,t.settings.loopJourney=!0)},t.listeners.onMouseUpLoopEnd=()=>{t.elements.listenerHelper.style.pointerEvents="none",t.settings.resizeLoop=!1;const{loopBar:e,totalBar:n,runningBar:i}=t.elements;if(i.style.width=i.offsetWidth/e.offsetWidth*100+"%",e.style.left=e.offsetLeft/n.offsetWidth*100+"%",e.style.width=e.offsetWidth/n.offsetWidth*100+"%",t.settings.loopJourney&&(t.createProgressDrag(i.offsetWidth),t.settings.loopJourney=!1),M(t,t.listeners.onMouseUpLoopEnd,t.listeners.onCursorMoveLoopEnd),A(t.listeners.onMouseDown,e,!0),t.settings.playAfterResize){if("idle"===t.clip.runTimeInfo.state||"completed"===t.clip.runTimeInfo.state){let e;e=t.clip.speed>=0?t.settings.loopStartMillisecond+1:t.settings.loopEndMillisecond-1,t.settings.needsUpdate=!0,t.goToMillisecond(e,{before:"pause",after:"play"})}else t.clip.play();t.settings.playAfterResize=!1}},t.listeners.onMouseDownLoopEnd=e=>{e.stopPropagation(),t.elements.listenerHelper.style.pointerEvents="auto",t.settings.resizeLoop=!0,t.settings.needsUpdate=!0,"playing"===t.clip.runTimeInfo.state&&(t.clip.pause(),t.settings.playAfterResize=!0),t.elements.runningBar.style.width=`${t.elements.runningBar.offsetWidth}px`;const n=t.elements.loopBar;n.style.left=`${n.offsetLeft}px`,n.style.width=`${n.offsetWidth}px`,t.listeners.onCursorMoveLoopEnd(e),S(t,t.listeners.onMouseUpLoopEnd,t.listeners.onCursorMoveLoopEnd)},A(t.listeners.onMouseDownLoopEnd,t.elements.loopBarEnd,!1),(t=>{t.listeners.onCursorMove=e=>{e.stopPropagation(),P()&&e.preventDefault();let n=(e.clientX||((e.touches||[])[0]||{}).clientX)-t.elements.loopBar.getBoundingClientRect().left;n<0?n=0:n>t.elements.loopBar.offsetWidth&&(n=t.elements.loopBar.offsetWidth),t.handleDrag(n)},t.listeners.onMouseUp=()=>{t.elements.listenerHelper.style.pointerEvents="none",M(t,t.listeners.onMouseUp,t.listeners.onCursorMove),t.handleDragEnd(t.settings)},t.listeners.onMouseDown=e=>{t.elements.listenerHelper.style.pointerEvents="auto","playing"===t.clip.runTimeInfo.state&&(t.settings.playAfterResize=!0),t.handleDragStart(t.clip),t.listeners.onCursorMove(e),S(t,t.listeners.onMouseUp,t.listeners.onCursorMove)},A(t.listeners.onMouseDown,t.elements.loopBar)})(this),(t=>{t.listeners.onCursorMoveLoopStart=e=>{e.stopPropagation(),P()&&e.preventDefault();const n=e.clientX||((e.touches||[])[0]||{}).clientX,i=t.elements.totalBar.getBoundingClientRect();let s=Math.round(n-i.left);const r=Math.round(t.settings.loopEndMillisecond/t.clip.duration*t.elements.totalBar.offsetWidth);s<0?s=0:s>t.elements.totalBar.offsetWidth&&(s=t.elements.totalBar.offsetWidth);const o=t.clip.runTimeInfo.currentMillisecond/t.clip.duration*t.elements.totalBar.offsetWidth-s;t.elements.loopBar.style.left=s+"px",t.elements.loopBar.style.width=r-s+"px",t.elements.runningBar.style.width=o+"px",t.settings.loopLastPositionXPxls=s,t.settings.loopStartMillisecond=Math.round(t.clip.duration*t.elements.loopBar.offsetLeft/t.elements.totalBar.offsetWidth),t.settings.loopEndMillisecondt.clip.runTimeInfo.currentMillisecond&&(t.settings.loopJourney=!0)},t.listeners.onMouseUpLoopStart=()=>{if(t.elements.listenerHelper.style.pointerEvents="none",t.settings.resizeLoop=!1,t.settings.loopJourney&&(t.createProgressDrag(t.elements.runningBar.offsetWidth),t.settings.loopJourney=!1),t.elements.loopBar.style.left=t.elements.loopBar.offsetLeft/t.elements.totalBar.offsetWidth*100+"%",t.elements.loopBar.style.width=t.elements.loopBar.offsetWidth/t.elements.totalBar.offsetWidth*100+"%",t.settings.loopStartMillisecond=Math.round(t.clip.duration*t.elements.loopBar.offsetLeft/t.elements.totalBar.offsetWidth),t.elements.runningBar.style.width=t.elements.runningBar.offsetWidth/t.elements.loopBar.offsetWidth*100+"%",M(t,t.listeners.onMouseUpLoopStart,t.listeners.onCursorMoveLoopStart),A(t.listeners.onMouseDown,t.elements.loopBar,!0),t.settings.playAfterResize){if("idle"===t.clip.runTimeInfo.state){let e;e=t.clip.speed>=0?t.settings.loopStartMillisecond+1:t.settings.loopEndMillisecond-1,t.settings.needsUpdate=!0,t.goToMillisecond(e,{before:"pause",after:"play"})}else t.clip.play();t.settings.playAfterResize=!1}},t.listeners.onMouseDownLoopStart=e=>{e.stopPropagation(),t.elements.listenerHelper.style.pointerEvents="auto",t.settings.resizeLoop=!0,t.settings.needsUpdate=!0,"playing"===t.clip.runTimeInfo.state&&(t.clip.pause(),t.settings.playAfterResize=!0),t.listeners.onCursorMoveLoopStart(e),S(t,t.listeners.onMouseUpLoopStart,t.listeners.onCursorMoveLoopStart)},A(t.listeners.onMouseDownLoopStart,t.elements.loopBarStart)})(this),function(t){t.elements.context.onkeydown=e=>{switch(e.code){case"Space":I(t);break;case"ArrowRight":t.goToMillisecond(t.clip.runTimeInfo.currentMillisecond+5e3);break;case"ArrowLeft":t.goToMillisecond(t.clip.runTimeInfo.currentMillisecond-5e3)}}}(this),function(t){const e=t.elements;let n=!1;e.volumeBtn.onclick=()=>{t.settings.volumeMute?(e.volumeBarActive.style.width=100*t.settings.volume+"%",t.clip.setVolume(t.settings.previousVolume),e.volumeBarActive.style.width=100*t.settings.previousVolume+"%",t.settings.volumeMute=!1,T(e.volumeBtn,F,R)):(t.settings.volumeMute=!0,T(e.volumeBtn,R,F),e.volumeBarActive.style.width="0%",t.clip.setVolume(0)),t.eventBroadcast(i,t.settings.previousVolume),t.eventBroadcast(s,t.settings.volumeMute)};let r=!1;e.volumeBtn.onmouseover=()=>{r=!0},t.elements.leftButtons.onmouseout=()=>{if(!r||n)return;const e=event.toElement||event.relatedTarget||event.target;e===t.elements.leftButtons||function(t,e){let n=e.parentNode;for(;null!=n;){if(n==t)return!0;n=n.parentNode}return!1}(t.elements.leftButtons,e)||(r=!1)};const o=t.listeners;o.onCursorMoveVolumeBar=n=>{let r=(n.clientX||((n.touches||[])[0]||{}).clientX)-e.volumeBarHelper.getBoundingClientRect().left;if(r<0?r=0:r>e.volumeBarHelper.offsetWidth&&(r=e.volumeBarHelper.offsetWidth),t.settings.volume=Number((r/e.volumeBarHelper.offsetWidth).toFixed(2)),e.volumeBarActive.style.width=100*t.settings.volume+"%",t.clip.setVolume(t.settings.volume),t.settings.volume>=0){const n=0===t.settings.volume;t.settings.volumeMute=n,n?T(e.volumeBtn,R,F):T(e.volumeBtn,F,R)}t.eventBroadcast(i,t.settings.volume),t.eventBroadcast(s,t.settings.volumeMute)},o.onMouseUpVolumeBar=()=>{n=!1,e.listenerHelper.style.pointerEvents="none",t.settings.volume>0&&(t.settings.previousVolume=t.settings.volume),M(t,o.onMouseUpVolumeBar,o.onCursorMoveVolumeBar)},o.onMouseDownVolumeBar=i=>{n=!0,e.listenerHelper.style.pointerEvents="auto",o.onCursorMoveVolumeBar(i),S(t,o.onMouseUpVolumeBar,o.onCursorMoveVolumeBar)},A(o.onMouseDownVolumeBar,e.volumeBarHelper),A(o.onMouseDownVolumeBar,e.volumeCursor)}(this),(t=>{t.elements.statusButton.onclick=()=>{switch(t.clip.runTimeInfo.state){case"playing":t.clip.pause();break;case"paused":case"idle":case"transitional":case"armed":t.clip.play()}return!1}})(this),function(t){t.elements.settingsPanel.onblur=()=>{t.elements.settingsButton.click()},t.elements.settingsPointerEvents.onclick=()=>H(t),t.elements.settingsShowVolume.onclick=()=>U(t),t.elements.settingsButton.onclick=()=>{const e=n=>{if(t.elements.settingsPanel.contains(n.target))return!0;t.elements.settingsPanel.classList.toggle(`${t.name}-hide`),t.elements.settingsPanel.classList.toggle("m-fadeOut"),t.elements.settingsPanel.classList.toggle("m-fadeIn"),t.elements.settingsPanel.className.includes("m-fadeOut")?(t.document.removeEventListener("click",e,!1),t.eventBroadcast(c,t.state)):t.elements.settingsPanel.focus()};t.elements.settingsPanel.className.includes("m-fadeOut")?(t.elements.controls.classList.value.includes("--mcp-force-show-controls")||t.elements.controls.classList.toggle("--mcp-force-show-controls"),t.document.addEventListener("click",e,!1)):t.document.removeEventListener("click",e,!1)}}(this),function(t){t.elements.settingsSpeedButtonShow.onclick=t.elements.settingsSpeedButtonHide.onclick=()=>{t.elements.settingsPanel.classList.toggle(`${t.name}-settings-speed-panel`),t.elements.settingsPanel.className.includes(`${t.name}-settings-speed-panel`)?(t.elements.settingsMainPanel.style.display="none",t.elements.settingsSpeedPanel.style.display="block"):(t.elements.settingsSpeedPanel.style.display="none",t.elements.settingsMainPanel.style.display="block")}}(this),function(t){t.elements.loopButton.onclick=()=>W(t)}(this),function(t){t.elements.fullScreenButton.onclick=()=>y(t)}(this),function(t){t.elements.pointerEventPanel.onclick=()=>function(t){I(t)}(t),t.elements.pointerEventPanel.ondblclick=()=>y(t)}(this),(t=>{this.elements.donkeyclipButton.addEventListener("click",(()=>{const t=window.DonkeyClip?.clipId,e=window.location.host.includes("staging")?"staging.":"";window.open(`https://${e}donkeyclip.com/${t?`explore/donkeyclips/${t}`:""}`)}))})(),(t=>{function e(){t.elements.mcPlayer.classList.toggle("full-screen"),t.clip.props.host.classList.toggle("full-screen")}t.document.addEventListener("fullscreenchange",e),t.document.addEventListener("webkitfullscreenchange",e),t.document.addEventListener("mozfullscreenchange",e),t.document.addEventListener("MSFullscreenChange",e)})(this),"scroller"===this.options.type&&K(this)}setTheme(){this.options.theme.replace(/\s\s+/g," "),this.options.theme.trim();const t=X[this.options.theme];if(t)this.elements.mcPlayer.classList.add(t);else if(this.options.themeCSS&&!this.document.getElementById("--mc-player-style-custom")){this.options.themeCSS=this.options.themeCSS.replace(/(behaviour|javascript|expression)/gm,"");const t=this.document.createElement("style");t.id="--mc-player-style-custom",t.styleSheet?t.styleSheet.cssText=this.options.themeCSS:t.appendChild(document.createTextNode(this.options.themeCSS)),this.document.querySelector("head").appendChild(t),this.elements.mcPlayer.classList.add(this.options.theme)}if(!this.document.getElementById("--mc-player-style")){const t=this.document.createElement("style");t.id="--mc-player-style",t.styleSheet?t.styleSheet.cssText=z:t.appendChild(document.createTextNode(z)),this.document.querySelector("head").appendChild(t)}this.eventBroadcast("theme-change",this.options.theme)}setSpeed(){const t=1==this.clip.speed?"Normal":this.clip.speed;this.elements.speedCurrent.innerHTML=t}}}(n(584))},359:function(t){t.exports=function(){"use strict";function t(t){var e=t.split(":");try{var n=e[2].split(",");return 1===n.length&&(n=e[2].split(".")),3600*parseFloat(e[0],10)+60*parseFloat(e[1],10)+parseFloat(n[0],10)+parseFloat(n[1],10)/1e3}catch(t){return 0}}function e(t,e){for(var n=e;!t[n];)n++;return n}return function(){for(var n=[],i=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/(?:\r\n|\r|\n)/gm),s=function(t){for(var e=t.length-1;e>=0&&!t[e];)e--;return e}(i)+1,r=0,o=void 0,a=void 0,l=void 0,c=0;c[\t ]*/),l.start=t(o[0]),-1!==(r=o[1].indexOf(" "))&&(o[1]=o[1].substr(0,r)),l.end=t(o[1]);c/g,">"),l.text=l.text.replace(/<(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)(\/?)>/gi,"<$1$3$7>"),l.text=l.text.replace(/\\N/gi,"
      "),n.push(l)}return n}}()},584:(t,e,n)=>{"use strict";n.r(e),n.d(e,{AudioClip:()=>os,AudioEffect:()=>Rs,AudioPlayback:()=>zs,BrowserClip:()=>Ui,CSSEffect:()=>_s,Combo:()=>Ls,CoreAudioClip:()=>Ws,Effect:()=>K,ExtendableCSSEffect:()=>ws,Group:()=>Ai,HTMLClip:()=>rs,JSX:()=>Ns,MediaPlayback:()=>ls,TimeCapsule:()=>Vs,loadPlugin:()=>vs,setCSSCore:()=>Ts,utils:()=>js,version:()=>Si});const i=[{key:"info",style:"color:#666;",level:5,consoleMethod:"log"},{key:"notice",style:"background:rgba(0,0,0,0.8);color:white;padding:8px;",level:4,consoleMethod:"log"},{key:"warning",style:"color:black;background:orange;",level:2,consoleMethod:"warn"},{key:"error",style:"color:black;background:red;",level:1,consoleMethod:"error"}],s="data-motorcortex2-id",r="MotorCortex",o="total",a="index",l="initParams",c=["object","array","any","boolean","class","tuple"],u="motor-cortex-js",p=`${u}-attribute`;window.AudioContext||(window.AudioContext=window.webkitAudioContext);const h=new window.AudioContext;function d(t){return t===parseInt(t,10)}function m(t){return!isNaN(parseFloat(t))&&isFinite(t)}function g(t){return"string"==typeof t||t instanceof String}function f(t){return"object"==typeof t}function y(t){return t&&"[object Function]"==={}.toString.call(t)}function v(t,e){return!(null==e||!f(t))&&Object.prototype.hasOwnProperty.call(t,e)}function b(t){return JSON.parse(JSON.stringify(t))}const x=/^[+-]?(\d+([.]\d*)?|[.]\d+)/gi;function C(t,e){const n=t?.[e];if(!g(n))return null;let i=n.match(x)[0];const s=n.substring(i.length);return i=Number(i),!function(t){return"number"==typeof t&&isFinite(t)}(i)||"%"!==s&&"px"!==s?null:{number:i,unit:s}}const w=['originalDims should be an object containing both the "width" and "height" keys'];function I(t){return null==t?{result:!0,analysis:{width:null,height:null}}:f(t)&&v(t,"width")&&v(t,"height")?null==C(t,"width")?{result:!1,errors:["originalDims.width should be defined either on px or %."]}:null==C(t,"height")?{result:!1,errors:["originalDims.height should be defined either on px or %."]}:{result:!0,analysis:E(t)}:{result:!1,errors:w}}function E(t){return f(t)&&null!=t?{width:C(t,"width"),height:C(t,"height")}:{width:null,height:null}}function k(t){const e=N(t),n=/.*\((.*)\).*/.exec(e)?.[1];return n?.split(",")}function P(t){const e=t.split("___");return{mcid:e[0],attribute:e[1]}}function S(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function M(t=!1){const e=t?"_":"-";return`${S()}${S()}${e}${S()}${e}${S()}`}function A(t,e){return`${t}___${e}`}function T(t,e){return!1}function _(t,e){return{result:!1}}function O(t,e,n){const i=e.split(".");let s=t;for(let t=0;t=n.level?this[n.key]=window.console[n.consoleMethod].bind(window.console,`MotorCortex - ${n.key}: `):this[n.key]=D}this.log=e>=3?window.console.log.bind(window.console,"MotorCortex - "):D}};function L(t,e,n){const i=e(t);if(i.length>0){let t=`Error on plugin's "${n.plugin_npm_name}" "${n.ClassName}" instantiation. Errors (op props):`;for(let e=0;e":">",'"':""","'":"'","/":"/"};return`${t}`.replace(/[&<>"'/]/g,(function(t){return e[t]}))}function $(t,e,n){const i=[];for(let s=0;s0?{result:!1,errors:e}:{result:!0,execute:()=>{this.incidentsById=Object.assign(this.incidentsById,n),this.incidents||(this.incidents=[]),this.incidents.push(...i),this.incidents.sort(((t,e)=>t.millisecond-e.millisecond));for(let e=0;et.millisecond-e.millisecond))}}}checkDelete(t){const e=this,n=[];for(let e=0;e!n.includes(t.id)));e.incidents=t;for(let t=0;tt.millisecond-e.millisecond))}}}moveTo(t,e,n,i=!1){if(i)for(let t=0;ti.millisecond+s.duration?s.onProgress(1,s.duration,n,!0):s.onProgress((e-i.millisecond)/s.duration,e-i.millisecond,n,!0)}else for(let t=0;t=1?1:a;o=a>=1?r.duration:e-o,r.onProgress(l,o,n,!1)}function s(n,i){let s=e,r=t;return e>t&&(s=r,r=e),i+n>=s&&i+n<=r||n+i>=r&&i<=r}}}function W(t){const e=new t.Class(t.attrs,t.props);if(!1===e.result)return e;if(v(t,"incidents"))for(const n in t.incidents){const i=t.incidents[n],s=W(i.leaf);if(!1===s.result)return s;const r=e.addIncident(s,i.position);if(!1===r.result)return r}return e}var H=(t=>(t._UP="up",t._DOWN="down",t))(H||{}),U=(t=>(t._ROOTOFTREE="native.tree.rootoftree",t))(U||{});const G="native.tree.bypass";class q{getIncidentsByChannel(t=0,e=0){return{[this.mc_plugin_npm_name]:[{millisecond:t,parentMillisecond:e,incident:this,id:this.id}]}}setBlock(t,e={}){null!=this.blockID||e.blockId||(this.blockID=M()),this.DescriptiveIncident?this.DescriptiveIncident.putMessageOnPipe("setBlock",{id:this.blockID||e.blockId,description:t,incidentId:this.DescriptiveIncident.id,realIncidentId:this.id,options:e},"rootClip",{selfExecute:!0,direction:H._UP}):B.error("Descriptive incident doesn't exist, failed to block")}unblock(t=null){this.DescriptiveIncident?this.DescriptiveIncident.putMessageOnPipe("unBlock",{id:t??this.blockID},"rootClip",{selfExecute:!0,direction:H._UP}):B.error("Descriptive incident doesn't exist, failed to unblock")}}class K extends q{constructor(t={animatedAttrs:{}},e={},n){super(),this.context={},this.initialValues={},this.attrs=t,this.props=e,this.dna=n,this.context=n?.context||{},this.mcid=n?.mcid,this.id=e.id||M(),this.modelId=e.modelId,this.gotContext=!1,this.plugin_channel_class=R,this.mc_plugin_npm_name=u,v(e,"plugin_channel_class")&&(this.plugin_channel_class=e.plugin_channel_class),v(e,"mc_plugin_npm_name")&&(this.mc_plugin_npm_name=e.mc_plugin_npm_name),this.hasIncidents=!1,this.initialValues={},this.userDefinedInitialValues=t.initialValues||{},this.pureInitialValues=null,this.autoGenerated=!1,v(this.attrs,"animatedAttrs")&&(this.attributeKey=Object.keys(this.attrs.animatedAttrs??{})[0]),this.onInitialise()}get duration(){}set duration(t){}get selector(){return this.props.selector}get animAttributes(){return this.attrs.animatedAttrs}set animAttributes(t){this.attrs.animatedAttrs[this.attributeKey]=t}getScratchValue(){return 0}get element(){return null===this.context?[]:this.context.getElementByMCID?this.context.getElementByMCID(this.mcid):this.context.getElements(this.selector)[0]}get targetValue(){return this.animAttributes[this.attributeKey]}getElementAttribute(t){return this.element.getAttribute(t)}getFraction(t){return t/this.props.duration}hasUserDefinedInitialValue(){return v(this.userDefinedInitialValues,this.attributeKey)}setInitialValue(t,e=!0){if(e&&(this.pureInitialValues=b(t)),this.hasUserDefinedInitialValue())if(f(this.targetValue)){for(const e in this.userDefinedInitialValues[this.attributeKey])t[e]=this.userDefinedInitialValues[this.attributeKey][e];this.initialValues[this.attributeKey]=t}else this.initialValues[this.attributeKey]=this.userDefinedInitialValues[this.attributeKey];else this.initialValues[this.attributeKey]=t}get initialValue(){return this.initialValues[this.attributeKey]}_onGetContextOnce(t){try{if(this.context.fragment)return;this.gotContext||(this.onGetContext(),this.gotContext=!0)}catch(t){B.error(t,this.mcid)}}onGetContext(){B.info('Overwrite the "onGetContext" method with the code you want to get executed',"info")}lastWish(){}onInitialise(){B.info('Overwrite the "onInialise" method with the code you want to get executed',"info")}onProgress(t,e,n,i){}}class X extends K{constructor(t,e,n){super(t,e,n),this.runTimeInfo={currentMillisecond:0}}get duration(){return this.DescriptiveIncident.realClip.duration}lastWish(){this.ownClip&&this.ownClip.context.unmount()}onGetContext(){const t=this.DescriptiveIncident.realClip.exportConstructionArguments(),e=(n=this.context,i=this.mcid,n.rootElement.querySelectorAll(`[${s}="${i}"]`)[0]);var n,i;const r=this.DescriptiveIncident.constructor,o={...t.props,selector:void 0,host:e,containerParams:this.DescriptiveIncident.props.containerParams||{},originalDims:r.originalDims||{}};this.ownClip=new r.Incident(t.attrs,o,this.DescriptiveIncident),this.ownClip.clipCopyId=this.id,this.DescriptiveIncident.realClip.addContext({clipId:this.id,context:this.ownClip.context},!0)}onProgress(t,e=!1){if(!1!==this.ownClip.ownContext.contextLoaded){for(const n in this.DescriptiveIncident.realClip.instantiatedChannels)this.DescriptiveIncident.realClip.instantiatedChannels[n].moveTo(this.runTimeInfo.currentMillisecond,t,this.id,e);this.runTimeInfo.currentMillisecond=t}else this.setBlock("context loading",{blockId:this.id})}}function Y(t,e=!1){const n=e?t.DescriptiveIncident:{context:t.context,mcid:t.mcid},i=new t.Incident(t.attrs,{...t.props,id:t.id||M()},n);return i.mc_plugin_npm_name=t.plugin_npm_name,i.plugin_channel_class=t.Channel,i.DescriptiveIncident=t.DescriptiveIncident,i}const J="Incidents with dynamic duration can't be resized. Once the Incident enters a Clip it'll become resizable",Z={supportedTypes:["amount","color","date","email","measurement","number","string"],preface:"attribute"},Q=new RegExp(`^@${Z.preface}\\([_A-z0-9-]*\\)$`),tt={Handler:class{constructor(t){this.expressionProps={attribute:/\(([^)]+)\)/.exec(t.value)?.[1]}}calculateValues(t){const e=[];for(let n=0;nfunction(){return e||(0,t[nt(t)[0]])((e={exports:{}}).exports,e),e.exports},st="INUMBER",rt="IOP1",ot="IOP2",at="IOP3",lt="IVAR",ct="IVARNAME",ut="IFUNCALL",pt="IFUNDEF",ht="IEXPR",dt="IEXPREVAL",mt="IMEMBER",gt="IENDSTATEMENT",ft="IARRAY";function yt(t,e){this.type=t,this.value=null!=e?e:0}function vt(t){return new yt(rt,t)}function bt(t){return new yt(ot,t)}function xt(t){return new yt(at,t)}function Ct(t,e,n,i,s){for(var r,o,a,l,c=[],u=[],p=0;p1)o=c.pop(),r=c.pop(),l=n[h.value],h=new yt(st,l(r.value,o.value)),c.push(h);else if(d===at&&c.length>2)a=c.pop(),o=c.pop(),r=c.pop(),"?"===h.value?c.push(r.value?o.value:a.value):(l=i[h.value],h=new yt(st,l(r.value,o.value,a.value)),c.push(h));else if(d===rt&&c.length>0)r=c.pop(),l=e[h.value],h=new yt(st,l(r.value)),c.push(h);else if(d===ht){for(;c.length>0;)u.push(c.shift());u.push(new yt(ht,Ct(h.value,e,n,i,s)))}else if(d===mt&&c.length>0)r=c.pop(),c.push(new yt(st,r.value[h.value]));else{for(;c.length>0;)u.push(c.shift());u.push(h)}}for(;c.length>0;)u.push(c.shift());return u}function wt(t,e,n){for(var i=[],s=0;s0;)a.unshift(Pt(c.pop(),n));if(!(o=c.pop()).apply||!o.call)throw new Error(o+" is not a function");c.push(o.apply(void 0,a))}else if(d===pt)c.push(function(){for(var t=c.pop(),i=[],s=h.value;s-- >0;)i.unshift(c.pop());var r=c.pop(),o=function(){for(var s=Object.assign({},n),r=0,o=i.length;r0;)a.unshift(c.pop());c.push(a)}}if(c.length>1)throw new Error("invalid Expression (parity)");return 0===c[0]?0:Pt(c[0],n)}function Et(t,e,n){return kt(t)?t:{type:dt,value:function(n){return It(t.value,e,n)}}}function kt(t){return t&&t.type===dt}function Pt(t,e){return kt(t)?t.value(e):t}function St(t,e){for(var n,i,s,r,o,a,l=[],c=0;c0;)o.unshift(l.pop());r=l.pop(),l.push(r+"("+o.join(", ")+")")}else if(p===pt){for(i=l.pop(),a=u.value,o=[];a-- >0;)o.unshift(l.pop());n=l.pop(),e?l.push("("+n+" = function("+o.join(", ")+") { return "+i+" })"):l.push("("+n+"("+o.join(", ")+") = "+i+")")}else if(p===mt)n=l.pop(),l.push(n+"."+u.value);else if(p===ft){for(a=u.value,o=[];a-- >0;)o.unshift(l.pop());l.push("["+o.join(", ")+"]")}else if(p===ht)l.push("("+St(u.value,e)+")");else if(p!==gt)throw new Error("invalid Expression")}return l.length>1&&(l=e?[l.join(",")]:[l.join(";")]),String(l[0])}function Mt(t){return"string"==typeof t?JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"):t}function At(t,e){for(var n=0;n=this.expression.length?this.newToken(Ot,"EOF"):this.isWhitespace()||this.isComment()?this.next():this.isRadixInteger()||this.isNumber()||this.isOperator()||this.isString()||this.isParen()||this.isBracket()||this.isComma()||this.isSemicolon()||this.isNamedOp()||this.isConst()||this.isName()?this.current:void this.parseError('Unknown character "'+this.expression.charAt(this.pos)+'"')},zt.prototype.isString=function(){var t=!1,e=this.pos,n=this.expression.charAt(e);if("'"===n||'"'===n)for(var i=this.expression.indexOf(n,e+1);i>=0&&this.pos"9")))break}if(e>t){var i=this.expression.substring(t,e);if(i in this.consts)return this.current=this.newToken(Bt,this.consts[i]),this.pos+=i.length,!0}return!1},zt.prototype.isNamedOp=function(){for(var t=this.pos,e=t;e"9")))break}if(e>t){var i=this.expression.substring(t,e);if(this.isOperatorEnabled(i)&&(i in this.binaryOps||i in this.unaryOps||i in this.ternaryOps))return this.current=this.newToken(Dt,i),this.pos+=i.length,!0}return!1},zt.prototype.isName=function(){for(var t=this.pos,e=t,n=!1;e"9"))break}else n=!0}if(n){var s=this.expression.substring(t,e);return this.current=this.newToken(jt,s),this.pos+=s.length,!0}return!1},zt.prototype.isWhitespace=function(){for(var t=!1,e=this.expression.charAt(this.pos);!(" "!==e&&"\t"!==e&&"\n"!==e&&"\r"!==e||(t=!0,this.pos++,this.pos>=this.expression.length));)e=this.expression.charAt(this.pos);return t};var Wt=/^[0-9a-f]{4}$/i;function Ht(t,e,n){this.parser=t,this.tokens=e,this.current=null,this.nextToken=null,this.next(),this.savedCurrent=null,this.savedNextToken=null,this.allowMemberAccess=!1!==n.allowMemberAccess}zt.prototype.unescape=function(t){var e=t.indexOf("\\");if(e<0)return t;for(var n=t.substring(0,e);e>=0;){var i=t.charAt(++e);switch(i){case"'":n+="'";break;case'"':n+='"';break;case"\\":n+="\\";break;case"/":n+="/";break;case"b":n+="\b";break;case"f":n+="\f";break;case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+="\t";break;case"u":var s=t.substring(e+1,e+5);Wt.test(s)||this.parseError("Illegal escape sequence: \\u"+s),n+=String.fromCharCode(parseInt(s,16)),e+=4;break;default:throw this.parseError('Illegal escape sequence: "\\'+i+'"')}++e;var r=t.indexOf("\\",e);n+=t.substring(e,r<0?t.length:r),e=r}return n},zt.prototype.isComment=function(){return"/"===this.expression.charAt(this.pos)&&"*"===this.expression.charAt(this.pos+1)&&(this.pos=this.expression.indexOf("*/",this.pos)+2,1===this.pos&&(this.pos=this.expression.length),!0)},zt.prototype.isRadixInteger=function(){var t,e,n=this.pos;if(n>=this.expression.length-2||"0"!==this.expression.charAt(n))return!1;if(++n,"x"===this.expression.charAt(n))t=16,e=/^[0-9a-f]$/i,++n;else{if("b"!==this.expression.charAt(n))return!1;t=2,e=/^[01]$/i,++n}for(var i=!1,s=n;n="0"&&t<="9"||!r&&"."===t);)"."===t?r=!0:o=!0,n++,e=o;if(e&&(s=n),"e"===t||"E"===t){n++;for(var a=!0,l=!1;n="0"&&t<="9"))break;l=!0,a=!1}else a=!1;n++}l||(n=s)}return e?(this.current=this.newToken(Bt,parseFloat(this.expression.substring(i,n))),this.pos=n):this.pos=s,e},zt.prototype.isOperator=function(){var t=this.pos,e=this.expression.charAt(this.pos);if("+"===e||"-"===e||"*"===e||"/"===e||"%"===e||"^"===e||"?"===e||":"===e||"."===e)this.current=this.newToken(Dt,e);else if("∙"===e||"•"===e)this.current=this.newToken(Dt,"*");else if(">"===e)"="===this.expression.charAt(this.pos+1)?(this.current=this.newToken(Dt,">="),this.pos++):this.current=this.newToken(Dt,">");else if("<"===e)"="===this.expression.charAt(this.pos+1)?(this.current=this.newToken(Dt,"<="),this.pos++):this.current=this.newToken(Dt,"<");else if("|"===e){if("|"!==this.expression.charAt(this.pos+1))return!1;this.current=this.newToken(Dt,"||"),this.pos++}else if("="===e)"="===this.expression.charAt(this.pos+1)?(this.current=this.newToken(Dt,"=="),this.pos++):this.current=this.newToken(Dt,e);else{if("!"!==e)return!1;"="===this.expression.charAt(this.pos+1)?(this.current=this.newToken(Dt,"!="),this.pos++):this.current=this.newToken(Dt,e)}return this.pos++,!!this.isOperatorEnabled(this.current.value)||(this.pos=t,!1)},zt.prototype.isOperatorEnabled=function(t){return this.parser.isOperatorEnabled(t)},zt.prototype.getCoordinates=function(){var t,e=0,n=-1;do{e++,t=this.pos-n,n=this.expression.indexOf("\n",n+1)}while(n>=0&&n=",">","in"];Ht.prototype.parseComparison=function(t){for(this.parseAddSub(t);this.accept(Dt,Ut);){var e=this.current;this.parseAddSub(t),t.push(bt(e.value))}};var Gt=["+","-","||"];Ht.prototype.parseAddSub=function(t){for(this.parseTerm(t);this.accept(Dt,Gt);){var e=this.current;this.parseTerm(t),t.push(bt(e.value))}};var qt=["*","/","%"];function Kt(t,e){return Number(t)+Number(e)}function Xt(t,e){return t-e}function Yt(t,e){return t*e}function Jt(t,e){return t/e}function Zt(t,e){return t%e}function Qt(t,e){return Array.isArray(t)&&Array.isArray(e)?t.concat(e):""+t+e}function te(t,e){return t===e}function ee(t,e){return t!==e}function ne(t,e){return t>e}function ie(t,e){return t=e}function re(t,e){return t<=e}function oe(t,e){return Boolean(t&&e)}function ae(t,e){return Boolean(t||e)}function le(t,e){return At(e,t)}function ce(t){return(Math.exp(t)-Math.exp(-t))/2}function ue(t){return(Math.exp(t)+Math.exp(-t))/2}function pe(t){return t===1/0?1:t===-1/0?-1:(Math.exp(t)-Math.exp(-t))/(Math.exp(t)+Math.exp(-t))}function he(t){return t===-1/0?t:Math.log(t+Math.sqrt(t*t+1))}function de(t){return Math.log(t+Math.sqrt(t*t-1))}function me(t){return Math.log((1+t)/(1-t))/2}function ge(t){return Math.log(t)*Math.LOG10E}function fe(t){return-t}function ye(t){return!t}function ve(t){return t<0?Math.ceil(t):Math.floor(t)}function be(t){return Math.random()*(t||1)}function xe(t){return Ie(t+1)}Ht.prototype.parseTerm=function(t){for(this.parseFactor(t);this.accept(Dt,qt);){var e=this.current;this.parseFactor(t),t.push(bt(e.value))}},Ht.prototype.parseFactor=function(t){var e=this.tokens.unaryOps;if(this.save(),this.accept(Dt,(function(t){return t.value in e}))){if("-"!==this.current.value&&"+"!==this.current.value){if(this.nextToken.type===Vt&&"("===this.nextToken.value)return this.restore(),void this.parseExponential(t);if(this.nextToken.type===Ft||this.nextToken.type===Nt||this.nextToken.type===Ot||this.nextToken.type===Vt&&")"===this.nextToken.value)return this.restore(),void this.parseAtom(t)}var n=this.current;this.parseFactor(t),t.push(vt(n.value))}else this.parseExponential(t)},Ht.prototype.parseExponential=function(t){for(this.parsePostfixExpression(t);this.accept(Dt,"^");)this.parseFactor(t),t.push(bt("^"))},Ht.prototype.parsePostfixExpression=function(t){for(this.parseFunctionCall(t);this.accept(Dt,"!");)t.push(vt("!"))},Ht.prototype.parseFunctionCall=function(t){var e=this.tokens.unaryOps;if(this.accept(Dt,(function(t){return t.value in e}))){var n=this.current;this.parseAtom(t),t.push(vt(n.value))}else for(this.parseMemberExpression(t);this.accept(Vt,"(");)if(this.accept(Vt,")"))t.push(new yt(ut,0));else{var i=this.parseArgumentList(t);t.push(new yt(ut,i))}},Ht.prototype.parseArgumentList=function(t){for(var e=0;!this.accept(Vt,")");)for(this.parseExpression(t),++e;this.accept(Nt);)this.parseExpression(t),++e;return e},Ht.prototype.parseMemberExpression=function(t){for(this.parseAtom(t);this.accept(Dt,".")||this.accept($t,"[");){var e=this.current;if("."===e.value){if(!this.allowMemberAccess)throw new Error('unexpected ".", member access is not permitted');this.expect(jt),t.push(new yt(mt,this.current.value))}else{if("["!==e.value)throw new Error("unexpected symbol: "+e.value);if(!this.tokens.isOperatorEnabled("["))throw new Error('unexpected "[]", arrays are disabled');this.parseExpression(t),this.expect($t,"]"),t.push(bt("["))}}};var Ce=4.7421875,we=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function Ie(t){var e,n;if(function(t){return isFinite(t)&&t===Math.round(t)}(t)){if(t<=0)return isFinite(t)?1/0:NaN;if(t>171)return 1/0;for(var i=t-2,s=t-1;i>1;)s*=i,i--;return 0===s&&(s=1),s}if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*Ie(1-t));if(t>=171.35)return 1/0;if(t>85){var r=t*t,o=r*t,a=o*t,l=a*t;return Math.sqrt(2*Math.PI/t)*Math.pow(t/Math.E,t)*(1+1/(12*t)+1/(288*r)-139/(51840*o)-571/(2488320*a)+163879/(209018880*l)+5246819/(75246796800*l*t))}--t,n=we[0];for(var c=1;c0?(i=s/e)*i:s}return e===1/0?1/0:e*Math.sqrt(t)}function Pe(t,e,n){return t?e:n}function Se(t,e){return void 0===e||0==+e?Math.round(t):(t=+t,e=-+e,isNaN(t)||"number"!=typeof e||e%1!=0?NaN:(t=t.toString().split("e"),+((t=(t=Math.round(+(t[0]+"e"+(t[1]?+t[1]-e:-e)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+e:e))))}function Me(t,e,n){return n&&(n[t]=e),e}function Ae(t,e){return t[0|e]}function Te(t){return 1===arguments.length&&Array.isArray(t)?Math.max.apply(Math,t):Math.max.apply(Math,arguments)}function _e(t){return 1===arguments.length&&Array.isArray(t)?Math.min.apply(Math,t):Math.min.apply(Math,arguments)}function Oe(t,e){if("function"!=typeof t)throw new Error("First argument to map is not a function");if(!Array.isArray(e))throw new Error("Second argument to map is not an array");return e.map((function(e,n){return t(e,n)}))}function De(t,e,n){if("function"!=typeof t)throw new Error("First argument to fold is not a function");if(!Array.isArray(n))throw new Error("Second argument to fold is not an array");return n.reduce((function(e,n,i){return t(e,n,i)}),e)}function Be(t,e){if("function"!=typeof t)throw new Error("First argument to filter is not a function");if(!Array.isArray(e))throw new Error("Second argument to filter is not an array");return e.filter((function(e,n){return t(e,n)}))}function Le(t,e){if(!Array.isArray(e)&&"string"!=typeof e)throw new Error("Second argument to indexOf is not a string or array");return e.indexOf(t)}function Ve(t,e){if(!Array.isArray(e))throw new Error("Second argument to join is not an array");return e.join(t)}function $e(t){return(t>0)-(t<0)||+t}var Ne=1/3;function je(t){return t<0?-Math.pow(-t,Ne):Math.pow(t,Ne)}function Fe(t){return Math.exp(t)-1}function Re(t){return Math.log(1+t)}function ze(t){return Math.log(t)/Math.LN2}function We(t){this.options=t||{},this.unaryOps={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sinh:Math.sinh||ce,cosh:Math.cosh||ue,tanh:Math.tanh||pe,asinh:Math.asinh||he,acosh:Math.acosh||de,atanh:Math.atanh||me,sqrt:Math.sqrt,cbrt:Math.cbrt||je,log:Math.log,log2:Math.log2||ze,ln:Math.log,lg:Math.log10||ge,log10:Math.log10||ge,expm1:Math.expm1||Fe,log1p:Math.log1p||Re,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc||ve,"-":fe,"+":Number,exp:Math.exp,not:ye,length:Ee,"!":xe,sign:Math.sign||$e},this.binaryOps={"+":Kt,"-":Xt,"*":Yt,"/":Jt,"%":Zt,"^":Math.pow,"||":Qt,"==":te,"!=":ee,">":ne,"<":ie,">=":se,"<=":re,and:oe,or:ae,in:le,"=":Me,"[":Ae},this.ternaryOps={"?":Pe},this.functions={random:be,fac:xe,min:_e,max:Te,hypot:Math.hypot||ke,pyt:Math.hypot||ke,pow:Math.pow,atan2:Math.atan2,if:Pe,gamma:Ie,roundTo:Se,map:Oe,fold:De,filter:Be,indexOf:Le,join:Ve},this.consts={E:Math.E,PI:Math.PI,true:!0,false:!1}}We.prototype.parse=function(t){var e=[],n=new Ht(this,new zt(this,t),{allowMemberAccess:this.options.allowMemberAccess});return n.parseExpression(e),n.expect(Ot,"EOF"),new _t(e,this)},We.prototype.evaluate=function(t,e){return this.parse(t).evaluate(e)};var He=new We;We.parse=function(t){return He.parse(t)},We.evaluate=function(t,e){return He.parse(t).evaluate(e)};var Ue={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"remainder","^":"power","!":"factorial","<":"comparison",">":"comparison","<=":"comparison",">=":"comparison","==":"comparison","!=":"comparison","||":"concatenate",and:"logical",or:"logical",not:"logical","?":"conditional",":":"conditional","=":"assignment","[":"array","()=":"fndef"};We.prototype.isOperatorEnabled=function(t){var e=function(t){return Ue.hasOwnProperty(t)?Ue[t]:t}(t),n=this.options.operators||{};return!(e in n)||!!n[e]};const Ge=new Set(["getValue","setValue","_getFromProxy","__createPathProxies","hasOwnProperty","pushValue","removePathKey","removeKey","restoreKey","getKeys","exportFlattened","isArray","push","sortBy","findIndex"]);function qe(t){const e={},n=new Set,i=Array.isArray(t);let s=i?t.length:0,r=null;return new Proxy(t,{get:function(o,a){return"length"===a&&i?s:Ge.has(a)?this[a]:n.has(a)?void 0:(i&&null!==r&&(a=r[a]),v(e,a)?e[a]:t[a])},isArray:()=>i,_getFromProxy:t=>v(e,t)?e[t]:void 0,set:T,sortBy(t){return r=null,!!i&&(r=function(t,e){const n=[];for(let e=0;e!n.has(t))),s},exportFlattened(){let n;if(i)if(n=[],null!==r)for(let i=0;i{if("initParams"===t||"attrs"===t)return r("undefined");let i=Xe(t,"",e.items);return g(i)&&(i=`'${n?V(i):i}'`),i}))),!1!==c&&(a=a.replaceAll(c,(t=>{let i=e.keys[t];return g(i)&&(i=`'${n?V(i):i}'`),i}))),a.match(sn)){const t=a.split(/===|==/);return t[0]=an(t[0]),t[1]=an(t[1]),r((t[0]===t[1]).toString())}try{const t=rn.parse(a),n=Object.assign({},e.keys,e.items),i=t.evaluate(n);if(void 0!==i&&!isNaN(i))return r(i)}catch(t){}if(a.match(nn))return r(an(a));const u=/===|==|>=|>|<=|<|!==|!=/g,p=a.split(u);if(2===p.length){const n=a.match(u)[0];try{const t=rn.parse(p[0]),i=rn.parse(p[1]),s=Object.assign({},e.keys,e.items);return r(function(t,e,n){switch(n){case"==":case"===":return t===e;case"!=":case"!==":return t!==e;case">":return t>e;case">=":return t>=e;case"<":return tun(`[{{${t.substring(1,t.length-1)}}}]`,{items:i}))),"",e);r.push(t)}return r}},validation:function(t,e){return!!fn.test(t)||(e(`Invalid ${gn.preface} expression`),!1)},preface:gn.preface,supportedTypes:gn.supportedTypes},vn={supportedTypes:["amount","array","boolean","color","currency","date","email","enum","measurement","number","object","string","tuple","url"],preface:"pattern"},bn=new RegExp(`^@${vn.preface}\\(( *#*[_A-z0-9.%-]+?( *, *#*[_A-z0-9.%-]+)*?)\\)$`),xn={Handler:class{constructor(t){let e=k(t.value)||[],n=!0;const i=[];for(let t=0;tt,easeInQuad:t=>t*t,easeOutQuad:t=>t*(2-t),easeInOutQuad:t=>t<.5?2*t*t:(4-2*t)*t-1,easeInCubic:t=>t*t*t,easeOutCubic:t=>--t*t*t+1,easeInOutCubic:t=>t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1,easeInQuart:t=>t*t*t*t,easeOutQuart:t=>1- --t*t*t*t,easeInOutQuart:t=>t<.5?8*t*t*t*t:1-8*--t*t*t*t,easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>1+--t*t*t*t*t,easeInOutQuint:t=>t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t,easeInSine:t=>-1*Math.cos(t*(Math.PI/2))+1,easeOutSine:t=>Math.sin(t*(Math.PI/2)),easeInOutSine:t=>-(Math.cos(Math.PI*t)-1)/2,easeInExpo:t=>0==t?1:1*Math.pow(2,10*(t-1)),easeOutExpo:t=>1==t?1:1*(1-Math.pow(2,-10*t)),easeInOutExpo:t=>0==t||1==t?t:(t*=2)<1?Math.pow(2,10*(t-1))/2:(2-Math.pow(2,-10*--t))/2,easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t=t/1-1)*t),easeInOutCirc:t=>(t*=2)<1?-(Math.sqrt(1-t*t)-1)/2:(Math.sqrt(1-(t-=2)*t)+1)/2,easeInElastic(t){if(0==t||1==t)return t;const e=.3/wn*Math.asin(1);return-Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*wn/.3)},easeOutElastic(t){if(0==t||1==t)return t;const e=.3/wn*Math.asin(1);return Math.pow(2,-10*t)*Math.sin((t-e)*wn/.3)+1},easeInOutElastic(t){if(0==t||1==t)return t;const e=.3*1.5,n=e/wn*Math.asin(1);return t<1?-Math.pow(2,10*(t-=1))*Math.sin((t-n)*wn/e)/2:Math.pow(2,-10*(t-=1))*Math.sin((t-n)*wn/e)/2+1},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=-1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t*=2)<1?t*t*((1+(e*=1.525))*t-e)/2:((t-=2)*t*((1+(e*=1.525))*t+e)+2)/2},easeInBounce:t=>1-In.easeOutBounce(1-t),easeOutBounce:t=>t<1/2.75?7.5625*t*t*1:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,easeInOutBounce:t=>(t<.5?In.easeInBounce(2*t):In.easeOutBounce(2*t-1)+1)/2};function En(t){t=N(t);const e=(/.*\((.*)\).*/.exec(t)?.[1]||"").split(",");return{start:e[0],end:e[1],startFraction:1*e[2]||0,easing:e[3]||"linear",mode:e[4]||"linear",reverse:"true"===e[5]}}function kn(t,e,n,i="linear"){return In[i](n)*(e-t)+t}const Pn=Object.keys(In),Sn={Handler:class{constructor(t){const e=En(t.value),n=e.start.match(x)?.[0]||[],i=e.end.match(x)?.[0],s=e.start.toString().substring(n.length);this.staggerProps={from:1*n,to:1*i,mode:e.mode,unit:s,fraction:e.startFraction,easing:e.easing,reverse:e.reverse,type:""===s?"amount":"measurement",integer:t.integer}}resize(t){return this.staggerProps.from*=t,this.staggerProps.to*=t,!0===this.staggerProps.integer&&(this.staggerProps.from=Math.round(this.staggerProps.from),this.staggerProps.to=Math.round(this.staggerProps.to)),`@stagger(${this.staggerProps.from}${this.staggerProps.unit}, ${this.staggerProps.to}${this.staggerProps.unit}, ${this.staggerProps.fraction||0}, ${this.staggerProps.easing||"linear"}, ${this.staggerProps.mode||"linear"}, ${this.staggerProps.reverse||!1})`}calculateValues(t){const e=t.length;if(e<2)return[this.staggerProps.from];const n=function(t,e=0,n="linear",i=!1){const s=[];if("linear"===n)for(let n=0;n1)return e(`The ${Cn.preface} fraction must be a number >=0 and <=1`),!1;if(!Pn.includes(s.easing))return e(`The ${Cn.preface} easing (${s.easing}) is not supported by the system`),!1;if("linear"!==s.mode&&"omni"!==s.mode)return e(`The ${Cn.preface} mode should be either "linear" or "omni"`),!1;if(!0!==s.reverse&&!1!==s.reverse)return e(`The ${Cn.preface} reverse should be either true or false`),!1;const r=s.start.match(x),o=s.end.match(x);if(null===r||null===o)return e(`The start and end units of a @stagger should always be the same. This doesn't stand for the couple ${s.start}, ${s.end}`),!1;const a=r[0],l=o[0],c=s.start.toString().substring(a.length),u=s.end.toString().substring(l.length);return c!==u?(e(`The start and end units of a @stagger should always be the same. ${c}, ${u} provided`),!1):n(["number"===i.type?parseFloat(s.start):s.start,"number"===i.type?parseFloat(s.end):s.end])},preface:Cn.preface,supportedTypes:Cn.supportedTypes},Mn=[];function An(t){Mn.push(t)}function Tn(){return Mn}An(tt),An(mn),An(yn),An(xn),An(Sn);const _n=Tn();function On(t,e=""){if(!t)return[];const n=[];for(const[i,s]of Object.entries(t)){if(s instanceof Element)continue;if(f(s)){const t=On(s,`${e}${""===e?"":"."}${i}`);n.push(...t);continue}if(!g(s))continue;const t=s.trim();for(let s=0;s<_n.length;s++){const r=_n[s];if(t.startsWith(`@${r.preface}`)){const s={dynamicType:r.preface,path:`${e}${""===e?"":"."}${i}`,Handler:r.Handler,value:t};n.push(s)}}}return n}class Dn extends q{constructor(t={duration:0}){super(),this._inheritedSelector=null,this.parentNode=null,this.isNode=!1,this.id=v(t,"id")?t.id:M(),this.props=t,this.resetDuration()}get name(){return this.props?.name}set name(t){this.props.name=t}get inheritedSelector(){return this._inheritedSelector}set inheritedSelector(t){this._inheritedSelector=t}get delay(){return v(this.props,"delay")?this.props.delay:0}set delay(t){0!==t&&(this.props.delay=t),this.resetDuration()}get hiatus(){return v(this.props,"hiatus")?this.props.hiatus:0}set hiatus(t){0!==t&&(this.props.hiatus=t),this.resetDuration()}get repeats(){return v(this.props,"repeats")?this.props.repeats:1}set repeats(t){this.props.repeats=t,this.resetDuration()}resetDuration(t=!1){this._duration=this.repeats*(this.delay+this.props.duration+this.hiatus),t&&this.putMessageOnPipe("recalcDuration",{},"Groups",{selfExecute:!1,direction:H._UP})}get duration(){return this._duration}set duration(t){const e=t/this.duration;this.props.duration*=e,this.hiatus*=e,this.delay*=e,this.resetDuration()}setNewDuration(t){this.duration=t,this.putMessageOnPipe("recalcDuration",{},"Groups",{selfExecute:!1,direction:H._UP})}systoleDiastole(t){this.duration*=t}get hasParent(){return null!==this.parentNode}attachToNode(t){this.parentNode=t}detachFromParent(){this.parentNode=null,this.inheritedSelector=null}putMessageOnPipe(t,e,n,i={}){if(v(i,"direction")||(i.direction=H._DOWN),i.direction!==H._DOWN||v(i,"positionDelta")||(i.positionDelta=0),i.selfExecute){const r=`handle${s=t,s.charAt(0).toUpperCase()+s.slice(1)}`;if("function"==typeof this[r]){const t=this[r](n,e);if(t!==G){const e={response:t,responder:this};return i.direction===H._UP?e:(e.positionDelta=i.positionDelta,[e])}}}var s;return i.direction!==H._UP?[]:this.hasParent?this.parentNode.putMessageOnPipe(t,e,n,{selfExecute:!0,direction:H._UP}):{response:!1,responder:null}}bypass(){return G}get positionOnPyramidion(){return this.getPositionOnPyramidion()}getPositionOnPyramidion(t=0){return this.hasParent?this.putMessageOnPipe("getPositionOnPyramidion",{delta:t,id:this.id},"Parent",{selfExecute:!1,direction:H._UP}).response:t}editAttributes(t){if(null!==this.constructor.attrsValidationRules){const e=this.constructor.attrsValidationMethod(t);if(e.length>0)return{result:!1,errors:e}}return this.putMessageOnPipe("checkForClip",{},U._DECISIONAUTHORITY,{selfExecute:!0,direction:H._UP}).response?this.manageEditAttrProps(t,"attrs"):(this.attrs=t,{result:!0})}editProperties(t){const e=L(t,this.constructor.propsValidationRules,this.constructor);return e.result?this.putMessageOnPipe("checkForClip",{},U._DECISIONAUTHORITY,{selfExecute:!0,direction:H._UP}).response?this.manageEditAttrProps(t,"props"):(this.props=t,{result:!0}):e}resize(t,e={check:!0}){if("dynamic"===this.duration)return{result:!1,reason:J};if(t===this.duration)return{result:!0,meta:{unprocessed:!0}};if(t<=0)return{result:!1,reason:"Size must always be > 0"};if(e.check&&this.hasParent){const e=this.putMessageOnPipe("checkResize",{id:this.id,newSize:t,fraction:t/this.duration},U._DECISIONAUTHORITY,{selfExecute:!1,direction:H._UP});if(!e.response?.result)return e.response}return this.setNewDuration(t),{result:!0}}clone(t={},e={}){const n=this.exportLiveDefinition();for(const e in t)Ke(e,t[e],!0,"attrs",n);for(const t in e)Ke(t,e[t],!0,"props",n);return W(n)}selector(){return null===this.inheritedSelector?v(this.props,"selector")?this.props.selector:null:v(this.props,"selector")?this.props.selector?.startsWith("&")?this.inheritedSelector+this.props.selector.substring(1):`${this.inheritedSelector} ${this.props.selector}`:this.inheritedSelector}getElements(t){return null!=this.props.host?[this.props.host]:this.hasParent&&this.putMessageOnPipe("checkForClip",{},U._DECISIONAUTHORITY,{selfExecute:!0,direction:H._UP}).response?this.putMessageOnPipe("getElements",{selector:this.selector()},U._DECISIONAUTHORITY,{selfExecute:!1,direction:H._UP}).response:[]}setupDynamicValues(){const t={attrs:{},props:{}};for(const e of["attrs","props"]){const n=On(this[e]);for(const i of n){const n=i.Handler,s={value:i.value,integer:i.integer};this[("attrs"===e?"attributes":"props")+"Staggers"].push({path:i.path,stagger:new n(s)}),v(t[e],i.dynamicType)?t[e][i.dynamicType]+=1:t[e][i.dynamicType]=1}}return t}_calculateDuration(t){}}const Bn=.1,Ln="function"==typeof Float32Array;function Vn(t,e){return 1-3*e+3*t}function $n(t,e){return 3*e-6*t}function Nn(t){return 3*t}function jn(t,e,n){return((Vn(e,n)*t+$n(e,n))*t+Nn(e))*t}function Fn(t,e,n){return 3*Vn(e,n)*t*t+2*$n(e,n)*t+Nn(e)}function Rn(t){return t}function zn(t,e,n,i){if(!(0<=t&&t<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===i)return Rn;const s=Ln?new Float32Array(11):new Array(11);for(let e=0;e<11;++e)s[e]=jn(e*Bn,t,n);function r(e){let i=0,r=1;for(;10!==r&&s[r]<=e;++r)i+=Bn;--r;const o=i+(e-s[r])/(s[r+1]-s[r])*Bn,a=Fn(o,t,n);return a>=.001?function(t,e,n,i){for(let s=0;s<4;++s){const s=Fn(e,n,i);if(0===s)return e;e-=(jn(e,n,i)-t)/s}return e}(e,o,t,n):0===a?o:function(t,e,n,i,s){let r,o,a=0;do{o=e+(n-e)/2,r=jn(o,i,s)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++a<10);return o}(e,i,i+Bn,t,n)}return function(t){return 0===t||1===t?t:jn(r(t),e,i)}}class Wn extends Dn{constructor(t,e,n,i){super({...t.props,id:`${t.incidentId}_${n}`}),this.contexts={},this.constructionIngredients=t,this.mcid=n,this.DescriptiveIncident=i,this.mc_plugin_npm_name=t.plugin_npm_name,this.plugin_channel_class=t.Channel,this.addContext(e),this.timeScale=1,i.realClip.duration>0&&(this.timeScale=this.props.duration/i.realClip.duration),i.realClip.subscribeToDurationChange((t=>{this.props.duration=this.timeScale*t,this.resetDuration(),this.putMessageOnPipe("recalcDuration",{},"Groups",{selfExecute:!1,direction:H._UP})})),v(this.props,"easing")?this.easing=Array.isArray(this.props.easing)?zn(this.props.easing[0],this.props.easing[1],this.props.easing[2],this.props.easing[3]):In[this.props.easing]:this.easing=In.linear}get originalContext(){return this.contexts[this.originalContextKey]}onProgress(t,e,n,i=!1){let s=e%(this.delay+this.props.duration+this.hiatus);0!==e&&0===s&&(s=this.delay+this.props.duration);let r=s-this.delay;r<0?r=0:r>this.props.duration&&(r=this.props.duration);const o=0===this.props.duration?0:r/this.props.duration,a=this.easing(o)*this.props.duration*(1/this.timeScale);this.originalContext.context&&!1!==this.originalContext.context.contextLoaded&&this.contexts[n].onProgress(a,i)}addContext(t,e=!1){0===Object.keys(this.contexts).length&&(this.originalContextKey=t.clipId);const n={...this.constructionIngredients,context:t.context,mcid:this.mcid,Incident:X,DescriptiveIncident:this.DescriptiveIncident};this.contexts[t.clipId]=Y(n),e&&this.contexts[t.clipId]._onGetContextOnce()}handleAddContext(t,e){return this.addContext(e,!0),!0}handleContextLoaded(t,e){this._onGetContextOnce()}gotContext(){for(const t in this.contexts)this.contexts[t].gotContext()}_onGetContextOnce(){if(!1!==this.originalContext.contextLoaded)for(const t in this.contexts)this.contexts[t]._onGetContextOnce()}lastWish(){for(const t in this.contexts)this.contexts[t].lastWish()}onGetContext(){if(!1!==this.originalContext.contextLoaded)for(const t in this.contexts)this.contexts[t].onGetContext()}exportLiveDefinition(t){throw new Error("Method not implemented.")}manageEditAttrProps(t,e){throw new Error("Method not implemented.")}}const Hn="Leaf has already been attached to another Node",Un="Negative positioning of childs on nodes is not allowed",Gn="The Leaf with the requested id couldn't be found on the TimedTree";class qn extends Dn{constructor(t){super(t),this.isNode=!0,this.children={},this.calculatedDuration=0,this.resetDuration()}resetDuration(){this._duration=this.repeats*(this.delay+this.calculatedDuration+this.hiatus)}get duration(){return this._duration}set duration(t){if(0===this.duration)return;const e=t/this.duration;this.calculatedDuration*=e,this.hiatus*=e,this.delay*=e,this.resetDuration();for(const t in this.children){const n=this.children[t];this.editPosition(n.id,n.position*e,!0),n.leaf.systoleDiastole(e)}}_calculateDuration(t){if(!t||null!=t.childId){const e=this.children[t?.childId],n=e.leaf.duration+e.position;return n>this.calculatedDuration&&(this.calculatedDuration=n,this.resetDuration(),!0)}let e=0;for(const t in this.children){const n=this.children[t];n.position+n.leaf.duration>e&&(e=n.position+n.leaf.duration)}return e!==this.calculatedDuration&&(this.calculatedDuration=e,this.resetDuration(),!0)}handleRecalcDuration(t,e){return!this._calculateDuration(e)||this.putMessageOnPipe("recalcDuration",e.childId?{childId:this.id}:{},"Groups",{selfExecute:!1,direction:H._UP})}getLeafById(t,e=!1){if(v(this.children,t))return this.children[t].leaf;if(!e)for(const e in this.children){const n=this.children[e].leaf;if(n.isNode){const e=n.getLeafById(t);if(null!=e)return e}}return null}getLeafPosition(t){if(v(this.children,t))return this.children[t].position;const e=this.putMessageOnPipe("getLeafPosition",{id:t},"Groups",{selfExecute:!1,direction:H._DOWN});return e.length>0?e[0].positionDelta+e[0].response:void 0}handleGetLeafPosition(t,e){return this.getLeafPosition(e.id)}checkAddition(t,e){return t.hasParent?{result:!1,reason:Hn}:e<0?{result:!1,reason:Un}:{result:!0}}addChild(t,e){return t.hasParent?{result:!1,reason:Hn}:(this.children[t.id]={id:t.id,leaf:t,position:e},t.attachToNode(this),this.putMsgOnPipeWithResult("recalcDuration",{childId:t.id},"Groups",{selfExecute:!0,direction:H._UP}))}checkRemoveChild(t){return v(this.children,t)?{result:!0}:{result:!1,reason:Gn}}removeChild(t){return this.children[t].leaf.detachFromParent(),delete this.children[t],this.putMsgOnPipeWithResult("recalcDuration",{},"Groups",{selfExecute:!0,direction:H._UP})}checkEditPosition(t,e){return e<0?{result:!1,reason:Un}:v(this.children,t)?{result:!0}:{result:!1,reason:Gn}}editPosition(t,e,n=!1){if(v(this.children,t))return this.children[t].position=e,n||this.putMessageOnPipe("recalcDuration",{},"Groups",{selfExecute:!0,direction:H._UP}),{result:!0}}putMessageOnPipe(t,e,n,i={}){if(v(i,"direction")||(i.direction=H._DOWN),i.direction!==H._DOWN||v(i,"positionDelta")||(i.positionDelta=0),i.direction===H._UP)return super.putMessageOnPipe(t,e,n,i);const s=super.putMessageOnPipe(t,e,n,i);if(s.length)return s;for(const r in this.children){const{leaf:o}=this.children[r],a={...i,selfExecute:!0,positionDelta:i.positionDelta+this.children[r].position};s.push(...o.putMessageOnPipe(t,e,n,a))}return s}putMsgOnPipeWithResult(t,e,n,i={}){return this.putMessageOnPipe(t,e,n,i),{result:!0}}handleGetPositionOnPyramidion(t,e){const n=e.delta+this.getLeafPosition(e.id);return this.getPositionOnPyramidion(n)}}class Kn extends qn{constructor(t,e){super(e),this.handleRemoveIncident=this.handleMoveIncident,this.mc_plugin_npm_name=u,this.plugin_channel_class=R,this.hasIncidents=!0,this.onGroupInitialise(),this.calculatedDuration=0}onGroupInitialise(){}handleAddIncident(t,e){if(this.id===t){const t=(0,e.incidentFromDescription)(e.incident,e.contextData);if(null!==t)return t}return this.bypass()}handleMoveIncident(t,e){if(this.id===t){const t=this.getLeafById(e.incidentId,!0);if(null!==t)return t}return this.bypass()}handleResize(t){return this.id===t?this:this.bypass()}removeChild(t){return this.children[t].leaf.lastWish(),super.removeChild(t)}getIncidentsByChannel(t=0,e=0){const n={[u]:[{millisecond:t,parentMillisecond:e,incident:this,id:this.id}]};for(const e in this.children){const i=this.children[e],s=i.leaf.getIncidentsByChannel(t+i.position,t);for(const t in s)v(n,t)?n[t]=n[t].concat(s[t]):n[t]=s[t]}return n}lastWish(){for(const t in this.children)this.children[t].leaf.lastWish()}}class Xn extends Dn{constructor(t,e,n,i){if(super({...t.props,id:`${t.incidentId}_${n}${null!=i?"_"+i:""}`}),this.contexts={},this.constructionIngredients=t,this.mcid=n,this.attribute=i,this.mc_plugin_npm_name=t.plugin_npm_name,this.plugin_channel_class=t.Channel,this.DescriptiveIncident=t.DescriptiveIncident,this.addContext(e),null!==i){const t=this.constructionIngredients.attrs.animatedAttrs[this.attribute];Array.isArray(t)?this.originalAnimatedAttributeValue=[...t]:f(t)?this.originalAnimatedAttributeValue={...t}:this.originalAnimatedAttributeValue=t}this.easing=In.linear,v(this.props,"easing")&&(this.easing=Array.isArray(this.props.easing)?zn(this.props.easing[0],this.props.easing[1],this.props.easing[2],this.props.easing[3]):In[this.props.easing]),this._duration=super.duration,this.repeatDuration=this.delay+this.props.duration+this.hiatus}exportLiveDefinition(t){throw new Error("Method not implemented.")}manageEditAttrProps(t,e){throw new Error("Method not implemented.")}get originalContext(){return this.contexts[this.originalContextKey]}get duration(){return this._duration}set duration(t){super.duration=t;for(const e in this.contexts)this.contexts[e].duration=t;this._duration=super.duration,this.repeatDuration=this.delay+this.props.duration+this.hiatus}addContext(t,e=!1){let n=!1;0===Object.keys(this.contexts).length&&(this.originalContextKey=t.clipId,this.originalClipContext=t.context,n=!0);const i=Y({...this.constructionIngredients,context:t.context,mcid:this.mcid});this.contexts[t.clipId]=i,n||null==this.attribute||this.contexts[t.clipId].setInitialValue(this.initialValue),e&&this.contexts[t.clipId].context.contextLoaded&&this.contexts[t.clipId]._onGetContextOnce()}handleAddContext(t,e){return this.addContext(e,!0),!0}handleContextLoaded(t,e){return this._onGetContextOnce(),!0}onProgress(t,e){const n=this.props.delay||0;let i=t%this.repeatDuration;0!==t&&0===i&&(i=n+this.props.duration);let s=i-n;s<0?s=0:s>this.props.duration&&(s=this.props.duration);const r=s/this.props.duration,o=this.easing(r)*this.props.duration;if(null!=e)this.contexts[e].onProgress(o);else for(const t in this.contexts)this.originalContextKey===t&&!0===this.originalContext.fragment||this.contexts[t].onProgress(o)}get animatedAttributeValue(){return this.constructionIngredients.attrs.animatedAttrs[this.attribute]}set animatedAttributeValue(t){this.constructionIngredients.attrs.animatedAttrs[this.attribute]=t}gotContext(){for(const t in this.contexts)this.contexts[t].gotContext()}_onGetContextOnce(){if(this.originalContext.context.contextLoaded)for(const t in this.contexts)this.contexts[t]._onGetContextOnce()}lastWish(){for(const t in this.contexts)this.contexts[t].lastWish()}onGetContext(){if(0!=!this.originalContext.contextLoaded)for(const t in this.contexts)this.contexts[t].context.contextLoaded&&this.contexts[t].onGetContext()}get initialValue(){return this.originalContext.initialValue}get scratchValue(){return this.originalContext.scratchValue}get pureInitialValues(){return this.originalContext.pureInitialValues}setInitialValue(t,e=!0){const n=b(t??this.getScratchValue());for(const t in this.contexts)this.contexts[t].setInitialValue(n,e)}getScratchValue(t=null){if(!1===this.originalContext.context.contextLoaded)return 0;if(null!=t)return this.contexts[t].getScratchValue();if(v(this.originalClipContext,"nonFragmentedContext"))return Y({...this.constructionIngredients,context:this.originalClipContext.nonFragmentedContext,mcid:this.mcid}).getScratchValue();const e=Object.keys(this.contexts);return 1===e.length?this.originalContext.getScratchValue():this.contexts[e[1]].getScratchValue()}play(t,e,n){return this.contexts[n].play(e)}stop(t){this.contexts[t].stop()}}class Yn extends Kn{constructor(t,e,n,i,s){super({},{id:`${t.id}_${n}`}),this.mcid=n,this.selector=i,this.data=s,this.setUp(t,e)}exportLiveDefinition(t){throw new Error("Method not implemented.")}manageEditAttrProps(t,e){throw new Error("Method not implemented.")}setUp(t,e){for(const n in this.data.attrs.animatedAttrs){const i={[n]:this.data.attrs.animatedAttrs[n]},s={...this.data.attrs,animatedAttrs:i},r={...this.data.props,selector:this.selector},o={incidentId:t.id,attrs:s,props:r,Incident:t.constructor.Incident,plugin_npm_name:t.constructor.plugin_npm_name,Channel:t.constructor.Channel,DescriptiveIncident:t},a=new Xn(o,e,this.mcid,n);this.addChild(a,0)}}}class Jn extends Kn{constructor(t,e){super({},{id:t.id,duration:t.duration}),this.contexts={[e.clipId]:e.context},this.originalContextKey=e.clipId,this.initParams=e.context.initParams,this.instantiatedCopiesContexts=e.instantiatedCopiesContexts,this.descriptiveIncident=t,this.staggerAttrs=[],this.staggerProps=[],this.setUp(t,e)}get originalContext(){return this.contexts[this.originalContextKey]}parsePropsDynamicValues(t,e){for(let n=0;n0&&(this.descriptiveIncident.dynamicDurationValue=1*this.duration),n}lastWish(){this.descriptiveIncident.propsStaggers.length>0&&(this.descriptiveIncident.dynamicDurationValue=null,this.descriptiveIncident.putMessageOnPipe("setDurationDynamic",{},"Groups",{selfExecute:!1,direction:H._UP})),super.lastWish()}_getElementMCID(t){let e=this.originalContext.getMCID(t);return e||(e=M(!0),this.originalContext.setMCID(t,e)),e}_setElementMCID(t,e,n){t.getMCID(e)||t.setMCID(e,n)}_prepareAttrsPropsForElement(t,e){const n=function(t,e){const n=[];for(let i=0;i0){s=b(t.attrs);for(let t=0;t0){r=b(t.props);for(let t=0;t{t._setState(n)}),0,1,!0),t.handleSetBlock=(n,i)=>e.putMessageOnPipe("setBlock",{...i,id:t.id},"rootClip",{selfExecute:!0,direction:H._UP}),t.handleUnBlock=()=>e.putMessageOnPipe("unBlock",{id:t.id},"rootClip",{selfExecute:!0,direction:H._UP})}const a=e.realClip.exportConstructionArguments(),l={...e.props,duration:e.realClip.duration,...a.props,...o.props,selector:n.context.getElementSelectorByMCID(r)},c={incidentId:e.id,attrs:a.attrs,props:l,Incident:e.constructor.Incident,plugin_npm_name:e.constructor.plugin_npm_name,Channel:z,DescriptiveIncident:e},u=new Wn(c,n,r,e);this.addChild(u,0)}exportLiveDefinition(t){throw new Error("Method not implemented.")}manageEditAttrProps(t,e){throw new Error("Method not implemented.")}}var Qn=it({"../../node_modules/.pnpm/fastest-validator@1.17.0/node_modules/fastest-validator/dist/index.min.js"(t,e){var n=n||{};n.scope={},n.arrayIteratorImpl=function(t){var e=0;return function(){return e>>0,n.propertyToPolyfillSymbol[s]=n.IS_SYMBOL_NATIVE?n.global.Symbol(s):n.POLYFILL_PREFIX+t+"$"+s),n.defineProperty(r,n.propertyToPolyfillSymbol[s],{configurable:!0,writable:!0,value:e})))},n.initSymbol=function(){},n.polyfill("Symbol",(function(t){function e(t,e){this.$jscomp$symbol$id_=t,n.defineProperty(this,"description",{configurable:!0,writable:!0,value:e})}if(t)return t;e.prototype.toString=function(){return this.$jscomp$symbol$id_};var i="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",s=0;return function t(n){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(i+(n||"")+"_"+s++,n)}}),"es6","es3"),n.polyfill("Symbol.iterator",(function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var e="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i=r}}),"es6","es3"),n.owns=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.assign=n.TRUST_ES6_POLYFILLS&&"function"==typeof Object.assign?Object.assign:function(t,e){for(var i=1;i=s}}),"es6","es3"),n.polyfill("Number.isNaN",(function(t){return t||function(t){return"number"==typeof t&&isNaN(t)}}),"es6","es3"),n.polyfill("Object.entries",(function(t){return t||function(t){var e,i=[];for(e in t)n.owns(t,e)&&i.push([e,t[e]]);return i}}),"es8","es3");var i=t;function s(){function t(t){if(this.opts={},this.defaults={},this.messages=Object.assign({},A),this.rules={any:E,array:I,boolean:w,class:C,custom:x,currency:b,date:v,email:y,enum:f,equal:g,forbidden:m,function:d,multi:h,number:p,object:u,objectID:c,record:l,string:a,tuple:o,url:r,uuid:s,mac:i,luhn:n},this.aliases={},this.cache=new Map,t){if(P(this.opts,t),t.defaults&&P(this.defaults,t.defaults),t.messages)for(var k in t.messages)this.addMessage(k,t.messages[k]);if(t.aliases)for(var S in t.aliases)this.alias(S,t.aliases[S]);if(t.customRules)for(var M in t.customRules)this.add(M,t.customRules[M]);if(t.plugins){if(t=t.plugins,!Array.isArray(t))throw Error("Plugins type must be array");t.forEach(this.plugin.bind(this))}this.opts.debug&&(t=function(t){return t},"undefined"==typeof window&&(t=e),this._formatter=t)}}function e(t){return T||(T=M(),_={parser:"babel",useTabs:!1,printWidth:120,trailingComma:"none",tabWidth:4,singleQuote:!1,semi:!0,bracketSpacing:!0},O=M(),D={language:"js",theme:O.fromJson({keyword:["white","bold"],built_in:"magenta",literal:"cyan",number:"magenta",regexp:"red",string:["yellow","bold"],symbol:"plain",class:"blue",attr:"plain",function:["white","bold"],title:"plain",params:"green",comment:"grey"})}),t=T.format(t,_),O.highlight(t,D)}function n(t){return t.schema,t=t.messages,{source:'\n\t\t\tif (typeof value !== "string") {\n\t\t\t\t'+this.makeError({type:"string",actual:"value",messages:t})+'\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (typeof value !== "string")\n\t\t\t\tvalue = String(value);\n\n\t\t\tval = value.replace(/\\D+/g, "");\n\n\t\t\tvar array = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9];\n\t\t\tvar len = val ? val.length : 0,\n\t\t\t\tbit = 1,\n\t\t\t\tsum = 0;\n\t\t\twhile (len--) {\n\t\t\t\tsum += !(bit ^= 1) ? parseInt(val[len], 10) : array[val[len]];\n\t\t\t}\n\n\t\t\tif (!(sum % 10 === 0 && sum > 0)) {\n\t\t\t\t'+this.makeError({type:"luhn",actual:"value",messages:t})+"\n\t\t\t}\n\n\t\t\treturn value;\n\t\t"}}function i(t){return t.schema,t=t.messages,{source:'\n\t\t\tif (typeof value !== "string") {\n\t\t\t\t'+this.makeError({type:"string",actual:"value",messages:t})+"\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tvar v = value.toLowerCase();\n\t\t\tif (!"+G.toString()+".test(v)) {\n\t\t\t\t"+this.makeError({type:"mac",actual:"value",messages:t})+"\n\t\t\t}\n\t\t\t\n\t\t\treturn value;\n\t\t"}}function s(t){var e=t.schema;t=t.messages;var n=[];return n.push('\n\t\tif (typeof value !== "string") {\n\t\t\t'+this.makeError({type:"string",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\n\t\tvar val = value.toLowerCase();\n\t\tif (!"+U.toString()+".test(val)) {\n\t\t\t"+this.makeError({type:"uuid",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\n\t\tconst version = val.charAt(14) | 0;\n\t"),7>parseInt(e.version)&&n.push("\n\t\t\tif ("+e.version+" !== version) {\n\t\t\t\t"+this.makeError({type:"uuidVersion",expected:e.version,actual:"version",messages:t})+"\n\t\t\t\treturn value;\n\t\t\t}\n\t\t"),n.push('\n\t\tswitch (version) {\n\t\tcase 0:\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 6:\n\t\t\tbreak;\n\t\tcase 3:\n\t\tcase 4:\n\t\tcase 5:\n\t\t\tif (["8", "9", "a", "b"].indexOf(val.charAt(19)) === -1) {\n\t\t\t\t'+this.makeError({type:"uuid",actual:"value",messages:t})+"\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t"),{source:n.join("\n")}}function r(t){var e=t.schema;t=t.messages;var n=[];return n.push('\n\t\tif (typeof value !== "string") {\n\t\t\t'+this.makeError({type:"string",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\t"),e.empty?n.push("\n\t\t\tif (value.length === 0) return value;\n\t\t"):n.push("\n\t\t\tif (value.length === 0) {\n\t\t\t\t"+this.makeError({type:"urlEmpty",actual:"value",messages:t})+"\n\t\t\t\treturn value;\n\t\t\t}\n\t\t"),n.push("\n\t\tif (!"+H.toString()+".test(value)) {\n\t\t\t"+this.makeError({type:"url",actual:"value",messages:t})+"\n\t\t}\n\n\t\treturn value;\n\t"),{source:n.join("\n")}}function o(t,e,n){var i=t.schema,s=t.messages;if(t=[],null!=i.items){if(!Array.isArray(i.items))throw Error("Invalid '"+i.type+"' schema. The 'items' field must be an array.");if(0===i.items.length)throw Error("Invalid '"+i.type+"' schema. The 'items' field must not be an empty array.")}if(t.push("\n\t\tif (!Array.isArray(value)) {\n\t\t\t"+this.makeError({type:"tuple",actual:"value",messages:s})+"\n\t\t\treturn value;\n\t\t}\n\n\t\tvar len = value.length;\n\t"),!1===i.empty&&t.push("\n\t\t\tif (len === 0) {\n\t\t\t\t"+this.makeError({type:"tupleEmpty",actual:"value",messages:s})+"\n\t\t\t\treturn value;\n\t\t\t}\n\t\t"),null!=i.items){for(t.push("\n\t\t\tif ("+i.empty+" !== false && len === 0) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (len !== "+i.items.length+") {\n\t\t\t\t"+this.makeError({type:"tupleLength",expected:i.items.length,actual:"len",messages:s})+"\n\t\t\t\treturn value;\n\t\t\t}\n\t\t"),t.push("\n\t\t\tvar arr = value;\n\t\t\tvar parentField = field;\n\t\t"),s=0;s "+e.max+") {\n\t\t\t\t"+this.makeError({type:"stringMax",expected:e.max,actual:"len",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.length&&n.push("\n\t\t\tif (len !== "+e.length+") {\n\t\t\t\t"+this.makeError({type:"stringLength",expected:e.length,actual:"len",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.pattern){var s=e.pattern;"string"==typeof e.pattern&&(s=new RegExp(e.pattern,e.patternFlags)),n.push("\n\t\t\tif (!"+s.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringPattern",expected:'"'+s.toString().replace(/"/g,"\\$&")+'"',actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t")}return null!=e.contains&&n.push('\n\t\t\tif (value.indexOf("'+e.contains+'") === -1) {\n\t\t\t\t'+this.makeError({type:"stringContains",expected:'"'+e.contains+'"',actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.enum&&(s=JSON.stringify(e.enum),n.push("\n\t\t\tif ("+s+".indexOf(value) === -1) {\n\t\t\t\t"+this.makeError({type:"stringEnum",expected:'"'+e.enum.join(", ")+'"',actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t")),!0===e.numeric&&n.push("\n\t\t\tif (!"+N.toString()+".test(value) ) {\n\t\t\t\t"+this.makeError({type:"stringNumeric",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.alpha&&n.push("\n\t\t\tif(!"+j.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringAlpha",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.alphanum&&n.push("\n\t\t\tif(!"+F.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringAlphanum",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.alphadash&&n.push("\n\t\t\tif(!"+R.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringAlphadash",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.hex&&n.push("\n\t\t\tif(value.length % 2 !== 0 || !"+z.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringHex",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.singleLine&&n.push('\n\t\t\tif(value.includes("\\n")) {\n\t\t\t\t'+this.makeError({type:"stringSingleLine",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.base64&&n.push("\n\t\t\tif(!"+W.toString()+".test(value)) {\n\t\t\t\t"+this.makeError({type:"stringBase64",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),n.push("\n\t\treturn value;\n\t"),{sanitized:i,source:n.join("\n")}}function l(t,e,n){var i=t.schema,s=[];for(var r in s.push('\n\t\tif (typeof value !== "object" || value === null || Array.isArray(value)) {\n\t\t\t'+this.makeError({type:"record",actual:"value",messages:t.messages})+"\n\t\t\treturn value;\n\t\t}\n\t"),t=i.key||"string",i=i.value||"any",s.push("\n\t\tconst record = value;\n\t\tlet sanitizedKey, sanitizedValue;\n\t\tconst result = {};\n\t\tfor (let key in value) {\n\t"),s.push("sanitizedKey = value = key;"),(t=this.getRuleFromSchema(t)).messages)r.startsWith("string")&&(t.messages[r]=t.messages[r].replace(" field "," key "));return s.push(this.compileRule(t,n,null,"\n\t\tsanitizedKey = "+(n.async?"await ":"")+'context.fn[%%INDEX%%](key, field ? field + "." + key : key, record, errors, context);\n\t',"sanitizedKey")),s.push("sanitizedValue = value = record[key];"),r=this.getRuleFromSchema(i),s.push(this.compileRule(r,n,e+"[key]","\n\t\tsanitizedValue = "+(n.async?"await ":"")+'context.fn[%%INDEX%%](value, field ? field + "." + key : key, record, errors, context);\n\t',"sanitizedValue")),s.push("result[sanitizedKey] = sanitizedValue;"),s.push("\n\t\t}\n\t"),s.push("return result;"),{source:s.join("\n")}}function c(t,e,n){e=t.schema;var i=t.messages;t=t.index;var s=[];return n.customs[t]?n.customs[t].schema=e:n.customs[t]={schema:e},s.push("\n\t\tconst ObjectID = context.customs["+t+"].schema.ObjectID;\n\t\tif (!ObjectID.isValid(value)) {\n\t\t\t"+this.makeError({type:"objectID",actual:"value",messages:i})+"\n\t\t\treturn;\n\t\t}\n\t"),!0===e.convert?s.push("return new ObjectID(value)"):"hexString"===e.convert?s.push("return value.toString()"):s.push("return value"),{source:s.join("\n")}}function u(t,e,n){var i=t.schema;t=t.messages;var s=[];s.push('\n\t\tif (typeof value !== "object" || value === null || Array.isArray(value)) {\n\t\t\t'+this.makeError({type:"object",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\t");var r=i.properties||i.props;if(r){s.push("var parentObj = value;"),s.push("var parentField = field;");for(var o=Object.keys(r),a=0;a "+i.maxProps+") {\n\t\t\t\t"+this.makeError({type:"objectMaxProps",expected:i.maxProps,actual:"props.length",messages:t})+"\n\t\t\t}\n\t\t"),r?s.push("\n\t\t\treturn parentObj;\n\t\t"):s.push("\n\t\t\treturn value;\n\t\t"),{source:s.join("\n")}}function p(t){var e=t.schema;t=t.messages;var n=[];n.push("\n\t\tvar origValue = value;\n\t");var i=!1;return!0===e.convert&&(i=!0,n.push('\n\t\t\tif (typeof value !== "number") {\n\t\t\t\tvalue = Number(value);\n\t\t\t}\n\t\t')),n.push('\n\t\tif (typeof value !== "number" || isNaN(value) || !isFinite(value)) {\n\t\t\t'+this.makeError({type:"number",actual:"origValue",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\t"),null!=e.min&&n.push("\n\t\t\tif (value < "+e.min+") {\n\t\t\t\t"+this.makeError({type:"numberMin",expected:e.min,actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.max&&n.push("\n\t\t\tif (value > "+e.max+") {\n\t\t\t\t"+this.makeError({type:"numberMax",expected:e.max,actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.equal&&n.push("\n\t\t\tif (value !== "+e.equal+") {\n\t\t\t\t"+this.makeError({type:"numberEqual",expected:e.equal,actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),null!=e.notEqual&&n.push("\n\t\t\tif (value === "+e.notEqual+") {\n\t\t\t\t"+this.makeError({type:"numberNotEqual",expected:e.notEqual,actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.integer&&n.push("\n\t\t\tif (value % 1 !== 0) {\n\t\t\t\t"+this.makeError({type:"numberInteger",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.positive&&n.push("\n\t\t\tif (value <= 0) {\n\t\t\t\t"+this.makeError({type:"numberPositive",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),!0===e.negative&&n.push("\n\t\t\tif (value >= 0) {\n\t\t\t\t"+this.makeError({type:"numberNegative",actual:"origValue",messages:t})+"\n\t\t\t}\n\t\t"),n.push("\n\t\treturn value;\n\t"),{sanitized:i,source:n.join("\n")}}function h(t,e,n){var i=t.schema;t.messages,(t=[]).push("\n\t\tvar hasValid = false;\n\t\tvar newVal = value;\n\t\tvar checkErrors = [];\n\t\tvar errorsSize = errors.length;\n\t");for(var s=0;s "+e.max+") {\n\t\t\t\t"+this.makeError({type:"emailMax",expected:e.max,actual:"value.length",messages:t})+"\n\t\t\t}\n\t\t"),n.push("\n\t\tif (!"+i.toString()+".test(value)) {\n\t\t\t"+this.makeError({type:"email",actual:"value",messages:t})+"\n\t\t}\n\n\t\treturn value;\n\t"),{sanitized:s,source:n.join("\n")}}function v(t){var e=t.schema;t=t.messages;var n=[],i=!1;return n.push("\n\t\tvar origValue = value;\n\t"),!0===e.convert&&(i=!0,n.push("\n\t\t\tif (!(value instanceof Date)) {\n\t\t\t\tvalue = new Date(value.length && !isNaN(+value) ? +value : value);\n\t\t\t}\n\t\t")),n.push("\n\t\tif (!(value instanceof Date) || isNaN(value.getTime()))\n\t\t\t"+this.makeError({type:"date",actual:"origValue",messages:t})+"\n\n\t\treturn value;\n\t"),{sanitized:i,source:n.join("\n")}}function b(t){var e=t.schema;t=t.messages;var n=e.currencySymbol||null,i=e.thousandSeparator||",",s=e.decimalSeparator||".",r=e.customRegex;return e=!e.symbolOptional,e="(?=.*\\d)^(-?~1|~1-?)(([0-9]\\d{0,2}(~2\\d{3})*)|0)?(\\~3\\d{1,2})?$".replace(/~1/g,n?"\\"+n+(e?"":"?"):"").replace("~2",i).replace("~3",s),(n=[]).push("\n\t\tif (!value.match("+(r||new RegExp(e))+")) {\n\t\t\t"+this.makeError({type:"currency",actual:"value",messages:t})+"\n\t\t\treturn value;\n\t\t}\n\n\t\treturn value;\n\t"),{source:n.join("\n")}}function x(t,e,n){var i=[];return i.push("\n\t\t"+this.makeCustomValidator({fnName:"check",path:e,schema:t.schema,messages:t.messages,context:n,ruleIndex:t.index})+"\n\t\treturn value;\n\t"),{source:i.join("\n")}}function C(t,e,n){e=t.schema;var i=t.messages;t=t.index;var s=[],r=e.instanceOf.name?e.instanceOf.name:"";return n.customs[t]?n.customs[t].schema=e:n.customs[t]={schema:e},s.push("\n\t\tif (!(value instanceof context.customs["+t+"].schema.instanceOf))\n\t\t\t"+this.makeError({type:"classInstanceOf",actual:"value",expected:"'"+r+"'",messages:i})+"\n\t"),s.push("\n\t\treturn value;\n\t"),{source:s.join("\n")}}function w(t){var e=t.schema;t=t.messages;var n=[],i=!1;return n.push("\n\t\tvar origValue = value;\n\t"),!0===e.convert&&(i=!0,n.push('\n\t\t\tif (typeof value !== "boolean") {\n\t\t\t\tif (\n\t\t\t\tvalue === 1\n\t\t\t\t|| value === "true"\n\t\t\t\t|| value === "1"\n\t\t\t\t|| value === "on"\n\t\t\t\t) {\n\t\t\t\t\tvalue = true;\n\t\t\t\t} else if (\n\t\t\t\tvalue === 0\n\t\t\t\t|| value === "false"\n\t\t\t\t|| value === "0"\n\t\t\t\t|| value === "off"\n\t\t\t\t) {\n\t\t\t\t\tvalue = false;\n\t\t\t\t}\n\t\t\t}\n\t\t')),n.push('\n\t\tif (typeof value !== "boolean") {\n\t\t\t'+this.makeError({type:"boolean",actual:"origValue",messages:t})+"\n\t\t}\n\t\t\n\t\treturn value;\n\t"),{sanitized:i,source:n.join("\n")}}function I(t,e,n){var i=t.schema,s=t.messages;t=[];var r=!1;if(!0===i.convert&&(r=!0,t.push("\n\t\t\tif (!Array.isArray(value) && value != null) {\n\t\t\t\tvalue = [value];\n\t\t\t}\n\t\t")),t.push("\n\t\tif (!Array.isArray(value)) {\n\t\t\t"+this.makeError({type:"array",actual:"value",messages:s})+"\n\t\t\treturn value;\n\t\t}\n\n\t\tvar len = value.length;\n\t"),!1===i.empty&&t.push("\n\t\t\tif (len === 0) {\n\t\t\t\t"+this.makeError({type:"arrayEmpty",actual:"value",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.min&&t.push("\n\t\t\tif (len < "+i.min+") {\n\t\t\t\t"+this.makeError({type:"arrayMin",expected:i.min,actual:"len",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.max&&t.push("\n\t\t\tif (len > "+i.max+") {\n\t\t\t\t"+this.makeError({type:"arrayMax",expected:i.max,actual:"len",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.length&&t.push("\n\t\t\tif (len !== "+i.length+") {\n\t\t\t\t"+this.makeError({type:"arrayLength",expected:i.length,actual:"len",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.contains&&t.push("\n\t\t\tif (value.indexOf("+JSON.stringify(i.contains)+") === -1) {\n\t\t\t\t"+this.makeError({type:"arrayContains",expected:JSON.stringify(i.contains),actual:"value",messages:s})+"\n\t\t\t}\n\t\t"),!0===i.unique&&t.push("\n\t\t\tif(len > (new Set(value)).size) {\n\t\t\t\t"+this.makeError({type:"arrayUnique",expected:"Array.from(new Set(value.filter((item, index) => value.indexOf(item) !== index)))",actual:"value",messages:s})+"\n\t\t\t}\n\t\t"),null!=i.enum){var o=JSON.stringify(i.enum);t.push("\n\t\t\tfor (var i = 0; i < value.length; i++) {\n\t\t\t\tif ("+o+".indexOf(value[i]) === -1) {\n\t\t\t\t\t"+this.makeError({type:"arrayEnum",expected:'"'+i.enum.join(", ")+'"',actual:"value[i]",messages:s})+"\n\t\t\t\t}\n\t\t\t}\n\t\t")}return null!=i.items?(t.push("\n\t\t\tvar arr = value;\n\t\t\tvar parentField = field;\n\t\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t\t\tvalue = arr[i];\n\t\t"),e+="[]",i=this.getRuleFromSchema(i.items),t.push(this.compileRule(i,n,e,"arr[i] = "+(n.async?"await ":"")+'context.fn[%%INDEX%%](arr[i], (parentField ? parentField : "") + "[" + i + "]", parent, errors, context)',"arr[i]")),t.push("\n\t\t\t}\n\t\t"),t.push("\n\t\treturn arr;\n\t")):t.push("\n\t\treturn value;\n\t"),{sanitized:r,source:t.join("\n")}}function E(){var t=[];return t.push("\n\t\treturn value;\n\t"),{source:t.join("\n")}}function k(t,e,n){return t.replace(e,null==n?"":"function"==typeof n.toString?n:typeof n)}function P(t,e,n){for(var i in void 0===n&&(n={}),e){var s=e[i];(s="object"==typeof s&&!Array.isArray(s)&&null!=s&&0()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,L=/^\S+@\S+\.\S+$/,V=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/,$=/["'\\\n\r\u2028\u2029]/g,N=/^-?[0-9]\d*(\.\d+)?$/,j=/^[a-zA-Z]+$/,F=/^[a-zA-Z0-9]+$/,R=/^[a-zA-Z0-9_-]+$/,z=/^[0-9a-fA-F]+$/,W=/^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+/]{3}=)?$/,H=/^https?:\/\/\S+/,U=/^([0-9a-f]{8}-[0-9a-f]{4}-[1-6][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}|[0]{8}-[0]{4}-[0]{4}-[0]{4}-[0]{12})$/i,G=/^((([a-f0-9][a-f0-9]+[-]){5}|([a-f0-9][a-f0-9]+[:]){5})([a-f0-9][a-f0-9])$)|(^([a-f0-9][a-f0-9][a-f0-9][a-f0-9]+[.]){2}([a-f0-9][a-f0-9][a-f0-9][a-f0-9]))$/i;try{var q=new Function("return Object.getPrototypeOf(async function(){}).constructor")()}catch(t){}return t.prototype.validate=function(t,e){return this.compile(e)(t)},t.prototype.wrapRequiredCheckSourceCode=function(t,e,n,i){var s=[],r=this.opts.considerNullAsAValue;void 0===r&&(r=!1);var o=!0===t.schema.optional||"forbidden"===t.schema.type,a=r?!1!==t.schema.nullable||"forbidden"===t.schema.type:!0===t.schema.optional||!0===t.schema.nullable||"forbidden"===t.schema.type;return(r?null!=t.schema.default&&null!=t.schema.default:null!=t.schema.default)?(o=!1,r?!1===t.schema.nullable&&(a=!1):!0!==t.schema.nullable&&(a=!1),"function"==typeof t.schema.default?(n.customs[t.index]||(n.customs[t.index]={}),n.customs[t.index].defaultFn=t.schema.default,t="context.customs["+t.index+"].defaultFn.call(this, context.rules["+t.index+"].schema, field, parent, context)"):t=JSON.stringify(t.schema.default),i="\n\t\t\t\tvalue = "+t+";\n\t\t\t\t"+i+" = value;\n\t\t\t"):i=this.makeError({type:"required",actual:"value",messages:t.messages}),s.push("\n\t\t\tif (value === undefined) { "+(o?"\n// allow undefined\n":i)+" }\n\t\t\telse if (value === null) { "+(a?"\n// allow null\n":i)+" }\n\t\t\t"+(e?"else { "+e+" }":"")+"\n\t\t"),s.join("\n")},t.prototype.compile=function(t){function e(t,e){return i.data=t,e&&e.meta&&(i.meta=e.meta),r.call(n,t,i)}if(null===t||"object"!=typeof t)throw Error("Invalid schema.");var n=this,i={index:0,async:!0===t.$$async,rules:[],fn:[],customs:{},utils:{replace:k}};if(this.cache.clear(),delete t.$$async,i.async&&!q)throw Error("Asynchronous mode is not supported.");if(!0!==t.$$root)if(Array.isArray(t))t=this.getRuleFromSchema(t).schema;else{var s=Object.assign({},t);t={type:"object",strict:s.$$strict,properties:s},delete s.$$strict}s=["var errors = [];","var field;","var parent = null;","var label = "+(t.label?'"'+t.label+'"':"null")+";"],t=this.getRuleFromSchema(t),s.push(this.compileRule(t,i,null,(i.async?"await ":"")+"context.fn[%%INDEX%%](value, field, null, errors, context, label);","value")),s.push("if (errors.length) {"),s.push("\n\t\t\treturn errors.map(err => {\n\t\t\t\tif (err.message) {\n\t\t\t\t\terr.message = context.utils.replace(err.message, /\\{field\\}/g, err.label || err.field);\n\t\t\t\t\terr.message = context.utils.replace(err.message, /\\{expected\\}/g, err.expected);\n\t\t\t\t\terr.message = context.utils.replace(err.message, /\\{actual\\}/g, err.actual);\n\t\t\t\t}\n\t\t\t\tif(!err.label) delete err.label\n\t\t\t\treturn err;\n\t\t\t});\n\t\t"),s.push("}"),s.push("return true;"),t=s.join("\n");var r=new(i.async?q:Function)("value","context",t);return this.opts.debug&&console.log(this._formatter("// Main check function\n"+r.toString())),this.cache.clear(),e.async=i.async,e},t.prototype.compileRule=function(t,e,n,i,s){var r=[],o=this.cache.get(t.schema);return o?((t=o).cycle=!0,t.cycleStack=[],r.push(this.wrapRequiredCheckSourceCode(t,"\n\t\t\t\tvar rule = context.rules["+t.index+"];\n\t\t\t\tif (rule.cycleStack.indexOf(value) === -1) {\n\t\t\t\t\trule.cycleStack.push(value);\n\t\t\t\t\t"+i.replace(/%%INDEX%%/g,t.index)+"\n\t\t\t\t\trule.cycleStack.pop(value);\n\t\t\t\t}\n\t\t\t",e,s))):(this.cache.set(t.schema,t),t.index=e.index,e.rules[e.index]=t,o=null!=n?n:"$$root",e.index++,(n=t.ruleFunction.call(this,t,n,e)).source=n.source.replace(/%%INDEX%%/g,t.index),n=new(e.async?q:Function)("value","field","parent","errors","context","label",n.source),e.fn[t.index]=n.bind(this),r.push(this.wrapRequiredCheckSourceCode(t,i.replace(/%%INDEX%%/g,t.index),e,s)),r.push(this.makeCustomValidator({vName:s,path:o,schema:t.schema,context:e,messages:t.messages,ruleIndex:t.index})),this.opts.debug&&console.log(this._formatter("// Context.fn["+t.index+"]\n"+n.toString()))),r.join("\n")},t.prototype.getRuleFromSchema=function(t){t=this.resolveType(t);var e=this.aliases[t.type];if(e&&(delete t.type,t=P(t,e,{skipIfExist:!0})),!(e=this.rules[t.type]))throw Error("Invalid '"+t.type+"' type in validator schema.");return{messages:Object.assign({},this.messages,t.messages),schema:P(t,this.defaults[t.type],{skipIfExist:!0}),ruleFunction:e}},t.prototype.parseShortHand=function(t){var e=(t=t.split("|").map((function(t){return t.trim()})))[0],n=e.endsWith("[]")?this.getRuleFromSchema({type:"array",items:e.slice(0,-2)}).schema:{type:t[0]};return t.slice(1).map((function(t){var e=t.indexOf(":");if(-1!==e){var i=t.substr(0,e).trim();"true"===(t=t.substr(e+1).trim())||"false"===t?t="true"===t:Number.isNaN(Number(t))||(t=Number(t)),n[i]=t}else t.startsWith("no-")?n[t.slice(3)]=!1:n[t]=!0})),n},t.prototype.makeError=function(t){var e=t.type,n=t.field,i=t.expected,s=t.actual,r={type:'"'+e+'"',message:'"'+t.messages[e]+'"'};return r.field=n?'"'+n+'"':"field",null!=i&&(r.expected=i),null!=s&&(r.actual=s),r.label="label","errors.push({ "+Object.keys(r).map((function(t){return t+": "+r[t]})).join(", ")+" });"},t.prototype.makeCustomValidator=function(t){var e=t.vName;void 0===e&&(e="value");var n=t.fnName;void 0===n&&(n="custom");var i=t.ruleIndex,s=t.path,r=t.schema,o=t.context,a=t.messages;t="rule"+i;var l="fnCustomErrors"+i;return"function"==typeof r[n]?(o.customs[i]?(o.customs[i].messages=a,o.customs[i].schema=r):o.customs[i]={messages:a,schema:r},this.opts.useNewCustomCheckerFunction?"\n \t\tconst "+t+" = context.customs["+i+"];\n\t\t\t\t\tconst "+l+" = [];\n\t\t\t\t\t"+e+" = "+(o.async?"await ":"")+t+".schema."+n+".call(this, "+e+", "+l+" , "+t+'.schema, "'+s+'", parent, context);\n\t\t\t\t\tif (Array.isArray('+l+" )) {\n \t\t"+l+" .forEach(err => errors.push(Object.assign({ message: "+t+".messages[err.type], field }, err)));\n\t\t\t\t\t}\n\t\t\t\t":"\n\t\t\t\tconst "+t+" = context.customs["+i+"];\n\t\t\t\tconst "+(r="res_"+t)+" = "+(o.async?"await ":"")+t+".schema."+n+".call(this, "+e+", "+t+'.schema, "'+s+'", parent, context);\n\t\t\t\tif (Array.isArray('+r+")) {\n\t\t\t\t\t"+r+".forEach(err => errors.push(Object.assign({ message: "+t+".messages[err.type], field }, err)));\n\t\t\t\t}\n\t\t"):""},t.prototype.add=function(t,e){this.rules[t]=e},t.prototype.addMessage=function(t,e){this.messages[t]=e},t.prototype.alias=function(t,e){if(this.rules[t])throw Error("Alias name must not be a rule name");this.aliases[t]=e},t.prototype.plugin=function(t){if("function"!=typeof t)throw Error("Plugin fn type must be function");return t(this)},t.prototype.resolveType=function(t){var e=this;if("string"==typeof t)t=this.parseShortHand(t);else if(Array.isArray(t)){if(0===t.length)throw Error("Invalid schema.");(t={type:"multi",rules:t}).rules.map((function(t){return e.getRuleFromSchema(t)})).every((function(t){return!0===t.schema.optional}))&&(t.optional=!0);var n=!this.opts.considerNullAsAValue;t.rules.map((function(t){return e.getRuleFromSchema(t)})).every((function(t){return t.schema.nullable===n}))&&(t.nullable=n)}if(t.$$type){var i=this.getRuleFromSchema(t.$$type).schema;delete t.$$type;var s,r=Object.assign({},t);for(s in t)delete t[s];P(t,i,{skipIfExist:!0}),t.props=r}return t},t.prototype.normalize=function(t){var e=this,n=this.resolveType(t);return this.aliases[n.type]&&(n=P(n,this.normalize(this.aliases[n.type]),{skipIfExists:!0})),"multi"===(n=P(n,this.defaults[n.type],{skipIfExist:!0})).type?(n.rules=n.rules.map((function(t){return e.normalize(t)})),n.optional=n.rules.every((function(t){return!0===t.optional})),n):"array"===n.type?(n.items=this.normalize(n.items),n):("object"===n.type&&n.props&&Object.entries(n.props).forEach((function(t){return n.props[t[0]]=e.normalize(t[1])})),"object"==typeof t&&(t.type?(t=this.normalize(t.type),P(n,t,{skipIfExists:!0})):Object.entries(t).forEach((function(t){return n[t[0]]=e.normalize(t[1])}))),n)},t}"object"==typeof t&&void 0!==e?e.exports=s():"function"==typeof define&&define.amd?define(s):(i="undefined"!=typeof globalThis?globalThis:i||self).FastestValidator=s()}}),ti=it({"optimize-deps:fastest-validator"(t,e){e.exports=Qn()}})();const ei=new RegExp(/^[-+]?\d+$/),ni=new ti({messages:{color:"The '{field}' field must be an a valid color! Actual: {actual}",measurement:"The '{field}' must be a measurement with specs that are not met. You've either provided wrong value/units or an invalid @ expression. Actual: {actual}",measurementNotAString:"measurement - The provided value of {field} is not a string",measurementMin:"measurement - The provided value of {field} ({actual}) is smaller than the schema's min",measurementMax:"measurement - The provided value of {field} ({actual}) is bigger than the schema's max",measurementInt:"measurement - The provided value of {field} ({actual}) is not an integer"},useNewCustomCheckerFunction:!0});ni.add("html",(function({messages:t},e,n){return{source:`\n if(value === null){\n ${this.makeError({type:"html",actual:"value",messages:t})}\n } else {\n return value;\n }\n `}})),ni.add("css",(function({messages:t},e,n){return{source:`\n if(value === null){\n ${this.makeError({type:"css",actual:"value",messages:t})}\n } else {\n return value;\n }\n `}})),ni.add("measurement",(function({schema:t,messages:e},n,i){const s=new RegExp("^[+-]?(\\d+([.]\\d*)?|[.]\\d+)("+t.units.join("|")+")$","gi");return{source:`\n const validUnits = ['${t.units.join("','")}'];\n\n if(typeof value !== 'string' && !(value instanceof String)){\n ${this.makeError({type:"measurementNotAString",actual:"value",messages:e})}\n return ;\n }\n\n if(!value.match(${s})){\n ${this.makeError({type:"measurement",actual:"value",messages:e})}\n } else {\n var numberPart = value.match(${x})[0];\n if(${v(t,"min")}){\n if(${t.min} > numberPart){\n ${this.makeError({type:"measurementMin",actual:"value",messages:e})}\n }\n }\n if(${v(t,"max")}){\n if(${t.max} < numberPart){\n ${this.makeError({type:"measurementMax",actual:"value",messages:e})}\n }\n }\n if(${v(t,"integer")}){\n if(!numberPart.match(${ei})){\n ${this.makeError({type:"measurementInt",actual:"value",messages:e})}\n }\n }\n }\n return value;\n `}})),ni.add("color",(function({messages:t},e,n){return{source:`\n if(typeof value !== 'string' && !(value instanceof String)){\n ${this.makeError({type:"measurement",actual:"value",messages:t})}\n return ;\n }\n var option;\n function isColor(strColor) {\n if (!option ) {\n option = new Option().style;\n }\n option.color = strColor;\n const res = option.color !== '';\n option.color = '';\n return res;\n }\n if(!isColor(value)){\n ${this.makeError({type:"color",actual:"value",messages:t})}\n }\n return value;\n `}})),ni.alias("amount",{type:"number"});const ii=Tn(),si=(t,e)=>{const n=ni.compile({[e]:t});return function(i,s,r){return function(t,e,n,i,s,r){const o=function(n){e.push({type:i.type,message:n,actual:t})};if(!g(t))return o("Not a dynamic value expression"),null;const a=function(t){if(c.includes(i.type))return B.warning(`${i.type} does not support checkValues method. Returning true without validation`),!0;let n=!0;for(let i=0;ie&&(e=i.position+i.leaf.duration)}return e!==this.calculatedDuration&&(this.calculatedDuration=e,this.resetDuration(),!0)}_rebuildTree(){for(const t in this.children){const e=this.children[t];!0===e.leaf.passive&&this.removeIncident(e.id)}this.passiveAddition=!0,this.buildTree(),this.passiveAddition=!1}_buildTree(){this.buildTree()}buildTree(){}get duration(){return"dynamic"===this.calculatedDuration?this.calculatedDuration:super.duration}set duration(t){super.duration=t}manageEditAttrProps(t,e){const{parentNode:n}=this,i=n.getLeafPosition(this.id),s=b(this[e]);this[e]=t,n.removeIncident(this.id),this._rebuildTree();const r=n.addIncident(this,i);return r.result||(this[e]=s,this._rebuildTree(),n.addIncident(this,i)),this.resetDuration(),r}detachFromParent(){super.detachFromParent(),this.inheritedSelector=null}get inheritedSelector(){return this._inheritedSelector}set inheritedSelector(t){this._inheritedSelector=t;for(const t in this.children)this.children[t].leaf.inheritedSelector=this.selector()}get selectorToPassToChildren(){return this.selector()}exportDefinition(){const t={ClassName:this.constructor.ClassName,version:this.constructor.version,plugin:this.constructor.plugin||this.constructor.plugin_npm_name,plugin_npm_name:this.constructor.plugin_npm_name,attrs:this.attrs,props:this.props,incidents:{},duration:this.duration};for(const e in this.children){const n=this.children[e];!0!==n.leaf.passive&&(t.incidents[e]={id:n.id,position:n.position,leaf:n.leaf.exportDefinition()})}return t}exportLiveDefinition(t=!0){const e=b(this.props);t||delete e.id;const n={Class:this.constructor,attrs:b(this.attrs),props:e,incidents:{}};for(const e in this.children){const i=this.children[e];!0!==i.leaf.passive&&(n.incidents[e]={position:i.position,leaf:i.leaf.exportLiveDefinition(t)})}return n}addIncident(t,e,n={check:!0}){if(!(t instanceof Dn))return B.warning("addIncident rejected, invalid incident provided"),{result:!1,errors:"Invalid Incident provided"};let i;if(t.inheritedSelector=this.selectorToPassToChildren,!0===n.check){const n=super.checkAddition(t,e);if(!n.result)return t.inheritedSelector=null,n;if(i=this.putMessageOnPipe("checkForClip",{},Mi,{selfExecute:!0,direction:H._UP}),!0===i.response){const e=t.putMessageOnPipe("checkForInvalidSelectors",{},null,{selfExecute:!0,direction:H._DOWN});if(e.length>0){const t=[];for(let n=0;ni*(e||0)+(i+1)*(t||0)+i*n,refersToOwnSelector(t,e,n=0){let i=e;!1===Array.isArray(e)&&(i=e.split("."));const s=this.getItem(t,i.slice(0,2+n));return(""===s.props.selector||null==s.props.selector)&&("props"===i[2]||!this.isCombo(s)||this.refersToOwnSelector(t,i,n+3))},cascadeSelectors(t,e,n=""){let i=[];for(let s=0;s({constructor:{Incident:t.incidentClass.targetClass.Incident,plugin_npm_name:t.incidentClass.targetClass.plugin_npm_name,Channel:t.incidentClass.targetClass.Channel,isClip:!1},attrs:i||t.attrs,props:s||t.props,selector:()=>t.props.selector,id:t.props.id,audioClip:null,audio:"no",dynamicDurationValue:null,putMessageOnPipe:D,attributesStaggers:e,propsStaggers:n}),parseElementsDynamics(t,e,n,i,s){const r=`incidents.${s}.attrs`,o=`incidents.${s}.props`,a=qe(e),l=qe(n);for(let e=0;e{const{incidentAttrs:c,incidentProps:u}=_i.parseElementsDynamics(this.staggerAttrs,a.attrs,a.props,i,l),p=_i.getStaggersForChild(r,l,"attrs"),h=_i.getStaggersForChild(p.remainingDynamics,l,"props"),d=_i.getStaggersForChild(p.remainingDynamics,l,"position");r=h.remainingDynamics,o.setValue(`attrs.incidents.${l}.props.id`,`${this.id}_element${Ti}${i}_repeat${Ti}${t}_incident${Ti}${l}`);const m=Di(_i.createDescriptiveIncidentLikeObject(a,p.identifiedDynamics,h.identifiedDynamics,c,u),n);let g=a.position;1===d.identifiedDynamics.length&&(g=d.identifiedDynamics[0].stagger.calculateValues(new Array(s),this.initParams)[i]),e.addChild(m,g)})),a.addChild(e,_i.getRepeatPosition(o.props.delay,o.props.hiatus,e.duration,t))}this.addChild(a,0)}}function Di(t,e){const n=e.context.audio;if(n&&"off"===t.audio||!n&&"only"===t.audio)return null;if(v(t.props,"selector")&&(!n&&t.props.selector.startsWith("~")||n&&!t.props.selector.startsWith("~")&&!t.constructor.isClip))return null;if(t.constructor.isClip){if(!n){const n=new Zn(t,e);return n.plugin_channel_class=R,n}return n?t.audioClip:t.realClip}if(t.constructor.isCombo)return new Oi(t,e);if(t.constructor.isGroup){const n=Y({id:t.id,attrs:t.attrs,props:t.props,Incident:t.constructor.Incident,plugin_npm_name:t.constructor.plugin_npm_name,Channel:t.constructor.Channel,DescriptiveIncident:t});for(const i in t.children){const s=Di(t.children[i].leaf,e);null!==s&&n.addChild(s,t.children[i].position)}return n}return new Jn(t,e)}function Bi(t){return function(){for(let e=0;e{i.execute();for(let n=0;n{i.execute();for(let t=0;t0&&(i=e[0].positionDelta);const s=this.checkResize(t.fraction,n,i);return s.result?{result:!0,execute:()=>{s.execute();for(let n=0;n0;)t.removeAttribute(t.attributes[0].name);t.setAttribute(Wi,!0)}get targetHost(){return this.props.host}}class Ui extends Li{constructor(t={},e={},n){super(t,e,n),e={...e,html:""!==this.html?this.html:e.html,css:""!==this.css?this.css:e.css,fonts:this.fonts.length>0?this.fonts:e.fonts};const i=new(document.head.createShadowRoot||document.head.attachShadow?Hi:zi)(e);this.ownContext={...i.context,initParams:e.initParams},this.iframe=i.iframeElement,this.onAfterRender()}onAfterRender(){}get html(){return""}get css(){return""}get fonts(){return[]}get rootElement(){return this.context.rootElement}exportConstructionArguments(){return{attrs:this.attrs,props:{...this.props,host:void 0,html:!0===(this.DescriptiveIncident?.constructor).customClip?"":this.context.rootElement.innerHTML}}}}function Gi(){return{result:!0}}class qi extends Ai{constructor(t,e){super(t,e),this.listeners={},this.runTimeInfo={currentMillisecond:0,state:"idle"},this.listeners={},this.previousTimeStamp=-1,this.speed=1}_setState(t,e={}){if(t!==this.runTimeInfo.state){this.runTimeInfo.state=t,this.putMessageOnPipe("setState",{newState:t,options:e},"Clips",{selfExecute:!1,direction:H._DOWN});for(const n in this.listeners)this.listeners[n].funct(this.runTimeInfo.currentMillisecond,t,e)}}handleSetState(t,e){this._setState(e.newState,e.options||{})}play(t=!1){switch(this.runTimeInfo.state){case"idle":case"paused":case"armed":case"transitional":case"blocked":if("paused"===this.runTimeInfo.state){const t=(new Date).getTime()-this.pauseMoment;this.previousTimeStamp+=t}this._setState("playing"),this.onPlay(),t||window.requestAnimationFrame((t=>{this.step(t)}))}}pause(){"playing"===this.runTimeInfo.state&&(this._setState("paused"),this.pauseMoment=(new Date).getTime(),this.onWait())}arm(){"transitional"!==this.runTimeInfo.state&&"blocked"!==this.runTimeInfo.state||this._setState("armed")}complete(){this._setState("idle"),this.previousTimeStamp=-1}stop(){this._setState("transitional"),this.previousTimeStamp=-1}block(t={}){v(t,"exception")&&"playing"!==this.runTimeInfo.state||(this._setState("blocked",t),this.previousTimeStamp=-1)}onPlay(){}onWait(){}playableProgress(t,e){if(!this.isTheRootClip)return!1;for(const t in this.listeners){const s=this.listeners[t];!0!==s.onlyOnStateChange&&(Math.abs(e+s.cavaDelta-this.runTimeInfo.currentMillisecond)>s.threshold?(s.funct((n=e,i=s.roundTo,Math.round(n/i)*i),this.runTimeInfo.state),s.cavaDelta=0):s.cavaDelta+=Math.abs(e-this.runTimeInfo.currentMillisecond))}var n,i;return this.onProgress(t,e),this.runTimeInfo.currentMillisecond=e,!0}set executionSpeed(t){this.isTheRootClip&&(this.speed=parseFloat(t))}step(t,e=!1){if("playing"!==this.runTimeInfo.state)return;-1===this.previousTimeStamp&&(this.previousTimeStamp=t);const n=Math.round(this.runTimeInfo.currentMillisecond+(t-this.previousTimeStamp)*this.speed),i=n/this.duration;return i>=1?(this.playableProgress(1,this.duration),void this.complete()):i<0?(this.playableProgress(0,0),void this.complete()):(this.playableProgress(i,n),this.previousTimeStamp=t,void(e||window.requestAnimationFrame(this.step.bind(this))))}subscribe(t,e,n,i,s=!1){n||(n=0),i||(i=1),this.listeners[t]={funct:e,threshold:n,roundTo:i,cavaDelta:0,onlyOnStateChange:s}}unsubscribe(t){v(this.listeners,t)&&delete this.listeners[t]}subscribeToDurationChange(t){return!!this.isTheRootClip&&(this.realClip.subscribeToDurationChange(t),!0)}}class Ki{constructor(){this.output=h.createGain(),this.gainNode=h.createGain(),h.createStereoPanner&&(this.pannerNode=h.createStereoPanner()),h.createStereoPanner?(this.pannerNode.connect(this.gainNode),this.gainNode.connect(this.output),this.input=this.pannerNode):(this.gainNode.connect(this.output),this.input=this.gainNode)}connect(t){this.output.connect(t)}disconnect(){this.output.disconnect()}}function Xi(t){const e=window.atob(t),n=e.length,i=new Uint8Array(n);for(let t=0;t{this._setBuffer(s,t,e)}));else{const t=new XMLHttpRequest;t.open("GET",s.src,!0),t.responseType="arraybuffer",this.soundLoaded=!1,t.onload=()=>{h.decodeAudioData(t.response,(t=>{this._setBuffer(s,t,e)}),this.onError)},t.send()}}this.setContext({contextLoaded:!0,audio:!0,document,window,rootElement:document.body,unmount:D,masterNode:e,audioContext:h})}_setBuffer(t,e,n){t.soundLoaded=!0,t.buffer=e,t.audioNodeSet=new Ki,t.audioNodeSet.connect(n.input),t.pubSub?.pub()}getElementByMCID(t){return v(this.elementsByMCID,t)?this.elementsByMCID[t]:null}getElements(t){if(!t.startsWith("~")){if(Yi.exec(t)){const e=t.split('"')[1];return[this.elementsByMCID[e]]}return[]}if((t=t.substring(1)).startsWith("#"))return v(this.audioSources,t.substring(1))?[this.audioSources[t.substring(1)]]:[];if(!t.startsWith("."))return[];const e=t.substring(1),n=[];for(const t in this.audioSources)t.classes.indexOf(e)>=0&&n.push(t);return n}getMCID(t){return t.mcid}setMCID(t,e){t.mcid=e}getElementSelectorByMCID(t){return`[data-mcid="${t}"]`}}class Qi extends Li{constructor(t,e){super(t,e),this.audioNodeSet=new Ki,this.audioNodeSet.connect(h.destination);const n=new Zi(this.props.audioSources,this.audioNodeSet).context;n.initParams=e.initParams,this.ownContext=n}handleRecalcDuration(t,e){return!!super.handleRecalcDuration(t,e)&&!!this.putMessageOnPipe("recalcDuration",e.childId?{childId:this.id}:{},"Groups",{selfExecute:!1,direction:H._UP}).response}onProgress(t,e,n,i=!1){if(e>this.duration)return super.onProgress(1,this.duration,this.id,i);const s=this.delay+this.calculatedDuration+this.hiatus;let r=0===s?0:e%s;0!==e&&0===r&&(r=this.delay+this.calculatedDuration);let o=r-this.delay;if(o<0)return;o>this.calculatedDuration&&(o=this.calculatedDuration);const a=0===this.calculatedDuration?0:o/this.calculatedDuration;super.onProgress(a,o,this.id,i)}_onGetContextOnce(t){this.audioNodeSet.disconnect(),this.parentClipContext=t,this.audioNodeSet.connect(t.masterNode?.input)}lastWish(){this.audioNodeSet.output.disconnect(),this.audioNodeSet.output.connect(h.destination)}get volume(){return this.audioNodeSet.output.gain.value}set volume(t){this.audioNodeSet.output.gain.value=t}}class ts extends Hi{constructor(t={}){super(t),this.context.fragment=!0,this.rendered=!1,this.removeDOMTimeout=null}get targetHost(){return this._targetHost||(this._targetHost=document.createElement("div"),this._targetHost.style.zIndex="-1",this._targetHost.style.width="0px",this._targetHost.style.height="0px",this._targetHost.style.overflow="hidden",this._targetHost.style.position="relative"),this._targetHost}checkProps(){return f(this.props)?(v(this.props,"html")||(this.props.html=""),v(this.props,"css")||(this.props.css=""),!0):(B.error(`HTMLFragmentContextHandler expects an object on its constructor. ${typeof this.props} passed`),!1)}renderOnDOM(){this.removeDOMTimeout&&clearTimeout(this.removeDOMTimeout),this.rendered||(document.body.append(this._targetHost),this.rendered=!0)}removeFromDOM(){this.removeDOMTimeout&&clearTimeout(this.removeDOMTimeout),this.removeDOMTimeout=setTimeout((()=>{try{document.body.removeChild(this._targetHost),this.rendered=!1}catch(t){B.info("Clip's DOM element was not found and thus not removed from DOM")}}),50)}}class es extends Li{constructor(t={},e=null,n){let i=t,s=e;null==s&&(i={},s=t),super(i,s,n),s.html=v(s,"html")?s.html:this.html,s.css=v(s,"css")?s.css:this.css,s.fonts=v(s,"fonts")?s.fonts:this.fonts;const r=new ts(s);this.ownContext={...r.context,isHostedClip:!1},this.iframe=r.iframeElement,this.contextHandler=r,this.onDOMCLipInitialise()}exportConstructionArguments(){return{attrs:this.attrs,props:{...this.props,html:this.context.rootElement.innerHTML}}}onDOMCLipInitialise(){}get rootElement(){return this.context.rootElement}renderOnDOM(){this.contextHandler.renderOnDOM()}removeFromDOM(){this.contextHandler.removeFromDOM()}}class ns{constructor(){this.context={},this.isNullClip=!0}get duration(){return 0}set duration(t){}addIncident(){return F}moveIncident(){return F}removeIncident(){return F}resizeIncident(){return F}getIncidentsByChannel(){return{}}flash(){}_resize(){}onProgress(){}renderOnDOM(){}removeFromDOM(){}get volume(){return 0}set volume(t){}setVolume(){}}class is{constructor(t){this.runTimeInfo={currentMillisecond:0,state:"transitional"},this.id=M(),this.realClip=t.descriptiveIncident.realClip;const e=t.descriptiveIncident.realClip.exportConstructionArguments(),n={...e.props,selector:void 0,host:t.host,id:this.id};this.ownClip=new t.descriptiveIncident.constructor.Incident(e.attrs,n),t.descriptiveIncident.realClip.addContext({clipId:this.id,context:this.ownClip.context,synchronize:t.synchronize,runTimeInfo:this.runTimeInfo},!0)}onProgress(t,e,n=!1){for(const t in this.realClip.instantiatedChannels)this.realClip.instantiatedChannels[t].moveTo(this.runTimeInfo.currentMillisecond,e,this.id,!0);this.runTimeInfo.currentMillisecond=e}}function ss(t,e,n){const i=t.realClip[e](n),s=t.audioClip[e](n);return i.result&&s.result?(i.execute(),s.execute(),t.putMsgOnPipeWithResult("flash",{},"RootClip",{selfExecute:!0,direction:H._UP})):i}class rs extends qi{constructor(t,e=null){let n=t,i=e;if(null===i&&(n={},i=t),super(n,i),this.volumeChangeSubsribers={},this.mustHaveNullClip=!1,this.initParams=i.initParams||{},v(i,"initParamsValidationRules")){const t=function(t,e,n="Error on validation"){try{const i=ai(t)(e);if(!0===i)return{result:!0};let s=`${n}:`;for(let t=0;t',css:"",fonts:[]});a.props.host=t.rootElement,a.Incident=this.constructor.Incident}else"only"===this.audio&&!0!==this.props.root?this.isTheRootClip=!1:(this.isTheRootClip=!0,this.blockingWaitings={},a.Incident=this.constructor.Incident);if("on"===this.audio||"only"===this.audio){const t={id:this.id,attrs:{},props:{audioSources:v(i,"audioSources")?i.audioSources:this.audioSources,runTimeInfo:this.runTimeInfo,subscribe:this.subscribe.bind(this),hiatus:this.hiatus,delay:this.delay,repeats:this.repeats,initParams:this.initParams},plugin_npm_name:this.constructor.plugin_npm_name,Channel:this.constructor.Channel,Incident:Qi,DescriptiveIncident:this};v(i,"audioSources")&&(t.props.audioSources=this.resolveAudioSources(i.audioSources)),this.audioClip=Y(t)}else this.audio="off",this.audioClip=new ns;"only"===this.audio?this.realClip=new ns:!this.isTheRootClip&&(v(o.attrs,"expression")||v(o.props,"expression")||v(o.attrs,"initParams")||v(o.props,"initParams"))?(this.mustHaveNullClip=!0,this.realClip=new ns):this.realClip=Y(a,!0),this.dynamicDurationValue=null,this.passiveAddition=!0,this._buildTree(),this.passiveAddition=!1,this.constructor.isAnimation&&v(this.props,"duration")&&this.resize(this.duration)}get selectorToPassToChildren(){return null}get inheritedSelector(){return this._inheritedSelector}set inheritedSelector(t){this._inheritedSelector=t}get html(){return""}get css(){return""}get fonts(){return[]}get audioSources(){return[]}resolveAudioSources(t){const e=b(t);for(let t=0;t0&&!this.isTheRootClip?"dynamic":v(this.props,"duration")?this.repeats*(this.delay+this.props.duration+this.hiatus):super.duration}set duration(t){if(0!=this.propsStaggers.length){for(let e=0;e{i.block(n)}),0)}handleUnBlock(t,e){if(!this.isTheRootClip)return this.bypass();v(this.blockingWaitings,e.id)&&(delete this.blockingWaitings[e.id],0===Object.keys(this.blockingWaitings).length&&("playing"===this.statusBeforeBlock?(this.previousTimeStamp=-1,this.play()):this.arm()))}stop(){super.stop(),this.blockingWaitings={}}onProgress(t,e){this.realClip.onProgress(t,e),this.audioClip.onProgress(t,e)}paste(t){return this.isTheRootClip?new is({host:t,descriptiveIncident:this}):null}flash(){this.realClip.flash(),this.audioClip.flash()}get volume(){return"off"===this.audio?0:this.audioClip.volume}setVolume(t){if("off"===this.audio)return{result:!1,errors:[{type:"can not set volume of Clip with audio off"}]};if(t<0||t>1)return{result:!1,errors:[{type:"invalid volume number"}]};this.audioClip.volume=t;for(const e in this.volumeChangeSubsribers)this.volumeChangeSubsribers[e](t);return{result:!0}}attachMediaElementSource(t){"off"!==this.audio&&this.audioClip.context.audioContext?.createMediaElementSource(t).connect(this.audioClip.context.masterNode?.input)}volumeChangeSubscribe(t,e){return this.putMessageOnPipe("volumeChangeSubscribe",{type:"subscribe",id:t,funct:e},"RootClip",{selfExecute:!0,direction:H._UP}).response}volumeChangeUnsubscribe(t){return this.putMessageOnPipe("volumeChangeSubscribe",{type:"unsubscribe",id:t},"RootClip",{selfExecute:!0,direction:H._UP}),0}handleVolumeChangeSubscribe(t,e){if(!this.isTheRootClip)return this.bypass();switch(e.type){case"subscribe":return this.volumeChangeSubsribers[e.id]=e.funct,this.volume;case"unsubscribe":return delete this.volumeChangeSubsribers[e.id],0}return!1}}rs.isClip=!0,rs.Incident=Ui,rs.plugin_npm_name="@donkeyclip/self-contained-incidents",rs.version=Si,rs.Channel=z,rs.ClassName="HTMLClip",rs.propsValidationRules=Ei;class os extends rs{constructor(t,e=null){let n=t,i=e;null===e&&v(t,"audioSources")?(n={},i=t):null===e&&(i={}),i.audio="only",super(n,i)}}class as extends z{constructor(t){super(t),this.playingIncidentsIds=[],this.transitioned=!1,t.subscribe(M(),this._stateChange.bind(this),0,1,!0)}_stateChange(t,e,n={}){"paused"!==e&&"idle"!==e&&"blocked"!==e||(this._stopPlayingIncidents(n),this.transitioned=!0)}_stopPlayingIncidents(t={}){for(let e=0;er+o.duration?o.duration:e-r,o.onProgress(a,n,!0)}return}this.transitioned&&(t=0,this.transitioned=!1);const r=t>e;for(let i=0;it&&u<=e||r){l.stop(n);const t=this.playingIncidentsIds.indexOf(p);t>-1&&this.playingIncidentsIds.splice(t,1)}if(a>=(r?0:t)&&ae){const t=(e-a)/c>=1,i=t?c:e-a,s=t?1:i/c;l.play(s,i,n)&&this.playingIncidentsIds.push(p)}}this.runTimeInfo.currentMillisecond=e}}class ls extends q{constructor(t={},e={},n){super(),this.attrs=t,this.props=e,this.dna=n,this.context=n.context,this.mcid=n.mcid,this.id=e.id||M(),this.modelId=e.modelId,this.gotContext=!1,this.plugin_channel_class=as,this.mc_plugin_npm_name="motor-cortex-js-media-playback",v(e,"plugin_channel_class")&&(this.plugin_channel_class=e.plugin_channel_class),v(e,"mc_plugin_npm_name")&&(this.mc_plugin_npm_name=e.mc_plugin_npm_name),this.hasIncidents=!1,this.autoGenerated=!1,this.onInitialise(t,e)}get selector(){return this.props.selector}get element(){return this.context.getElementByMCID(this.mcid)}_onGetContextOnce(){if(!this.context.fragment)try{this.gotContext||(this.onGetContext(),this.gotContext=!0)}catch(t){B.error(t,this.mcid)}}onGetContext(){B.info('Overwrite the "onGetContext" method with the code you want to get executed',"info")}lastWish(){}onInitialise(t,e){B.info('Overwrite the "onInialise" method with the code you want to get executed',"info")}onProgress(t){}play(t){return!0}stop(){}}const cs={npm_name:"@donkeyclip/motorcortex-soundsystem",name:"Internal MotorCortex Soundsystem",incidents:[{exportable:class extends ls{play(t){if(!this.element.soundLoaded)return this.setBlock("loading sound"),this.element.pubSub.sub(this.id,(()=>{this.unblock()})),!1;let e=0;return v(this.props,"startFrom")&&(e=this.props.startFrom),this.audioNode=h.createBufferSource(),this.audioNode.buffer=this.element.buffer,this.audioNode.connect(this.element.audioNodeSet.input),this.audioNode.start(0,(t+e)/1e3),!0}stop(){this.audioNode&&this.audioNode.stop()}},name:"AudioPlayback"},{exportable:class extends K{onProgress(t){const e=this.getFraction(t);if(!this.element.soundLoaded)return this.setBlock("loading sound"),this.element.pubSub.sub(this.id,(()=>{this.unblock()})),!1;const n=(this.targetValue-this.initialValue)*e+this.initialValue;switch(this.attributeKey){case"gain":this.element.audioNodeSet.gainNode.gain.value=n;break;case"pan":this.element.audioNodeSet.pannerNode.pan.value=n}return!0}getScratchValue(){return"pan"===this.attributeKey?v(this.element.startValues,"pan")?this.element.startValues.pan:0:"gain"===this.attributeKey?v(this.element.startValues,"gain")?this.element.startValues.gain:1:void 0}},name:"AudioEffect"}],Clip:{exportable:Qi},audio:"only"},us="forwards",ps="backwards";class hs{constructor(){this._executionSubscribers={},this._bwExecutionSubscribers={},this.subPeriod=10,this._currentPeriod={},this._nextIterationLanes={}}reset(){this._executionSubscribers={},this._bwExecutionSubscribers={},this._nextIterationLanes={}}executionSubscribers(t,e){const n=e===us?this._executionSubscribers:this._bwExecutionSubscribers;return n[t]??(n[t]={}),n[t]}subscribe(t,e,n,i,s){const r=this.executionSubscribers(t,e);r[n]??(r[n]={}),r[n][i]=()=>{var e;(e=this._nextIterationLanes)[t]??(e[t]={}),this._nextIterationLanes[t][i]=s}}nextIterationLanes(t,e){var n;return(n=this._nextIterationLanes)[t]??(n[t]={...e}),this._nextIterationLanes[t]}setNextIterationLanes(t,e){this._nextIterationLanes[t]=e}currentPeriod(t){var e;return(e=this._currentPeriod)[t]??(e[t]=0),this._currentPeriod[t]}setCurrentPeriod(t,e){this._currentPeriod[t]=e}}function ds(t,e,n,i,s=!1){const r=e[t[i].id];r.setInitialValue(n,s);const o=function(t,e,n,i){let s=!1;const r=Object.keys(e);for(let t=0;t=t&&i.millisecondt&&i.millisecond+c<=l+t||i.millisecondl+t)&&a.push(i)}return a}addElementToLane(t,e,n,i){const s=[],r=A(t,e);this.incidentsById[i.id]=i;const o={millisecond:n,id:i.id};this.laneExists(t,e,!0),this.lanes.pushValue(r,o),this.lanes[r].sortBy("millisecond");const a=Array.from(this.lanes[r]),l=a.findIndex((t=>t.id===i.id));if(v(i.id)?this.belongingLaneKeysByAnimationId.pushValue(i.id,r):this.belongingLaneKeysByAnimationId.setValue(i.id,[r]),0===l)if(a.length>1){const t=this.incidentsById[a[1].id].pureInitialValues;s.push((()=>{i.setInitialValue(t)}))}else s.push((()=>{i.setInitialValue()}));else s.push((()=>{const t=this.incidentsById[a[l-1].id].animatedAttributeValue;i.setInitialValue(t)}));if(v(this.comboAttributes,e)&&s.push((()=>{ds(a,this.incidentsById,i.initialValue,l)})),l+1{this.incidentsById[t].setInitialValue(i.animatedAttributeValue),this.incidentsById[t].gotContext&&(this.incidentsById[t].lastWish(),this.incidentsById[t].onGetContext())}))}return s}updateLane(t,e){const n={},i=this;for(let e=0;et.millisecond-e.millisecond));const a=v(this.comboAttributes,i.attribute);for(let t=0;tt.millisecond-e.millisecond)),this.lanes[t]=s;for(let t=0;tt.id===e)),i=s.findIndex((t=>t.id===e));if(n===i&&i<=1)continue;const l=this.incidentsById[s[i].id];if(n+1n?n:i;ds(s,this.incidentsById,this.incidentsById[o[n-1].id].animatedAttributeValue,t,!0)}else this.incidentsById[o[n+1].id].setInitialValue(this.incidentsById[o[n-1].id].animatedAttributeValue),this.incidentsById[o[n+1].id].onGetContext();if(0===i?a?ds(s,this.incidentsById,this.incidentsById[o[0].id].pureInitialValues,i,!0):(l.setInitialValue(this.incidentsById[o[0].id].pureInitialValues),l.onGetContext()):a?ds(s,this.incidentsById,this.incidentsById[s[i-1].id].animatedAttributeValue,i,!0):(l.setInitialValue(this.incidentsById[s[i-1].id].animatedAttributeValue),l.onGetContext()),i+1>=s.length)continue;if(a){ds(s,this.incidentsById,l.animatedAttributeValue,i+1,!0);continue}const c=this.incidentsById[s[i+1].id];c.setInitialValue(l.animatedAttributeValue),c.onGetContext()}}}deleteAnimations(t){const e={};for(let n=0;n=n.length||!1===u)continue;if(v(this.comboAttributes,l.attribute)){ds(n,this.incidentsById,u,r,!0);continue}const p=this.incidentsById[n[r].id];p.setInitialValue(u),p.onGetContext()}delete this.belongingLaneKeysByAnimationId[t[n]]}return e}recalcScratchValues(t){const e=Object.keys(this.lanes);for(let n=0;n0){const e=this.incidentsById[s[0].id],n=e.getScratchValue(t),r=P(i);v(this.comboAttributes,r.attribute)?ds(s,this.incidentsById,n,0,!0):e.setInitialValue(n),e.lastWish(),e.onGetContext()}}}getLastAffectedIndex(t,e,n){return this.lastAnimatedItemPerLane[t]?this.lastAnimatedItemPerLane[t][e]&&!n||(this.lastAnimatedItemPerLane[t][e]=[0,this.incidentsById[this.lanes[e][0].id].duration+this.lanes[e][0].millisecond]):this.lastAnimatedItemPerLane[t]={[e]:[0,this.incidentsById[this.lanes[e][0].id].duration+this.lanes[e][0].millisecond]},this.lastAnimatedItemPerLane[t][e]}setLastAffectedIndex(t,e,n){this.lastAnimatedItemPerLane[t]||(this.lastAnimatedItemPerLane[t]={}),this.lastAnimatedItemPerLane[t][e]=[n,this.incidentsById[this.lanes[e][n].id].duration+this.lanes[e][n].millisecond]}}function gs(t){if(t){const e=Object.keys(t);for(let n=0;n0){const t=this.incidentsById[p[0].id];o=!0,r.push({type:"unauthorised, overlapping incidents on the same element",element_mcid:c,attribute:u,millisecond:p[0].millisecond,incident:t?{attrs:t.DescriptiveIncident.attrs,props:t.DescriptiveIncident.props,duration:t.duration}:void 0})}if(!o){const t=n.addElementToLane(c,u,a.millisecond,l);s.push((()=>{for(let e=0;e0&&"all-or-nothing"===e)return{result:!1,errors:r};const o=this.LanesHandler;return{result:!0,errors:r,execute:function(){for(let t=0;tt.millisecond-e.millisecond)),n.lanes.setValue(e,s)}for(let t=0;t0&&s.push({type:"unauthorised, overlapping animations on the same element",meta:{element_mcid:a,attribute:l,newAnimation:r,overlappingAnims:o}});break}}if(s.length>0)return{result:!1,errors:s};const r=this;return{result:!0,execute:function(){r.LanesHandler.updateLane(n,e),r.irema.reset()}}}checkResizedIncidents(t,e=!1){const n=[];for(let e=0;e0&&s.push({type:"unauthorized overlapping animations on the same element",meta:{element_mcid:o,attribute:a,newAnimation:p,overlappingAnims:h}})}}if(s.length>0)return{result:!1,errors:s};const r=this;return{execute:function(){for(let e=0;e=i){if(!r||0===h){const n=Math.floor(l.millisecond/this.irema.subPeriod);this.irema.subscribe(s,us,n,t,e)}o=!1;break}if(u<=n)h=n&&u<=i)){a.push(l),c=h,p=!1;break}a.push(l),c=h,p=!0,h=0;p--){const a=e[p];if(cn)p>0?e[p-1].millisecond+this.incidentsById[e[p-1].id].durationi)){o.push(a),l=p,u=!1;break}o.push(a),l=p,u=!0,p>0?c=this.incidentsById[e[p-1].id].duration+e[p-1].millisecond:r=!1}}if(l!==a[0]&&this.LanesHandler.setLastAffectedIndex(s,t,l),0===o.length)return!0;const p=o.length-1,h=this.incidentsById[o[p].id],d=o[p].millisecond,m=u?0:i-d;return h.onProgress(m,s),r}moveTo(t,e,n,i=!1){const s=e>=t?us:ps,r=this.irema.executionSubscribers(n,s);(i||s!==this.direction)&&(this.irema._nextIterationLanes={});const o=this.irema.nextIterationLanes(n,this.lanes),a=this.irema.currentPeriod(n),l=Math.floor(e/this.irema.subPeriod);if(s===us)for(let t=a;t<=l;t++)gs(r[t]);else for(let t=a;t>=l;t--)gs(r[t]);const c={},u=Object.keys(o),p=s===us?this.slipIntoLaneForwards.bind(this):this.slipToLaneBackwards.bind(this);for(let s=0;s0?"dynamic":super.duration}set duration(t){if(this.propsStaggers.length>0){for(let e=0;e0){let e=`Error on plugin's "${t.npm_name}" Clip instantiation. Errors:`;for(let t=0;t0){let e=`Error on plugin's "${t.npm_name}" "${o.name}" instantiation. Errors:`;for(let t=0;td}}ys.Incident=K,ys.plugin_npm_name=p,ys.version=Si,ys.Channel=fs,ys.ClassName="Incident",ys.attrsValidationRules=null,ys.propsValidationRules=Ci;const xs=Math.PI/180,Cs=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skewX","skewY"];class ws extends K{constructor(t={},e={},n){super(t,e,n),this.compoAttributes={transform:Cs}}getScratchValue(){let t=this.attributeKey;if("cssOffset"===t&&(t="offset"),"transform"!==t){const e=this.context.window.getComputedStyle(this.element)[t];return void 0!==e&&""!==e?e:0}const e=this.compoAttributes[t],n=function(t,e){const n=t.getComputedStyle(e).transform;return""===n||"none"===n?{rotate:"0deg",rotateX:"0deg",rotateY:"0deg",scaleX:1,scaleY:1,scale:1,skewX:"0deg",skewY:"0deg",translateX:"0px",translateY:"0px"}:function(t){const e=Math.atan2(t[1],t[0]),n=Math.pow(t[0],2)+Math.pow(t[1],2),i=Math.pow(t[2],2)+Math.pow(t[3],2),s=Math.round(100*Math.sqrt(n))/100,r=Math.round((t[0]*t[3]-t[2]*t[1])/s*100||0)/100,o=Math.atan2(t[0]*t[2]+t[1]*t[3],n),a=Math.atan2(t[1]*t[3]+t[0]*t[2],i);return{rotate:`${e/xs||0}deg`,scaleX:s===r?1:s??1,scaleY:s===r?1:r??1,scale:s===r&&null!=s?r:1,skewX:(1===n?o/xs:0)+"deg",skewY:(1===i?a/xs:0)+"deg",translateX:`${t[4].trim()}px`,translateY:`${t[5].trim()}px`}}(n.split("(")[1].split(")")[0].split(","))}(this.context.window,this.element),i=this.context.window.getComputedStyle(this.element),s={};let r;for(let t=0;t0)return B.error("The provided attributes for Combo Incident are invalid"),{result:!1,errors:i};let s=[];for(let t=0;t0&&(s=s.concat(t.errors))}const n=L(e.props,e.incidentClass.propsValidationRules,e.incidentClass);n.result||(s=s.concat(n.errors))}if(s.length>0)return{result:!1,errors:s};this.dynamicDurationValue=null}get incidents(){return null}get duration(){return null!==this.dynamicDurationValue?this.dynamicDurationValue:"dynamic"}set duration(t){super.duration=t}exportDefinition(){const t={...this.attrs,incidents:function t(e){const n=[];for(let i=0;i({startMillisecond:i,startState:s,stations:n}),destination(i){null!=i?this.station(i):i=n[n.length-1],t.playableProgress(i/t.duration,i),"playing"===s||"blocked"===s&&"playing"===t.statusBeforeBlock?t.play():i>=t.duration?t.complete():t.arm(),e.push(this.exportLog)}}}(t,this.memory):(B.error("startJourney expects an Incident as an argument"),!1)}}const $s=function(){const t=(t,e)=>t.startsWith("on")&&"function"==typeof e,e=t=>t.substr(2).toLowerCase();return function(n,i,...s){if("function"==typeof n)return n({...i,children:s});const r=function(n,i){if(!i)return n;for(let[s,r]of Object.entries(i))if(t(s))n.addEventListener(e(s),r);else if("class"===s){const t=Array.isArray(r)?r:[r];n.classList.add(...t)}else n.setAttribute(s,r);return n}(document.createElement(n),i);return s.flat().forEach((t=>{if(!1!==t){const e=(t=>"string"==typeof t)(t)?function(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild}(t):t;r.appendChild(e)}})),r.outerHTML}}(),Ns=$s,js={easings:In,clipFromDefinition:W},Fs=vs(cs);if(!Fs)throw new Error("failed to create audio plugin");const{AudioEffect:Rs,AudioPlayback:zs,Clip:Ws}=Fs}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t=n(584),e=n(657),i=n.n(e);const s=JSON.parse('{"u2":"@donkeyclip/motorcortex-subtitles","i8":"3.1.3"}');var r=n(359),o=n.n(r);class a extends t.Effect{getScratchValue(){return""}onProgress(t){for(const e in this.targetValue){const{start:n,end:i,text:s}=this.targetValue[e];if(t>=1e3*n&&t<1e3*i){this.element.innerHTML=s;break}this.element.innerHTML=""}}}const l={npm_name:"parse-text-definition",version:"1.0.0",incidents:[{exportable:a,name:"ParseTextIncident"}]},c=(0,t.loadPlugin)(l);class u extends t.HTMLClip{get html(){return'\n
      \n
      \n
      \n '}get css(){let t="flex-end";return"top"==this.attrs.position?t="flex-start":"center"==this.attrs.position&&(t="center"),`\n .container {\n display:flex;\n justify-content:center;\n align-items:${t};\n font-size:${this.attrs.fontSize||12}px;\n color:${this.attrs.textColor||"white"};\n text-shadow:${this.attrs.textShadow||"none"};\n font-family: ${this.attrs.fontFamily||"'Ubuntu'"};\n width: 100%;\n height: 100%;\n }\n\n #subs-container{\n max-width:${this.attrs.maxWidth?this.attrs.maxWidth+"px":"100%"};\n text-align:center;\n padding-top:${this.attrs.paddingTop||0}px;\n padding-bottom:${this.attrs.paddingBottom||0}px;\n }\n `}buildTree(){try{const t=o()(this.attrs.subtitles),e=new c.ParseTextIncident({animatedAttrs:{subsArray:t}},{duration:1e3*t[t.length-1].end,selector:"#subs-container"});this.addIncident(e,0)}catch(t){console.error("Error while loading subtitles",t)}}}const p={npm_name:s.u2,version:s.i8,incidents:[{exportable:u,name:"ParseText",attributesValidationRules:{fontSize:{type:"number",optional:!0},textColor:{type:"color",optional:!0},fontFamily:{type:"string",optional:!0},position:{type:"enum",optional:!0,values:["top","center","bottom"]},maxWidth:{type:"number",optional:!0},paddingTop:{type:"number",optional:!0},paddingBottom:{type:"number",optional:!0},subtitles:"string"}}]},h=(0,t.loadPlugin)(p),d=new t.HTMLClip({html:'\n
      \n
      \n
      ',css:"\n .container{\n width:100%;\n height:100%;\n position:relative;\n background:#151515;\n }\n",host:document.getElementById("clip"),containerParams:{width:"720px",height:"640px"}}),m=new h.ParseText({fontSize:14,textColor:"white",fontFamily:"Ubuntu",subtitles:"\n1\n00:00:00,001 --\x3e 00:00:05,000\nThese are some captions\n\n2\n00:00:05,000 --\x3e 00:00:10,000\nThese are some other captions\n\n3\n00:00:12,000 --\x3e 00:00:15,000\nThese are some other captions that are here. A Long\nlong long long long long long long long long long\nlong long long long long long long long long long\nlong long long long long long long long long long\nlong long long long long long long long long text.\n\n4\n00:00:20,000 --\x3e 00:00:23,000\nThis is the end of subtitles.. That was fun!? Right?\n",position:"bottom",maxWidth:400,paddingBottom:50},{selector:"#subs-container",containerParams:{width:"720px",height:"640px"}});d.addIncident(m,0),new(i())({clip:d})})()})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d9a615d2..4f1ec0b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@babel/plugin-syntax-jsx": "7.23.3", "@babel/plugin-transform-react-jsx": "7.23.4", "@babel/preset-env": "7.23.5", - "@donkeyclip/motorcortex": "9.12.0", + "@donkeyclip/motorcortex": "9.13.1", "@donkeyclip/motorcortex-player": "2.10.11", "@rollup/plugin-babel": "5.3.1", "@rollup/plugin-commonjs": "22.0.2", @@ -1855,9 +1855,9 @@ } }, "node_modules/@donkeyclip/motorcortex": { - "version": "9.12.0", - "resolved": "https://registry.npmjs.org/@donkeyclip/motorcortex/-/motorcortex-9.12.0.tgz", - "integrity": "sha512-8LDLIX4RuGzqlpPC8aNHJ6UxPsCkN0KCWx/Pkll7zxmadrTlh9okL+/41s7sP4423sFT8SVsPMaG9Y+21OuR7A==", + "version": "9.13.1", + "resolved": "https://registry.npmjs.org/@donkeyclip/motorcortex/-/motorcortex-9.13.1.tgz", + "integrity": "sha512-T4FDA5xjH+sD/pbTfFXMNPrl7/ZzcD1Zwhgy2EYxNy6N1157H3B7GIrfnffBaAl+dke+zLnyQ4abaqpMmQmiEw==", "dev": true, "dependencies": { "expr-eval": "2.0.2", @@ -10763,9 +10763,9 @@ "dev": true }, "@donkeyclip/motorcortex": { - "version": "9.12.0", - "resolved": "https://registry.npmjs.org/@donkeyclip/motorcortex/-/motorcortex-9.12.0.tgz", - "integrity": "sha512-8LDLIX4RuGzqlpPC8aNHJ6UxPsCkN0KCWx/Pkll7zxmadrTlh9okL+/41s7sP4423sFT8SVsPMaG9Y+21OuR7A==", + "version": "9.13.1", + "resolved": "https://registry.npmjs.org/@donkeyclip/motorcortex/-/motorcortex-9.13.1.tgz", + "integrity": "sha512-T4FDA5xjH+sD/pbTfFXMNPrl7/ZzcD1Zwhgy2EYxNy6N1157H3B7GIrfnffBaAl+dke+zLnyQ4abaqpMmQmiEw==", "dev": true, "requires": { "expr-eval": "2.0.2", diff --git a/package.json b/package.json index a74f874a..3b9f407e 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "@babel/plugin-syntax-jsx": "7.23.3", "@babel/plugin-transform-react-jsx": "7.23.4", "@babel/preset-env": "7.23.5", - "@donkeyclip/motorcortex": "9.12.0", + "@donkeyclip/motorcortex": "9.13.1", "@donkeyclip/motorcortex-player": "2.10.11", "@rollup/plugin-babel": "5.3.1", "@rollup/plugin-commonjs": "22.0.2",