"use strict";Liferay.Loader.define("@liferay!analytics-settings-web$testing-library/dom@8.20.0/dist/events",["module","exports","require","./config","./helpers","./event-map"],(function(e,t,r){window;{function _objectWithoutProperties(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};Object.defineProperty(t,"__esModule",{value:!0}),t.createEvent=createEvent,t.fireEvent=fireEvent;var a=r("./config"),o=r("./helpers"),i=r("./event-map");function fireEvent(e,t){return(0,a.getConfig)().eventWrapper((()=>{if(!t)throw new Error("Unable to fire an event - please provide an event object.");if(!e)throw new Error(`Unable to fire a "${t.type}" event - please provide a DOM element.`);return e.dispatchEvent(t)}))}function createEvent(e,t,r,{EventType:a="Event",defaultInit:i={}}={}){if(!t)throw new Error(`Unable to fire a "${e}" event - please provide a DOM element.`);const c=n({},i,r),{target:{value:l,files:v}={}}=c,f=_objectWithoutProperties(c.target,["value","files"]);void 0!==l&&function setNativeValue(e,t){const{set:r}=Object.getOwnPropertyDescriptor(e,"value")||{},n=Object.getPrototypeOf(e),{set:a}=Object.getOwnPropertyDescriptor(n,"value")||{};if(a&&r!==a)a.call(e,t);else{if(!r)throw new Error("The given element does not have a value setter");r.call(e,t)}}(t,l),void 0!==v&&Object.defineProperty(t,"files",{configurable:!0,enumerable:!0,writable:!0,value:v}),Object.assign(t,f);const s=(0,o.getWindowFromNode)(t),p=s[a]||s.Event;let u;if("function"==typeof p)u=new p(e,c);else{u=s.document.createEvent(a);const{bubbles:t,cancelable:r,detail:n}=c,o=_objectWithoutProperties(c,["bubbles","cancelable","detail"]);u.initEvent(e,t,r,n),Object.keys(o).forEach((e=>{u[e]=o[e]}))}return["dataTransfer","clipboardData"].forEach((e=>{const t=c[e];"object"==typeof t&&("function"==typeof s.DataTransfer?Object.defineProperty(u,e,{value:Object.getOwnPropertyNames(t).reduce(((e,r)=>(Object.defineProperty(e,r,{value:t[r]}),e)),new s.DataTransfer)}):Object.defineProperty(u,e,{value:t}))})),u}Object.keys(i.eventMap).forEach((e=>{const{EventType:t,defaultInit:r}=i.eventMap[e],n=e.toLowerCase();createEvent[e]=(e,a)=>createEvent(n,e,a,{EventType:t,defaultInit:r}),fireEvent[e]=(t,r)=>fireEvent(t,createEvent[e](t,r))})),Object.keys(i.eventAliasMap).forEach((e=>{const t=i.eventAliasMap[e];fireEvent[e]=(...e)=>fireEvent[t](...e)}))}}));
//# sourceMappingURL=events.js.map