UNPKG

@wppconnect-team/wppconnect

Version:

WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligen

1 lines 89.3 kB
(()=>{var e={490:e=>{var t=function(e){"use strict";var t,n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var o=t&&t.prototype instanceof P?t:P,a=Object.create(o.prototype),s=new _(r||[]);return i(a,"_invoke",{value:M(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f="suspendedStart",h="suspendedYield",p="executing",w="completed",v={};function P(){}function y(){}function g(){}var m={};c(m,a,function(){return this});var A=Object.getPrototypeOf,b=A&&A(A(x([])));b&&b!==n&&r.call(b,a)&&(m=b);var W=g.prototype=P.prototype=Object.create(m);function I(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function S(e,t){function n(i,o,a,s){var u=d(e[i],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then(function(e){n("next",e,a,s)},function(e){n("throw",e,a,s)}):t.resolve(l).then(function(e){c.value=e,a(c)},function(e){return n("throw",e,a,s)})}s(u.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t(function(t,i){n(e,r,t,i)})}return o=o?o.then(i,i):i()}})}function M(e,n,r){var i=f;return function(o,a){if(i===p)throw new Error("Generator is already running");if(i===w){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=C(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=w,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=d(e,n,r);if("normal"===c.type){if(i=r.done?w:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=w,r.method="throw",r.arg=c.arg)}}}function C(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=d(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function x(e){if(null!=e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return y.prototype=g,i(W,"constructor",{value:g,configurable:!0}),i(g,"constructor",{value:y,configurable:!0}),y.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,u,"GeneratorFunction")),e.prototype=Object.create(W),e},e.awrap=function(e){return{__await:e}},I(S.prototype),c(S.prototype,s,function(){return this}),e.AsyncIterator=S,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new S(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(W),c(W,u,"Generator"),c(W,a,function(){return this}),c(W,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=x,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:x(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},496:(e,t,n)=>{"use strict";function r(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(){var e;return e=function*(e){return yield new Promise((t,n)=>{var r=new XMLHttpRequest;r.onload=function(){if(4==r.readyState)if(200==r.status){var e=new FileReader;e.readAsDataURL(r.response),e.onload=function(n){t(e.result.substr(e.result.indexOf(",")+1))}}else console.error(r.statusText);else t(!1)},r.open("GET",e,!0),r.responseType="blob",r.send(null)})},i=function(){var t=this,n=arguments;return new Promise(function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,u,"next",e)}function u(e){r(a,i,o,s,u,"throw",e)}s(void 0)})},i.apply(this,arguments)}function o(e,t){var n=e.split(","),r=n[0].match(/(?:data:)?(.*?)(?:;base64)?$/i)[1];r=r.split(/\s+;\s+/).join("; ");for(var i=window.Base64?window.Base64.atob(n[1]):atob(n[1]),o=i.length,a=new Uint8Array(o);o--;)a[o]=i.charCodeAt(o);return new File([a],t,{type:r})}var a=n(730);function s(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function u(e){return c.apply(this,arguments)}function c(){var e;return e=function*(e){var t=yield e.arrayBuffer(),n=new a("SHA-256","ARRAYBUFFER");return n.update(t),n.getHash("B64")},c=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,u,"next",e)}function u(e){s(o,r,i,a,u,"throw",e)}a(void 0)})},c.apply(this,arguments)}function l(e){for(var t="",n=0;n<e;n++)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return t}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function w(){var e;return e=function*(e,t){var n=yield u(t),r=l(32),i=(new AbortController).signal,o=yield window.Store.UploadUtils.encryptAndUpload({blob:t,type:e,signal:i,mediaKey:r});return f(f({},o),{},{clientUrl:o.url,filehash:n,id:n,uploadhash:o.encFilehash,mediaBlob:t})},w=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){p(o,r,i,a,s,"next",e)}function s(e){p(o,r,i,a,s,"throw",e)}a(void 0)})},w.apply(this,arguments)}function v(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function P(){var e;return e=function*(e){var t=[];e?t.push(WAPI.getAllChatsWithNewMsg().map(e=>WAPI.getChat(e.id._serialized))):t.push(WAPI.getAllChatIds().map(e=>WAPI.getChat(e)));var n=(yield Promise.all(t)).flatMap(e=>e),r=JSON.stringify(n);return JSON.parse(r)},P=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){v(o,r,i,a,s,"next",e)}function s(e){v(o,r,i,a,s,"throw",e)}a(void 0)})},P.apply(this,arguments)}function y(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function g(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){y(o,r,i,a,s,"next",e)}function s(e){y(o,r,i,a,s,"throw",e)}a(void 0)})}}var m=function(){var e=g(function*(){var e=yield Promise.all(WPP.whatsapp.ContactStore.map(function(){var e=g(function*(e){return yield WAPI._serializeContactObj(e)});return function(t){return e.apply(this,arguments)}}()));return e});return function(){return e.apply(this,arguments)}}();function A(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function b(){var e;return e=function*(e,t,n,r){var i=yield WAPI.sendExist(e),o=[];if(!i.erro){var a=i.msgs.getModelsArray();for(var s in a)if("remove"!==s){var u=a[s],c=WAPI.processMessageObj(u,t,n);c&&o.push(c)}}return void 0!==r&&r(o),o},b=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){A(o,r,i,a,s,"next",e)}function s(e){A(o,r,i,a,s,"throw",e)}a(void 0)})},b.apply(this,arguments)}var W=function(e){return e.unreadCount>0},I=function(e){var t=WPP.whatsapp.ChatStore.filter(W).map(e=>WAPI._serializeChatObj(e));return void 0!==e&&e(t),t};function S(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}var M=function(){var e,t=(e=function*(){var e=I().map(e=>WPP.chat.getMessages(e.id,{count:e.unreadCount}));return(yield Promise.all(e)).flat().map(WAPI._serializeMessageObj)},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){S(o,r,i,a,s,"next",e)}function s(e){S(o,r,i,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();function C(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function O(){var e;return e=function*(e,t){var n=yield WAPI.getChat(e);return n=!!n&&WAPI._serializeChatObj(n),void 0!==t&&t(n),n},O=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){C(o,r,i,a,s,"next",e)}function s(e){C(o,r,i,a,s,"throw",e)}a(void 0)})},O.apply(this,arguments)}function E(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function _(){var e;return e=function*(e,t){var n=[],r=window.WAPI.getAllGroups();for(var i in r)try{(yield window.WAPI.getGroupParticipantIDs(r[i].id)).filter(t=>t==e).length&&n.push(r[i])}catch(e){console.log("Error in group:"),console.log(r[i]),console.log(e)}return void 0!==t&&t(n),n},_=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){E(o,r,i,a,s,"next",e)}function s(e){E(o,r,i,a,s,"throw",e)}a(void 0)})},_.apply(this,arguments)}function x(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function j(){var e;return e=function*(e,t){var n=WPP.whatsapp.GroupMetadataStore.find(e);return void 0!==t&&t(n),n},j=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){x(o,r,i,a,s,"next",e)}function s(e){x(o,r,i,a,s,"throw",e)}a(void 0)})},j.apply(this,arguments)}function k(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function T(){var e;return e=function*(e,t){var n=yield Promise.resolve(WPP.group.getParticipants()).then(e=>e.map(e=>e.id));return void 0!==t&&t(n),n},T=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){k(o,r,i,a,s,"next",e)}function s(e){k(o,r,i,a,s,"throw",e)}a(void 0)})},T.apply(this,arguments)}function U(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function L(){var e;return e=function*(e){return(yield WAPI.getGroupMetadata(e)).participants},L=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){U(o,r,i,a,s,"next",e)}function s(e){U(o,r,i,a,s,"throw",e)}a(void 0)})},L.apply(this,arguments)}function N(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function R(){var e;return e=function*(e,t){var n=yield WPP.contact.queryExists(e);if(!n||void 0===n.wid)throw 404;var r=window.WAPI._serializeNumberStatusObj({jid:n.wid,status:200,isBusiness:n.biz});return 200==r.status&&(r.numberExists=!0),void 0!==t&&(t(window.WAPI._serializeNumberStatusObj(n)),t(r)),r},R=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){N(o,r,i,a,s,"next",e)}function s(e){N(o,r,i,a,s,"throw",e)}a(void 0)})},R.apply(this,arguments)}function F(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function H(e,t){return z.apply(this,arguments)}function z(){var e;return e=function*(e,t){var n=WAPI.getChat(e);if(!n)return t&&t(!1),!1;try{yield WPP.whatsapp.MsgStore.findQuery({remote:n.id,count:-1})}catch(e){}for(;!n.msgs.msgLoadState.noEarlierMsgs;)yield n.loadEarlierMsgs();return t&&t(!0),!0},z=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){F(o,r,i,a,s,"next",e)}function s(e){F(o,r,i,a,s,"throw",e)}a(void 0)})},z.apply(this,arguments)}function B(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function D(){var e;return e=function*(e,t,n,r){return WAPI.loadAllEarlierMessages(e).then(i=>{var o=WAPI.getChat(e);if(!o)throw{error:!0,code:"chat_not_found",message:"Chat not found"};var a=[],s=o.msgs.getModelsArray();for(var u in s)if("remove"!==u){var c=s[u],l=WAPI.processMessageObj(c,t,n);l&&a.push(l)}return void 0!==r&&r(a),a})},D=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){B(o,r,i,a,s,"next",e)}function s(e){B(o,r,i,a,s,"throw",e)}a(void 0)})},D.apply(this,arguments)}function G(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Y(){var e;return e=function*(e){var t=WAPI.getChat(e);if(t){var n=yield t.loadEarlierMsgs();if(n)return n.map(WAPI._serializeMessageObj)}return!1},Y=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){G(o,r,i,a,s,"next",e)}function s(e){G(o,r,i,a,s,"throw",e)}a(void 0)})},Y.apply(this,arguments)}function V(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function q(e,t){return J.apply(this,arguments)}function J(){var e;return e=function*(e,t){Array.isArray(t)||(t=[t]);var n=new Store.MediaCollection({chatParticipantCount:e.getParticipantCount()});return yield n.processAttachments("0.4.613"===Debug.VERSION?t:t.map(e=>({file:e})),e,1),n},J=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){V(o,r,i,a,s,"next",e)}function s(e){V(o,r,i,a,s,"throw",e)}a(void 0)})},J.apply(this,arguments)}function K(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Q(){var e;return e=function*(e,t){e=parseInt(e,10);var n=WPP.whatsapp.ChatStore.get(t);if(!n)throw{error:!0,code:"chat_not_found",message:"Chat not found"};switch(e){case 0:window.Store.ChatStates.sendChatStateComposing(n.id);break;case 1:window.Store.ChatStates.sendChatStateRecording(n.id);break;case 2:window.Store.ChatStates.sendChatStatePaused(n.id);break;default:return!1}return!0},Q=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){K(o,r,i,a,s,"next",e)}function s(e){K(o,r,i,a,s,"throw",e)}a(void 0)})},Q.apply(this,arguments)}function X(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Z(e,t){return $.apply(this,arguments)}function $(){var e;return e=function*(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("object"==typeof e&&e._serialized&&(e=e._serialized),"string"!=typeof e)return!1;var r=yield WPP.chat.getMessageById(e);if(!r)return!1;var i=!1;if(n)try{i=WAPI.processMessageObj(r,!0,!0)}catch(e){}else i=r;if("function"!=typeof t)return i;t(i)},$=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){X(o,r,i,a,s,"next",e)}function s(e){X(o,r,i,a,s,"throw",e)}a(void 0)})},$.apply(this,arguments)}function ee(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function te(e,t,n,r,i){return ne.apply(this,arguments)}function ne(){var e;return e=function*(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(i=i||"sendFile","string"!=typeof n&&null!=n||"string"!=typeof r&&null!=r)return WAPI.scope(t,!0,null,"incorrect parameter, insert an string.");var u=e.match(/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/);u&&u.length&&(u=u[1]);var c=yield WAPI.sendExist(t);if(c.erro)return c;var l=null;if("string"==typeof a&&a){var d=yield Z(a,null,!1);d&&d.canReply()&&(l=d)}var f=o(e,n),h=(yield q(c,f)).getModelsArray()[0],p=(yield h.sendToChat(c,{caption:r,quotedMsg:l,isViewOnce:s}))||"",w={type:i,filename:n,text:r,mimeType:u},v=yield WAPI.getchatId(c.id);if("success"===p||"OK"===p){var P=WAPI.scope(v,!1,p,null);return Object.assign(P,w),P}return P=WAPI.scope(v,!0,p,null),Object.assign(P,w),P},ne=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ee(o,r,i,a,s,"next",e)}function s(e){ee(o,r,i,a,s,"throw",e)}a(void 0)})},ne.apply(this,arguments)}function re(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function ie(){var e;return e=function*(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=yield WAPI.sendExist(t);if(s.erro)return s;var u=null;if("string"==typeof a&&a){var c=yield Z(a,null,!1);c&&c.canReply()&&(u=c)}var l=o(e,n),d=(yield q(s,l)).getModelsArray()[0];d.mediaPrep._mediaData.type="ptt";var f=(yield d.sendToChat(s,{caption:r,quotedMsg:u}))||"";void 0!==i&&i(!0);var h={type:"ptt",filename:n,text:r},p=yield WAPI.getchatId(s.id);if("success"===f||"OK"===f){var w=WAPI.scope(p,!1,f,null);return Object.assign(w,h),w}return w=WAPI.scope(p,!0,f,null),Object.assign(w,h),w},ie=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){re(o,r,i,a,s,"next",e)}function s(e){re(o,r,i,a,s,"throw",e)}a(void 0)})},ie.apply(this,arguments)}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ae(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function se(){var e;return e=function*(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=yield WAPI.sendExist(e);if(i.erro)return i;var o,a={ack:0,id:WPP.chat.generateMessageID(i.id),local:!0,self:"out",t:parseInt((new Date).getTime()/1e3),from:WPP.whatsapp.UserPrefs.getMaybeMeUser(),to:i.id,isNewMsg:!0,type:"location",lat:t,lng:n,loc:r},s=(yield Promise.all(WPP.whatsapp.functions.addAndSendMsgToChat(i,a)))[1]||"",u={latitude:t,longitude:n,title:r,type:"location"},c=yield WAPI.getchatId(i.id);return"success"==s||"OK"==s?(o=WAPI.scope(c,!1,s,null),Object.assign(o,u),o):(o=WAPI.scope(c,!0,s,null),Object.assign(o,u),o)},se=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ae(o,r,i,a,s,"next",e)}function s(e){ae(o,r,i,a,s,"throw",e)}a(void 0)})},se.apply(this,arguments)}function ue(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function ce(){var e;return e=function*(e,t){var n=yield WAPI.sendExist(e);if(n.erro)return n;var r=WPP.chat.generateMessageID(n.id),i={id:r,body:t,type:"chat",subtype:null,t:parseInt((new Date).getTime()/1e3),from:WPP.whatsapp.UserPrefs.getMaybeMeUser(),to:n.id,self:"out",isNewMsg:!0,local:!0,ack:0,urlText:null,urlNumber:null},o=(yield Promise.all(WPP.whatsapp.functions.addAndSendMsgToChat(n,i)))[1]||"";if("success"===o||"OK"===o)return null==r?void 0:r._serialized;var a={type:"sendtext",text:i},s=yield WAPI.getchatId(n.id),u=WAPI.scope(s,!0,o,null);return Object.assign(u,a),u},ce=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ue(o,r,i,a,s,"next",e)}function s(e){ue(o,r,i,a,s,"throw",e)}a(void 0)})},ce.apply(this,arguments)}function le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?le(Object(n),!0).forEach(function(t){fe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):le(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fe(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function he(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function pe(){var e;return e=function*(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=WPP.chat.get(e)||(yield WPP.chat.find(e)),i={};n.attachment&&(t=(i=yield WWebJS.processMediaData(n.attachment,n.sendAudioAsVoice)).preview,delete n.attachment);var o={};if(n.quotedMessageId){var a=yield Z(n.quotedMessageId,null,!1);a&&a.canReply()&&(o=a.msgContextInfo(r)),delete n.quotedMessageId}n.mentionedJidList&&(n.mentionedJidList=n.mentionedJidList.map(e=>WPP.whatsapp.ContactStore.get(e).id));var s={};n.location&&(s={type:"location",loc:n.location.description,lat:n.location.latitude,lng:n.location.longitude},delete n.location);var u={};if(n.contactCard){var c=WPP.whatsapp.ContactStore.get(n.contactCard);u={body:WPP.whatsapp.VCard.vcardFromContactModel(c).vcard,type:"vcard",vcardFormattedName:c.formattedName},delete n.contactCard}else if(n.contactCardList)u={type:"multi_vcard",vcardList:n.contactCardList.map(e=>WPP.whatsapp.ContactStore.get(e)).map(e=>WPP.whatsapp.VCard.vcardFromContactModel(e)),body:void 0},delete n.contactCardList;else if(n.parseVCards&&"string"==typeof t&&t.startsWith("BEGIN:VCARD")){delete n.parseVCards;try{var l=yield WPP.whatsapp.VCard.parseVcard(t);l&&(u={type:"vcard",vcardFormattedName:yield WPP.whatsapp.VCard.vcardGetNameFromParsed(l)})}catch(e){}}if(n.linkPreview){delete n.linkPreview;var d=yield window.Store.Validators.findLink(t);if(d&&!WPP.conn.isMultiDevice()){var f=yield WPP.whatsapp.functions.queryLinkPreview(d.url);f.preview=!0,f.subtype="url",n=de(de({},n),f)}}var h=WPP.chat.generateMessageID(r.id),p=de(de(de(de(de({id:h,ack:0,body:t,from:WPP.whatsapp.UserPrefs.getMaybeMeUser(),to:r.id,local:!0,self:"out",t:parseInt((new Date).getTime()/1e3),isNewMsg:!0,type:"chat"},n),s),i),o),u);return yield WPP.whatsapp.functions.addAndSendMsgToChat(r,p),h._serialized},pe=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){he(o,r,i,a,s,"next",e)}function s(e){he(o,r,i,a,s,"throw",e)}a(void 0)})},pe.apply(this,arguments)}function we(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function ve(){var e;return e=function*(e,t){var n=e.id?e:WPP.whatsapp.ChatStore.get(e),r=n.id._serialized,i=n.msgs.filter(e=>e.__x_isSentByMe)[0];if(!i)return n.sendMessage(t);var o=Object.create(i),a=WPP.chat.generateMessageID(r),s=t.match(/@(\d*)/g).map(e=>new WPP.whatsapp.WidFactory.createUserWid(e.replace("@","")))||void 0,u={ack:0,id:a,local:!0,self:"out",t:parseInt((new Date).getTime()/1e3),to:new WPP.whatsapp.WidFactory.createWid(r),isNewMsg:!0,type:"chat",body:t,quotedMsg:null,mentionedJidList:s};return Object.assign(o,u),yield WPP.whatsapp.functions.addAndSendMsgToChat(n,o),a._serialized},ve=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){we(o,r,i,a,s,"next",e)}function s(e){we(o,r,i,a,s,"throw",e)}a(void 0)})},ve.apply(this,arguments)}function Pe(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function ye(){var e;return e=function*(e,t,n,r,i){var a=yield WAPI.sendExist(t);if(a.erro)return a;var s=o(e,n),u=(yield q(a,s)).getModelsArray()[0];u.mediaPrep._mediaData.isGif=!0,u.mediaPrep._mediaData.gifAttribution=1;var c=(yield u.sendToChat(a,{caption:r}))||"",l={filename:n,text:r},d=yield WAPI.getchatId(a.id);if("success"===c||"OK"===c){void 0!==i&&i(!1);var f=WAPI.scope(d,!1,c,null);return Object.assign(f,l),f}return void 0!==i&&i(!0),f=WAPI.scope(d,!0,c,null),Object.assign(f,l),f},ye=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Pe(o,r,i,a,s,"next",e)}function s(e){Pe(o,r,i,a,s,"throw",e)}a(void 0)})},ye.apply(this,arguments)}function ge(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function me(){var e;return e=function*(e){yield window.Store.Perfil.setPushname(e)},me=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ge(o,r,i,a,s,"next",e)}function s(e){ge(o,r,i,a,s,"throw",e)}a(void 0)})},me.apply(this,arguments)}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function be(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function We(){var e;return e=function*(e,t,n){Array.isArray(t)||(t=[t]),yield WAPI.sendExist(e);var r=WPP.whatsapp.ChatStore.get(e);if(!r)throw{error:!0,code:"chat_not_found",message:"Chat not found",chatId:e};var i,o=[],a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ae(e,t);var n={}.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)?Ae(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(t);try{for(a.s();!(i=a.n()).done;){var s=i.value,u="string"==typeof s?s:s.id,c=yield Z(u,null,!1);if(!c)throw{error:!0,code:"message_not_found",message:"Message not Found",messageId:u};o.push(c)}}catch(e){a.e(e)}finally{a.f()}var l=o.filter(e=>!n||!e.isSentByMe);return yield r.forwardMessages(l),yield new Promise(e=>setTimeout(e,100)),r.msgs.getModelsArray().slice(-1*t.length).map(e=>e.id._serialized)},We=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){be(o,r,i,a,s,"next",e)}function s(e){be(o,r,i,a,s,"throw",e)}a(void 0)})},We.apply(this,arguments)}function Ie(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Se(){var e;return e=function*(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=yield WPP.chat.getMessages(e,t);if(!Array.isArray(n)){var r=new Error("Failed to fetch messages for ".concat(e));throw Object.assign(r,n),r}return n.map(e=>new WPP.whatsapp.MsgStore.modelClass(e)).map(e=>WAPI.processMessageObj(e,!0,!0))},Se=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Ie(o,r,i,a,s,"next",e)}function s(e){Ie(o,r,i,a,s,"throw",e)}a(void 0)})},Se.apply(this,arguments)}function Me(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Ce(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Me(o,r,i,a,s,"next",e)}function s(e){Me(o,r,i,a,s,"throw",e)}a(void 0)})}}function Oe(){return(Oe=Ce(function*(e){return"dark"==e||"light"==e?(yield Store.Theme.setTheme(e),!0):console.error("Use type dark or light")})).apply(this,arguments)}function Ee(){return(Ee=Ce(function*(){return yield Store.Theme.getTheme()})).apply(this,arguments)}function _e(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function xe(){var e;return e=function*(e,t,n){n=n||"";var r={Protocol:"^(https?:\\/\\/)?",Domain:"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|",IP:"((\\d{1,3}\\.){3}\\d{1,3}))",Port:"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*",Query:"(\\?[;&a-z\\d%_.~+=-]*)?",End:"(\\#[-a-z\\d_]*)?$",Reg:()=>new RegExp(r.Protocol+r.Domain+r.IP+r.Port+r.Query+r.End,"i")};if(!r.Reg().test(t))return n="Use a valid HTTP protocol. Example: https://www.youtube.com/watch?v=V1bFr2SWP1",WAPI.scope(e,!0,null,n);var i=yield WAPI.sendExist(e);if(i.erro)return i;var o=WPP.conn.isMultiDevice()?void 0:yield WPP.whatsapp.functions.queryLinkPreview(t),a=(yield i.sendMessage(n.includes(t)?n:"".concat(t,"\n").concat(n),{linkPreview:o}))||"",s={type:"LinkPreview",url:t,text:n},u=yield WAPI.getchatId(i.id);if("success"===a||"OK"===a){var c=WAPI.scope(u,!1,a,null);return Object.assign(c,s),c}return c=WAPI.scope(u,!0,a,null),Object.assign(c,s),c},xe=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){_e(o,r,i,a,s,"next",e)}function s(e){_e(o,r,i,a,s,"throw",e)}a(void 0)})},xe.apply(this,arguments)}function je(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function ke(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){je(o,r,i,a,s,"next",e)}function s(e){je(o,r,i,a,s,"throw",e)}a(void 0)})}}function Te(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return{me:WPP.whatsapp.Conn.attributes,to:e,erro:t,text:r,status:n}}function Ue(){return(Ue=ke(function*(e){var t=yield WAPI.getChatById(e),n=t.lastReceivedKey||{},r={formattedName:t.contact.formattedName,isBusiness:t.contact.isBusiness,isMyContact:t.contact.isMyContact,verifiedName:t.contact.verifiedName,pushname:t.contact.pushname};return Object.assign(n,r),n})).apply(this,arguments)}function Le(){return Le=ke(function*(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return Te(e,!0,500,"Chat ID is empty");var r=yield window.WAPI.getChat(e);if(r||"status@broadcast"!==e||(r=new WPP.whatsapp.ChatStore.modelClass({id:WPP.whatsapp.WidFactory.createWid("status@broadcast")}),WPP.whatsapp.ChatStore.add(r),r=yield window.WAPI.getChat(e)),!r&&!e.includes("@g")){var i=yield window.WAPI.checkNumberStatus(e);if(!i.numberExists)return Te(e,!0,i.status,"The number does not exist");yield WPP.chat.find(i.id),e=i.id._serialized,r=yield window.WAPI.getChat(e)}return r?(n&&(yield WPP.chat.markIsRead(r.id).catch(()=>null)),t?r:Te(e,!1,200)):Te(e,!0,404)}),Le.apply(this,arguments)}function Ne(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Re(){var e;return e=function*(e,t){t||(t=WPP.whatsapp.UserPrefs.getMaybeMeUser());var n=WPP.whatsapp.WidFactory.createWid(t),r="data:image/jpeg;base64,";return yield WPP.whatsapp.functions.sendSetPicture(n,r+e.b,r+e.a)},Re=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Ne(o,r,i,a,s,"next",e)}function s(e){Ne(o,r,i,a,s,"throw",e)}a(void 0)})},Re.apply(this,arguments)}function Fe(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function He(){var e;return e=function*(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("boolean"!=typeof t||"boolean"!=typeof n)return WAPI.scope(e,!0,null,"incorrect parameter, insert a boolean true or false");var r=t?"pin":"unpin",i=void 0,o=yield WAPI.sendExist(e,!0,n);if(o.erro)return o;var a={type:"pinChat",typefix:r},s=yield WAPI.getchatId(o.id);return yield Store.pinChat.setPin(o,t).then(e=>{var t=WAPI.scope(s,!1,"OK",null);Object.assign(t,a),i=t}).catch(e=>{var t=WAPI.scope(s,!0,e,"Pin Chat first");Object.assign(t,a),i=t}),i},He=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Fe(o,r,i,a,s,"next",e)}function s(e){Fe(o,r,i,a,s,"throw",e)}a(void 0)})},He.apply(this,arguments)}function ze(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Be(){var e;return e=function*(){if(window.localStorage){var e=yield JSON.parse(JSON.stringify(window.localStorage));return{WABrowserId:e.WABrowserId,WASecretBundle:e.WASecretBundle,WAToken1:e.WAToken1,WAToken2:e.WAToken2}}},Be=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ze(o,r,i,a,s,"next",e)}function s(e){ze(o,r,i,a,s,"throw",e)}a(void 0)})},Be.apply(this,arguments)}function De(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Ge(){var e;return e=function*(e,t,n){var r=yield WAPI.sendExist(e);if(r.erro)return r;var i,o=null,a=null,s=null,u=yield WAPI.getchatId(r.id),c=yield window.Store.Mute.get(r.id),l={type:"sendMute",time:t,timeType:n};if("number"==typeof t&&"string"==typeof n){switch(n){case"hours":o=parseInt(new Date((new Date).setHours((new Date).getHours()+t)).getTime()/1e3);break;case"minutes":o=parseInt(new Date((new Date).setMinutes((new Date).getMinutes()+t)).getTime()/1e3);break;case"year":o=parseInt(new Date((new Date).setDate((new Date).getDate()+t)).getTime()/1e3)}yield window.Store.SendMute.sendConversationMute(r.id,o,0).then(e=>{a=e}).catch(e=>{a=e})}else s=!0,yield window.Store.SendMute.sendConversationMute(r.id,0,c.__x_expiration).then(e=>{a=e}).catch(e=>{a=e});if(200===a.status){s?(c.__x_expiration=0,c.__x_isMuted=!1):(c.__x_expiration=o,c.__x_isMuted=!0);var d=WAPI.scope(u,!1,a.status,null);return Object.assign(d,l),d}return i=s?"is not mute to remove":"This chat is already mute",d=WAPI.scope(u,!0,a.status,i),Object.assign(d,l),d},Ge=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){De(o,r,i,a,s,"next",e)}function s(e){De(o,r,i,a,s,"throw",e)}a(void 0)})},Ge.apply(this,arguments)}function Ye(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Ve(){var e;return e=function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all",t=(yield window.Store.Mute)._models,n=new Array,r=new Array;for(var i in t)t[i].__x_isMuted?r.push(WAPI.interfaceMute(t[i])):n.push(WAPI.interfaceMute(t[i]));var o=null;switch(console.log(0,e),e){case"all":o=[{total:r.length+n.length,amountToMute:r.length,amountnoMute:n.length},r,n];break;case"toMute":o=[{total:r.length},r];break;case"noMute":o=[{total:n.length},n]}return o},Ve=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Ye(o,r,i,a,s,"next",e)}function s(e){Ye(o,r,i,a,s,"throw",e)}a(void 0)})},Ve.apply(this,arguments)}function qe(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}var Je=null,Ke=!0;function Qe(){return Xe.apply(this,arguments)}function Xe(){var e;return e=function*(){if("MAIN"===WPP.whatsapp.Stream.mode&&"TIMEOUT"!==WPP.whatsapp.Socket.state)return Ke?(Ke=!1,WPP.whatsapp.Socket.sendBasic({tag:WPP.whatsapp.Socket.tag("ping"),data:["admin","test"]}).then(()=>{Ke=!0})):(WPP.whatsapp.Socket.phoneWatchdog.activate(),void WPP.whatsapp.Socket.phoneWatchdog.poke(250))},Xe=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){qe(o,r,i,a,s,"next",e)}function s(e){qe(o,r,i,a,s,"throw",e)}a(void 0)})},Xe.apply(this,arguments)}function Ze(){Je&&clearInterval(Je),Je=null}function $e(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return et(e,t);var n={}.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)?et(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function et(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tt(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function nt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){tt(o,r,i,a,s,"next",e)}function s(e){tt(o,r,i,a,s,"throw",e)}a(void 0)})}}function rt(){return(rt=nt(function*(e){Array.isArray(e)||(e=[e]);var t,n=0,r=$e(e);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=new WPP.whatsapp.WidFactory.createWid(i);Store.Presence.get(o)||(yield Store.Presence.find(o),n++)}}catch(e){r.e(e)}finally{r.f()}return n})).apply(this,arguments)}function it(){return(it=nt(function*(e){Array.isArray(e)||(e=[e]);var t,n=0,r=$e(e);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=new WPP.whatsapp.WidFactory.createWid(i),a=Store.Presence.get(o);a&&(a.delete(),n++)}}catch(e){r.e(e)}finally{r.f()}return n})).apply(this,arguments)}function ot(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function at(){var e;return e=function*(e){void 0===e&&(e=!0),e?yield WPP.whatsapp.ChatPresence.sendPresenceAvailable():yield WPP.whatsapp.ChatPresence.sendPresenceUnavailable()},at=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ot(o,r,i,a,s,"next",e)}function s(e){ot(o,r,i,a,s,"throw",e)}a(void 0)})},at.apply(this,arguments)}function st(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function ut(){var e;return e=function*(e,t){var n=WPP.whatsapp.ChatStore.get(e);if(!n)throw{error:!0,code:"chat_not_found",message:"Chat not found"};return n.isGroup?yield WPP.group.setProperty(n.id,"ephemeral",t):(t=t?604800:0,yield Store.changeEphemeralDuration(n,t).catch(e=>{throw{error:!0,code:e.code||e.status||e.statusCode||"unknown",message:e.message||e.reason||"Unknown Error"}}),!0)},ut=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){st(o,r,i,a,s,"next",e)}function s(e){st(o,r,i,a,s,"throw",e)}a(void 0)})},ut.apply(this,arguments)}function ct(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function lt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){ct(o,r,i,a,s,"next",e)}function s(e){ct(o,r,i,a,s,"throw",e)}a(void 0)})}}function dt(){return dt=lt(function*(e,t){void 0===t&&(t=!0),Array.isArray(e)||(e=[e]);var n=yield Promise.all(e.map(function(){var e=lt(function*(e){return yield Z(e,null,!1)});return function(t){return e.apply(this,arguments)}}())),r=(n=n.filter(e=>e&&e.star!==t)).reduce(function(e,t){var n=t.id.remote._serialized;return e[n]=e[n]||[],e[n].push(t),e},Object.create(null)),i=0,o=function*(){var e=WPP.whatsapp.ChatStore.get(a),n=r[a];i+=(yield e.sendStarMsgs(n,t).then(()=>n.length).catch(()=>0))};for(var a in r)yield*o();return i}),dt.apply(this,arguments)}function ft(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0;return window.WAPI._newMessagesCallbacks.push({callback:t,rmAfterUse:e}),!0}function ht(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function pt(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}var wt={};function vt(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}var Pt=function(){var e,t=(e=function*(e){var t=WPP.whatsapp.WidFactory.createWid(e),n=WPP.whatsapp.ProfilePicThumbStore.get(t);return n||(n=yield WPP.whatsapp.ProfilePicThumbStore.find(t)),n?WAPI._serializeProfilePicThumb(n):null},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){vt(o,r,i,a,s,"next",e)}function s(e){vt(o,r,i,a,s,"throw",e)}a(void 0)})});return function(e){return t.apply(this,arguments)}}();function yt(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function gt(){var e;return e=function*(e){var t=WPP.whatsapp.CatalogStore.get(e);if(t||(t=yield WPP.whatsapp.CatalogStore.find(WPP.whatsapp.WidFactory.createWid(e))),!t)throw{error:!0,code:"catalog_not_found",message:"Catalog not found"};return t.productCollection?t.productCollection.serialize():[]},gt=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){yt(o,r,i,a,s,"next",e)}function s(e){yt(o,r,i,a,s,"throw",e)}a(void 0)})},gt.apply(this,arguments)}function mt(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function At(){var e;return e=function*(e){var t=yield Z(e,null,!1);if(!t)throw{error:!0,code:"message_not_found",message:"Message not found"};if("order"!==t.type)throw{error:!0,code:"message_is_not_an_order",message:"Message is not an order"};var n=WPP.order.get(e);if(n||(n=yield WPP.whatsapp.OrderStore.findOrder(t.orderId,t.sellerJid,t.token)),!n)throw{error:!0,code:"order_not_found",message:"Order not found"};return n.products},At=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){mt(o,r,i,a,s,"next",e)}function s(e){mt(o,r,i,a,s,"throw",e)}a(void 0)})},At.apply(this,arguments)}var bt=[{id:"Store",conditions:e=>e.default&&e.default.Chat&&e.default.Msg?e.default:null},{id:"MediaCollection",conditions:e=>e.default&&e.default.prototype&&void 0!==e.default.prototype.processAttachments?e.default:null},{id:"GroupInvite",conditions:e=>e.sendQueryGroupInviteCode?e:null},{id:"Archive",conditions:e=>e.setArchive?e:null},{id:"pinChat",conditions:e=>e.setPin.toString().includes(".unproxy")?e:null},{id:"Perfil",conditions:e=>e.setPushname&&!e.getComposeContents},{id:"ChatStates",conditions:e=>e.sendChatStatePaused&&e.sendChatStateRecording&&e.sendChatStateComposing?e:null},{id:"MediaObject",conditions:e=>e.getOrCreateMediaObject&&e.disassociateMediaFromStickerPack?e:null},{id:"UploadUtils",conditions:e=>e.default&&e.default.encryptAndUpload?e.default:null},{id:"Theme",conditions:e=>e.getTheme&&e.setTheme?e:null},{id:"SendMute",conditions:e=>e.sendConversationMute?e:null},{id:"Validators",conditions:e=>e.findLinks?e:null},{id:"changeEphemeralDuration",conditions:e=>e.changeEphemeralDuration},{id:"sendCreateGroup",conditions:e=>e.sendCreateGroup},{id:"sendQueryGroupInvite",conditions:e=>e.sendQueryGroupInvite?e.sendQueryGroupInvite:null}];function Wt(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function It(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Wt(o,r,i,a,s,"next",e)}function s(e){Wt(o,r,i,a,s,"throw",e)}a(void 0)})}}function St(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Mt=new Promise(e=>{WPP.isReady?e():WPP.webpack.onReady(e)});void 0===window.Store&&(window.Store={},window.Store.promises={},Mt.then(()=>{var e,t=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return St(e,t);var n={}.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)?St(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(bt);try{var n=function(){var t=e.value;window.Store.promises[t.id]=Promise.resolve(WPP.webpack.search(t.conditions)).then(e=>(e||console.error("Store Object '".concat(t.id,"' was not found")),e)).then(t.conditions).then(e=>{"Store"===t.id?window.Store=Object.assign({},window.Store,e):window.Store[t.id]=e})};for(t.s();!(e=t.n()).done;)n()}catch(e){t.e(e)}finally{t.f()}})),void 0===window.WAPI&&(window.WAPI={lastRead:{}},window.WAPI.interfaceMute=function(e){return{attributes:e.attributes,expiration:e.expiration,id:e.id,isMuted:e.isMuted,isState:e.isState,promises:e.promises,stale:e.stale}},window.WAPI.setProfilePic=function(e,t){return Re.apply(this,arguments)},window.WAPI.getSessionTokenBrowser=function(){return Be.apply(this,arguments)},window.WAPI.scope=Te,window.WAPI.getchatId=function(e){return Ue.apply(this,arguments)},window.WAPI.sendExist=function(e){return Le.apply(this,arguments)},window.WAPI.pinChat=function(e){return He.apply(this,arguments)},window.WAPI.setTemporaryMessages=function(e,t){return ut.apply(this,arguments)},window.WAPI.setTheme=function(e){return Oe.apply(this,arguments)},window.WAPI.getTheme=function(){return Ee.apply(this,arguments)},window.WAPI._serializeRawObj=e=>e&&e.toJSON?e.toJSON():{},window.WAPI._serializeChatObj=e=>null==e?null:Object.assign(window.WAPI._seri