"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _message=require("./Message");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)})}}class TextMessage extends _message.Message{constructor(src){super(src);this.content="";this.isForwarded=false;let inner=src.message;this.content=inner.conversation;if(inner.extendedTextMessage){let extended=inner.extendedTextMessage;this.content=extended.text;if(extended.contextInfo){let ctx=extended.contextInfo;this.quoted=ctx.quotedMessage;this.mentions=ctx.mentionedJid;this.isForwarded=ctx.isForwarded;this.forwardCount=ctx.forwardingScore}}}}exports.TextMessage=TextMessage;TextMessage.prototype.reply=function(){var _reply=_asyncToGenerator(function*(response){yield this.me.send(this.from,response)});function reply(response){return _reply.apply(this,arguments)}return reply}();TextMessage.prototype.quote=function(){var _quote=_asyncToGenerator(function*(response){yield this.me._send(this.from,{text:response},{quoted:this.raw})});function quote(response){return _quote.apply(this,arguments)}return quote}();TextMessage.prototype.read=function(){var _read=_asyncToGenerator(function*(response){yield this.me.readMessages([this.raw.key])});function read(response){return _read.apply(this,arguments)}return read}();TextMessage.prototype.delete=function(){var __delete=_asyncToGenerator(function*(forEveryone=true){if(forEveryone){yield this.me.sock.sendMessage(this.from,{delete:this.raw.key})}else{throw new Error("Deleting message for yourself is not yet implemented.")}});function _delete(){return __delete.apply(this,arguments)}return _delete}()