var DataLayerEvents=function(){"use strict";return class{constructor(){this.resetEvents(),this._subscribers=[]}resetEvents(){this._events=new Proxy([],{set:(s,t,e)=>{const r=s[t],i=Reflect.set(s,t,e);return"length"!==t&&r!==e&&this.emitEvents(),i}})}subscribe(s){!this._subscribers.includes(s)&&this._subscribers.push(s)}unsubscribe(s){this._subscribers=this._subscribers.filter((t=>t!==s))}push(s){this._events.push(s)}emitEvents(){if(this._subscribers.length){const s=[...this._events];this.resetEvents(),this._subscribers.forEach((t=>{try{"function"==typeof t.next&&t.next(s)}catch(s){"function"==typeof t.error&&t.error(s)}}))}}size(){return this._events.length}}}();
|