@lappis/cg-manager 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/loadbg.d.ts +1 -0
- package/dist/commands/mixer.d.ts +7 -0
- package/dist/index.js +1 -1
- package/dist/plugin.d.ts +2 -0
- package/dist/types/manager.d.ts +2 -0
- package/dist/types/routes.d.ts +47 -0
- package/package.json +1 -1
|
@@ -36,6 +36,7 @@ export declare class LoadBGCommand extends LayeredCommand {
|
|
|
36
36
|
constructor();
|
|
37
37
|
private setArguments;
|
|
38
38
|
static video(video: string, options?: PlayoutOptions): LoadBGCommand;
|
|
39
|
+
static decklink(device: number, format: string): LoadBGCommand;
|
|
39
40
|
static route(source: BasicLayer | BasicChannel): LoadBGCommand;
|
|
40
41
|
static color(color: string): LoadBGCommand;
|
|
41
42
|
}
|
package/dist/commands/mixer.d.ts
CHANGED
|
@@ -53,6 +53,12 @@ export type Tween = {
|
|
|
53
53
|
type?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
54
54
|
duration: number;
|
|
55
55
|
} | number;
|
|
56
|
+
export interface EdgeBlendOptions {
|
|
57
|
+
edgeblend?: [number, number, number, number];
|
|
58
|
+
g: number;
|
|
59
|
+
p: number;
|
|
60
|
+
a: number;
|
|
61
|
+
}
|
|
56
62
|
export declare class MixerCommand extends CommandGroup {
|
|
57
63
|
constructor(shouldClear?: boolean);
|
|
58
64
|
protected single(command: string, args?: string[], tween?: Tween): this;
|
|
@@ -77,6 +83,7 @@ export declare class MixerCommand extends CommandGroup {
|
|
|
77
83
|
volume(volume: number, tween?: Tween): this;
|
|
78
84
|
mastervolume(volume: number): this;
|
|
79
85
|
straightAlphaOutput(enabled: boolean): this;
|
|
86
|
+
edgeblend(edgeblend: EdgeBlendOptions): this;
|
|
80
87
|
clear(): this;
|
|
81
88
|
}
|
|
82
89
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
(()=>{"use strict";var t={7:t=>{var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}v(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,{once:!0})}(t,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var u=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?i.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var o,i,u,f;if(a(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),u=i[e]),void 0===u)u=i[e]=r,++t._eventsCount;else if("function"==typeof u?u=i[e]=n?[r,u]:[u,r]:n?u.unshift(r):u.push(r),(o=c(t))>0&&u.length>o&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=u.length,f=l,console&&console.warn&&console.warn(f)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function s(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function y(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):h(o,o.length)}function p(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var u;if(e.length>0&&(u=e[0]),u instanceof Error)throw u;var a=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw a.context=u,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)n(c,this,e);else{var f=c.length,l=h(c,f);for(r=0;r<f;++r)n(l[r],this,e)}return!0},i.prototype.addListener=function(t,e){return f(this,t,e,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(t,e){return f(this,t,e,!0)},i.prototype.once=function(t,e){return a(e),this.on(t,s(this,t,e)),this},i.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,s(this,t,e)),this},i.prototype.removeListener=function(t,e){var r,n,o,i,u;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){u=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,u||e)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},i.prototype.listeners=function(t){return y(this,t,!0)},i.prototype.rawListeners=function(t){return y(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{r.r(n),r.d(n,{AddCommand:()=>Y,BasicChannel:()=>p,BasicCommand:()=>A,BasicLayer:()=>h,CallCommand:()=>tt,CasparPlugin:()=>Cn,CgCommand:()=>lt,Channel:()=>Wr,ClearCommand:()=>dt,Command:()=>C,CommandExecutor:()=>yn,CommandGroup:()=>D,Effect:()=>Er,EffectGroup:()=>Vr,EffectRegistry:()=>kr,Layer:()=>Yr,LayeredCommand:()=>R,LoadBGCommand:()=>At,LoadCommand:()=>Gt,LogLevel:()=>i,MediaDoc:()=>t.MediaDoc,MixerCommand:()=>ee,PauseCommand:()=>fe,PlayCommand:()=>me,PlayoutOptions:()=>e.PlayoutOptions,PluginAPI:()=>An,PrintCommand:()=>Pe,RawCommand:()=>B,RemoveCommand:()=>Re,ResumeCommand:()=>Fe,SimpleArgsCommand:()=>N,SimpleCommand:()=>I,StopCommand:()=>qe,SwapCommand:()=>ir,Transform:()=>Bn,UI_INJECTION_ZONE:()=>u});var t={};r.r(t);var e={};r.r(e),r.d(e,{RD:()=>At});var o=r(7),i=function(t){return t.INFO="INFO",t.WARN="WARN",t.DEBUG="DEBUG",t.ERROR="ERROR",t.FATAL="FATAL",t.NONE="NONE",t}({}),u={PLUGIN_PAGE:"plugin-page",RUNDOWN_ITEM:"rundown-item",RUNDOWN_EDITOR:"rundown-editor"};function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,y(n.key),n)}}function l(t,e,r){return e&&f(t.prototype,e),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=y(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:String(e)}var p=function(){function t(e){c(this,t),s(this,"casparChannel",void 0),this.casparChannel=e}return l(t,[{key:"getCasparChannel",value:function(){return this.casparChannel}},{key:"getCommandString",value:function(){return this.getCasparChannel().toString()}}]),t}(),h=function(){function t(e){c(this,t),s(this,"channel",void 0),s(this,"casparLayer",void 0),this.setChannel(e)}return l(t,[{key:"setChannel",value:function(t){this.channel=t}},{key:"setCasparLayer",value:function(t){this.casparLayer=t,this.onMove()}},{key:"onMove",value:function(){}},{key:"getCasparLayer",value:function(){return this.casparLayer}},{key:"getCasparChannel",value:function(){var t;return null===(t=this.channel)||void 0===t?void 0:t.getCasparChannel()}},{key:"getCommandString",value:function(){var t=this.getCasparChannel(),e=this.getCasparLayer();if(void 0!==e&&void 0!==t)return"".concat(t,"-").concat(e)}}],[{key:"caspar",value:function(e,r){return t.from(e,r)}},{key:"from",value:function(e,r){if(e instanceof t)return e;if("number"==typeof e&&(e=new p(e)),"number"!=typeof r)return e;var n=new t(e);return n.setCasparLayer(r),n}}]),t}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},b.apply(this,arguments)}function m(t,e,r){return(e=T(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||g(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t,e){if(t){if("string"==typeof t)return w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function O(t,e,r){return e=_(e),function(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return j(t)}(t,S()?Reflect.construct(e,r||[],_(t).constructor):e.apply(t,r))}function j(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function S(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(S=function(){return!!t})()}function _(t){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_(t)}function P(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&E(t,e)}function E(t,e){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},E(t,e)}function k(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,T(n.key),n)}}function x(t,e,r){return e&&k(t.prototype,e),r&&k(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(t){var e=function(t,e){if("object"!=v(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(e)?e:String(e)}function L(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var C=x((function t(){L(this,t)})),A=function(){function t(){L(this,t)}return x(t,[{key:"compileArgs",value:function(){return this.getArguments().map((function(t){return JSON.stringify(t)})).map((function(t){return t.includes(" ")?t:t.substring(1,t.length-1)})).join(" ")}},{key:"getCommand",value:function(){var t=this.getCommandType();if(t){var e=this.compileArgs();return e?"".concat(t," ").concat(e,"\r\n"):"".concat(t,"\r\n")}}}],[{key:"create",value:function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return new(function(t){function r(){return L(this,r),O(this,r,arguments)}return P(r,t),x(r,[{key:"getCommandType",value:function(){return e}},{key:"getArguments",value:function(){return n}},{key:"getCmd",value:function(){return this.getCommandType()}},{key:"getArgs",value:function(){return this.getArguments()}}]),r}(t))}},{key:"parseQuotes",value:function(t){for(var e=0;e<t.length;e++){var r=t[e];if(r.endsWith('"')){for(var n=!1,o=r.length-2;o>=0&&"\\"===r[o];o--)n=!n;if(!n)return t.slice(0,e+1)}}throw new Error("Command contains unclosed quotes")}},{key:"parseArguments",value:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];if(n.startsWith('"')){var o=this.parseQuotes(t.slice(r));e.push(JSON.parse(o.join(" "))),r+=o.length-1}else e.push(n)}return e}},{key:"from",value:function(t){if(t.endsWith("\r\n")&&(t=t.slice(0,-2)),t.indexOf("\r\n")>-1)throw new Error("Command cannot contain line breaks");if(t.startsWith('"'))throw new Error("Command cannot start with quotes");var e=t.split(" ");return this.create.apply(this,[e[0]].concat(d(this.parseArguments(e.slice(1)))))}},{key:"interpret",value:function(t){var e=this;return t.split("\r\n").filter((function(t){return t.length>0})).map((function(t){return e.from(t)}))}}]),t}(),R=function(t){function e(t){var r;return L(this,e),m(j(r=O(this,e)),"allocation",void 0),t&&r.allocate(t),r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){return this.allocation=h.from(t,e),this}},{key:"isChannel",value:function(){return this.allocation instanceof p}},{key:"isLayer",value:function(){return this.allocation instanceof h}},{key:"getPosition",value:function(){var t;return null===(t=this.allocation)||void 0===t?void 0:t.getCommandString()}}]),e}(A),I=function(t){function e(){return L(this,e),O(this,e,arguments)}return P(e,t),x(e,[{key:"getArguments",value:function(){var t=this.getPosition();return t?[t]:[]}}]),e}(R),N=function(t){function e(){var t;L(this,e),m(j(t=O(this,e)),"args",void 0);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.args=n,t}return P(e,t),x(e,[{key:"setArgs",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.args=e,this}},{key:"getArguments",value:function(){return[].concat(d(b(_(e.prototype),"getArguments",this).call(this)),d(this.args))}}]),e}(I),D=function(t){function e(t){var r;return L(this,e),m(j(r=O(this,e)),"commands",void 0),m(j(r),"allocation",void 0),r.commands=t,r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){this.allocation=h.from(t,e);var r,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=g(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}(this.commands);try{for(n.s();!(r=n.n()).done;){var o=r.value;o instanceof R&&o.allocate(this.allocation)}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"getCommand",value:function(){return this.commands.map((function(t){return t.getCommand()})).join("")}}]),e}(C),B=function(t){function e(t){var r;return L(this,e),m(j(r=O(this,e)),"command",void 0),r.command=t,r}return P(e,t),x(e,[{key:"getCommand",value:function(){return this.command}}]),e}(C);function M(t){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(t)}function U(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,G(n.key),n)}}function G(t){var e=function(t,e){if("object"!=M(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==M(e)?e:String(e)}function F(t,e,r){return e=V(e),function(t,e){if(e&&("object"===M(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,J()?Reflect.construct(e,r||[],V(t).constructor):e.apply(t,r))}function J(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(J=function(){return!!t})()}function V(t){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(t)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}var Y=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),F(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&W(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"ADD"}}])&&U(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function H(t){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(t)}function $(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,z(n.key),n)}}function K(t,e,r){return e=Q(e),function(t,e){if(e&&("object"===H(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return X(t)}(t,q()?Reflect.construct(e,r||[],Q(t).constructor):e.apply(t,r))}function q(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(q=function(){return!!t})()}function Q(t){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Q(t)}function X(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Z(t,e){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Z(t,e)}function z(t){var e=function(t,e){if("object"!=H(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:String(e)}var tt=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=X(r=K(this,e)),i=void 0,(o=z(o="method"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.method=t,r}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Z(t,e)}(e,t),r=e,o=[{key:"call",value:function(t){return new e(t)}}],(n=[{key:"setMethod",value:function(t){return this.method=t,this}},{key:"getCommandType",value:function(){return"CALL"}},{key:"getArguments",value:function(){return[this.method]}}])&&$(r.prototype,n),o&&$(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function et(t){return et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et(t)}function rt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ft(n.key),n)}}function nt(t,e,r){return e=it(e),function(t,e){if(e&&("object"===et(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ut(t)}(t,ot()?Reflect.construct(e,r||[],it(t).constructor):e.apply(t,r))}function ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ot=function(){return!!t})()}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function ut(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function at(t,e){return at=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},at(t,e)}function ct(t,e,r){return(e=ft(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ft(t){var e=function(t,e){if("object"!=et(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==et(e)?e:String(e)}var lt=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ct(ut(t=nt(this,e)),"cmd",void 0),ct(ut(t),"cgLayer",void 0),ct(ut(t),"arguments",[]),t}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&at(t,e)}(e,t),r=e,o=[{key:"single",value:function(t){var r=new e;return r.cmd=t,r}},{key:"add",value:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,o=e.single("ADD");return o.arguments.push(t),o.arguments.push(r?"1":"0"),n&&o.arguments.push(JSON.stringify(n)),o}},{key:"play",value:function(){return e.single("PLAY")}},{key:"stop",value:function(){return e.single("STOP")}},{key:"next",value:function(){return e.single("NEXT")}},{key:"remove",value:function(){return e.single("REMOVE")}},{key:"clear",value:function(){return e.single("CLEAR")}},{key:"update",value:function(t){var r=e.single("UPDATE");return r.arguments.push(JSON.stringify(t)),r}},{key:"invoke",value:function(t){var r=e.single("INVOKE");return r.arguments.push(t),r}},{key:"info",value:function(){return e.single("INFO")}}],(n=[{key:"setLayer",value:function(t){return this.cgLayer=t,this}},{key:"getCommandType",value:function(){return"CG"}},{key:"getArguments",value:function(){var t=this.arguments.slice();void 0!==this.cgLayer?t.unshift(this.cgLayer.toString()):"CLEAR"!==this.cmd&&t.unshift("0"),t.unshift(this.cmd);var e=this.getPosition();return e&&t.unshift(e),t}}])&&rt(r.prototype,n),o&&rt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function st(t){return st="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},st(t)}function yt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pt(n.key),n)}}function pt(t){var e=function(t,e){if("object"!=st(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=st(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==st(e)?e:String(e)}function ht(t,e,r){return e=bt(e),function(t,e){if(e&&("object"===st(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vt()?Reflect.construct(e,r||[],bt(t).constructor):e.apply(t,r))}function vt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vt=function(){return!!t})()}function bt(t){return bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bt(t)}function mt(t,e){return mt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mt(t,e)}var dt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ht(this,e,arguments)}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mt(t,e)}(e,t),r=e,o=[{key:"all",value:function(){return new B("CLEAR ALL")}}],(n=[{key:"getCommandType",value:function(){return"CLEAR"}}])&&yt(r.prototype,n),o&&yt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function gt(t){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt(t)}function wt(t){return function(t){if(Array.isArray(t))return Ot(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ot(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ot(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function jt(t,e,r){return e=_t(e),function(t,e){if(e&&("object"===gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Pt(t)}(t,St()?Reflect.construct(e,r||[],_t(t).constructor):e.apply(t,r))}function St(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(St=function(){return!!t})()}function _t(t){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_t(t)}function Pt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Et(t,e){return Et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Et(t,e)}function kt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Lt(n.key),n)}}function Tt(t,e,r){return e&&xt(t.prototype,e),r&&xt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Lt(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gt(e)?e:String(e)}var Ct=function(){function t(){kt(this,t)}return Tt(t,null,[{key:"getVideoArguments",value:function(t){var e,r=[];return(t=t||{}).transition&&(r.push(t.transition),r.push((null!==(e=t.duration)&&void 0!==e?e:0).toString()),t.tween&&r.push(t.tween),t.direction&&r.push(t.direction)),t.seek&&r.push("SEEK",t.seek.toString()),t.length&&r.push("LENGTH",t.length.toString()),t.filter&&r.push("FILTER",t.filter),t.loop&&r.push("LOOP"),t.auto&&r.push("AUTO"),r}}]),t}(),At=function(t){function e(){var t,r,n,o;return kt(this,e),r=Pt(t=jt(this,e)),o=void 0,(n=Lt(n="arguments"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t.arguments=[],t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Et(t,e)}(e,t),Tt(e,[{key:"getCommandType",value:function(){return"LOADBG"}},{key:"getArguments",value:function(){var t=this.getPosition();return t?[t].concat(wt(this.arguments)):[]}},{key:"setArguments",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.arguments=e,this}}],[{key:"video",value:function(t,e){var r;return(r=new this).setArguments.apply(r,[t].concat(wt(Ct.getVideoArguments(e))))}},{key:"route",value:function(t){return(new this).setArguments("route://".concat(t.getCommandString()))}},{key:"color",value:function(t){return(new this).setArguments(t)}}]),e}(R);function Rt(t){return Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(t)}function It(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Nt(n.key),n)}}function Nt(t){var e=function(t,e){if("object"!=Rt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rt(e)?e:String(e)}function Dt(t,e,r){return e=Mt(e),function(t,e){if(e&&("object"===Rt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bt()?Reflect.construct(e,r||[],Mt(t).constructor):e.apply(t,r))}function Bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bt=function(){return!!t})()}function Mt(t){return Mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mt(t)}function Ut(t,e){return Ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ut(t,e)}var Gt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Dt(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ut(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"LOAD"}}])&&It(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function Ft(t){return Ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ft(t)}function Jt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Vt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Wt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,zt(n.key),n)}}function Yt(t,e,r){return e&&Wt(t.prototype,e),r&&Wt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ht(t,e,r){return e=Kt(e),function(t,e){if(e&&("object"===Ft(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return qt(t)}(t,$t()?Reflect.construct(e,r||[],Kt(t).constructor):e.apply(t,r))}function $t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($t=function(){return!!t})()}function Kt(t){return Kt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kt(t)}function qt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xt(t,e)}function Xt(t,e){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xt(t,e)}function Zt(t,e,r){return(e=zt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zt(t){var e=function(t,e){if("object"!=Ft(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ft(e)?e:String(e)}var te=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Vt(this,e),Zt(qt(r=Ht(this,e)),"command",void 0),Zt(qt(r),"args",void 0),r.command=t,r.args=n,r}return Qt(e,t),Yt(e,[{key:"getCommandType",value:function(){return"MIXER"}},{key:"getArguments",value:function(){return[this.getPosition(),this.command].concat(function(t){if(Array.isArray(t))return Jt(t)}(t=this.args)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Jt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var t}}]),e}(R),ee=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Vt(this,e),t=Ht(this,e,[[]]),r&&t.commands.push(new te("CLEAR")),t}return Qt(e,t),Yt(e,[{key:"single",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;r&&("number"==typeof r?e.push(r.toString()):e.push(r.duration.toString())),"number"!=typeof r&&null!=r&&r.type&&e.push(r.type);var n=new te(t,e);return this.commands.push(n),this}},{key:"keyer",value:function(t){return this.single("KEYER",[t.toString()])}},{key:"chroma",value:function(t,e){if(!t.enabled)return this.single("CHROMA",["0"]);var r=[1,t.target_hue,t.hue_width,t.min_saturation,t.min_brightness,t.softness,t.spill_suppress,t.spill_suppress_saturation,t.show_mask?1:0];return this.single("CHROMA",r.map((function(t){return t.toString()})),e)}},{key:"blend",value:function(t){return this.single("BLEND",[t])}},{key:"invert",value:function(t){return this.single("INVERT",[t?"1":"0"])}},{key:"opacity",value:function(t,e){var r=[t];return this.single("OPACITY",r.map((function(t){return t.toString()})),e)}},{key:"brightness",value:function(t,e){var r=[t];return this.single("BRIGHTNESS",r.map((function(t){return t.toString()})),e)}},{key:"saturation",value:function(t,e){var r=[t];return this.single("SATURATION",r.map((function(t){return t.toString()})),e)}},{key:"contrast",value:function(t,e){var r=[t];return this.single("CONTRAST",r.map((function(t){return t.toString()})),e)}},{key:"levels",value:function(t,e){var r=[t.min_input,t.max_input,t.gamma,t.min_output,t.max_output];return this.single("LEVELS",r.map((function(t){return t.toString()})),e)}},{key:"fill",value:function(t,e){var r=[t.x,t.y,t.x_scale,t.y_scale];return this.single("FILL",r.map((function(t){return t.toString()})),e)}},{key:"clip",value:function(t,e){var r=[t.x,t.y,t.width,t.height];return this.single("CLIP",r.map((function(t){return t.toString()})),e)}},{key:"anchor",value:function(t,e){var r=[t.x,t.y];return this.single("ANCHOR",r.map((function(t){return t.toString()})),e)}},{key:"crop",value:function(t,e){var r=[t.left_edge,t.top_edge,t.right_edge,t.bottom_edge];return this.single("CROP",r.map((function(t){return t.toString()})),e)}},{key:"rotation",value:function(t,e){var r=[t];return this.single("ROTATION",r.map((function(t){return t.toString()})),e)}},{key:"perspective",value:function(t,e){var r=[t.top_left.x,t.top_left.y,t.top_right.x,t.top_right.y,t.bottom_right.x,t.bottom_right.y,t.bottom_left.x,t.bottom_left.y];return this.single("PERSPECTIVE",r.map((function(t){return t.toString()})),e)}},{key:"mipmap",value:function(t){return this.single("MIPMAP",[t?"1":"0"])}},{key:"volume",value:function(t,e){var r=[t];return this.single("VOLUME",r.map((function(t){return t.toString()})),e)}},{key:"mastervolume",value:function(t){return this.single("MASTERVOLUME",[t.toString()])}},{key:"straightAlphaOutput",value:function(t){return this.single("STRAIGHT_ALPHA_OUTPUT",[t?"1":"0"])}},{key:"clear",value:function(){return this.commands.splice(0,this.commands.length),this}}],[{key:"create",value:function(){return new e}},{key:"clear",value:function(){return new e(!0)}}]),e}(D);function re(t){return re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},re(t)}function ne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,oe(n.key),n)}}function oe(t){var e=function(t,e){if("object"!=re(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=re(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==re(e)?e:String(e)}function ie(t,e,r){return e=ae(e),function(t,e){if(e&&("object"===re(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ue()?Reflect.construct(e,r||[],ae(t).constructor):e.apply(t,r))}function ue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ue=function(){return!!t})()}function ae(t){return ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ae(t)}function ce(t,e){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ce(t,e)}var fe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ie(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ce(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PAUSE"}}])&&ne(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}function se(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ye(n.key),n)}}function ye(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==le(e)?e:String(e)}function pe(t,e,r){return e=ve(e),function(t,e){if(e&&("object"===le(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,he()?Reflect.construct(e,r||[],ve(t).constructor):e.apply(t,r))}function he(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(he=function(){return!!t})()}function ve(t){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ve(t)}function be(t,e){return be=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},be(t,e)}var me=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),pe(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&be(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PLAY"}}])&&se(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function de(t){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(t)}function ge(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,we(n.key),n)}}function we(t){var e=function(t,e){if("object"!=de(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==de(e)?e:String(e)}function Oe(t,e,r){return e=Se(e),function(t,e){if(e&&("object"===de(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,je()?Reflect.construct(e,r||[],Se(t).constructor):e.apply(t,r))}function je(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(je=function(){return!!t})()}function Se(t){return Se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Se(t)}function _e(t,e){return _e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_e(t,e)}var Pe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Oe(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_e(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PRINT"}}])&&ge(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Ee(t){return Ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ee(t)}function ke(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xe(n.key),n)}}function xe(t){var e=function(t,e){if("object"!=Ee(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ee(e)?e:String(e)}function Te(t,e,r){return e=Ce(e),function(t,e){if(e&&("object"===Ee(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Le()?Reflect.construct(e,r||[],Ce(t).constructor):e.apply(t,r))}function Le(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Le=function(){return!!t})()}function Ce(t){return Ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ce(t)}function Ae(t,e){return Ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ae(t,e)}var Re=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Te(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ae(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"REMOVE"}}])&&ke(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function Ie(t){return Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ie(t)}function Ne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,De(n.key),n)}}function De(t){var e=function(t,e){if("object"!=Ie(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ie(e)?e:String(e)}function Be(t,e,r){return e=Ue(e),function(t,e){if(e&&("object"===Ie(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Me()?Reflect.construct(e,r||[],Ue(t).constructor):e.apply(t,r))}function Me(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Me=function(){return!!t})()}function Ue(t){return Ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ue(t)}function Ge(t,e){return Ge=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ge(t,e)}var Fe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Be(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ge(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"RESUME"}}])&&Ne(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Je(t){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Je(t)}function Ve(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,We(n.key),n)}}function We(t){var e=function(t,e){if("object"!=Je(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Je(e)?e:String(e)}function Ye(t,e,r){return e=$e(e),function(t,e){if(e&&("object"===Je(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,He()?Reflect.construct(e,r||[],$e(t).constructor):e.apply(t,r))}function He(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(He=function(){return!!t})()}function $e(t){return $e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$e(t)}function Ke(t,e){return Ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ke(t,e)}var qe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ye(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ke(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"STOP"}}])&&Ve(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Qe(t){return Qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qe(t)}function Xe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,or(n.key),n)}}function Ze(t,e,r){return e=tr(e),function(t,e){if(e&&("object"===Qe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return er(t)}(t,ze()?Reflect.construct(e,r||[],tr(t).constructor):e.apply(t,r))}function ze(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ze=function(){return!!t})()}function tr(t){return tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tr(t)}function er(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rr(t,e){return rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rr(t,e)}function nr(t,e,r){return(e=or(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function or(t){var e=function(t,e){if("object"!=Qe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qe(e)?e:String(e)}var ir=function(t){function e(t,r){var n,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),nr(er(n=Ze(this,e)),"allocation1",void 0),nr(er(n),"allocation2",void 0),nr(er(n),"transforms",void 0),t&&n.allocate1(t),r&&n.allocate2(r),n.transforms=o,n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rr(t,e)}(e,t),r=e,(n=[{key:"allocate1",value:function(t,e){return this.allocation1=h.from(t,e),this}},{key:"allocate2",value:function(t,e){return this.allocation2=h.from(t,e),this}},{key:"getCommandType",value:function(){return"SWAP"}},{key:"getArguments",value:function(){var t,e,r=null===(t=this.allocation1)||void 0===t?void 0:t.getCommandString(),n=null===(e=this.allocation2)||void 0===e?void 0:e.getCommandString();if(!r||!n)return[];var o=[r,n];return this.transforms&&o.push("TRANSFORMS"),o}}])&&Xe(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);const ur={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ar;const cr=new Uint8Array(16);function fr(){if(!ar&&(ar="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ar))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ar(cr)}const lr=[];for(let t=0;t<256;++t)lr.push((t+256).toString(16).slice(1));const sr=function(t,e,r){if(ur.randomUUID&&!e&&!t)return ur.randomUUID();const n=(t=t||{}).random||(t.rng||fr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){r=r||0;for(let t=0;t<16;++t)e[r+t]=n[t];return e}return function(t,e=0){return lr[t[e+0]]+lr[t[e+1]]+lr[t[e+2]]+lr[t[e+3]]+"-"+lr[t[e+4]]+lr[t[e+5]]+"-"+lr[t[e+6]]+lr[t[e+7]]+"-"+lr[t[e+8]]+lr[t[e+9]]+"-"+lr[t[e+10]]+lr[t[e+11]]+lr[t[e+12]]+lr[t[e+13]]+lr[t[e+14]]+lr[t[e+15]]}(n)};function yr(t){return yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(t)}function pr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=hr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function hr(t,e){if(t){if("string"==typeof t)return vr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vr(t,e):void 0}}function vr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function br(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pr(n.key),n)}}function dr(t,e,r){return e&&mr(t.prototype,e),r&&mr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function gr(t,e,r){return e=Or(e),function(t,e){if(e&&("object"===yr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return jr(t)}(t,wr()?Reflect.construct(e,r||[],Or(t).constructor):e.apply(t,r))}function wr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wr=function(){return!!t})()}function Or(t){return Or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Or(t)}function jr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Sr(t,e){return Sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sr(t,e)}function _r(t,e,r){return(e=Pr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pr(t){var e=function(t,e){if("object"!=yr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=yr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yr(e)?e:String(e)}var Er=function(t){function e(t){var r;return br(this,e),_r(jr(r=gr(this,e)),"_active",!1),_r(jr(r),"_disposed",!1),_r(jr(r),"id",sr()),_r(jr(r),"transform",void 0),_r(jr(r),"effectGroup",void 0),_r(jr(r),"layers",[]),r.effectGroup=t,r.group.addEffect(jr(r)),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Sr(t,e)}(e,t),dr(e,[{key:"active",get:function(){return this._active}},{key:"getTransform",value:function(){return this.transform}},{key:"setTransform",value:function(t){this.transform=t,this.applyTransform()}},{key:"applyTransform",value:function(){if(this.active&&this.transform){var t,e=pr(this.layers);try{for(e.s();!(t=e.n()).done;){var r=t.value;this.executor.execute(this.transform.getCommand().allocate(r))}}catch(t){e.e(t)}finally{e.f()}}}},{key:"group",get:function(){return this.effectGroup}},{key:"executor",get:function(){return this.group.channel.executor}},{key:"activate",value:function(){return!this._disposed&&!this.active&&(this._active=!0,this.executor.executeAllocations(),this.applyTransform(),!0)}},{key:"deactivate",value:function(){return!!this.active&&(this._active=!1,!0)}},{key:"dispose",value:function(){this._disposed||(this._disposed=!0,this.deactivate(),this.deallocateLayers(this.layers),this.executor.executeAllocations(),this.group.removeEffect(this),this.effectGroup=null,this.transform=null,this.removeAllListeners())}},{key:"getLayers",value:function(){return this.layers}},{key:"allocateLayers",value:function(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=this.group.getEffectIndex(this),o=this.group.channel.allocateLayers({count:r,index:n});(t=this.layers).push.apply(t,function(t){if(Array.isArray(t))return vr(t)}(e=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||hr(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var i,u=pr(o);try{for(u.s();!(i=u.n()).done;)i.value.setEffect(this)}catch(t){u.e(t)}finally{u.f()}return o}},{key:"deallocateLayers",value:function(t){var e,r=pr(t=t.slice());try{for(r.s();!(e=r.n()).done;){var n=e.value;n.setEffect(null);var o=this.layers.indexOf(n);o>=0&&this.layers.splice(o,1)}}catch(t){r.e(t)}finally{r.f()}this.group.channel.deallocateLayers(t)}},{key:"updatePositions",value:function(){return[]}},{key:"getName",value:function(){return this.constructor.name}},{key:"getMetadata",value:function(){return{}}},{key:"toJSON",value:function(){return{id:this.id,type:this.getName(),active:this.active,metadata:this.getMetadata(),layers:this.layers.map((function(t){return t.toJSON()}))}}}]),e}(o.EventEmitter),kr=function(){function t(){br(this,t),_r(this,"effects",new Map)}return dr(t,[{key:"register",value:function(t,e){this.effects.set(t,e)}},{key:"unregister",value:function(t){this.effects.delete(t)}},{key:"get",value:function(t){return this.effects.get(t)}},{key:"create",value:function(t,e,r){var n=this.get(t);return n?n(e,r):null}}]),t}();function xr(t){return xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xr(t)}function Tr(t,e,r){return e=Cr(e),function(t,e){if(e&&("object"===xr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ar(t)}(t,Lr()?Reflect.construct(e,r||[],Cr(t).constructor):e.apply(t,r))}function Lr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Lr=function(){return!!t})()}function Cr(t){return Cr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cr(t)}function Ar(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Rr(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ir(t,e)}function Ir(t,e){return Ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ir(t,e)}function Nr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Dr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function Dr(t,e){if(t){if("string"==typeof t)return Br(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Br(t,e):void 0}}function Br(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Mr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ur(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Jr(n.key),n)}}function Gr(t,e,r){return e&&Ur(t.prototype,e),r&&Ur(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Fr(t,e,r){return(e=Jr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Jr(t){var e=function(t,e){if("object"!=xr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=xr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xr(e)?e:String(e)}var Vr=function(){function t(e,r){Mr(this,t),Fr(this,"effects",[]),Fr(this,"name",void 0),Fr(this,"channel",void 0),this.name=r,this.channel=e}return Gr(t,[{key:"addEffect",value:function(t){this.effects.push(t),this.channel.executor.effects.set(t.id,t)}},{key:"removeEffect",value:function(t){var e=this.effects.indexOf(t);e>=0&&this.effects.splice(e,1),this.channel.executor.effects.delete(t.id)}},{key:"dispose",value:function(){var t,e=Nr(this.effects);try{for(e.s();!(t=e.n()).done;)t.value.dispose()}catch(t){e.e(t)}finally{e.f()}}},{key:"getEffectIndex",value:function(t){var e=this.effects.indexOf(t);if(e<0)throw new Error("Effect not found in group");for(;e>=0;){var r=this.effects[e].getLayers();if(r.length){var n=r[r.length-1];return this.channel.getLayerIndex(n)+1}e--}return this.getStartingIndex()}},{key:"getStartingIndex",value:function(){var t=this.channel.groups.indexOf(this);if(t<0)throw new Error("Effect group not found in channel");if(0===t)return 0;for(;t>0;){t--;var e=this.channel.groups[t];if(!(e.effects.length<1)){for(var r=e.effects,n=r.length-1;n>=0&&!r[n].getLayers().length;)n--;if(!(n<0)){var o=r[n].getLayers(),i=o[o.length-1];return this.channel.getLayerIndex(i)+1}}}return 0}},{key:"toJSON",value:function(){return{name:this.name,effects:this.effects.map((function(t){return t.id}))}}}]),t}(),Wr=function(t){function e(t,r){var n;return Mr(this,e),Fr(Ar(n=Tr(this,e,[t])),"layers",new Map),Fr(Ar(n),"groups",[]),Fr(Ar(n),"lastOrder",[]),Fr(Ar(n),"currentOrder",[]),Fr(Ar(n),"executor",void 0),Fr(Ar(n),"needExecute",!1),n.executor=r,n}return Rr(e,t),Gr(e,[{key:"createGroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=new Vr(this,t);return e=e<0?this.groups.length:e,this.groups.splice(e,0,r),r}},{key:"getGroup",value:function(t,e){var r;t=null!==(r=t)&&void 0!==r?r:sr();var n=this.groups.find((function(e){return e.name===t}));return null!=n?n:this.createGroup(t,null!=e?e:-1)}},{key:"setExecutor",value:function(t){this.executor=t}},{key:"getLayer",value:function(t){return this.layers.get(t)}},{key:"getLayers",value:function(){var t=this;return this.currentOrder.map((function(e){return t.layers.get(e)})).filter((function(t){return void 0!==t}))}},{key:"getLayerIndex",value:function(t){return this.currentOrder.indexOf(t.id)}},{key:"allocateLayers",value:function(t){var e,r,n,o,i=null!==(r=(t=null!==(e=t)&&void 0!==e?e:{}).count)&&void 0!==r?r:1;if(i<1)throw new Error("You have to allocate at least 1 layer");for(var u=new Array(i),a=new Array(i),c=0;c<i;c++){var f=new Yr(this);this.layers.set(f.id,f),u[c]=f,a[c]=f.id}var l=null!==(n=t.index)&&void 0!==n?n:this.currentOrder.length;(o=this.currentOrder).splice.apply(o,[l,0].concat(a));for(var s=l+1;s<this.currentOrder.length&&i>0;s++)void 0===this.currentOrder[s]&&(this.currentOrder.splice(s,1),i--,s--);return this.needExecute=!0,u}},{key:"allocateLayer",value:function(t){return this.allocateLayers({index:t,count:1})[0]}},{key:"deallocateLayers",value:function(t){var e,r=Nr(t);try{for(r.s();!(e=r.n()).done;){var n=e.value,o=this.currentOrder.indexOf(n.id);this.currentOrder[o]=void 0,this.layers.delete(n.id)}}catch(t){r.e(t)}finally{r.f()}this.needExecute=!0}},{key:"executeAllocation",value:function(){if(this.needExecute){this.needExecute=!1;for(var t=[],e=this.lastOrder.slice(),r=0;r<e.length;r++){var n=e[r];if(void 0!==n&&!(this.currentOrder.indexOf(n)>=0)){e[r]=void 0;var o=h.caspar(this.casparChannel,r+1);t.push(new dt(o)),t.push(ee.clear().allocate(o))}}for(var i=0;i<this.currentOrder.length;i++){var u=this.currentOrder[i];if(void 0!==u){this.layers.get(u).setCasparLayer(i+1);var a=e.indexOf(u);if(a!==i&&!(a<0)){e[a]=e[i],e[i]=u;var c=h.caspar(this.casparChannel,i+1),f=h.caspar(this.casparChannel,a+1);t.push(new ir(c,f,!0))}}}this.lastOrder=this.currentOrder,this.currentOrder=this.currentOrder.slice();for(var l=0;l<this.currentOrder.length;l++){var s=this.currentOrder[l];if(void 0!==s){var y=this.layers.get(s);y&&y.setCasparLayer(l+1)}}var p,v=Nr(this.executor.getEffects());try{for(v.s();!(p=v.n()).done;){var b=p.value;t.push.apply(t,function(t){if(Array.isArray(t))return Br(t)}(d=b.updatePositions())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(d)||Dr(d)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}catch(t){v.e(t)}finally{v.f()}var m=new D(t);this.executor.execute(m)}var d}},{key:"toJSON",value:function(){var t=this;return{channel:this.casparChannel,layers:this.currentOrder.filter((function(t){return t})).map((function(e){return t.layers.get(e)})).map((function(t){return t.toJSON()})),groups:this.groups.map((function(t){return t.toJSON()}))}}}]),e}(p),Yr=function(t){function e(t){var r;return Mr(this,e),Fr(Ar(r=Tr(this,e,[t])),"id",void 0),Fr(Ar(r),"effect",void 0),r.id=sr(),r}return Rr(e,t),Gr(e,[{key:"setEffect",value:function(t){this.effect=t}},{key:"getEffect",value:function(){return this.effect}},{key:"dispose",value:function(){this.channel.deallocateLayers([this])}},{key:"toJSON",value:function(){var t;return{id:this.id,effect:null===(t=this.effect)||void 0===t?void 0:t.id}}}]),e}(h);function Hr(t){return Hr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hr(t)}function $r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Zr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function Kr(){Kr=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,u=Object.create(i.prototype),a=new L(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",b={};function m(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=m.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==Hr(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===b)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===b)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,b):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Hr(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),b},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),b}},e}function qr(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function Qr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){qr(i,n,o,u,a,"next",t)}function a(t){qr(i,n,o,u,a,"throw",t)}u(void 0)}))}}function Xr(t){return function(t){if(Array.isArray(t))return zr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Zr(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zr(t,e){if(t){if("string"==typeof t)return zr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zr(t,e):void 0}}function zr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function tn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ln(n.key),n)}}function en(t,e,r){return e&&tn(t.prototype,e),r&&tn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function on(t){var e="function"==typeof Map?new Map:void 0;return on=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(un())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&an(o,r.prototype),o}(t,arguments,cn(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),an(r,t)},on(t)}function un(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(un=function(){return!!t})()}function an(t,e){return an=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},an(t,e)}function cn(t){return cn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cn(t)}function fn(t,e,r){return(e=ln(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ln(t){var e=function(t,e){if("object"!=Hr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Hr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hr(e)?e:String(e)}var sn=function(t){function e(t,r){var n,o,i,u;return rn(this,e),fn(nn((o=this,i=e,u=[[r].concat(Xr(t)).join("\n")],i=cn(i),n=function(t,e){if(e&&("object"===Hr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return nn(t)}(o,un()?Reflect.construct(i,u||[],cn(o).constructor):i.apply(o,u)))),"data",void 0),fn(nn(n),"code",void 0),n.data=t,n.code=r,n.name="CasparResponseError",n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&an(t,e)}(e,t),en(e)}(on(Error)),yn=function(){function t(){rn(this,t),fn(this,"templates",[]),fn(this,"lastFetch",0),fn(this,"fetchPromise",null),fn(this,"channels",new Map),fn(this,"listeners",[]),fn(this,"effects",new Map)}var e,r;return en(t,[{key:"connected",get:function(){return!0}},{key:"_fetchTemplates",value:(r=Qr(Kr().mark((function t(){return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",[]);case 1:case"end":return t.stop()}}),t)}))),function(){return r.apply(this,arguments)})},{key:"fetchTemplates",value:function(){var t=this;return this.fetchPromise||(this.fetchPromise=this._fetchTemplates().then((function(e){return t.fetchPromise=null,t.templates=e}))),this.fetchPromise}},{key:"getTemplates",value:(e=Qr(Kr().mark((function t(){var e=arguments;return Kr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e.length>0&&void 0!==e[0]&&e[0]||Date.now()-this.lastFetch>3e5)){t.next=5;break}return this.lastFetch=Date.now(),t.next=5,this.fetchTemplates();case 5:return t.abrupt("return",this.templates);case 6:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"resolveTemplates",value:function(){return this.templates}},{key:"promise",value:function(t){var e=this;return new Promise((function(r,n){var o;!function t(){o=setTimeout((function(){if(!e.connected)return t();e.removeListener(i),n(new sn(["Timeout"],-1))}),1e3)}();var i={command:t,success:function(t,e){o&&clearTimeout(o),r({data:t,code:e})},error:function(t,e){o&&clearTimeout(o),n(new sn(t,e))}};e.addListener(i)}))}},{key:"executePassive",value:function(t){var e=t.getCommand();e&&this.send(e)}},{key:"execute",value:function(t){var e=this,r=t.getCommand();if(r){var n=A.interpret(r).map((function(t){return e.promise(t.getCmd())}));return this.send(r),Promise.all(n)}}},{key:"getChannel",value:function(t){return this.channels.get(t)}},{key:"getChannels",value:function(){return Array.from(this.channels.values())}},{key:"allocateChannel",value:function(t){var e=new Wr(t,this);return this.channels.set(t,e),e}},{key:"executeAllocations",value:function(){var t,e=$r(this.channels.values());try{for(e.s();!(t=e.n()).done;)t.value.executeAllocation()}catch(t){e.e(t)}finally{e.f()}}},{key:"send",value:function(t){}},{key:"readData",value:function(t,e,r){var n=[];if((101===t||201===t||400===t)&&(n.push(r[0]),r.length<1))return-1;if(200===t){for(var o=0;r[o];o++)n.push(r[o]);if(n.length===r.length)return-1}return this.executeListeners(t,e,n),this.onEvent(t,e,n),200===t?n.length+1:n.length}},{key:"receive",value:function(t){for(var e=t.split("\r\n"),r=e.pop(),n=0,o=0;o<e.length;o++){var i=e[o].split(" "),u=parseInt(i[0]),a=null;400!==u&&500!==u&&(a=i[1]);var c=this.readData(u,a,e.slice(o+1));if(c<0)break;n=(o+=c)+1}return[].concat(Xr(e.slice(n)),[r]).join("\r\n")}},{key:"addListener",value:function(t){this.listeners.push(t)}},{key:"removeListener",value:function(t){var e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},{key:"executeListeners",value:function(t,e,r){if(!(t<200)&&e){var n,o=2===Math.floor(t/100),i=$r(this.listeners);try{for(i.s();!(n=i.n()).done;){var u=n.value;if(u.command===e){o?u.success(r,t):u.error(r,t),this.removeListener(u);break}}}catch(t){i.e(t)}finally{i.f()}}}},{key:"onEvent",value:function(t,e,r){}},{key:"getEffects",value:function(){return Array.from(this.effects.values())}},{key:"getEffect",value:function(t){return this.effects.get(t)}},{key:"toJSON",value:function(){return{channels:this.getChannels().map((function(t){return t.toJSON()}))}}}]),t}();function pn(t,e=(t=>null)){const r=[null,null];try{r[1]=t()}catch(t){r[0]=t,e(t)}return r}function hn(t){return hn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hn(t)}function vn(){vn=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,u=Object.create(i.prototype),a=new L(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",b={};function m(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=m.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==hn(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===b)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===b)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,b):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(hn(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),b},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),b}},e}function bn(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function mn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=_n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function dn(t,e,r){return e=wn(e),function(t,e){if(e&&("object"===hn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return On(t)}(t,gn()?Reflect.construct(e,r||[],wn(t).constructor):e.apply(t,r))}function gn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(gn=function(){return!!t})()}function wn(t){return wn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wn(t)}function On(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jn(t,e){return jn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jn(t,e)}function Sn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,e)||_n(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _n(t,e){if(t){if("string"==typeof t)return Pn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Pn(t,e):void 0}}function Pn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function En(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ln(n.key),n)}}function xn(t,e,r){return e&&kn(t.prototype,e),r&&kn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Tn(t,e,r){return(e=Ln(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ln(t){var e=function(t,e){if("object"!=hn(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=hn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hn(e)?e:String(e)}var Cn=function(){function t(){En(this,t),Tn(this,"_api",void 0),Tn(this,"_enabled",!1),Tn(this,"logger",void 0)}return xn(t,[{key:"pluginName",get:function(){return this.constructor.pluginName}},{key:"enable",value:function(t){var e=this;if(!this._enabled){this._enabled=!0;var r=Sn(pn((function(){return e.onEnable()})),1)[0];if(r)return t.error("Error enabling plugin: ".concat(r)),void(this._enabled=!1);t.debug("Enabled")}}},{key:"disable",value:function(t){var e=this;if(this._enabled){this._enabled=!1,this._api.unregister();var r=Sn(pn((function(){return e.onDisable()})),1)[0];r?t.error("Error disabling plugin: ".concat(r)):t.debug("Disabled")}}},{key:"onEnable",value:function(){}},{key:"onDisable",value:function(){}},{key:"api",get:function(){return this._api}}],[{key:"pluginName",get:function(){return this.name}}]),t}(),An=function(t){function e(t,r){var n;return En(this,e),Tn(On(n=dn(this,e)),"files",[]),Tn(On(n),"uiInjections",[]),Tn(On(n),"_manager",void 0),Tn(On(n),"_plugin",void 0),Tn(On(n),"_effects",[]),Tn(On(n),"routes",[]),n._manager=t,n._plugin=r,n._plugin._api=On(n),n._plugin.logger=t.getLogger("Plugin").scope(n._plugin.pluginName),n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jn(t,e)}(e,t),xn(e,[{key:"registerEffect",value:function(t,e){this._effects.push(t),this._manager.effects.register(t,e)}},{key:"unregisterEffects",value:function(){var t,e=mn(this._effects);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.effects.unregister(r)}}catch(t){e.e(t)}finally{e.f()}this._effects=[]}},{key:"unregisterRoutes",value:function(){var t,e=mn(this.routes);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.server.unregisterRoute(r)}}catch(t){e.e(t)}finally{e.f()}this.routes=[]}},{key:"unregisterFiles",value:(r=vn().mark((function t(){var e,r,n;return vn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=mn(this.files),t.prev=1,e.s();case 3:if((r=e.n()).done){t.next=9;break}return n=r.value,t.next=7,this._manager.directory.deleteDirectory(n);case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),e.e(t.t0);case 14:return t.prev=14,e.f(),t.finish(14);case 17:this.files=[];case 18:case"end":return t.stop()}}),t,this,[[1,11,14,17]])})),n=function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function u(t){bn(i,n,o,u,a,"next",t)}function a(t){bn(i,n,o,u,a,"throw",t)}u(void 0)}))},function(){return n.apply(this,arguments)})},{key:"unregisterUIInjections",value:function(){var t,e=mn(this.uiInjections);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.ui.unregister(r)}}catch(t){e.e(t)}finally{e.f()}this.uiInjections=[]}},{key:"unregister",value:function(){return this.unregisterEffects(),this.unregisterRoutes(),this.unregisterUIInjections(),this.unregisterFiles()}},{key:"registerRoute",value:function(t,e,r){var n=this._manager.server.registerRoute("plugin/".concat(this._plugin.pluginName,"/").concat(t),e,r);return this.routes.push(n),n}},{key:"unregisterRoute",value:function(t){var e=this.routes.indexOf(t);e<0||(this.routes.splice(e,1),this._manager.server.unregisterRoute(t))}},{key:"registerFile",value:function(t,e){var r=this;return this._manager.directory.createDirectory(t,e).then((function(t){return r.files.push(t.id),t}))}},{key:"getEffectGroup",value:function(t,e){return this._manager.executor.getEffectGroup(t,e)}},{key:"unregisterFile",value:function(t){var e=this.files.indexOf(t);if(!(e<0))return this.files.splice(e,1),this._manager.directory.deleteDirectory(t)}},{key:"getDirectory",value:function(t){if(this.files.includes(t))return this._manager.directory.getDirectory(t)}},{key:"getDirectories",value:function(){var t=this;return this.files.map((function(e){return t._manager.directory.getDirectory(e)}))}},{key:"getFileDatabase",value:function(){return this._manager.getFiles()}},{key:"registerUI",value:function(t,e){var r=this._manager.ui.register(t,e,this._plugin.pluginName);this.uiInjections.push(r)}},{key:"unregisterUI",value:function(t){var e=this.uiInjections.indexOf(t);e<0||(this.uiInjections.splice(e,1),this._manager.ui.unregister(t))}},{key:"createEffect",value:function(t,e,r){var n=this._manager.executor.getEffectGroup(e);return this._manager.effects.create(t,n,r)}},{key:"getEffect",value:function(t){return this._manager.executor.getEffect(t)}},{key:"registerRundownAction",value:function(t,e){this._manager.rundowns.executor.registerAction(t,e)}}]),e}(o.EventEmitter);function Rn(t){return Rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rn(t)}function In(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Dn(n.key),n)}}function Nn(t,e,r){return(e=Dn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Dn(t){var e=function(t,e){if("object"!=Rn(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Rn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rn(e)?e:String(e)}var Bn=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Nn(this,"source",void 0),Nn(this,"destination",void 0),Nn(this,"fillTransition",null),Nn(this,"cropTransition",null),this.source=e,this.destination=r}var e,r,n;return e=t,n=[{key:"getRect",value:function(t,e,r,n){return{start:{x:t,y:e},end:{x:r,y:n}}}},{key:"normalRect",value:function(){return t.getRect(0,0,1,1)}},{key:"fromArray",value:function(e){return new t(t.getRect(e[0],e[1],e[2],e[3]),t.getRect(e[4],e[5],e[6],e[7]))}}],(r=[{key:"setTween",value:function(t,e){void 0===t&&(t=null),void 0===e&&(e=t),this.fillTransition=t,this.cropTransition=e}},{key:"getFill",value:function(t){return{x:t.start.x,y:t.start.y,x_scale:t.end.x-t.start.x,y_scale:t.end.y-t.start.y}}},{key:"getCrop",value:function(t){return{left_edge:t.start.x,top_edge:t.start.y,right_edge:t.end.x,bottom_edge:t.end.y}}},{key:"getCommand",value:function(){return ee.create().crop(this.getCrop(this.source),this.cropTransition).fill(this.getFill(this.destination),this.fillTransition)}}])&&In(e.prototype,r),n&&In(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()})(),module.exports=n})();
|
|
2
|
+
(()=>{"use strict";var t={7:t=>{var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}v(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,{once:!0})}(t,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var u=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?i.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var o,i,u,f;if(a(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),u=i[e]),void 0===u)u=i[e]=r,++t._eventsCount;else if("function"==typeof u?u=i[e]=n?[r,u]:[u,r]:n?u.unshift(r):u.push(r),(o=c(t))>0&&u.length>o&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=u.length,f=l,console&&console.warn&&console.warn(f)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function s(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function y(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):h(o,o.length)}function p(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var u;if(e.length>0&&(u=e[0]),u instanceof Error)throw u;var a=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw a.context=u,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)n(c,this,e);else{var f=c.length,l=h(c,f);for(r=0;r<f;++r)n(l[r],this,e)}return!0},i.prototype.addListener=function(t,e){return f(this,t,e,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(t,e){return f(this,t,e,!0)},i.prototype.once=function(t,e){return a(e),this.on(t,s(this,t,e)),this},i.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,s(this,t,e)),this},i.prototype.removeListener=function(t,e){var r,n,o,i,u;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){u=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,u||e)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},i.prototype.listeners=function(t){return y(this,t,!0)},i.prototype.rawListeners=function(t){return y(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{r.r(n),r.d(n,{AddCommand:()=>Y,BasicChannel:()=>p,BasicCommand:()=>A,BasicLayer:()=>h,CallCommand:()=>tt,CasparPlugin:()=>An,CgCommand:()=>lt,Channel:()=>Yr,ClearCommand:()=>dt,Command:()=>C,CommandExecutor:()=>pn,CommandGroup:()=>D,Effect:()=>kr,EffectGroup:()=>Wr,EffectRegistry:()=>xr,Layer:()=>Hr,LayeredCommand:()=>R,LoadBGCommand:()=>At,LoadCommand:()=>Ut,LogLevel:()=>i,MediaDoc:()=>t.MediaDoc,MixerCommand:()=>re,PauseCommand:()=>le,PlayCommand:()=>de,PlayoutOptions:()=>e.PlayoutOptions,PluginAPI:()=>Rn,PrintCommand:()=>Ee,RawCommand:()=>B,RemoveCommand:()=>Ie,ResumeCommand:()=>Ve,SimpleArgsCommand:()=>N,SimpleCommand:()=>I,StopCommand:()=>Qe,SwapCommand:()=>ur,Transform:()=>Mn,UI_INJECTION_ZONE:()=>u});var t={};r.r(t);var e={};r.r(e),r.d(e,{RD:()=>At});var o=r(7),i=function(t){return t.INFO="INFO",t.WARN="WARN",t.DEBUG="DEBUG",t.ERROR="ERROR",t.FATAL="FATAL",t.NONE="NONE",t}({}),u={PLUGIN_PAGE:"plugin-page",RUNDOWN_ITEM:"rundown-item",RUNDOWN_EDITOR:"rundown-editor"};function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,y(n.key),n)}}function l(t,e,r){return e&&f(t.prototype,e),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=y(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:String(e)}var p=function(){function t(e){c(this,t),s(this,"casparChannel",void 0),this.casparChannel=e}return l(t,[{key:"getCasparChannel",value:function(){return this.casparChannel}},{key:"getCommandString",value:function(){return this.getCasparChannel().toString()}}]),t}(),h=function(){function t(e){c(this,t),s(this,"channel",void 0),s(this,"casparLayer",void 0),this.setChannel(e)}return l(t,[{key:"setChannel",value:function(t){this.channel=t}},{key:"setCasparLayer",value:function(t){this.casparLayer=t,this.onMove()}},{key:"onMove",value:function(){}},{key:"getCasparLayer",value:function(){return this.casparLayer}},{key:"getCasparChannel",value:function(){var t;return null===(t=this.channel)||void 0===t?void 0:t.getCasparChannel()}},{key:"getCommandString",value:function(){var t=this.getCasparChannel(),e=this.getCasparLayer();if(void 0!==e&&void 0!==t)return"".concat(t,"-").concat(e)}}],[{key:"caspar",value:function(e,r){return t.from(e,r)}},{key:"from",value:function(e,r){if(e instanceof t)return e;if("number"==typeof e&&(e=new p(e)),"number"!=typeof r)return e;var n=new t(e);return n.setCasparLayer(r),n}}]),t}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},b.apply(this,arguments)}function m(t,e,r){return(e=T(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||g(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t,e){if(t){if("string"==typeof t)return w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function O(t,e,r){return e=_(e),function(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return j(t)}(t,S()?Reflect.construct(e,r||[],_(t).constructor):e.apply(t,r))}function j(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function S(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(S=function(){return!!t})()}function _(t){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_(t)}function P(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&E(t,e)}function E(t,e){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},E(t,e)}function k(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,T(n.key),n)}}function x(t,e,r){return e&&k(t.prototype,e),r&&k(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(t){var e=function(t,e){if("object"!=v(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(e)?e:String(e)}function L(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var C=x((function t(){L(this,t)})),A=function(){function t(){L(this,t)}return x(t,[{key:"compileArgs",value:function(){return this.getArguments().map((function(t){return JSON.stringify(t)})).map((function(t){return t.includes(" ")?t:t.substring(1,t.length-1)})).join(" ")}},{key:"getCommand",value:function(){var t=this.getCommandType();if(t){var e=this.compileArgs();return e?"".concat(t," ").concat(e,"\r\n"):"".concat(t,"\r\n")}}}],[{key:"create",value:function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return new(function(t){function r(){return L(this,r),O(this,r,arguments)}return P(r,t),x(r,[{key:"getCommandType",value:function(){return e}},{key:"getArguments",value:function(){return n}},{key:"getCmd",value:function(){return this.getCommandType()}},{key:"getArgs",value:function(){return this.getArguments()}}]),r}(t))}},{key:"parseQuotes",value:function(t){for(var e=0;e<t.length;e++){var r=t[e];if(r.endsWith('"')){for(var n=!1,o=r.length-2;o>=0&&"\\"===r[o];o--)n=!n;if(!n)return t.slice(0,e+1)}}throw new Error("Command contains unclosed quotes")}},{key:"parseArguments",value:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];if(n.startsWith('"')){var o=this.parseQuotes(t.slice(r));e.push(JSON.parse(o.join(" "))),r+=o.length-1}else e.push(n)}return e}},{key:"from",value:function(t){if(t.endsWith("\r\n")&&(t=t.slice(0,-2)),t.indexOf("\r\n")>-1)throw new Error("Command cannot contain line breaks");if(t.startsWith('"'))throw new Error("Command cannot start with quotes");var e=t.split(" ");return this.create.apply(this,[e[0]].concat(d(this.parseArguments(e.slice(1)))))}},{key:"interpret",value:function(t){var e=this;return t.split("\r\n").filter((function(t){return t.length>0})).map((function(t){return e.from(t)}))}}]),t}(),R=function(t){function e(t){var r;return L(this,e),m(j(r=O(this,e)),"allocation",void 0),t&&r.allocate(t),r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){return this.allocation=h.from(t,e),this}},{key:"isChannel",value:function(){return this.allocation instanceof p}},{key:"isLayer",value:function(){return this.allocation instanceof h}},{key:"getPosition",value:function(){var t;return null===(t=this.allocation)||void 0===t?void 0:t.getCommandString()}}]),e}(A),I=function(t){function e(){return L(this,e),O(this,e,arguments)}return P(e,t),x(e,[{key:"getArguments",value:function(){var t=this.getPosition();return t?[t]:[]}}]),e}(R),N=function(t){function e(){var t;L(this,e),m(j(t=O(this,e)),"args",void 0);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.args=n,t}return P(e,t),x(e,[{key:"setArgs",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.args=e,this}},{key:"getArguments",value:function(){return[].concat(d(b(_(e.prototype),"getArguments",this).call(this)),d(this.args))}}]),e}(I),D=function(t){function e(t){var r;return L(this,e),m(j(r=O(this,e)),"commands",void 0),m(j(r),"allocation",void 0),r.commands=t,r}return P(e,t),x(e,[{key:"allocate",value:function(t,e){this.allocation=h.from(t,e);var r,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=g(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}(this.commands);try{for(n.s();!(r=n.n()).done;){var o=r.value;o instanceof R&&o.allocate(this.allocation)}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"getCommand",value:function(){return this.commands.map((function(t){return t.getCommand()})).join("")}}]),e}(C),B=function(t){function e(t){var r;return L(this,e),m(j(r=O(this,e)),"command",void 0),r.command=t,r}return P(e,t),x(e,[{key:"getCommand",value:function(){return this.command}}]),e}(C);function M(t){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(t)}function G(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,U(n.key),n)}}function U(t){var e=function(t,e){if("object"!=M(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==M(e)?e:String(e)}function F(t,e,r){return e=J(e),function(t,e){if(e&&("object"===M(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,V()?Reflect.construct(e,r||[],J(t).constructor):e.apply(t,r))}function V(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(V=function(){return!!t})()}function J(t){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},J(t)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}var Y=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),F(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&W(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"ADD"}}])&&G(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function H(t){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(t)}function K(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,z(n.key),n)}}function $(t,e,r){return e=Q(e),function(t,e){if(e&&("object"===H(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return X(t)}(t,q()?Reflect.construct(e,r||[],Q(t).constructor):e.apply(t,r))}function q(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(q=function(){return!!t})()}function Q(t){return Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Q(t)}function X(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Z(t,e){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Z(t,e)}function z(t){var e=function(t,e){if("object"!=H(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:String(e)}var tt=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=X(r=$(this,e)),i=void 0,(o=z(o="method"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.method=t,r}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Z(t,e)}(e,t),r=e,o=[{key:"call",value:function(t){return new e(t)}}],(n=[{key:"setMethod",value:function(t){return this.method=t,this}},{key:"getCommandType",value:function(){return"CALL"}},{key:"getArguments",value:function(){return[this.method]}}])&&K(r.prototype,n),o&&K(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function et(t){return et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et(t)}function rt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ft(n.key),n)}}function nt(t,e,r){return e=it(e),function(t,e){if(e&&("object"===et(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ut(t)}(t,ot()?Reflect.construct(e,r||[],it(t).constructor):e.apply(t,r))}function ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ot=function(){return!!t})()}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function ut(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function at(t,e){return at=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},at(t,e)}function ct(t,e,r){return(e=ft(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ft(t){var e=function(t,e){if("object"!=et(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==et(e)?e:String(e)}var lt=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ct(ut(t=nt(this,e)),"cmd",void 0),ct(ut(t),"cgLayer",void 0),ct(ut(t),"arguments",[]),t}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&at(t,e)}(e,t),r=e,o=[{key:"single",value:function(t){var r=new e;return r.cmd=t,r}},{key:"add",value:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,o=e.single("ADD");return o.arguments.push(t),o.arguments.push(r?"1":"0"),n&&o.arguments.push(JSON.stringify(n)),o}},{key:"play",value:function(){return e.single("PLAY")}},{key:"stop",value:function(){return e.single("STOP")}},{key:"next",value:function(){return e.single("NEXT")}},{key:"remove",value:function(){return e.single("REMOVE")}},{key:"clear",value:function(){return e.single("CLEAR")}},{key:"update",value:function(t){var r=e.single("UPDATE");return r.arguments.push(JSON.stringify(t)),r}},{key:"invoke",value:function(t){var r=e.single("INVOKE");return r.arguments.push(t),r}},{key:"info",value:function(){return e.single("INFO")}}],(n=[{key:"setLayer",value:function(t){return this.cgLayer=t,this}},{key:"getCommandType",value:function(){return"CG"}},{key:"getArguments",value:function(){var t=this.arguments.slice();void 0!==this.cgLayer?t.unshift(this.cgLayer.toString()):"CLEAR"!==this.cmd&&t.unshift("0"),t.unshift(this.cmd);var e=this.getPosition();return e&&t.unshift(e),t}}])&&rt(r.prototype,n),o&&rt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(R);function st(t){return st="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},st(t)}function yt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pt(n.key),n)}}function pt(t){var e=function(t,e){if("object"!=st(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=st(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==st(e)?e:String(e)}function ht(t,e,r){return e=bt(e),function(t,e){if(e&&("object"===st(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vt()?Reflect.construct(e,r||[],bt(t).constructor):e.apply(t,r))}function vt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vt=function(){return!!t})()}function bt(t){return bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bt(t)}function mt(t,e){return mt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mt(t,e)}var dt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ht(this,e,arguments)}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mt(t,e)}(e,t),r=e,o=[{key:"all",value:function(){return new B("CLEAR ALL")}}],(n=[{key:"getCommandType",value:function(){return"CLEAR"}}])&&yt(r.prototype,n),o&&yt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function gt(t){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt(t)}function wt(t){return function(t){if(Array.isArray(t))return Ot(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ot(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ot(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function jt(t,e,r){return e=_t(e),function(t,e){if(e&&("object"===gt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Pt(t)}(t,St()?Reflect.construct(e,r||[],_t(t).constructor):e.apply(t,r))}function St(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(St=function(){return!!t})()}function _t(t){return _t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_t(t)}function Pt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Et(t,e){return Et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Et(t,e)}function kt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Lt(n.key),n)}}function Tt(t,e,r){return e&&xt(t.prototype,e),r&&xt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Lt(t){var e=function(t,e){if("object"!=gt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gt(e)?e:String(e)}var Ct=function(){function t(){kt(this,t)}return Tt(t,null,[{key:"getVideoArguments",value:function(t){var e,r=[];return(t=t||{}).transition&&(r.push(t.transition),r.push((null!==(e=t.duration)&&void 0!==e?e:0).toString()),t.tween&&r.push(t.tween),t.direction&&r.push(t.direction)),t.seek&&r.push("SEEK",t.seek.toString()),t.length&&r.push("LENGTH",t.length.toString()),t.filter&&r.push("FILTER",t.filter),t.loop&&r.push("LOOP"),t.auto&&r.push("AUTO"),r}}]),t}(),At=function(t){function e(){var t,r,n,o;return kt(this,e),r=Pt(t=jt(this,e)),o=void 0,(n=Lt(n="arguments"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t.arguments=[],t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Et(t,e)}(e,t),Tt(e,[{key:"getCommandType",value:function(){return"LOADBG"}},{key:"getArguments",value:function(){var t=this.getPosition();return t?[t].concat(wt(this.arguments)):[]}},{key:"setArguments",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this.arguments=e,this}}],[{key:"video",value:function(t,e){var r;return(r=new this).setArguments.apply(r,[t].concat(wt(Ct.getVideoArguments(e))))}},{key:"decklink",value:function(t,e){return(new this).setArguments("DECKLINK","DEVICE",t.toString(),"FORMAT",e)}},{key:"route",value:function(t){return(new this).setArguments("route://".concat(t.getCommandString()))}},{key:"color",value:function(t){return(new this).setArguments(t)}}]),e}(R);function Rt(t){return Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(t)}function It(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Nt(n.key),n)}}function Nt(t){var e=function(t,e){if("object"!=Rt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rt(e)?e:String(e)}function Dt(t,e,r){return e=Mt(e),function(t,e){if(e&&("object"===Rt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bt()?Reflect.construct(e,r||[],Mt(t).constructor):e.apply(t,r))}function Bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bt=function(){return!!t})()}function Mt(t){return Mt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mt(t)}function Gt(t,e){return Gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gt(t,e)}var Ut=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Dt(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gt(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"LOAD"}}])&&It(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function Ft(t){return Ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ft(t)}function Vt(t){return function(t){if(Array.isArray(t))return Jt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Jt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Wt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,te(n.key),n)}}function Ht(t,e,r){return e&&Yt(t.prototype,e),r&&Yt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Kt(t,e,r){return e=qt(e),function(t,e){if(e&&("object"===Ft(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Qt(t)}(t,$t()?Reflect.construct(e,r||[],qt(t).constructor):e.apply(t,r))}function $t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($t=function(){return!!t})()}function qt(t){return qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qt(t)}function Qt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Xt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zt(t,e)}function Zt(t,e){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zt(t,e)}function zt(t,e,r){return(e=te(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function te(t){var e=function(t,e){if("object"!=Ft(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ft(e)?e:String(e)}var ee=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Wt(this,e),zt(Qt(r=Kt(this,e)),"command",void 0),zt(Qt(r),"args",void 0),r.command=t,r.args=n,r}return Xt(e,t),Ht(e,[{key:"getCommandType",value:function(){return"MIXER"}},{key:"getArguments",value:function(){return[this.getPosition(),this.command].concat(Vt(this.args))}}]),e}(R),re=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Wt(this,e),t=Kt(this,e,[[]]),r&&t.commands.push(new ee("CLEAR")),t}return Xt(e,t),Ht(e,[{key:"single",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;r&&("number"==typeof r?e.push(r.toString()):e.push(r.duration.toString())),"number"!=typeof r&&null!=r&&r.type&&e.push(r.type);var n=new ee(t,e);return this.commands.push(n),this}},{key:"keyer",value:function(t){return this.single("KEYER",[t.toString()])}},{key:"chroma",value:function(t,e){if(!t.enabled)return this.single("CHROMA",["0"]);var r=[1,t.target_hue,t.hue_width,t.min_saturation,t.min_brightness,t.softness,t.spill_suppress,t.spill_suppress_saturation,t.show_mask?1:0];return this.single("CHROMA",r.map((function(t){return t.toString()})),e)}},{key:"blend",value:function(t){return this.single("BLEND",[t])}},{key:"invert",value:function(t){return this.single("INVERT",[t?"1":"0"])}},{key:"opacity",value:function(t,e){var r=[t];return this.single("OPACITY",r.map((function(t){return t.toString()})),e)}},{key:"brightness",value:function(t,e){var r=[t];return this.single("BRIGHTNESS",r.map((function(t){return t.toString()})),e)}},{key:"saturation",value:function(t,e){var r=[t];return this.single("SATURATION",r.map((function(t){return t.toString()})),e)}},{key:"contrast",value:function(t,e){var r=[t];return this.single("CONTRAST",r.map((function(t){return t.toString()})),e)}},{key:"levels",value:function(t,e){var r=[t.min_input,t.max_input,t.gamma,t.min_output,t.max_output];return this.single("LEVELS",r.map((function(t){return t.toString()})),e)}},{key:"fill",value:function(t,e){var r=[t.x,t.y,t.x_scale,t.y_scale];return this.single("FILL",r.map((function(t){return t.toString()})),e)}},{key:"clip",value:function(t,e){var r=[t.x,t.y,t.width,t.height];return this.single("CLIP",r.map((function(t){return t.toString()})),e)}},{key:"anchor",value:function(t,e){var r=[t.x,t.y];return this.single("ANCHOR",r.map((function(t){return t.toString()})),e)}},{key:"crop",value:function(t,e){var r=[t.left_edge,t.top_edge,t.right_edge,t.bottom_edge];return this.single("CROP",r.map((function(t){return t.toString()})),e)}},{key:"rotation",value:function(t,e){var r=[t];return this.single("ROTATION",r.map((function(t){return t.toString()})),e)}},{key:"perspective",value:function(t,e){var r=[t.top_left.x,t.top_left.y,t.top_right.x,t.top_right.y,t.bottom_right.x,t.bottom_right.y,t.bottom_left.x,t.bottom_left.y];return this.single("PERSPECTIVE",r.map((function(t){return t.toString()})),e)}},{key:"mipmap",value:function(t){return this.single("MIPMAP",[t?"1":"0"])}},{key:"volume",value:function(t,e){var r=[t];return this.single("VOLUME",r.map((function(t){return t.toString()})),e)}},{key:"mastervolume",value:function(t){return this.single("MASTERVOLUME",[t.toString()])}},{key:"straightAlphaOutput",value:function(t){return this.single("STRAIGHT_ALPHA_OUTPUT",[t?"1":"0"])}},{key:"edgeblend",value:function(t){var e=[].concat(Vt(t.edgeblend),[t.g,t.p,t.a]);return this.single("EDGEBLEND",e.map((function(t){return t.toString()})))}},{key:"clear",value:function(){return this.commands.splice(0,this.commands.length),this}}],[{key:"create",value:function(){return new e}},{key:"clear",value:function(){return new e(!0)}}]),e}(D);function ne(t){return ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ne(t)}function oe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ie(n.key),n)}}function ie(t){var e=function(t,e){if("object"!=ne(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ne(e)?e:String(e)}function ue(t,e,r){return e=ce(e),function(t,e){if(e&&("object"===ne(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ae()?Reflect.construct(e,r||[],ce(t).constructor):e.apply(t,r))}function ae(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ae=function(){return!!t})()}function ce(t){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ce(t)}function fe(t,e){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fe(t,e)}var le=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ue(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PAUSE"}}])&&oe(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function se(t){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(t)}function ye(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pe(n.key),n)}}function pe(t){var e=function(t,e){if("object"!=se(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==se(e)?e:String(e)}function he(t,e,r){return e=be(e),function(t,e){if(e&&("object"===se(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ve()?Reflect.construct(e,r||[],be(t).constructor):e.apply(t,r))}function ve(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ve=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},be(t)}function me(t,e){return me=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},me(t,e)}var de=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),he(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&me(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PLAY"}}])&&ye(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(At);function ge(t){return ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge(t)}function we(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Oe(n.key),n)}}function Oe(t){var e=function(t,e){if("object"!=ge(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ge(e)?e:String(e)}function je(t,e,r){return e=_e(e),function(t,e){if(e&&("object"===ge(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Se()?Reflect.construct(e,r||[],_e(t).constructor):e.apply(t,r))}function Se(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Se=function(){return!!t})()}function _e(t){return _e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_e(t)}function Pe(t,e){return Pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pe(t,e)}var Ee=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),je(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"PRINT"}}])&&we(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function ke(t){return ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ke(t)}function xe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Te(n.key),n)}}function Te(t){var e=function(t,e){if("object"!=ke(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ke(e)?e:String(e)}function Le(t,e,r){return e=Ae(e),function(t,e){if(e&&("object"===ke(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ce()?Reflect.construct(e,r||[],Ae(t).constructor):e.apply(t,r))}function Ce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ce=function(){return!!t})()}function Ae(t){return Ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ae(t)}function Re(t,e){return Re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Re(t,e)}var Ie=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Le(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Re(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"REMOVE"}}])&&xe(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(N);function Ne(t){return Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(t)}function De(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Be(n.key),n)}}function Be(t){var e=function(t,e){if("object"!=Ne(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ne(e)?e:String(e)}function Me(t,e,r){return e=Ue(e),function(t,e){if(e&&("object"===Ne(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ge()?Reflect.construct(e,r||[],Ue(t).constructor):e.apply(t,r))}function Ge(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ge=function(){return!!t})()}function Ue(t){return Ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ue(t)}function Fe(t,e){return Fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fe(t,e)}var Ve=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Me(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"RESUME"}}])&&De(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Je(t){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Je(t)}function We(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ye(n.key),n)}}function Ye(t){var e=function(t,e){if("object"!=Je(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Je(e)?e:String(e)}function He(t,e,r){return e=$e(e),function(t,e){if(e&&("object"===Je(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ke()?Reflect.construct(e,r||[],$e(t).constructor):e.apply(t,r))}function Ke(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ke=function(){return!!t})()}function $e(t){return $e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$e(t)}function qe(t,e){return qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qe(t,e)}var Qe=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),He(this,e,arguments)}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qe(t,e)}(e,t),r=e,(n=[{key:"getCommandType",value:function(){return"STOP"}}])&&We(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(I);function Xe(t){return Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xe(t)}function Ze(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ir(n.key),n)}}function ze(t,e,r){return e=er(e),function(t,e){if(e&&("object"===Xe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return rr(t)}(t,tr()?Reflect.construct(e,r||[],er(t).constructor):e.apply(t,r))}function tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(tr=function(){return!!t})()}function er(t){return er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},er(t)}function rr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function nr(t,e){return nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nr(t,e)}function or(t,e,r){return(e=ir(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ir(t){var e=function(t,e){if("object"!=Xe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xe(e)?e:String(e)}var ur=function(t){function e(t,r){var n,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),or(rr(n=ze(this,e)),"allocation1",void 0),or(rr(n),"allocation2",void 0),or(rr(n),"transforms",void 0),t&&n.allocate1(t),r&&n.allocate2(r),n.transforms=o,n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nr(t,e)}(e,t),r=e,(n=[{key:"allocate1",value:function(t,e){return this.allocation1=h.from(t,e),this}},{key:"allocate2",value:function(t,e){return this.allocation2=h.from(t,e),this}},{key:"getCommandType",value:function(){return"SWAP"}},{key:"getArguments",value:function(){var t,e,r=null===(t=this.allocation1)||void 0===t?void 0:t.getCommandString(),n=null===(e=this.allocation2)||void 0===e?void 0:e.getCommandString();if(!r||!n)return[];var o=[r,n];return this.transforms&&o.push("TRANSFORMS"),o}}])&&Ze(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}(A);const ar={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let cr;const fr=new Uint8Array(16);function lr(){if(!cr&&(cr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!cr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cr(fr)}const sr=[];for(let t=0;t<256;++t)sr.push((t+256).toString(16).slice(1));const yr=function(t,e,r){if(ar.randomUUID&&!e&&!t)return ar.randomUUID();const n=(t=t||{}).random||(t.rng||lr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){r=r||0;for(let t=0;t<16;++t)e[r+t]=n[t];return e}return function(t,e=0){return sr[t[e+0]]+sr[t[e+1]]+sr[t[e+2]]+sr[t[e+3]]+"-"+sr[t[e+4]]+sr[t[e+5]]+"-"+sr[t[e+6]]+sr[t[e+7]]+"-"+sr[t[e+8]]+sr[t[e+9]]+"-"+sr[t[e+10]]+sr[t[e+11]]+sr[t[e+12]]+sr[t[e+13]]+sr[t[e+14]]+sr[t[e+15]]}(n)};function pr(t){return pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pr(t)}function hr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=vr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function vr(t,e){if(t){if("string"==typeof t)return br(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?br(t,e):void 0}}function br(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function mr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Er(n.key),n)}}function gr(t,e,r){return e&&dr(t.prototype,e),r&&dr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function wr(t,e,r){return e=jr(e),function(t,e){if(e&&("object"===pr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Sr(t)}(t,Or()?Reflect.construct(e,r||[],jr(t).constructor):e.apply(t,r))}function Or(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Or=function(){return!!t})()}function jr(t){return jr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},jr(t)}function Sr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _r(t,e){return _r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_r(t,e)}function Pr(t,e,r){return(e=Er(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Er(t){var e=function(t,e){if("object"!=pr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=pr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pr(e)?e:String(e)}var kr=function(t){function e(t){var r;return mr(this,e),Pr(Sr(r=wr(this,e)),"_active",!1),Pr(Sr(r),"_disposed",!1),Pr(Sr(r),"id",yr()),Pr(Sr(r),"transform",void 0),Pr(Sr(r),"effectGroup",void 0),Pr(Sr(r),"layers",[]),r.effectGroup=t,r.group.addEffect(Sr(r)),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_r(t,e)}(e,t),gr(e,[{key:"active",get:function(){return this._active}},{key:"getTransform",value:function(){return this.transform}},{key:"setTransform",value:function(t){this.transform=t,this.applyTransform()}},{key:"applyTransform",value:function(){if(this.active&&this.transform){var t,e=hr(this.layers);try{for(e.s();!(t=e.n()).done;){var r=t.value;this.executor.execute(this.transform.getCommand().allocate(r))}}catch(t){e.e(t)}finally{e.f()}}}},{key:"group",get:function(){return this.effectGroup}},{key:"executor",get:function(){return this.group.channel.executor}},{key:"activate",value:function(){return!this._disposed&&!this.active&&(this._active=!0,this.executor.executeAllocations(),this.applyTransform(),!0)}},{key:"deactivate",value:function(){return!!this.active&&(this._active=!1,!0)}},{key:"dispose",value:function(){this._disposed||(this._disposed=!0,this.deactivate(),this.deallocateLayers(this.layers),this.executor.executeAllocations(),this.group.removeEffect(this),this.effectGroup=null,this.transform=null,this.removeAllListeners())}},{key:"getLayers",value:function(){return this.layers}},{key:"allocateLayers",value:function(){var t,e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=this.group.getEffectIndex(this),o=this.group.channel.allocateLayers({count:r,index:n});(t=this.layers).push.apply(t,function(t){if(Array.isArray(t))return br(t)}(e=o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||vr(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var i,u=hr(o);try{for(u.s();!(i=u.n()).done;)i.value.setEffect(this)}catch(t){u.e(t)}finally{u.f()}return o}},{key:"deallocateLayers",value:function(t){var e,r=hr(t=t.slice());try{for(r.s();!(e=r.n()).done;){var n=e.value;n.setEffect(null);var o=this.layers.indexOf(n);o>=0&&this.layers.splice(o,1)}}catch(t){r.e(t)}finally{r.f()}this.group.channel.deallocateLayers(t)}},{key:"updatePositions",value:function(){return[]}},{key:"getName",value:function(){return this.constructor.name}},{key:"getMetadata",value:function(){return{}}},{key:"toJSON",value:function(){return{id:this.id,type:this.getName(),active:this.active,metadata:this.getMetadata(),layers:this.layers.map((function(t){return t.toJSON()}))}}}]),e}(o.EventEmitter),xr=function(){function t(){mr(this,t),Pr(this,"effects",new Map)}return gr(t,[{key:"register",value:function(t,e){this.effects.set(t,e)}},{key:"unregister",value:function(t){this.effects.delete(t)}},{key:"get",value:function(t){return this.effects.get(t)}},{key:"create",value:function(t,e,r){var n=this.get(t);return n?n(e,r):null}}]),t}();function Tr(t){return Tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tr(t)}function Lr(t,e,r){return e=Ar(e),function(t,e){if(e&&("object"===Tr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Rr(t)}(t,Cr()?Reflect.construct(e,r||[],Ar(t).constructor):e.apply(t,r))}function Cr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Cr=function(){return!!t})()}function Ar(t){return Ar=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ar(t)}function Rr(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ir(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Nr(t,e)}function Nr(t,e){return Nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nr(t,e)}function Dr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Br(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function Br(t,e){if(t){if("string"==typeof t)return Mr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Mr(t,e):void 0}}function Mr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Gr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ur(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Jr(n.key),n)}}function Fr(t,e,r){return e&&Ur(t.prototype,e),r&&Ur(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vr(t,e,r){return(e=Jr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Jr(t){var e=function(t,e){if("object"!=Tr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Tr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tr(e)?e:String(e)}var Wr=function(){function t(e,r){Gr(this,t),Vr(this,"effects",[]),Vr(this,"name",void 0),Vr(this,"channel",void 0),this.name=r,this.channel=e}return Fr(t,[{key:"addEffect",value:function(t){this.effects.push(t),this.channel.executor.effects.set(t.id,t)}},{key:"removeEffect",value:function(t){var e=this.effects.indexOf(t);e>=0&&this.effects.splice(e,1),this.channel.executor.effects.delete(t.id)}},{key:"dispose",value:function(){var t,e=Dr(this.effects);try{for(e.s();!(t=e.n()).done;)t.value.dispose()}catch(t){e.e(t)}finally{e.f()}}},{key:"getEffectIndex",value:function(t){var e=this.effects.indexOf(t);if(e<0)throw new Error("Effect not found in group");for(;e>=0;){var r=this.effects[e].getLayers();if(r.length){var n=r[r.length-1];return this.channel.getLayerIndex(n)+1}e--}return this.getStartingIndex()}},{key:"getStartingIndex",value:function(){var t=this.channel.groups.indexOf(this);if(t<0)throw new Error("Effect group not found in channel");if(0===t)return 0;for(;t>0;){t--;var e=this.channel.groups[t];if(!(e.effects.length<1)){for(var r=e.effects,n=r.length-1;n>=0&&!r[n].getLayers().length;)n--;if(!(n<0)){var o=r[n].getLayers(),i=o[o.length-1];return this.channel.getLayerIndex(i)+1}}}return 0}},{key:"toJSON",value:function(){return{name:this.name,effects:this.effects.map((function(t){return t.id}))}}}]),t}(),Yr=function(t){function e(t,r){var n;return Gr(this,e),Vr(Rr(n=Lr(this,e,[t])),"layers",new Map),Vr(Rr(n),"groups",[]),Vr(Rr(n),"lastOrder",[]),Vr(Rr(n),"currentOrder",[]),Vr(Rr(n),"executor",void 0),Vr(Rr(n),"needExecute",!1),n.executor=r,n}return Ir(e,t),Fr(e,[{key:"createGroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=new Wr(this,t);return e=e<0?this.groups.length:e,this.groups.splice(e,0,r),r}},{key:"getGroup",value:function(t,e){var r;t=null!==(r=t)&&void 0!==r?r:yr();var n=this.groups.find((function(e){return e.name===t}));return null!=n?n:this.createGroup(t,null!=e?e:-1)}},{key:"setExecutor",value:function(t){this.executor=t}},{key:"getLayer",value:function(t){return this.layers.get(t)}},{key:"getLayers",value:function(){var t=this;return this.currentOrder.map((function(e){return t.layers.get(e)})).filter((function(t){return void 0!==t}))}},{key:"getLayerIndex",value:function(t){return this.currentOrder.indexOf(t.id)}},{key:"allocateLayers",value:function(t){var e,r,n,o,i=null!==(r=(t=null!==(e=t)&&void 0!==e?e:{}).count)&&void 0!==r?r:1;if(i<1)throw new Error("You have to allocate at least 1 layer");for(var u=new Array(i),a=new Array(i),c=0;c<i;c++){var f=new Hr(this);this.layers.set(f.id,f),u[c]=f,a[c]=f.id}var l=null!==(n=t.index)&&void 0!==n?n:this.currentOrder.length;(o=this.currentOrder).splice.apply(o,[l,0].concat(a));for(var s=l+1;s<this.currentOrder.length&&i>0;s++)void 0===this.currentOrder[s]&&(this.currentOrder.splice(s,1),i--,s--);return this.needExecute=!0,u}},{key:"allocateLayer",value:function(t){return this.allocateLayers({index:t,count:1})[0]}},{key:"deallocateLayers",value:function(t){var e,r=Dr(t);try{for(r.s();!(e=r.n()).done;){var n=e.value,o=this.currentOrder.indexOf(n.id);this.currentOrder[o]=void 0,this.layers.delete(n.id)}}catch(t){r.e(t)}finally{r.f()}this.needExecute=!0}},{key:"executeAllocation",value:function(){if(this.needExecute){this.needExecute=!1;for(var t=[],e=this.lastOrder.slice(),r=0;r<e.length;r++){var n=e[r];if(void 0!==n&&!(this.currentOrder.indexOf(n)>=0)){e[r]=void 0;var o=h.caspar(this.casparChannel,r+1);t.push(new dt(o)),t.push(re.clear().allocate(o))}}for(var i=0;i<this.currentOrder.length;i++){var u=this.currentOrder[i];if(void 0!==u){this.layers.get(u).setCasparLayer(i+1);var a=e.indexOf(u);if(a!==i&&!(a<0)){e[a]=e[i],e[i]=u;var c=h.caspar(this.casparChannel,i+1),f=h.caspar(this.casparChannel,a+1);t.push(new ur(c,f,!0))}}}this.lastOrder=this.currentOrder,this.currentOrder=this.currentOrder.slice();for(var l=0;l<this.currentOrder.length;l++){var s=this.currentOrder[l];if(void 0!==s){var y=this.layers.get(s);y&&y.setCasparLayer(l+1)}}var p,v=Dr(this.executor.getEffects());try{for(v.s();!(p=v.n()).done;){var b=p.value;t.push.apply(t,function(t){if(Array.isArray(t))return Mr(t)}(d=b.updatePositions())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(d)||Br(d)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}catch(t){v.e(t)}finally{v.f()}var m=new D(t);this.executor.execute(m)}var d}},{key:"toJSON",value:function(){var t=this;return{channel:this.casparChannel,layers:this.currentOrder.filter((function(t){return t})).map((function(e){return t.layers.get(e)})).map((function(t){return t.toJSON()})),groups:this.groups.map((function(t){return t.toJSON()}))}}}]),e}(p),Hr=function(t){function e(t){var r;return Gr(this,e),Vr(Rr(r=Lr(this,e,[t])),"id",void 0),Vr(Rr(r),"effect",void 0),r.id=yr(),r}return Ir(e,t),Fr(e,[{key:"setEffect",value:function(t){this.effect=t}},{key:"getEffect",value:function(){return this.effect}},{key:"dispose",value:function(){this.channel.deallocateLayers([this])}},{key:"toJSON",value:function(){var t;return{id:this.id,effect:null===(t=this.effect)||void 0===t?void 0:t.id}}}]),e}(h);function Kr(t){return Kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kr(t)}function $r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=zr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function qr(){qr=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,u=Object.create(i.prototype),a=new L(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",b={};function m(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=m.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==Kr(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===b)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===b)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,b):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Kr(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),b},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),b}},e}function Qr(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function Xr(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){Qr(i,n,o,u,a,"next",t)}function a(t){Qr(i,n,o,u,a,"throw",t)}u(void 0)}))}}function Zr(t){return function(t){if(Array.isArray(t))return tn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||zr(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zr(t,e){if(t){if("string"==typeof t)return tn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tn(t,e):void 0}}function tn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function en(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,sn(n.key),n)}}function rn(t,e,r){return e&&en(t.prototype,e),r&&en(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function nn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function on(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function un(t){var e="function"==typeof Map?new Map:void 0;return un=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(an())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&cn(o,r.prototype),o}(t,arguments,fn(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),cn(r,t)},un(t)}function an(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(an=function(){return!!t})()}function cn(t,e){return cn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cn(t,e)}function fn(t){return fn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fn(t)}function ln(t,e,r){return(e=sn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sn(t){var e=function(t,e){if("object"!=Kr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Kr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kr(e)?e:String(e)}var yn=function(t){function e(t,r){var n,o,i,u;return nn(this,e),ln(on((o=this,i=e,u=[[r].concat(Zr(t)).join("\n")],i=fn(i),n=function(t,e){if(e&&("object"===Kr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return on(t)}(o,an()?Reflect.construct(i,u||[],fn(o).constructor):i.apply(o,u)))),"data",void 0),ln(on(n),"code",void 0),n.data=t,n.code=r,n.name="CasparResponseError",n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cn(t,e)}(e,t),rn(e)}(un(Error)),pn=function(){function t(){nn(this,t),ln(this,"templates",[]),ln(this,"lastFetch",0),ln(this,"fetchPromise",null),ln(this,"channels",new Map),ln(this,"listeners",[]),ln(this,"effects",new Map)}var e,r;return rn(t,[{key:"connected",get:function(){return!0}},{key:"_fetchTemplates",value:(r=Xr(qr().mark((function t(){return qr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",[]);case 1:case"end":return t.stop()}}),t)}))),function(){return r.apply(this,arguments)})},{key:"fetchTemplates",value:function(){var t=this;return this.fetchPromise||(this.fetchPromise=this._fetchTemplates().then((function(e){return t.fetchPromise=null,t.templates=e}))),this.fetchPromise}},{key:"getTemplates",value:(e=Xr(qr().mark((function t(){var e=arguments;return qr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e.length>0&&void 0!==e[0]&&e[0]||Date.now()-this.lastFetch>3e5)){t.next=5;break}return this.lastFetch=Date.now(),t.next=5,this.fetchTemplates();case 5:return t.abrupt("return",this.templates);case 6:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"resolveTemplates",value:function(){return this.templates}},{key:"promise",value:function(t){var e=this;return new Promise((function(r,n){var o;!function t(){o=setTimeout((function(){if(!e.connected)return t();e.removeListener(i),n(new yn(["Timeout"],-1))}),1e3)}();var i={command:t,success:function(t,e){o&&clearTimeout(o),r({data:t,code:e})},error:function(t,e){o&&clearTimeout(o),n(new yn(t,e))}};e.addListener(i)}))}},{key:"executePassive",value:function(t){var e=t.getCommand();e&&this.send(e)}},{key:"execute",value:function(t){var e=this,r=t.getCommand();if(r){var n=A.interpret(r).map((function(t){return e.promise(t.getCmd())}));return this.send(r),Promise.all(n)}}},{key:"getChannel",value:function(t){return this.channels.get(t)}},{key:"getChannels",value:function(){return Array.from(this.channels.values())}},{key:"allocateChannel",value:function(t){var e=new Yr(t,this);return this.channels.set(t,e),e}},{key:"executeAllocations",value:function(){var t,e=$r(this.channels.values());try{for(e.s();!(t=e.n()).done;)t.value.executeAllocation()}catch(t){e.e(t)}finally{e.f()}}},{key:"send",value:function(t){}},{key:"readData",value:function(t,e,r){var n=[];if((101===t||201===t||400===t)&&(n.push(r[0]),r.length<1))return-1;if(200===t){for(var o=0;r[o];o++)n.push(r[o]);if(n.length===r.length)return-1}return this.executeListeners(t,e,n),this.onEvent(t,e,n),200===t?n.length+1:n.length}},{key:"receive",value:function(t){for(var e=t.split("\r\n"),r=e.pop(),n=0,o=0;o<e.length;o++){var i=e[o].split(" "),u=parseInt(i[0]),a=null;400!==u&&500!==u&&(a=i[1]);var c=this.readData(u,a,e.slice(o+1));if(c<0)break;n=(o+=c)+1}return[].concat(Zr(e.slice(n)),[r]).join("\r\n")}},{key:"addListener",value:function(t){this.listeners.push(t)}},{key:"removeListener",value:function(t){var e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},{key:"executeListeners",value:function(t,e,r){if(!(t<200)&&e){var n,o=2===Math.floor(t/100),i=$r(this.listeners);try{for(i.s();!(n=i.n()).done;){var u=n.value;if(u.command===e){o?u.success(r,t):u.error(r,t),this.removeListener(u);break}}}catch(t){i.e(t)}finally{i.f()}}}},{key:"onEvent",value:function(t,e,r){}},{key:"getEffects",value:function(){return Array.from(this.effects.values())}},{key:"getEffect",value:function(t){return this.effects.get(t)}},{key:"toJSON",value:function(){return{channels:this.getChannels().map((function(t){return t.toJSON()}))}}}]),t}();function hn(t,e=(t=>null)){const r=[null,null];try{r[1]=t()}catch(t){r[0]=t,e(t)}return r}function vn(t){return vn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vn(t)}function bn(){bn=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,u=Object.create(i.prototype),a=new L(n||[]);return o(u,"_invoke",{value:E(t,r,a)}),u}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var y="suspendedStart",p="suspendedYield",h="executing",v="completed",b={};function m(){}function d(){}function g(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,j=O&&O(O(C([])));j&&j!==r&&n.call(j,u)&&(w=j);var S=g.prototype=m.prototype=Object.create(w);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,u,a){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==vn(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,a)}),(function(t){r("throw",t,u,a)})):e.resolve(l).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function E(e,r,n){var o=y;return function(i,u){if(o===h)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:t,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===b)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var f=s(e,r,n);if("normal"===f.type){if(o=n.done?v:p,f.arg===b)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=v,n.method="throw",n.arg=f.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,b;var u=i.arg;return u?u.done?(r[e.resultName]=u.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,b):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(vn(e)+" is not iterable")}return d.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:d,configurable:!0}),d.displayName=f(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,f(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},_(P.prototype),f(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(t,r,n,o),i);return e.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},_(S),f(S,c,"Generator"),f(S,u,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=n.call(u,"catchLoc"),f=n.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=e,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(u)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),b},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),b}},e}function mn(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function dn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Pn(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function gn(t,e,r){return e=On(e),function(t,e){if(e&&("object"===vn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return jn(t)}(t,wn()?Reflect.construct(e,r||[],On(t).constructor):e.apply(t,r))}function wn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wn=function(){return!!t})()}function On(t){return On=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},On(t)}function jn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Sn(t,e){return Sn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sn(t,e)}function _n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,e)||Pn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pn(t,e){if(t){if("string"==typeof t)return En(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?En(t,e):void 0}}function En(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function kn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Cn(n.key),n)}}function Tn(t,e,r){return e&&xn(t.prototype,e),r&&xn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ln(t,e,r){return(e=Cn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Cn(t){var e=function(t,e){if("object"!=vn(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=vn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vn(e)?e:String(e)}var An=function(){function t(){kn(this,t),Ln(this,"_api",void 0),Ln(this,"_enabled",!1),Ln(this,"logger",void 0)}return Tn(t,[{key:"pluginName",get:function(){return this.constructor.pluginName}},{key:"enable",value:function(t){var e=this;if(!this._enabled){this._enabled=!0;var r=_n(hn((function(){return e.onEnable()})),1)[0];if(r)return t.error("Error enabling plugin: ".concat(r)),void(this._enabled=!1);t.debug("Enabled")}}},{key:"disable",value:function(t){var e=this;if(this._enabled){this._enabled=!1,this._api.unregister();var r=_n(hn((function(){return e.onDisable()})),1)[0];r?t.error("Error disabling plugin: ".concat(r)):t.debug("Disabled")}}},{key:"onEnable",value:function(){}},{key:"onDisable",value:function(){}},{key:"api",get:function(){return this._api}}],[{key:"pluginName",get:function(){return this.name}}]),t}(),Rn=function(t){function e(t,r){var n;return kn(this,e),Ln(jn(n=gn(this,e)),"files",[]),Ln(jn(n),"uiInjections",[]),Ln(jn(n),"_manager",void 0),Ln(jn(n),"_plugin",void 0),Ln(jn(n),"_effects",[]),Ln(jn(n),"routes",[]),n._manager=t,n._plugin=r,n._plugin._api=jn(n),n._plugin.logger=t.getLogger("Plugin").scope(n._plugin.pluginName),n}var r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Sn(t,e)}(e,t),Tn(e,[{key:"registerEffect",value:function(t,e){this._effects.push(t),this._manager.effects.register(t,e)}},{key:"unregisterEffects",value:function(){var t,e=dn(this._effects);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.effects.unregister(r)}}catch(t){e.e(t)}finally{e.f()}this._effects=[]}},{key:"unregisterRoutes",value:function(){var t,e=dn(this.routes);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.server.unregisterRoute(r)}}catch(t){e.e(t)}finally{e.f()}this.routes=[]}},{key:"unregisterFiles",value:(r=bn().mark((function t(){var e,r,n;return bn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=dn(this.files),t.prev=1,e.s();case 3:if((r=e.n()).done){t.next=9;break}return n=r.value,t.next=7,this._manager.directory.deleteDirectory(n);case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),e.e(t.t0);case 14:return t.prev=14,e.f(),t.finish(14);case 17:this.files=[];case 18:case"end":return t.stop()}}),t,this,[[1,11,14,17]])})),n=function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function u(t){mn(i,n,o,u,a,"next",t)}function a(t){mn(i,n,o,u,a,"throw",t)}u(void 0)}))},function(){return n.apply(this,arguments)})},{key:"unregisterUIInjections",value:function(){var t,e=dn(this.uiInjections);try{for(e.s();!(t=e.n()).done;){var r=t.value;this._manager.ui.unregister(r)}}catch(t){e.e(t)}finally{e.f()}this.uiInjections=[]}},{key:"unregister",value:function(){return this.unregisterEffects(),this.unregisterRoutes(),this.unregisterUIInjections(),this.unregisterFiles()}},{key:"registerRoute",value:function(t,e,r){var n=this._manager.server.registerRoute("plugin/".concat(this._plugin.pluginName,"/").concat(t),e,r);return this.routes.push(n),n}},{key:"unregisterRoute",value:function(t){var e=this.routes.indexOf(t);e<0||(this.routes.splice(e,1),this._manager.server.unregisterRoute(t))}},{key:"registerFile",value:function(t,e){var r=this;return this._manager.directory.createDirectory(t,e).then((function(t){return r.files.push(t.id),t}))}},{key:"getEffectGroup",value:function(t,e){return this._manager.executor.getEffectGroup(t,e)}},{key:"unregisterFile",value:function(t){var e=this.files.indexOf(t);if(!(e<0))return this.files.splice(e,1),this._manager.directory.deleteDirectory(t)}},{key:"getDirectory",value:function(t){if(this.files.includes(t))return this._manager.directory.getDirectory(t)}},{key:"getDirectories",value:function(){var t=this;return this.files.map((function(e){return t._manager.directory.getDirectory(e)}))}},{key:"getFileDatabase",value:function(){return this._manager.getFiles()}},{key:"registerUI",value:function(t,e){var r=this._manager.ui.register(t,e,this._plugin.pluginName);this.uiInjections.push(r)}},{key:"unregisterUI",value:function(t){var e=this.uiInjections.indexOf(t);e<0||(this.uiInjections.splice(e,1),this._manager.ui.unregister(t))}},{key:"createEffect",value:function(t,e,r){var n=this._manager.executor.getEffectGroup(e);return this._manager.effects.create(t,n,r)}},{key:"getEffect",value:function(t){return this._manager.executor.getEffect(t)}},{key:"registerRundownAction",value:function(t,e){this._manager.rundowns.executor.registerAction(t,e)}},{key:"enableVideoRoute",value:function(t){this._manager.routes.enableVideoRoute(t)}},{key:"disableVideoRoute",value:function(t){this._manager.routes.disableVideoRoute(t)}}]),e}(o.EventEmitter);function In(t){return In="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},In(t)}function Nn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Bn(n.key),n)}}function Dn(t,e,r){return(e=Bn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Bn(t){var e=function(t,e){if("object"!=In(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=In(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==In(e)?e:String(e)}var Mn=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Dn(this,"source",void 0),Dn(this,"destination",void 0),Dn(this,"fillTransition",null),Dn(this,"cropTransition",null),this.source=e,this.destination=r}var e,r,n;return e=t,n=[{key:"getRect",value:function(t,e,r,n){return{start:{x:t,y:e},end:{x:r,y:n}}}},{key:"normalRect",value:function(){return t.getRect(0,0,1,1)}},{key:"fromArray",value:function(e){return new t(t.getRect(e[0],e[1],e[2],e[3]),t.getRect(e[4],e[5],e[6],e[7]))}}],(r=[{key:"setTween",value:function(t,e){void 0===t&&(t=null),void 0===e&&(e=t),this.fillTransition=t,this.cropTransition=e}},{key:"getFill",value:function(t){return{x:t.start.x,y:t.start.y,x_scale:t.end.x-t.start.x,y_scale:t.end.y-t.start.y}}},{key:"getCrop",value:function(t){return{left_edge:t.start.x,top_edge:t.start.y,right_edge:t.end.x,bottom_edge:t.end.y}}},{key:"getCommand",value:function(){return re.create().crop(this.getCrop(this.source),this.cropTransition).fill(this.getFill(this.destination),this.fillTransition)}}])&&Nn(e.prototype,r),n&&Nn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()})(),module.exports=n})();
|
package/dist/plugin.d.ts
CHANGED
|
@@ -49,4 +49,6 @@ export declare class PluginAPI extends EventEmitter {
|
|
|
49
49
|
createEffect<T = Effect>(name: string, group: string, options: any): T;
|
|
50
50
|
getEffect(id: string): Effect;
|
|
51
51
|
registerRundownAction(name: string, handler: (item: RundownItem) => Promise<void> | void): void;
|
|
52
|
+
enableVideoRoute(id: string): void;
|
|
53
|
+
disableVideoRoute(id: string): void;
|
|
52
54
|
}
|
package/dist/types/manager.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { CasparProcess } from './caspar/process';
|
|
|
11
11
|
import { CasparExecutor } from './caspar/executor';
|
|
12
12
|
import { FileDatabase } from './scanner/db';
|
|
13
13
|
import { RundownManager } from './rundown';
|
|
14
|
+
import { VideoRoutesManager } from './routes';
|
|
14
15
|
export declare class CasparManager extends EventEmitter {
|
|
15
16
|
effects: EffectRegistry;
|
|
16
17
|
ui: UIInjector;
|
|
@@ -21,6 +22,7 @@ export declare class CasparManager extends EventEmitter {
|
|
|
21
22
|
executor: CasparExecutor;
|
|
22
23
|
db: FileDatabase;
|
|
23
24
|
rundowns: RundownManager;
|
|
25
|
+
routes: VideoRoutesManager;
|
|
24
26
|
start(): Promise<void>;
|
|
25
27
|
stop(): Promise<void>;
|
|
26
28
|
getMediaScanner(): MediaScanner;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CasparManager } from '../index';
|
|
2
|
+
interface DecklinkSource {
|
|
3
|
+
device: number;
|
|
4
|
+
format: string;
|
|
5
|
+
type: 'decklink';
|
|
6
|
+
}
|
|
7
|
+
interface VideoSource {
|
|
8
|
+
video: string;
|
|
9
|
+
type: 'video';
|
|
10
|
+
}
|
|
11
|
+
interface ChannelSource {
|
|
12
|
+
channel: number;
|
|
13
|
+
type: 'channel';
|
|
14
|
+
}
|
|
15
|
+
interface ColorSource {
|
|
16
|
+
color: string;
|
|
17
|
+
type: 'color';
|
|
18
|
+
}
|
|
19
|
+
interface EffectGroupDestination {
|
|
20
|
+
effectLayer: string;
|
|
21
|
+
index?: number;
|
|
22
|
+
type: 'effect-group';
|
|
23
|
+
}
|
|
24
|
+
type Source = DecklinkSource | VideoSource | ChannelSource | ColorSource;
|
|
25
|
+
type Destination = EffectGroupDestination;
|
|
26
|
+
export interface VideoRoute {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
transform?: number[];
|
|
30
|
+
source: Source;
|
|
31
|
+
destination: Destination;
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
metadata?: Record<string, any>;
|
|
34
|
+
}
|
|
35
|
+
export declare class VideoRoutesManager {
|
|
36
|
+
constructor(manager: CasparManager);
|
|
37
|
+
createVideoRoute(data: Omit<VideoRoute, 'id'>): VideoRoute;
|
|
38
|
+
getVideoRoute(id: string): VideoRoute | null;
|
|
39
|
+
getVideoRoutes(): VideoRoute[];
|
|
40
|
+
updateVideoRoute(data: VideoRoute): Promise<void>;
|
|
41
|
+
loadVideoRoutes(): Promise<void>;
|
|
42
|
+
saveVideoRoute(route: VideoRoute): Promise<void>;
|
|
43
|
+
deleteVideoRoute(id: string): Promise<void>;
|
|
44
|
+
enableVideoRoute(id: string): any;
|
|
45
|
+
disableVideoRoute(id: string): any;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"repository": "https://github.com/Lapplandsveckan/cg-manager-plugin",
|
|
4
4
|
"author": "firecraftgaming <eliyah@sundstroem.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.14",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"devDependencies": {
|