"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.changeProfilePicture=changeProfilePicture;exports.fetchProfilePictureUrl=fetchProfilePictureUrl;exports.changePushName=changePushName;exports.changeStatus=changeStatus;var _baileys=require("../../Baileys");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function changeProfilePicture(newPicture){return _changeProfilePicture.apply(this,arguments)}function _changeProfilePicture(){_changeProfilePicture=_asyncToGenerator(function*(newPicture){yield this.sock.updateProfilePicture(this.sock.user.id,newPicture)});return _changeProfilePicture.apply(this,arguments)}function fetchProfilePictureUrl(){return _fetchProfilePictureUrl.apply(this,arguments)}function _fetchProfilePictureUrl(){_fetchProfilePictureUrl=_asyncToGenerator(function*(){return yield this.sock.profilePictureUrl(this.sock.user.id)});return _fetchProfilePictureUrl.apply(this,arguments)}function changePushName(newName){return _changePushName.apply(this,arguments)}function _changePushName(){_changePushName=_asyncToGenerator(function*(newName,makeOnline=true){let node={tag:"presence",attrs:{name:newName,type:makeOnline?"available":"unavailable"}};this.query(node).then(()=>{}).catch(()=>{});let patch={syncAction:{pushNameSetting:{name:newName},timestamp:Date.now()},index:["setting_pushName"],type:"critical_block",apiVersion:1,operation:_baileys.proto.SyncdMutation.SyncdOperation.SET};let response=yield this.sock.appPatch(patch);return response});return _changePushName.apply(this,arguments)}function changeStatus(newStatus){return _changeStatus.apply(this,arguments)}function _changeStatus(){_changeStatus=_asyncToGenerator(function*(newStatus){let node={tag:"iq",attrs:{to:"s.whatsapp.net",type:"set",xmlns:"status"},content:[{tag:"status",attrs:{},content:Buffer.from(newStatus,"utf-8")}]};yield this.query(node)});return _changeStatus.apply(this,arguments)}