/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@okikio/emitter@2.1.7/lib/api.es.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var o=class{constructor(e){this.map=new Map(e)}getMap(){return this.map}get(e){return this.map.get(e)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(e,t){return this.map.set(e,t),this}add(e){let n=this.size;return this.set(n,e),this}get size(){return this.map.size}get length(){return this.map.size}last(e=1){let t=this.keys()[this.size-e];return this.get(t)}delete(e){return this.map.delete(e)}remove(e){return this.map.delete(e),this}clear(){return this.map.clear(),this}has(e){return this.map.has(e)}entries(){return this.map.entries()}forEach(e,t){return this.map.forEach(e,t),this}[Symbol.iterator](){return this.entries()}},b=(p,e,...t)=>{p.forEach(n=>{n[e](...t)})};var h=({callback:p=()=>{},scope:e=null,name:t="event"})=>({callback:p,scope:e,name:t}),c=class extends o{constructor(e="event"){super();this.name=e}},y=class extends o{constructor(){super()}getEvent(e){let t=this.get(e);return t instanceof c?t:(this.set(e,new c(e)),this.get(e))}newListener(e,t,n){let r=this.getEvent(e);return r.add(h({name:e,callback:t,scope:n})),r}on(e,t,n){if(typeof e=="undefined"||e==null)return this;typeof e=="string"&&(e=e.trim().split(/\s/g));let r,i,a=typeof e=="object"&&!Array.isArray(e),l=a?t:n;return a||(i=t),Object.keys(e).forEach(s=>{r=a?s:e[s],a&&(i=e[s]),this.newListener(r,i,l)},this),this}removeListener(e,t,n){let r=this.get(e);if(r instanceof c&&t){let i=h({name:e,callback:t,scope:n});r.forEach((a,l)=>{if(a.callback===i.callback&&a.scope===i.scope)return r.remove(l)})}return r}off(e,t,n){if(typeof e=="undefined"||e==null)return this;typeof e=="string"&&(e=e.trim().split(/\s/g));let r,i,a=typeof e=="object"&&!Array.isArray(e),l=a?t:n;return a||(i=t),Object.keys(e).forEach(s=>{r=a?s:e[s],a&&(i=e[s]),typeof i=="function"?this.removeListener(r,i,l):this.remove(r)},this),this}once(e,t,n){if(typeof e=="undefined"||e==null)return this;typeof e=="string"&&(e=e.trim().split(/\s/g));let r=typeof e=="object"&&!Array.isArray(e);return Object.keys(e).forEach(i=>{let a=r?i:e[i],l=r?e[i]:t,s=r?t:n,u=(...f)=>{l.apply(s,f),this.removeListener(a,u,s)};this.newListener(a,u,s)},this),this}emit(e,...t){return typeof e=="undefined"||e==null?this:(typeof e=="string"&&(e=e.trim().split(/\s/g)),e.forEach(n=>{let r=this.get(n);r instanceof c&&r.forEach(i=>{let{callback:a,scope:l}=i;a.apply(l,t)})},this),this)}clear(){return b(this,"clear"),super.clear(),this}},d=y;export{c as Event,y as EventEmitter,d as default,h as newListener};
