UNPKG

2.49 kBJavaScriptView Raw
1/*! holosun v1.0.0 | (c) roydukkey | https://github.com/roydukkey/holosun/blob/1.0.0/LICENSE */
2!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).holosun={})}(this,(function(e){"use strict";function n(e,n,t){"function"==typeof e?e.call(n,t):null==e||e.handleEvent(t)}function t(e){return"boolean"==typeof e?e:void 0!==e&&!!e.capture}function r(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 o=new WeakMap;function i(e,n,i,u,f,a){var l=!1,s=r(i);if(s.length){var c=o.get(e);if(c){var v=t(f);s.forEach((function(t){var r=c.get(t);r&&(r.forEach((function(o,i){if(void 0===u||u===i){var s=o.get(v),c=s.get(n);c.forEach((function(n,r){void 0!==a&&a!==r||(l=!0,e.removeEventListener(t,null!=n?n:i,f),c.delete(r))})),c.size||s.delete(n),s.size||o.delete(v),o.size||r.delete(i)}})),r.size||c.delete(t))})),c.size||o.delete(e)}}return l}function u(e,i,u,f,a,l,s){void 0===l&&(l=i?"D":"$");var c=null!=s?s:null;return i&&(c=function(e){for(var t=e.target;t&&t!==this;)t.matches(i)&&n(null!=s?s:f,t,e),t=t.parentElement}),function(e,n,i,u,f,a,l){var s=r(i),c=!1;if(s.length){var v=t(l);o.has(e)||o.set(e,new Map);var d=o.get(e);s.forEach((function(t){d.has(t)||d.set(t,new Map);var r=d.get(t);r.has(u)||r.set(u,new Map);var o=r.get(u);o.has(v)||o.set(v,new Map);var i=o.get(v);i.has(n)||i.set(n,new Map);var s=i.get(n);s.has(f)||(s.set(f,a),e.addEventListener(t,null!=a?a:u,l),c=!0)}))}return c}(e,i,u,f,l,c,a)?f:void 0}function f(e,t,r,o,f,a){var l,s,c=r;return"string"==typeof o?(l=o,s=f):(a=f,s=o,l=r,c=null),u(t,c,l,s,a,e,e?function(r){n(s,this,r),i(t,c,"A"===e?l:r.type,s,a,e)}:null)}var a=!1;try{var l={get once(){return a=!0,!1}};self.addEventListener("_",null,l),self.removeEventListener("_",null,l)}catch(e){a=!1}e.any=function(e,n,t,r,o){return f("A",e,n,t,r,o)},e.off=function(e,n,t,r,o){return"string"==typeof t?i(e,n,t,r,o):i(e,null,n,t,r)},e.on=function(e,n,t,r,o){return"string"==typeof t?u(e,n,t,r,o):u(e,null,n,t,r)},e.one=function(e,n,t,r,o){var i="O";return"string"!=typeof t&&a&&(void 0!==r&&"boolean"!=typeof r||(r={capture:r}),r.once=!0,i=void 0),f(i,e,n,t,r,o)},e.trigger=function(e,n,t){return r(n).map((function(n){return[n,e.dispatchEvent(new Event(n,t))]}))},Object.defineProperty(e,"__esModule",{value:!0})}));
\No newline at end of file