UNPKG

2.22 kBJavaScriptView Raw
1/*! holosun v1.0.0 | (c) roydukkey | https://github.com/roydukkey/holosun/blob/1.0.0/LICENSE */
2function e(e,n,t){"function"==typeof e?e.call(n,t):null==e||e.handleEvent(t)}function n(e){return"boolean"==typeof e?e:void 0!==e&&!!e.capture}function t(e){var n,t;return null!==(n=null===(t=e.match(/[^\x20\t\r\n\f]+/g))||void 0===t?void 0:t.filter((function(e,n,t){return t.indexOf(e)===n})))&&void 0!==n?n:[]}var r=new WeakMap;function i(e,i,a,o,u,l){var f=!1,v=t(a);if(v.length){var c=r.get(e);if(c){var s=n(u);v.forEach((function(n){var t=c.get(n);t&&(t.forEach((function(r,a){if(void 0===o||o===a){var v=r.get(s),c=v.get(i);c.forEach((function(t,r){void 0!==l&&l!==r||(f=!0,e.removeEventListener(n,null!=t?t:a,u),c.delete(r))})),c.size||v.delete(i),v.size||r.delete(s),r.size||t.delete(a)}})),t.size||c.delete(n))})),c.size||r.delete(e)}}return f}function a(i,a,o,u,l,f,v){void 0===f&&(f=a?"D":"$");var c=null!=v?v:null;return a&&(c=function(n){for(var t=n.target;t&&t!==this;)t.matches(a)&&e(null!=v?v:u,t,n),t=t.parentElement}),function(e,i,a,o,u,l,f){var v=t(a),c=!1;if(v.length){var s=n(f);r.has(e)||r.set(e,new Map);var d=r.get(e);v.forEach((function(n){d.has(n)||d.set(n,new Map);var t=d.get(n);t.has(o)||t.set(o,new Map);var r=t.get(o);r.has(s)||r.set(s,new Map);var a=r.get(s);a.has(i)||a.set(i,new Map);var v=a.get(i);v.has(u)||(v.set(u,l),e.addEventListener(n,null!=l?l:o,f),c=!0)}))}return c}(i,a,o,u,f,c,l)?u:void 0}function o(n,t,r,o,u,l){var f,v,c=r;return"string"==typeof o?(f=o,v=u):(l=u,v=o,f=r,c=null),a(t,c,f,v,l,n,n?function(r){e(v,this,r),i(t,c,"A"===n?f:r.type,v,l,n)}:null)}function u(e,n,t,r,i){return o("A",e,n,t,r,i)}function l(e,n,t,r,a){return"string"==typeof t?i(e,n,t,r,a):i(e,null,n,t,r)}function f(e,n,t,r,i){return"string"==typeof t?a(e,n,t,r,i):a(e,null,n,t,r)}var v=!1;try{var c={get once(){return v=!0,!1}};self.addEventListener("_",null,c),self.removeEventListener("_",null,c)}catch(e){v=!1}function s(e,n,t,r,i){var a="O";return"string"!=typeof t&&v&&(void 0!==r&&"boolean"!=typeof r||(r={capture:r}),r.once=!0,a=void 0),o(a,e,n,t,r,i)}function d(e,n,r){return t(n).map((function(n){return[n,e.dispatchEvent(new Event(n,r))]}))}export{u as any,l as off,f as on,s as one,d as trigger};
\No newline at end of file