ModuleBuilder/dist/module/Custom Sounds/js

4 lines
No EOL
7.6 KiB
Text

parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"index.js":[function(require,module,exports) {
var global = arguments[3];
var e=arguments[3];function t(e,t){return a(e)||i(e,t)||o(e,t)||n()}function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function i(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],o=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(o=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(c){r=!0,i=c}finally{try{o||null==u.return||u.return()}finally{if(r)throw i}}return n}}function a(e){if(Array.isArray(e))return e}function u(e,t,n,o,r,i,a){try{var u=e[i](a),c=u.value}catch(s){return void n(s)}u.done?t(c):Promise.resolve(c).then(o,r)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(o,r){var i=e.apply(t,n);function a(e){u(i,o,r,a,c,"next",e)}function c(e){u(i,o,r,a,c,"throw",e)}a(void 0)})}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var s="1.3.11";"undefined"!=typeof window&&void 0!==window.Audio||(e.window={Audio:{}});var d,l,p,f,m,g,v,y,b,h,x=window.Audio,w=!0,S=function(e){try{for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],o=new ArrayBuffer(t.length),r=new Uint8Array(o),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return URL.createObjectURL(new Blob([o],{type:n}))}catch(a){return}},R=function(){var e=c(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return d.value=null,d.click(),e.next=4,new Promise(function(e){d.onchange=function(){e()}});case 4:if(d.onchange=void 0,void 0!==(t=d.files[0])){e.next=8;break}return e.abrupt("return",void 0);case 8:return e.abrupt("return",t);case 9:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),U={gooseModHandlers:{onImport:function(){var e=c(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:goosemodScope.logger.debug("customSounds","Overriding Audio with a proxy function"),window.Audio=function(){var e=new x,t=e.play;return e.play=function(){return w&&(p&&this.src.includes("/assets/c6e92752668dde4eee5923d70441579f.mp3")&&(console.log("outgoing"),this.src=p),l&&this.src.includes("/assets/84a1b4e11d634dbfa1e5dd97a96de3ad.mp3")&&(console.log("incoming"),this.src=l),f&&this.src.includes("/assets/dd920c06a01e5bb8b09678581e29d56f.mp3")&&(console.log("notification"),this.src=f)),t.apply(this,arguments)},e};case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),onLoadingFinished:function(){var e=c(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(d=document.createElement("input")).type="file",d.style.display="none",document.body.appendChild(d),t=[{type:"text-and-button",text:"Incoming Call",subtext:"Not uploaded",buttonText:"Upload",onclick:function(){var e=c(regeneratorRuntime.mark(function e(n){var o,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n.textContent="Uploading...",e.next=3,R();case 3:o=e.sent,l=void 0===o?void 0:URL.createObjectURL(o),y=void 0===o?void 0:o.name,t[0].subtext=void 0===o?"Not uploaded":"Uploaded: ".concat(o.name),goosemodScope.settings.createFromItems(),goosemodScope.openSettingItem("Custom Sounds"),void 0!==o&&((r=new FileReader).onload=function(){m=r.result},r.readAsDataURL(o));case 10:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{type:"text-and-button",text:"Outgoing Call",subtext:"Not uploaded",buttonText:"Upload",onclick:function(){var e=c(regeneratorRuntime.mark(function e(n){var o,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n.textContent="Uploading...",e.next=3,R();case 3:o=e.sent,p=void 0===o?void 0:URL.createObjectURL(o),b=void 0===o?void 0:o.name,t[1].subtext=void 0===o?"Not uploaded":"Uploaded: ".concat(o.name),goosemodScope.settings.createFromItems(),goosemodScope.openSettingItem("Custom Sounds"),void 0!==o&&((r=new FileReader).onload=function(){g=r.result},r.readAsDataURL(o));case 10:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{type:"text-and-button",text:"Notification Sound",subtext:"Not uploaded",buttonText:"Upload",onclick:function(){var e=c(regeneratorRuntime.mark(function e(n){var o,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n.textContent="Uploading...",e.next=3,R();case 3:o=e.sent,f=void 0===o?void 0:URL.createObjectURL(o),h=void 0===o?void 0:o.name,t[2].subtext=void 0===o?"Not uploaded":"Uploaded: ".concat(o.name),goosemodScope.settings.createFromItems(),goosemodScope.openSettingItem("Custom Sounds"),void 0!==o&&((r=new FileReader).onload=function(){v=r.result},r.readAsDataURL(o));case 10:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()}],goosemodScope.settings.createItem("Custom Sounds",["(v".concat(s,")"),{type:"toggle",text:"Custom Sounds Enabled",onToggle:function(e){w=e},isToggled:function(){return w}},{type:"header",text:"Sounds"}].concat(t));case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),onRemove:function(){var e=c(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:window.Audio=x,d.remove(),t=goosemodScope.settings.items.find(function(e){return"Custom Sounds"===e[1]}),goosemodScope.settings.items.splice(goosemodScope.settings.items.indexOf(t),1);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),getSettings:function(){return[w,m,g,v,y,b,h]},loadSettings:function(e){var n=t(e,7),o=n[0],r=n[1],i=n[2],a=n[3],u=n[4],c=n[5],s=n[6];w=o,g=i,v=a,l=null===(m=r)?void 0:S(m),p=null===g?void 0:S(g),f=null===v?void 0:S(v),y=u,b=c,h=s;var d=goosemodScope.settings.items.find(function(e){return"Custom Sounds"===e[1]});d[2][2].subtext=y?"Uploaded: ".concat(y):"Not uploaded",d[2][3].subtext=b?"Uploaded: ".concat(b):"Not uploaded",d[2][4].subtext=h?"Uploaded: ".concat(h):"Not uploaded"},logRegionColor:"darkblue"}};exports.default=U;
},{}]},{},["index.js"], null);parcelRequire('index.js').default