"use strict";var O=Object.defineProperty;var d=(o,e,t)=>e in o?O(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var i=(o,e,t)=>(d(o,typeof e!="symbol"?e+"":e,t),t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("../../../../eventemitter3@5.0.1/node_modules/eventemitter3/index.js"),m=require("./instances.js"),T=require("./logger.js"),l=T.default("quill:events"),L=["selectionchange","mousedown","mouseup","click"];L.forEach(o=>{document.addEventListener(o,function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];Array.from(document.querySelectorAll(".ql-container")).forEach(s=>{const n=m.default.get(s);n&&n.emitter&&n.emitter.handleDOM(...t)})})});class c extends E.default{constructor(){super(),this.domListeners={},this.on("error",l.error)}emit(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return l.log.call(l,...t),super.emit(...t)}handleDOM(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];(this.domListeners[e.type]||[]).forEach(n=>{let{node:u,handler:a}=n;(e.target===u||u.contains(e.target))&&a(e,...r)})}listenDOM(e,t,r){this.domListeners[e]||(this.domListeners[e]=[]),this.domListeners[e].push({node:t,handler:r})}}i(c,"events",{EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_BLOT_MOUNT:"scroll-blot-mount",SCROLL_BLOT_UNMOUNT:"scroll-blot-unmount",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SCROLL_EMBED_UPDATE:"scroll-embed-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change",COMPOSITION_BEFORE_START:"composition-before-start",COMPOSITION_START:"composition-start",COMPOSITION_BEFORE_END:"composition-before-end",COMPOSITION_END:"composition-end"}),i(c,"sources",{API:"api",SILENT:"silent",USER:"user"});exports.default=c;
